[PATCH] parser: fix missing param in _match

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Tue Jun 8 09:28:23 CDT 2010


# HG changeset patch
# User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
# Date 1276007279 -7200
# Branch revset-dashes
# Node ID a7d8f5cbbf0c058905b306ff5f03acacb3cd8d83
# Parent  4a28385d026980bd0c671b09511dcab63e4badff
parser: fix missing param in _match

diff --git a/mercurial/parser.py b/mercurial/parser.py
--- a/mercurial/parser.py
+++ b/mercurial/parser.py
@@ -30,7 +30,7 @@
         except StopIteration:
             pass
         return t
-    def _match(self, m):
+    def _match(self, m, pos):
         'make sure the tokenizer matches an end condition'
         if self.current[0] != m:
             raise error.ParseError("unexpected token: %s" % self.current[2],
@@ -46,12 +46,12 @@
             expr = (prefix[0], value)
         else:
             if len(prefix) > 2 and prefix[2] == self.current[0]:
-                self._match(prefix[2])
+                self._match(prefix[2], pos)
                 expr = (prefix[0], None)
             else:
                 expr = (prefix[0], self._parse(prefix[1]))
                 if len(prefix) > 2:
-                    self._match(prefix[2])
+                    self._match(prefix[2], pos)
         # gather tokens until we meet a lower binding strength
         while bind < self._elements[self.current[0]][0]:
             token, value, pos = self._advance()
@@ -64,14 +64,14 @@
                 # handle infix rules
                 infix = self._elements[token][2]
                 if len(infix) == 3 and infix[2] == self.current[0]:
-                    self._match(infix[2])
+                    self._match(infix[2], pos)
                     expr = (infix[0], expr, (None))
                 else:
                     if not infix[0]:
                         raise error.ParseError("not an infix: %s" % token, pos)
                     expr = (infix[0], expr, self._parse(infix[1]))
                     if len(infix) == 3:
-                        self._match(infix[2])
+                        self._match(infix[2], pos)
         return expr
     def parse(self, message):
         'generate a parse tree from a message'


More information about the Mercurial-devel mailing list