-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected exception encountered in JFlex #974
Comments
Thanks for reporting this, definitely looks like a bug. For discussion later, I've pasted the files inline here: package sintatico;
import sintatico.sym;
//import static lexico.Tokens.*;
%%
//%public
%cup
%full
%line
%char
%ignorecase
%eofval{
return new Symbol(sym.EOF, new String("Fim do Arquivo"));
%eofval}
//%class AnalisadorLexico
//%type Tokens
BRANCO = [ \n\t\r]
/*%{
public String lexema;
/*public int ContaToken;*/
%}*/
ID = [_|a-z|A-Z][a-z|A-Z|0-9_]*
INTEIRO = 0|[1-9][0-9]*
%%
("se") {return new Symbol(sym.SE, yychar, yyline, yytext());}
("senao") {return new Symbol(sym.SENAO, yychar, yyline, yytext());}
("senaose") {return new Symbol(sym.SENAOSE, yychar, yyline, yytext());}
("enquanto") {return new Symbol(sym.ENQUANTO, yychar, yyline, yytext());}
("faca") {return new Symbol(sym.FACA, yychar, yyline, yytext());}
("para") {return new Symbol(sym.PARA, yychar, yyline, yytext());}
("+") {return new Symbol(sym.MAIS, yychar, yyline, yytext());}
("-") {return new Symbol(sym.MENOS, yychar, yyline, yytext());}
("*") {return new Symbol(sym.VEZES, yychar, yyline, yytext());}
("/") {return new Symbol(sym.DIVISAO, yychar, yyline, yytext());}
("=") {return new Symbol(sym.IGUAL, yychar, yyline, yytext());}
("<") {return new Symbol(sym.MENOR, yychar, yyline, yytext());}
(">") {return new Symbol(sym.MAIOR, yychar, yyline, yytext());}
("<=") {return new Symbol(sym.MENORIGUAL, yychar, yyline, yytext());}
(">=") {return new Symbol(sym.MAIORIGUAL, yychar, yyline, yytext());}
(";") {return new Symbol(sym.PTVIRG, yychar, yyline, yytext());}
("{") {return new Symbol(sym.ACHAVE, yychar, yyline, yytext());}
("}") {return new Symbol(sym.FCHAVE, yychar, yyline, yytext());}
("(") {return new Symbol(sym.APARENT, yychar, yyline, yytext());}
(")") {return new Symbol(sym.FPARENT, yychar, yyline, yytext());}
{INTEIRO} {return new Symbol(sym.INTEIRO, yychar, yyline, yytext());}
{ID} {return new Symbol(sym.ID, yychar, yyline, yytext());}
{BRANCO} {}
. {System.err.println("Caractere Ilegal: " + yytext());}
Error:
|
A small spec that produces the same exception: %%
%full
%ignorecase
%%
s {}
sn {} |
And even smaller: %%
%full
%ignorecase
%%
sb {} Looks like one of the ignore-case characters for |
lsf37
added a commit
that referenced
this issue
Dec 30, 2022
The lexer spec can mention characters that are not in the input set (e.g. for %7bit or %8bit). In particular, in caseless matching, the caseless class might contain such characters. Make getClassCode() robust against this situation, and ignore such characters when we add transitions. Fixes #974
lsf37
added a commit
that referenced
this issue
Dec 30, 2022
The lexer spec can mention characters that are not in the input set (e.g. for %7bit or %8bit). In particular, in caseless matching, the caseless class might contain such characters. Make getClassCode() robust against this situation, and ignore such characters when we add transitions. Fixes #974
lsf37
added a commit
that referenced
this issue
Dec 30, 2022
The lexer spec can mention characters that are not in the input set (e.g. for %7bit or %8bit). In particular, in caseless matching, the caseless class might contain such characters. Make getClassCode() robust against this situation, and ignore such characters when we add transitions. Fixes #974
lsf37
added a commit
that referenced
this issue
Dec 30, 2022
The lexer spec can mention characters that are not in the input set (e.g. for %7bit or %8bit). In particular, in caseless matching, the caseless class might contain such characters. Make getClassCode() robust against this situation, and ignore such characters when we add transitions. Fixes #974
lsf37
added a commit
that referenced
this issue
Dec 30, 2022
The lexer spec can mention characters that are not in the input set (e.g. for %7bit or %8bit). In particular, in caseless matching, the caseless class might contain such characters. Make getClassCode() robust against this situation, and ignore such characters when we add transitions. Fixes #974
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
scanner.flex
error.txt
i had a problem trying to generate a lexer with this .flex.
jflex version: jflex-1.8.2
The text was updated successfully, but these errors were encountered: