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

ticket for grammar end anchoring #92

Open
cedric-vincent opened this issue Dec 18, 2011 · 2 comments
Open

ticket for grammar end anchoring #92

cedric-vincent opened this issue Dec 18, 2011 · 2 comments

Comments

@cedric-vincent
Copy link

Reference: http://irclog.perlgeek.de/perl6/2011-12-18#i_4846857

Tested on 5abbd8a:

grammar Test { token TOP { . } }; say $(Test.parse: 'test') ~~ Match

Expected output:

Bool::True

Current output:

Bool::False
@cedric-vincent
Copy link
Author

Actually 5abbd8a does return a match object when the input is fully matched:

niecza> grammar Test { token TOP { .* } }; say $(Test.parse: 'test') ~~ Match
Bool::True

Is it related to LTM support in Niecza? Or maybe I wrongly assumed
that parse does not have to fully match the input, as with a
regular match:

niecza> my $token = token { . }; say ?('test' ~~ m/$token/)
Bool::True
niecza> grammar Test { token TOP { . } }; say ?(Test.parse: 'test')
Bool::False

@sorear
Copy link
Owner

sorear commented Dec 18, 2011

It is my opinion that grammars should normally require a full match, since trailing garbage after a file is normally supposed to be a syntax error. Rakudo currently does not do this, and the spec does not really say (I think it slightly hints towards my interpretation, but that's probably some kind of cognitive bias). Leaving open because this item needs to reach consensus.

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

No branches or pull requests

2 participants