Comments (3)
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:
PS C:\Users\jefh_\OneDrive\Área de Trabalho\Compiladores\Compilador\src\sintatico> jflex scanner.flex
Reading "scanner.flex"
Constructing NFA :
Unexpected exception encountered. This indicates a bug in JFlex.
Please consider filing an issue at http://github.com/jflex-de/jflex/issues/new
Index 31 out of bounds for length 31
java.lang.IndexOutOfBoundsException: Index 31 out of bounds for length 31
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
at java.base/java.util.Objects.checkIndex(Objects.java:385)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at jflex.core.unicode.CharClasses.getClassCode(CharClasses.java:191)
at jflex.core.NFA.insertStringNFA(NFA.java:544)
at jflex.core.NFA.insertNFA(NFA.java:912)
at jflex.core.NFA.addRegExp(NFA.java:187)
at jflex.core.LexParse$CUP$LexParse$actions.CUP$LexParse$do_action_part00000000(LexParse.java:1057)
at jflex.core.LexParse$CUP$LexParse$actions.CUP$LexParse$do_action(LexParse.java:2257)
at jflex.core.LexParse.do_action(LexParse.java:598)
at java_cup.runtime.lr_parser.parse(lr_parser.java:699)
at jflex.generator.LexGenerator.generate(LexGenerator.java:74)
at jflex.Main.generate(Main.java:320)
at jflex.Main.main(Main.java:336)
from jflex.
A small spec that produces the same exception:
%%
%full
%ignorecase
%%
s {}
sn {}
from jflex.
And even smaller:
%%
%full
%ignorecase
%%
sb {}
Looks like one of the ignore-case characters for s
is not in the char set allowed by %full
from jflex.
Related Issues (20)
- UnicodeCaseless.flex.vm uses incorrect unicode escapes HOT 1
- add test cases for warn/no-warn options
- optimisation: factor out common prefixes in large alternatives
- provide mechanism for annotations on lexer function
- investigate Windows test runners for CI
- matrix for bazel build
- Whitespaces negation in group not working as expected HOT 4
- jflex-maven-plugin 1.9.0/1 are missing from maven central HOT 1
- Generation aborted HOT 1
- Trailing-context is not working HOT 3
- improve error reporting for lookahead in macros HOT 2
- potential ArrayIndexOutOfBounds in zzRefill
- generated-class.md missing from manual published on website HOT 4
- Is there a way to suppress comment/absolute path in the generated code? HOT 6
- Unexpected dump? HOT 7
- char class directives delete existing classes HOT 1
- replace inefficient java regexps with jflex scanner HOT 1
- properly implement clone interface on JFlexAntTask
- allow length-1 expressions in char classes HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jflex.