Commit Graph

1 Commits

Author SHA1 Message Date
Olly Betts 4d2ba48b75 Improve error for unexpected token
Report "Unexpected token" rather than "Illegal token" since this
error fires for certain valid C/C++ tokens when used in an invalid way
(as well as `@` and `$`, but it's reasonable to report these as
"unexpected" too).

Also we now exit after this error rather than trying to continue
parsing, which used to just lead to a potentially confusing second
error.

For example instead of:

  c_unexpected_token.i:1: Error: Illegal token '/='.
  c_unexpected_token.i:1: Error: Syntax error - possibly a missing semicolon (';').

we now report:

  c_unexpected_token.i:1: Error: Unexpected token '/='.
2024-09-13 09:39:10 +12:00