My suggestion is simple:
1. Everywhere that the code generate currently
generates zzBuffer[xxxx], it should instead generate
zzCharAt(xxxx).
2. The standard skeletons define zzCharAt to be:
private char zzCharAt(int index) {
return zzBuffer[index];
}
The benefit is that, once this is done, then
user-defined skeletons can totally replace zzBuffer
with any data structure they choose. In particular,
they can replace it with a CharSequence.
The JetBrains team has already created such a modified
version of JFlex which they recommend people to use to
implement on-the-fly lexical analyzis for syntax
highlighting and other in-editor uses. Please see the
"Implementing a Lexer" section of
http://www.jetbrains.com/idea/documentation/idea_5.0.html
for information.
My suggested variation allows for the same
functionality as theirs, while remaining compatible
with older JDK versions (without CharSequence). I
believe, but haven't verified, that modern JVm's should
have no problems inlining zzCharAt() to result in
minimal performance impact. At least in my application,
performance wasn't impacted.
I will attach a patch in diff -u format.
Patch in diff -u format