-
-
Save FROGGS/e991e1b3bf8796d91b82 to your computer and use it in GitHub Desktop.
"BEGIN { say 1 }" is parsed as an identifier rather than what it really is.
This file contains 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
Perl5/Grammar.pm:340: proto token term { * } | |
Perl5/Grammar.pm:944: proto rule statement_prefix { * } | |
Perl5/Grammar.pm:1029: token identifier { '::'? <.alpha> \w* } | |
Perl5/Grammar.pm:1730: rule statement_prefix:sym<BEGIN> { :my $*SHIFT_FROM := '@ARGV'; <sym> <sblock> } | |
Perl5/Grammar.pm:2102: token term:sym<statement_prefix> { <statement_prefix> } | |
Perl5/Grammar.pm:3035: token term:sym<identifier> { | |
Perl5/Grammar.pm:3036: :my $name; | |
Perl5/Grammar.pm:3037: :my $*HAS_INDIRECT_OBJ = 0; | |
Perl5/Grammar.pm:3038: :my $*ALLOW_IOS_VAR = 0; | |
Perl5/Grammar.pm:3039: :my $*ALLOW_IOS_NAME = 1; | |
Perl5/Grammar.pm:3040: :my $*IN_SPLIT = 0; | |
Perl5/Grammar.pm:3041: :my $*IN_OPEN = 0; | |
Perl5/Grammar.pm:3042: <identifier> { $name := ~$<identifier> } | |
Perl5/Grammar.pm:3042: ... |
This file contains 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
NFA_DEBUG=1 nqp-m -e 'grammar G { token TOP { <a> }; proto token a {*}; token a:sym<foo> { <b> }; token a:sym<indirect> { <?{ say("bad") }> \w+ }; proto token b {*}; token b:sym<foo> { <?{ say("good") }> <sym> } }; say(G.parse("foo"))' | |
'0' => [ a:sym<foo> a:sym<indirect>] | |
'1' => [] | |
'2' => [] | |
'3' => [ b] | |
'4' => [] | |
'5' => [ b:sym<foo>] | |
'6' => [] | |
'7' => [] | |
'8' => [] | |
'9' => [] | |
'10' => [] | |
'11' => [] | |
'12' => [] | |
'13' => [] | |
'14' => [] | |
'15' => [] | |
][ | |
'0' => [ b:sym<foo>] | |
'1' => [] | |
'2' => [] | |
'3' => [] | |
'4' => [] | |
'5' => [] | |
'6' => [] | |
]good | |
foo |
This file contains 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
NFA_DEBUG=1 perl6-m -e 'grammar G { token TOP { <a> }; proto token a {*}; token a:sym<foo> { <b> }; token a:sym<indirect> { \w+ }; proto token b {*}; token b:sym<foo> { <sym> } }; say(G.parse("foo"))' | |
[ | |
'0' => [ a:sym<foo> a:sym<indirect>] | |
'1' => [] | |
'2' => [] | |
'3' => [ b] | |
'4' => [] | |
'5' => [] | |
'6' => [] | |
'7' => [] | |
「foo」 | |
a => 「foo」 |
This file contains 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
NFA_DEBUG=1 perl6-p -e 'grammar G { token TOP { <a> }; proto token a {*}; token a:sym<foo> { <b> }; token a:sym<indirect> { \w+ }; proto token b {*}; token b:sym<foo> { <sym> } }; say(G.parse("foo"))' | |
[ | |
'0' => [ a:sym<foo> a:sym<indirect>] | |
'1' => [] | |
'2' => [] | |
'3' => [ b] | |
'4' => [] | |
'5' => [ b:sym<foo>] | |
'6' => [] | |
'7' => [] | |
'8' => [] | |
'9' => [] | |
'10' => [] | |
'11' => [] | |
'12' => [] | |
'13' => [] | |
][ | |
'0' => [ b:sym<foo>] | |
'1' => [] | |
'2' => [] | |
'3' => [] | |
'4' => [] | |
'5' => [] | |
]「foo」 | |
a => 「foo」 | |
b => 「foo」 | |
sym => 「foo」 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment