[antlr-interest] return value during backtracking
Terence Parr
parrt at cs.usfca.edu
Fri Nov 13 11:37:51 PST 2009
Use {{...}} to force action evaluation during backtrack
ter
On Nov 13, 2009, at 1:42 AM, Philippe Faes wrote:
> Hi everybody,
>
> I can't figure out how to set a return value during backtracking.
> While backtracking, I'd like to do a semantic check on a return
> value of an underlying rule, but the return values are not set
> during backtracking.
>
> Example:
>
> some_rule
> : designator operand {someCheck($designator.text)}? // this will
> never work
> ;
> designator returns [Node node, String text]
> : identifier { $node = $identifier.node; $text=$identifier.text; }
> | operator_symbol {$node = $operator_symbol.node; $text=
> $operator_symbol.text; }
> ;
>
> Any ideas?
>
> Thanks
>
> Philippe
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
More information about the antlr-interest
mailing list