Can a rule be conditionally discarded after being matched and continue to try other rules with lower precedence?
<SOME_STATE>{rule} {
if(condition) {
return TOKEN;
}
// discard
// continue and try the other rules below...
}
<SOME_STATE>{other_rule} {
return OTHER_TOKEN;
}
...
PS: condition depends on other resolutions that can't be matched with regex
PS2: I searched the manuals already :)
PS3: I can't solve this by pushing a new state
I assume you're using default command line options, please let me know if otherwise (example
-fmay change things, but eventually I've to check).As short answer I would say no, it is not possible.
Long answer:
Personally I find the question a bit weird, maybe you need to re-think the scanner logic (ignore the token at the upper level or check the condition before the re2c block then use a different re2c block?).
Even if possible saving the cursor and with some goto would be still inefficient because the first rule would be always matched.
If you may provide a minimal example of your function implemntation, rules and command line options would be helpful.