It is a problem with the code generation templates for all the targets
(well, Java and C at least), someone did post a fix for it on the list, but
it has not been issued as any formal patch yet.



privilege_level

: privs -> ^(PRIVILEGE_LEVEL $privs)

;

privs

: (MULT|IDENTIFIER) (DOT^ (MULT|IDENTIFIER))?

;



Though in fact I would avoid the PRIVILEGE_LEVEL node altogether unless its
absence causes ambiguity issues in the tree grammar.



Jim



*From:* [email protected] [mailto:[email protected]] *On
Behalf Of *Mike Lischke
*Sent:* Thursday, April 19, 2012 5:59 AM
*To:* ANTLR Mailing Mailing List
*Subject:* [antlr-dev] Bug in C target generation



Jim,



with a rule like this:



privilege_level

          :

          (

          first=MULT

           | first=MULT DOT second=MULT

           | first=IDENTIFIER DOT second=MULT

           | first=IDENTIFIER DOT second=IDENTIFIER

           | first=IDENTIFIER

          )           -> ^( PRIVILEGE_LEVEL $first $second? )

          ;



ANTLR generates this code:



          pANTLR3_COMMON_TOKEN    ;

          pANTLR3_COMMON_TOKEN    ;



                = *NULL*;

                = *NULL*;



which obviously does not compile. Is this a known problem? Any workaround
possible?



Mike
-- 
www.soft-gems.net
_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to