parser: add error hint for x = 1

I've accidentally attempted this multiple times myself during testing.
This commit is contained in:
Zack Buhman 2023-08-23 20:41:23 +00:00
parent 7f69f6b2e1
commit 37fe5d5f81

View File

@ -615,7 +615,11 @@ std::optional<stmt_t *> parser_t::statement()
else
throw error(peek(), "expected eol or eof after instruction");
} 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;
}
}