Get column range instead of only line for parse errors?
Is there a way to know the specific {{first_line, first_column}, {last_line, last_column}} range of a parse error? This would be useful for code highlighting in my text editor. Currently, I just highlight the entire line.
For parse errors? Probably not. When a parse error happens it guesses where the error was by returning the greatest position in the input code that it was able to parse up to. It doesn't know where the error stops since it doesn't parse past where it fails.
In order to do that, the parser would have to parse invalid code until to comes across valid code. I guess it might be possible to creating error boundaries for common things like strings, tables, and comprehensions, but it would be a complicated change.
I recently ran into a compile error, and I noticed there's not even a line number associated with it. Is this normal for compile errors?
Compile error: Short-dot syntax must be called within a with block
It seems like it's a compiler error when the parser should be the one erroring (which is quite difficult). A lot of the times, the compiler will give an error without a line. It's normal, but it is bad design/a bug.
The compiler error not having access to the code position is a bug, it should have it but some refactoring needs to be done