-
Notifications
You must be signed in to change notification settings - Fork 229
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
Line numbers in error messages are wrong #389
Comments
Hi @bardo84, can you please post an example? |
Repro stepsTest.gravity func main() {
System.print("Run Tests!")
error
} Run
ExpectedError reported in file "Test.gravity" on line 3 character 2 Actual
|
Should the '0' value be the file name? |
FYI: Windows 11 running VS 2022 Version 17.4.3 |
Thanks @mwasplund, I see that you closed your pull request? That means that it was not ready to be applied? |
'0' is the fileID, the user is responsible to save the filename associated to each fileID. Line 64 in 971337c
|
Yes, it appears that in some cases when calling is_newline the current offset is pointing to the actual current token and in some cases it is already pointing to next. Still working out why this is the case. |
I think that a good starting point to investigate is the gravity/src/compiler/gravity_lexer.c Line 76 in 971337c
|
That was were I was looking, I had updated the checks in that method to use PEEK_NEXT instead of PEEK_CURRENT. This resolved a lot of issues where the LF was getting missed and then double counted. However, it appears that in some cases the caller is "peeking" in which case the next char is actually current... I sent an update to pass in the exact next and next2 characters to the is_newline call. Not the prettiest, but it is working. Let me know if you see a cleaner way to achieve the difference in state between calls. |
I introduced different syntax errors in a running code.
The resulting error messages are always larger than the line in question.
Subsequent detected errors did not conform to equally offset numbers.
How to debug a Gravity script?
The text was updated successfully, but these errors were encountered: