modus
modus copied to clipboard
Misleading error message `expected ")"`
a :-
(
(
b("aaa")
c("aaa")
), d).
error: expected ")"
┌─ aaa:5:7
│
1 │ ╭ a :-
2 │ ╭ │ (
3 │ │ │ (
4 │ │ │ b("aaa")
5 │ │ │ c("aaa")
│ │ │ ^
│ ╰─│───────' in section "rule_body"
│ ╰───────' in section "rule"
@thevirtuoso1973 is it possible to say something like expected "," or ")"
by any chance?
Yes, in a way.
I could rewrite the expression parser to be more like parsing binary operators. Then at some point we'll have alt((another_operator, parentheses_close_expression))
and if I cut(alt(...))
then the generated tree should store the alternatives so it would look something like this:
expected ")"
┌─ aaa:5:7
│
...
or
expected ","
┌─ aaa:5:7
│
...
Although I probably won't do this now.