itod/pegkit

Grammar error reports wrong line number

yepher opened this issue · 1 comments

When there is a syntax error in ParserGenApp the app reports the wrong line number. I think it is of by the number of @ blocks.

This is an example where a x is added after the ; on line to generate an error. The alert box shows the error as being on line 5 which is not correct.

errorlinenumber

This seems to be worse than I first In my project I need to keep track of what tokens come from which line number because if someone selects Grammar I need to highlight that in the output view.

I am using this code:

PKToken* token = [toks firstObject];
actor.lineNumber = [NSNumber numberWithUnsignedInteger:[token lineNumber]];

and so far I seem to always get a lineNumber of one while parsing. I will research this more to see if I can understand the problem better.