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

C# DebugToken Manager Problem #3

Open
skfcz opened this issue Jul 18, 2024 · 3 comments
Open

C# DebugToken Manager Problem #3

skfcz opened this issue Jul 18, 2024 · 3 comments

Comments

@skfcz
Copy link

skfcz commented Jul 18, 2024

Hello All,

I generated a C# parser with debug tokenmanager enabled and get a problem with the generated code

The exception is

System.IndexOutOfRangeException : Der Index war außerhalb des Arraybereichs.
bei prostep.aveva.vol.SimpleCharStream.getBeginLine() in C:\home\cz\OPS\opdm-aveva-val-parser\aveva-vol-csharp\src\CharStream.cs:Zeile 238.
bei prostep.aveva.vol.VOLParserTokenManager.getNextToken() in C:\home\cz\OPS\opdm-aveva-val-parser\aveva-vol-csharp\src\VOLParserTokenManager.cs:Zeile 394.
bei prostep.aveva.vol.VOLParser.jj_scan_token(Int32 kind) in C:\home\cz\OPS\opdm-aveva-val-parser\aveva-vol-csharp\src\VOLParser.cs:Zeile 1517.
....

and the generated code

for (;;) {
// First see if we have any input at all.
try {
curChar = input_stream.BeginToken();
} catch(System.Exception) {
if (lexStateNames.Length > 1) {
System.Console.Error.Write("<" + lexStateNames[curLexState] + "> ");
}
System.Console.Error.WriteLine("Reached EOF at " +
input_stream.getBeginLine() + ":" +
input_stream.getBeginColumn());

At the input_stream is out of range and throws the IndexOutOfRangeException exception.
My proposal ist to change the template for the EOF case.

@kaikalur
Copy link
Collaborator

Are you using javacc8?

@kaikalur
Copy link
Collaborator

But also we know there are some issues with debug token manager :( You can try using the JavaCCInterpreter to debug it better.

@MarcMazas
Copy link
Collaborator

I've been able to reproduce the problem. I'll try to find its origin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants