[antlr-interest] return value during backtracking

Philippe Faes philippe at faes.net
Fri Nov 13 01:42:20 PST 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091113/39f980a7/attachment.html 


More information about the antlr-interest mailing list