Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

negative lookahead doesn't LTM properly #3548

Open
p6rt opened this issue Oct 11, 2014 · 5 comments
Open

negative lookahead doesn't LTM properly #3548

p6rt opened this issue Oct 11, 2014 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Oct 11, 2014

Migrated from rt.perl.org#122951 (status was 'open')

Searchable as RT122951$

@p6rt
Copy link
Author

p6rt commented Oct 11, 2014

From @pmichaud

11​:55 <pmichaud> r​: say "abcde" ~~ / ab <![e]> cde | ab.. / # LTM fail
11​:55 <camelia> rakudo-{parrot,moar} fd017a​: OUTPUT«「abcd」␤␤»

Correct should be "abcde", since he first alternation has a longer token to be matched.

Per S05​:2887​:

  [...] So LTM completely ignores negative lookaheads, and
  continues to look for pure patterns in whatever follows the negative
  lookahead. You might say that positive lookaheads are opaque to LTM,
  but negative lookaheads are transparent to LTM.

Pm

@p6rt
Copy link
Author

p6rt commented Nov 11, 2015

From @usev6

I added a test (fudged 'todo') to S05-metasyntax/longest-alternative.t with commit Raku/roast@38931b20b4

1 similar comment
@p6rt
Copy link
Author

p6rt commented Nov 11, 2015

From @usev6

I added a test (fudged 'todo') to S05-metasyntax/longest-alternative.t with commit Raku/roast@38931b20b4

@p6rt
Copy link
Author

p6rt commented Nov 11, 2015

@usev6 - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Feb 21, 2018

From @dogbert17

On Sat, 11 Oct 2014 05​:05​:48 -0700, pmichaud wrote​:

11​:55 <pmichaud> r​: say "abcde" ~~ / ab <![e]> cde | ab.. / # LTM
fail
11​:55 <camelia> rakudo-{parrot,moar} fd017a​: OUTPUT«「abcd」␤␤»

Correct should be "abcde", since he first alternation has a longer
token to be matched.

Per S05​:2887​:

[...] So LTM completely ignores negative lookaheads, and
continues to look for pure patterns in whatever follows the negative
lookahead. You might say that positive lookaheads are opaque to LTM,
but negative lookaheads are transparent to LTM.

Pm

Still broken in Rakudo version 2018.02-12-ge3c4db732 built on MoarVM version 2018.02

dogbert@​dogbert-VirtualBox ~ $ perl6 -e 'say "abcde" ~~ / ab <![e]> cde | ab.. / '
「abcd」

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant