Fix des erreurs

This commit is contained in:
Shadow 2020-05-31 11:54:26 +02:00
parent 43e8328a38
commit f5794ce52f
1 changed files with 6 additions and 9 deletions

View File

@ -16,16 +16,10 @@
# --- Tokens --- #
class Token():
def __init_(self, token_type, token_value):
def __init__(self, token_type, token_value):
self.type = token_type
self.value = token_value
def type(self):
return self.type
def value(self):
return self.value
class TokenList():
def __init__(self, l_token = []):
self.index = -1
@ -41,6 +35,9 @@ class TokenList():
else:
return False
def reset(self):
self.index = -1
# --- Abstract Syntax Tree (AST) --- #
class AST():
@ -127,10 +124,10 @@ def parser(l_token):
# --- Secondary functions --- #
def expect(target = [], l_token):
def expect(l_token, token_see, target = []):
last = token_see
token_see = l_token.get()
if target != [] and last.type() not in target:
if target != [] and last.type not in target:
raise SyntaxError("unknown operand, one of these is expected : " + ", ".join(target))
return last