BNFC / bnfc

BNF Converter
http://bnfc.digitalgrammars.com/
588 stars 165 forks source link

Uncompilable Java generated in Java1.5 mode #89

Closed jmccrae closed 10 years ago

jmccrae commented 10 years ago

The following command generates Java code that does not compile.

BNFC file:

 token FullURI (["<"] ["^> "]* [">"]) ;

comment "//" ;
comment "/*" "*/" ;

EStatements. Statements ::= [Statement] ;

EPrefix. Statement ::= "@prefix" Ident ":" FullURI "." ;
separator Statement "" ;

Command:

bnfc -java1.5 test.cf

Compile errors:

      location: class Test
test/ComposVisitor.java:24: error: cannot find symbol
      String ident_ = p.ident_;
                       ^
  symbol:   variable ident_
  location: variable p of type EPrefix
test/ComposVisitor.java:25: error: cannot find symbol
      String fulluri_ = p.fulluri_;
                         ^
  symbol:   variable fulluri_
  location: variable p of type EPrefix
test/PrettyPrinter.java:128: error: cannot find symbol
       pp(_eprefix.ident_, 0);
                  ^

Variables in EPrefix.java are named ident_1 and fulluri_1

gdetrez commented 10 years ago

Have you tried the latest version from github?

jmccrae commented 10 years ago

Sorry, it seems to affect the 2.5 release but not the GitHub version