[antlr-interest] fragments..

Tobias Pape Das.Linux at gmx.de
Mon Mar 26 05:51:03 PDT 2007

Hello Gavin,

you'll getting my enlightement-cookie today ;)

Am 2007-03-26 um 14:23 schrieb Gavin Lambert:

> At 22:20 26/03/2007, Tobias Pape wrote:
> >BinarySelector :
> [...]
> >( Equal ) =>
> >   Equal {$type=Equal;}
> [...]
> >fragment Equal : '=' ;
> [...]
> >My problem is, when I change the Equal Rule, to be non-Fragment,
> >antlr warns me about Token Equal not beeing accessible.
> >--------
> >h248:~/dev/parsertest tobias$ antlr_ SOM.g
> >no such locale file org/antlr/tool/templates/messages/languages/
> >de.stg retrying with English locale
> >ANTLR Parser Generator  Version 3.0b7 (??, 2007)  1989-2007
> >warning(208): SOM.g:461:1: The following token definitions are
> >unreachable: Equal
> >--------
> >weird, huh?
> Not really, that makes sense.  It *is* inaccessible, because the  
> BinarySelector rule will match it first.  You should probably list  
> your 'primitive' tokens first, giving them the chance to match and  
> output first, and most of them probably shouldn't be fragments,  
> since you're actually trying to output them.  (You shouldn't use  
> {$type = x;} for any x that is a fragment.)

the main problem was, that it's an v2-converted former-Java-targeted  

Reodering my lexer Rules brought many improvements..

> Actually I don't really see the point of the whole BinarySelector  
> rule.  It seems too disconnected to be a useful rule.  Especially  
> since it doesn't even seem to be an output token in itself.

thats true. I 'managed' to eliminate the rule (an one similar to  
this, too).

ok, pain for today lessed :)

have a nice day,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: Signierter Teil der Nachricht
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20070326/3d122529/attachment.bin 

More information about the antlr-interest mailing list