Show More
@@ -60,15 +60,14 b' class parser(object):' | |||
|
60 | 60 | # gather tokens until we meet a lower binding strength |
|
61 | 61 | while bind < self._elements[self.current[0]][0]: |
|
62 | 62 | token, value, pos = self._advance() |
|
63 | # handle infix rules, take as suffix if unambiguous | |
|
63 | 64 | infix, suffix = self._elements[token][3:] |
|
64 | # check for suffix - next token isn't a valid prefix | |
|
65 | 65 | if suffix and not self._hasnewterm(): |
|
66 | 66 | expr = (suffix[0], expr) |
|
67 | elif infix: | |
|
68 | expr = (infix[0], expr, self._parseoperand(*infix[1:])) | |
|
67 | 69 | else: |
|
68 | # handle infix rules | |
|
69 | if not infix: | |
|
70 | raise error.ParseError(_("not an infix: %s") % token, pos) | |
|
71 | expr = (infix[0], expr, self._parseoperand(*infix[1:])) | |
|
70 | raise error.ParseError(_("not an infix: %s") % token, pos) | |
|
72 | 71 | return expr |
|
73 | 72 | def parse(self, tokeniter): |
|
74 | 73 | 'generate a parse tree from tokens' |
General Comments 0
You need to be logged in to leave comments.
Login now