Skip to content

Commit

Permalink
Merge pull request #203 from tomhea/dev
Browse files Browse the repository at this point in the history
handle None token inside parser-error function
  • Loading branch information
tomhea authored Dec 28, 2022
2 parents ead14de + 5c4a99f commit f936d63
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/fj_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,10 @@ def error(self, token: Token) -> None:
global error_occurred
error_occurred = True
print()
print(f'Syntax Error in {get_position(token.lineno)}, token=("{token.type}", {token.value})')
if token is None:
print(f'Syntax Error in {get_position(self.line_position(None))}, unknown token')
else:
print(f'Syntax Error in {get_position(token.lineno)}, token=("{token.type}", {token.value})')

@_('definable_line_statements')
def program(self, p: ParsedRule) -> None:
Expand Down

0 comments on commit f936d63

Please sign in to comment.