changeset 25598:55c2cb65bdfa

templater: drop strtoken argument from compiletemplate() There's no "rawstring" template now.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 13 Jun 2015 20:23:52 +0900
parents fd5bc660c9f0
children 695b93a79d17
files mercurial/templater.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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)