[antlr-interest] Need Help - Not able to use Java1.5 grammar available on site with ANTLRv3

Terence Parr parrt at cs.usfca.edu
Thu Jun 21 17:29:04 PDT 2007


Hi. there is something wrong with your input.  For one you can see no  
newlines given char position 15360 and line 1.

Ter
On Jun 22, 2007, at 2:41 AM, Amol Neurgaonkar wrote:

>
> Hi All,
>
> Previously I had used ANTLR 2.7.5 on Java 1.5 grammar to generate  
> the Lexer
> and Parser classes in Java. However the Parser was not recognizing
> Annotations feature from Java 1.5
> Inorder to resolve that problem, I am trying to use ANTLRWorks /  
> ANTLRv3
> with the Java 1.5 grammar provided by Terence
> (http://www.antlr.org/grammar/1152141644268/Java.g) which
> contains the Annotations rules so that the new Parser will be able  
> to parse
> Annotations, however receiving error while generating the code.
>
> The Grammar Check by ANTLRWorks shows successful, but the Generate  
> Code
> feature fails. The exception caught is shown below.
>
> [09:39:21] Java.g:1:16360: unexpected char: ' '
> at org.antlr.tool.ANTLRLexer.nextToken(Unknown Source)
> at antlr.TokenStreamRewriteEngine.nextToken 
> (TokenStreamRewriteEngine.java:161)
> at antlr.TokenBuffer.fill(TokenBuffer.java :69)
> at antlr.TokenBuffer.LA(TokenBuffer.java:80)
> at antlr.LLkParser.LA(LLkParser.java:52)
> at org.antlr.tool.ANTLRParser.actions(Unknown Source)
> at org.antlr.tool.ANTLRParser.grammar(Unknown Source)
> at org.antlr.tool.Grammar.setGrammarContent (Unknown Source)
> at org.antlr.tool.Grammar.setGrammarContent(Unknown Source)
> at org.antlr.works.grammar.EngineGrammar.createNewGrammar(Unknown  
> Source)
> at org.antlr.works.grammar.EngineGrammar.createCombinedGrammar  
> (Unknown Source)
> at org.antlr.works.grammar.EngineGrammar.createGrammars(Unknown  
> Source)
> at org.antlr.works.grammar.EngineGrammar.analyze(Unknown Source)
> at org.antlr.works.grammar.CheckGrammar.run(Unknown Source)
> at java.lang.Thread.run(Unknown Source)
>
> [09:39:21] error(100): C:\antlr3.0\Java.g:2:1: syntax error: antlr:  
> C:\antlr3.0\Java.g:2:1: unexpected token: null
> [09:39:21] error(150):  grammar file C:\antlr3.0\Java.g has no rules
>
>
>
> Please provide any info/help as to how I can fix this problem or if  
> any later version of Java 1.5 grammar tested on the ANTLR v3`s  
> latest version is available.
>
> Thanks,
> Amol.
>



More information about the antlr-interest mailing list