Closed ohmtech-rdi closed 1 year ago
We need to rethink how it is done. In a nutshell we expect some expression, and we might get another one. We then need to parse one token of a different type, and emit an error because the token type is wrong.
For example with length, we expect a length with an unit, but we can test the token to see if it would fall in the category of a number literal (that is, without units), and then make the error based on that.
But we also need to consider EOF, tokens like an early }
, and so on.
This PR enhances error reports for length errors, typically missing an unit, which is very common.
Before:
After:
It is also an exploration on how to improve error reporting at the PEG level.