Nothing Special   »   [go: up one dir, main page]

Skip to content
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

Java: jflex-generated lexer with line numbers fails to build #453

Closed
andreasabel opened this issue Jul 26, 2023 · 1 comment
Closed

Java: jflex-generated lexer with line numbers fails to build #453

andreasabel opened this issue Jul 26, 2023 · 1 comment
Assignees
Labels
Java lexer Concerning the generated lexer position Concerning position information in parsed AST
Milestone

Comments

@andreasabel
Copy link
Member
andreasabel commented Jul 26, 2023

Concerns option combination --java --jflex -l:

javac -sourcepath . test/Yylex.java test/parser.java test/sym.java
test/Yylex.java:296: error: no suitable constructor found for Location(int,int,long)
    return new ComplexSymbolFactory.Location(yyline+1, yycolumn+1, yychar);
           ^
    constructor Location.Location(int,int,int) is not applicable
      (argument mismatch; possible lossy conversion from long to int)

This could be due to an incompatibility with JFLex 1.8.

@andreasabel andreasabel added Java lexer Concerning the generated lexer position Concerning position information in parsed AST labels Jul 26, 2023
@andreasabel andreasabel added this to the 2.9.5 milestone Jul 26, 2023
@andreasabel andreasabel self-assigned this Jul 26, 2023
@andreasabel
Copy link
Member Author

Indeed, since JFLex 1.8 yychar is a long rather than an int to allow inputs > 2GB.
It seems that JavaCUP has not provided a ComplexSymbolFactoryLocation(int, int, long) constructor yet.

Our workaround is to cast yychar to int when creating a Location. This will produce garbage for inputs > 2GB due to overflow, but this is the situation with JFLex < 1.8 anyway. A proper fix has to wait for JavaCUP to catch up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java lexer Concerning the generated lexer position Concerning position information in parsed AST
Projects
None yet
Development

No branches or pull requests

1 participant