Created
August 11, 2015 00:10
-
-
Save cognominal/9067d157b484fb7703c7 to your computer and use it in GitHub Desktop.
should the .a action method should be called knowing the match is in an assertion that does not contribute to the TOP match
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
grammar A { | |
token TOP { a <?before <a> > } | |
token a { a } | |
} | |
class A-actions { | |
method TOP($/) { say('yea') } | |
method a($/) { say('oops') } | |
} | |
A.parse('aa', :actions(A-actions)); |
SO5 says "Action methods are invoked as soon as the corresponding rule has a successful match, regardless of if the match occurs in a zero-width match". It sounds to me like that covers the case you mention.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sure, why wouldn't it?