[antlr-interest] Patch to fix "method to big" errors
Paul J. Lucas
dude at darkfigure.org
Wed Oct 30 15:39:12 PST 2002
ANTLR was generating static arrays that were huge for my lexer.
It made Java complain about the method being too big (over 65535
bytes).
I hacked the ANTLR source code to change the way the tables are
generated. I've attached a patch file. I hope this makes it
into the main ANTLR source.
- Paul
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
-------------- next part --------------
--- JavaCodeGenerator.java-old Wed Oct 30 15:12:16 2002
+++ JavaCodeGenerator.java Wed Oct 30 15:12:05 2002
@@ -1184,15 +1184,14 @@
p.growToInclude(maxVocabulary);
// initialization data
println(
- "private static final long " + getBitsetName(i) + "_data_" + "[] = { " +
- p.toStringOfWords() +
- " };"
+ "private static long[] init" + getBitsetName(i)
+ + "() {\nfinal long data[] = { "
+ + p.toStringOfWords() + " };\nreturn data;\n}"
);
// BitSet object
println(
- "public static final BitSet " + getBitsetName(i) + " = new BitSet(" +
- getBitsetName(i) + "_data_" +
- ");"
+ "public static final BitSet " + getBitsetName(i)
+ + " = new BitSet( init" + getBitsetName(i) + "());"
);
}
}
More information about the antlr-interest
mailing list