If I call a token "sum", this example gives an error. If I call it
"something-else", it doesn't. I didn't expect an error in either case.
What's going on?
~~ actions-test.p6 ~~
grammar A {
rule TOP { <something-else> }
token something-else { <int>+ % '+' }
token int { \d+ }
}
grammar B {
rule TOP { <sum> }
token sum { <int>+ % '+' }
token int { \d+ }
}
class An-Action {
}
say A.parse('5',actions => An-Action.new); # OK
say B.parse('5',actions => An-Action.new); # hopes, dashed
__END__
The B.parse says "Too many positionals passed; expected 1 argument but got 2
in regex sum at action-test.p6 line 9
in regex TOP at action-test.p6 line 8
in block <unit> at action-test.p6 line 17"
perl6 -v
This is Rakudo Star version 2018.06 built on MoarVM version 2018.06
-y