diff mercurial/fileset.py @ 25654:af329a84310c

parser: accept iterator of tokens instead of tokenizer function and program This can simplify the interface of parse() function. Our tokenizer tends to have optional arguments other than the message to be parsed. Before this patch, the "lookup" argument existed only for the revset, and the templater had to pack [program, start, end] to be passed to its tokenizer.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 21 Jun 2015 00:49:26 +0900
parents 0f44d35731d6
children 328739ea70c3
line wrap: on
line diff
--- a/mercurial/fileset.py	Sat Jun 20 20:11:53 2015 -0700
+++ b/mercurial/fileset.py	Sun Jun 21 00:49:26 2015 +0900
@@ -80,8 +80,8 @@
     yield ('end', None, pos)
 
 def parse(expr):
-    p = parser.parser(tokenize, elements)
-    tree, pos = p.parse(expr)
+    p = parser.parser(elements)
+    tree, pos = p.parse(tokenize(expr))
     if pos != len(expr):
         raise error.ParseError(_("invalid token"), pos)
     return tree