[antlr-interest] Java1.5 grammar and enum as identifier and not as a keyword

Jörg Rech joerg.rech at gmail.com
Sun Jun 26 13:22:00 PDT 2005


Akhilesh Mritunjai schrieb:

>Hi
>
>I encountered similar problem, and since we were
>transitioning to 1.5, we decided to clean up the code.
>Fortunately, for java 1.4, it can be done using a
>simple find/replace. sed -i 's/\<enum\>/_enum/' takes
>care of it :-)
>  
>
Hi,
  thank you for your suggestion but sadly this will not solve my 
problem. As I am parsing external/open source code (like the java 
standard libraries) it is not possible to substitute every occurance of 
"enum" with "_enum". While I can substitute the keyword before calling 
the parser it could cause semantical errors if "_enum" is already used. 
Furthermore, it is also very likely that the external code is already in 
Java 1.5 and using enum constructs.

But nonetheless many thanks for your help,
Joerg.

>--- Jörg Rech <joerg.rech at gmail.com> wrote:
>  
>
>>  I have a problem parsing the java libraries using
>>the java1.5.g 
>>grammar updated by Scott Wisniewski. Several
>>statements use the 
>>java1.5-keyword "enum" as a name for a variable.
>>    
>>

-- 
Joerg Rech
Computer Scientist        Web:   http://www.joerg-rech.de
Tel.: (+49|0) 631/10653   email: joerg.rech at gmail.com



More information about the antlr-interest mailing list