Fix parsing error

This commit is contained in:
Jan-Niclas Loosen
2025-11-20 22:09:31 +01:00
parent 7ac8889a1d
commit cb0c7ac2e0
6 changed files with 593 additions and 580 deletions

View File

@@ -72,11 +72,17 @@ def t_newline(t):
# Ignore whitespace
t_ignore = ' \t'
# Comments
def t_comment(t):
# Single-line comment
def t_comment_single(t):
r'//.*'
pass
# Multi-line comment
def t_comment_multi(t):
r'/\*([^*]|\*+[^*/])*\*/'
t.lexer.lineno += t.value.count('\n')
pass
# Error handling
def t_error(t):
print("Illegal character '%s'" % t.value[0])