Implemented interpreter, almost fully documented
This commit is contained in:
@@ -91,7 +91,7 @@ class Reserved(Parser):
|
||||
|
||||
returns -- a Result object | None
|
||||
"""
|
||||
if pos < len(tokens) and tokens[pos] == [self.value, self.tag]:
|
||||
if pos < len(tokens) and tokens[pos][0] == self.value and tokens[pos][1] is self.tag:
|
||||
return Result(tokens[pos][0], pos + 1)
|
||||
else:
|
||||
return None
|
||||
@@ -170,7 +170,7 @@ class Alternate(Parser):
|
||||
def __call__(self, tokens, pos):
|
||||
"""
|
||||
Calls the parser. Returns a result if either
|
||||
parser matches, otherwisu returns None.
|
||||
parser matches, otherwise returns None.
|
||||
|
||||
tokens -- the token list
|
||||
pos -- the position to check
|
||||
|
Reference in New Issue
Block a user