# New Ticket Created by Jörg Walter
# Please include the string: [perl #81136]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81136 >
This example program explains it all:
grammar test {
token a { a };
token b { b };
token TOP { <a><b><before $<a>> };
};
if (test.parse("abc")) {
say "bug!"
} else {
say "correct."
}
grammar test2 is test {
token TOP { <a><b><before $<a>>$<a> };
}
if (test2.parse("abc")) {
say "bug!"
} else {
say "correct."
}
grammar test3 is test {
token TOP { <a><b><before {say 'have '~$<a>}$<a>> };
}
test3.parse("abc");
On rakudo star 2010.11, it prints
bug!
correct
have
Modifying the grammars to use positional captures yields the same results.
--
Mit freundlichen Grüßen,
Jörg Walter