Code Monkey home page Code Monkey logo

Comments (3)

lsf37 avatar lsf37 commented on July 20, 2024

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.

lsf37 avatar lsf37 commented on July 20, 2024

A small spec that produces the same exception:

%%

%full
%ignorecase

%%

s {}
sn {}

from jflex.

lsf37 avatar lsf37 commented on July 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.