Created
March 27, 2018 17:58
-
-
Save ronaldxs/c8755a791373afb89240e6525a436d7f to your computer and use it in GitHub Desktop.
P6 looks like it is incorrectly matching a token backwards for some reason
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#use Grammar::Tracer; | |
grammar g { | |
token keywords { 'or' } | |
token BASEIDENT {\w+<!after <keywords>>} | |
token BASEIDENT_SIMPLER {\w+<!after 'or'>} | |
token TOP { <BASEIDENT> } | |
} | |
say so g.parse('a'); | |
say so g.parse('ro'); # this should match - looks wrong | |
say so g.parse('ro', :rule<BASEIDENT>); # same as above as expected | |
say so g.parse('ro', :rule<BASEIDENT_SIMPLER>); # different from above | |
my token keywordz { | |
'or' | |
} | |
say so "a" ~~ /\w+<!after <keywordz>>/; | |
say so "ro" ~~ /\w+<!after <keywordz>>/; | |
# Grammar::Tracer shows ro matching or | |
# TOP | |
# | BASEIDENT | |
# | | keywords | |
# | | * MATCH "or" | |
# | * FAIL | |
# * FAIL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment