parser: add error hint for x = 1
I've accidentally attempted this multiple times myself during testing.
This commit is contained in:
parent
7f69f6b2e1
commit
37fe5d5f81
@ -615,7 +615,11 @@ std::optional<stmt_t *> parser_t::statement()
|
|||||||
else
|
else
|
||||||
throw error(peek(), "expected eol or eof after instruction");
|
throw error(peek(), "expected eol or eof after instruction");
|
||||||
} else {
|
} else {
|
||||||
throw error(peek(), "expected statement");
|
auto exc = error(peek(), "expected statement");
|
||||||
|
advance();
|
||||||
|
if (check(equal) || check(_equ))
|
||||||
|
std::cerr << "hint: it is not legal to assign a value to a keyword" << std::endl;
|
||||||
|
throw exc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user