Hello-
I'm trying to handle a file that contains the character hex FF, but that results in an exception:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 711
at JFlex_problem.yylex(JFlex_problem.java:503)
at JFlex_problem.main(JFlex_problem.java:237)
711 is the value of the zzInput variable, which is used as an index into an array of length 256.
I thought declaring the parser as "8bit" should be sufficient to handle just about everything; am I missing something? I'm appending a minimal jflex file that exhibits the problem below. I'd be grateful on any clues on how to handle that character.
Thanks in advance,
Ulf
import java.io.*;
%%
%public
%class JFlex_problem
%8bit
%int
%apiprivate
%{
public JFlex_problem() { }
public static void main (String args[]) throws Exception {
if (args == null) {
System.err.println("usage: java JFlex_problem file");
System.exit(1);
}
JFlex_problem self = new JFlex_problem();
self.zzReader = new FileReader(args[0]);
while ( !self.zzAtEOF ) self.yylex();
}
%}
%%
<YYINITIAL> {
. {
System.out.println("read char: "+(int)yytext().charAt(0));
}
}
.|\n {
/* ignore every character that's not recognizably part of a command */
System.out.println("ignoring char: "+(int)yytext().charAt(0));
}
|