Skip to content

C# DebugToken Manager Problem #3

@skfcz

Description

@skfcz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions