Hi Kaleb and Kirby,
Thanks for taking a look at this. Like you both, I did not find this documented
anywhere.
The grammar fragment that I showed as an example (rule range) was from the
ANTLR v3 grammar, and is itself a v3 grammar, and ANTLR 3 processes it with no
complaint.
Kaleb quotes the relevant part of the v3 grammar that shows the "!" being
accepted. But if you look at that rule, what does it do when it recognizes the
"!" ? The way I read it, it does nothing, or am I missing something that
happens automatically or by some other means?
I inspected the code that ANTLR3 generates for the rule "rule", and I see where
the '!' is recognized, and where it's matched (consumed) but the code seems to
do nothing with that info.
I too am unsure whether this grammar is the actual spec that ANTLR 3 uses, so I
ran ANTLR 3 on the ANTLR v3 grammar with "range!" changed to "range", and this
seemed to make no difference in code generated for the range rule, aside from
changes in variable numbers (which thus gives a lot of diff results, so easy to
overlook something).
Anyhow, it looks to me like a '!' in this position is recognized but ignored --
either a vestige of a no-longer active feature, or an anticipation of a future
feature?
-- Graham
=============================
rule
scope {
String name;
}
: DOC_COMMENT?
( modifier=('protected'|'public'|'private'|'fragment') )?
id {$rule::name = $id.text;}
'!'?
( arg=ARG_ACTION )?
( 'returns' rt=ARG_ACTION )?
throwsSpec? optionsSpec? ruleScopeSpec? ruleAction*
':' altList ';'
exceptionGroup?
-> ^( RULE id {modifier!=null?adaptor.create(modifier):null}
^(ARG[$arg] $arg)?
^('returns' $rt)?
throwsSpec? optionsSpec? ruleScopeSpec? ruleAction*
altList
exceptionGroup?
EOR["EOR"]
)
;
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---