Skip to content

Commit

Permalink
better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-develop committed Oct 4, 2024
1 parent bf0ec3f commit f52824f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ to str)
(does not change anything to public API)
* Optimised asserts a little bit
* Fixed bug where identifiers after `$` could start with digits
* Better error messages

#### Build scripts
* Build scripts now copy `CHANGELOG.md`.
Expand Down
5 changes: 4 additions & 1 deletion src/lexer/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,10 +861,13 @@ def make_less_than(self):
self.advance()
token_type = TT["LTEQ"]
else:
current_char_user_friendly = f"'{new_char}'"
if new_char is None:
current_char_user_friendly = "(end of file)"
return None, InvalidSyntaxError(
pos_start,
self.pos,
f"expected '=' after '<<', got '{self.current_char}'.",
f"expected '=' after '<<', got {current_char_user_friendly}.",
"src.lexer.lexer.Lexer.make_less_than"
)
elif self.current_char == "d" and self.next_char(7) == "efault>": # <default>
Expand Down

0 comments on commit f52824f

Please sign in to comment.