lessExpression: attribute lt dr=value? {if($ctx.dr==null) "somehow add predefined value to expression" };
If it is possible that when I enter:
"attr < 5" in java tree visitor I will get 5
when visiting valueContext, but
"attr < " will still visit valueContext, but with value ?
.
is it possible to make such condition in rule file?
Greetings!
Recall that the `?` meta operator is antlr sugar for the empty alternative. that is x? is the same as (x|) which i like to write as (x|/*empty*/) making the empty choice more explicit to a human reader.
And so you should use the expanded form and insert whatever
action you need in the empty alternative. Something like:
lessExpression: attribute lt (dr=value | /*empty*/ { dr=predefinedDefaultValue } );
Hope this helps...
-jbb
--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--