templater: drop strtoken argument from compiletemplate()
authorYuya Nishihara <yuya@tcha.org>
Sat, 13 Jun 2015 20:23:52 +0900
changeset 25598 55c2cb65bdfa
parent 25597 fd5bc660c9f0
child 25599 695b93a79d17
templater: drop strtoken argument from compiletemplate() There's no "rawstring" template now.
mercurial/templater.py
--- a/mercurial/templater.py	Wed Jun 10 21:44:43 2015 +0900
+++ b/mercurial/templater.py	Sat Jun 13 20:23:52 2015 +0900
@@ -93,23 +93,23 @@
         pos += 1
     yield ('end', None, pos)
 
-def compiletemplate(tmpl, context, strtoken="string"):
+def compiletemplate(tmpl, context):
     parsed = []
     pos, stop = 0, len(tmpl)
     p = parser.parser(tokenizer, elements)
     while pos < stop:
         n = tmpl.find('{', pos)
         if n < 0:
-            parsed.append((strtoken, tmpl[pos:]))
+            parsed.append(('string', tmpl[pos:]))
             break
         bs = (n - pos) - len(tmpl[pos:n].rstrip('\\'))
-        if strtoken == 'string' and bs % 2 == 1:
-            # escaped (e.g. '\{', '\\\{', but not '\\{' nor r'\{')
-            parsed.append((strtoken, (tmpl[pos:n - 1] + "{")))
+        if bs % 2 == 1:
+            # escaped (e.g. '\{', '\\\{', but not '\\{')
+            parsed.append(('string', (tmpl[pos:n - 1] + "{")))
             pos = n + 1
             continue
         if n > pos:
-            parsed.append((strtoken, tmpl[pos:n]))
+            parsed.append(('string', tmpl[pos:n]))
 
         pd = [tmpl, n + 1, stop]
         parseres, pos = p.parse(pd)