[antlr-interest] Fragment for Parserrules

Kay Roepke kroepke at classdump.org
Tue Jan 9 06:35:18 PST 2007


On 9. Jan 2007, at 15:21 , Alexander Gängel wrote:

> Is it possible to make a parserrule a fragment like in a lexer.

No, nor would you want to.

In a parser normally you have a designated start rule that you call  
and from that it recurses.
In a lexer ANTLR generates the implicit start rule 'mTokens' for you,  
which does the prediction
and then calls the individual lexer rules. Rules declared 'fragment'  
don't get included in that
mTokens rule, so they aren't called automatically to figure out the  
next token, they can
only be called explicitely by your own lexer rules.

What are you trying to solve?

cheers,
-k

-- 
Kay Röpke
http://classdump.org/






More information about the antlr-interest mailing list