[antlr-interest] Fragment for Parserrules

Alexander Gängel Alexander at gaengel.de
Wed Jan 10 03:27:14 PST 2007


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