[antlr-interest] Fragment for Parserrules

Shmuel Siegel ssiegel at finjan.com
Wed Jan 10 03:45:09 PST 2007


It is still not clear what the problem is. Parser rules always behave like fragments in that they only get invoked if they are called or referenced.

-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Alexander G?ngel
Sent: Wednesday, January 10, 2007 1:27 PM
To: antlr-interest at antlr.org
Subject: Re: [antlr-interest] Fragment for Parserrules

I have some parserrule which should only be applied at special points,
the problem why I can't inline it because I use in an Syntactic Predicate.

or is there some better way I just don't see

Alexander

Kay Roepke schrieb:
>
> 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