bugfix in lexer

This commit is contained in:
edraft
2020-05-23 13:40:51 +02:00
parent aa0be5507e
commit d66ea29d8f
14 changed files with 42 additions and 51 deletions

View File

@@ -27,6 +27,7 @@ class Repo:
'public'
]
self.types = [
'any',
'number',
'string',
'bool',
@@ -35,7 +36,15 @@ class Repo:
'emptyType',
'void'
]
self.expr_chars = ['+', '-', '*', '/', '=']
self.var_types = [
'any',
'number',
'string',
'bool',
'list',
'dict'
]
self.expr_chars = ['+', '-', '*', '/', '=', '^']
self.bool_expr_chars = ['<', '>', '!', '!=', '==', '>=', '<=']
self.bool_values = ['true', 'false']
self.format_chars = ['{', '}', '(', ')', ';', ':', ',']
@@ -45,10 +54,10 @@ class Repo:
def output_tokens(self, toks: list) -> None:
if self.debug and len(toks) > 0:
# outp_toks = []
outp_toks = []
for tok in toks:
# outp_toks.append({tok.value: tok.type})
print({tok.value: tok.type})
outp_toks.append({tok.value: tok.type})
# print({tok.value: tok.type})
# print(outp_toks)
print('\n')
print(outp_toks)
# print('\n')