-
Notifications
You must be signed in to change notification settings - Fork 8
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
Each error message should mention the right line number and position. #40
Comments
@stebanos I tried adding the line numbers in the
Can this be a start to the potential solution to this issue? |
Yes, it's a good start! But it's more consistent to call them either |
Ohkay! I will continue working on these lines then. |
@stebanos Well, I guess I didn't think this through properly. |
Instead maybe I can modify |
Not sure. The Parser might need access to the line number, the Lexer not really I think. |
@stebanos For fixing the additional two positions in error messages, can we use a parameter in the |
That won't be sufficient because a phrase can span multiple lines, and the Lexer isn't aware if it does. |
I don't understand what you mean by a phrase spanning multiple lines. |
Let me illustrate by an example:
Not only is the reported line number wrong (it should be line 4, not line 2), but since it's all grouped the position gets wrong as well (it should be 19 and not 46). |
Oh.. Okay. Now I get it.
So the error message should be changed to have the line number as |
It could be, and it's one that crossed my mind before, but I wonder if there's a more elegant solution. I think it would be more beneficial if each parsed token becomes aware of it's line number and position within that line. |
Yes, that would be a better solution as it would provide easy access to the line numbers, which could be helpful for future additional features. |
Right now only errors on the global structure of the source code communicate their line numbers. Expand this to the parsing and runtime level.
Also I noticed the current position numbers mentioned in errors are always off by at least 2 positions (due to the the first 2 characters of a line as the necessary indentation).
The text was updated successfully, but these errors were encountered: