##// END OF EJS Templates
parser: improve infix error checking...
Matt Mackall -
r11412:51ceb157 default
parent child Browse files
Show More
@@ -62,13 +62,13 b' class parser(object):'
62 expr = (suffix[0], expr)
62 expr = (suffix[0], expr)
63 else:
63 else:
64 # handle infix rules
64 # handle infix rules
65 infix = self._elements[token][2]
65 if len(e) < 3 or not e[2]:
66 raise error.ParseError("not an infix: %s" % token, pos)
67 infix = e[2]
66 if len(infix) == 3 and infix[2] == self.current[0]:
68 if len(infix) == 3 and infix[2] == self.current[0]:
67 self._match(infix[2], pos)
69 self._match(infix[2], pos)
68 expr = (infix[0], expr, (None))
70 expr = (infix[0], expr, (None))
69 else:
71 else:
70 if not infix[0]:
71 raise error.ParseError("not an infix: %s" % token, pos)
72 expr = (infix[0], expr, self._parse(infix[1]))
72 expr = (infix[0], expr, self._parse(infix[1]))
73 if len(infix) == 3:
73 if len(infix) == 3:
74 self._match(infix[2], pos)
74 self._match(infix[2], pos)
General Comments 0
You need to be logged in to leave comments. Login now