[antlr-interest] suggestion for the static initializer too big in java
Patrick Ericx
patrick.ericx at gmail.com
Mon Oct 24 01:26:39 PDT 2011
Hi folks,
when I build a grammar, first line of my java generated code is always :
public static final String[] tokenNames = new String[] { verly large array
list }
followed by a very long list of
public static final int ;
it's not the first thread on blowing the 65K static initializer when you
have a lot of tokens or rules.
Why not use more recent structures like Enum (available since java 1.5) that
can hold a string and an int for each token ? I think enum is final by
default.
as a little test, I made an enum class with all my tokens manually and that
enum class compiles fine.
Unfortunately, as the code has compile errors in java, refactoring is not
an option , and manually search / replace in 80.000 lines of generated code
will drive me nuts,
PS: is that mailing list available online? how can I access it ? receiving
all these mails in my mailbox becomes a little overhead for me.
keep on doing such a great job,
best regards,
patrick ericx
More information about the antlr-interest
mailing list