diff mercurial/templater.py @ 25815:e71e5629e006

parser: separate actions for primary expression and prefix operator This will allow us to define both a primary expression, ":", and a prefix operator, ":y". The ambiguity will be resolved by the next patch. Prefix actions in elements table are adjusted as follows: original prefix primary prefix ----------------- -------- ----------------- ("group", 1, ")") -> n/a ("group", 1, ")") ("negate", 19) -> n/a ("negate", 19) ("symbol",) -> "symbol" n/a
author Yuya Nishihara <yuya@tcha.org>
date Sun, 05 Jul 2015 12:02:13 +0900
parents 272ff3680bf3
children 7eb357b5f774 4ca98a389152
line wrap: on
line diff
--- a/mercurial/templater.py	Fri Jul 17 15:53:56 2015 +0200
+++ b/mercurial/templater.py	Sun Jul 05 12:02:13 2015 +0900
@@ -15,17 +15,17 @@
 # template parsing
 
 elements = {
-    # token-type: binding-strength, prefix, infix, suffix
-    "(": (20, ("group", 1, ")"), ("func", 1, ")"), None),
-    ",": (2, None, ("list", 2), None),
-    "|": (5, None, ("|", 5), None),
-    "%": (6, None, ("%", 6), None),
-    ")": (0, None, None, None),
-    "integer": (0, ("integer",), None, None),
-    "symbol": (0, ("symbol",), None, None),
-    "string": (0, ("string",), None, None),
-    "template": (0, ("template",), None, None),
-    "end": (0, None, None, None),
+    # token-type: binding-strength, primary, prefix, infix, suffix
+    "(": (20, None, ("group", 1, ")"), ("func", 1, ")"), None),
+    ",": (2, None, None, ("list", 2), None),
+    "|": (5, None, None, ("|", 5), None),
+    "%": (6, None, None, ("%", 6), None),
+    ")": (0, None, None, None, None),
+    "integer": (0, "integer", None, None, None),
+    "symbol": (0, "symbol", None, None, None),
+    "string": (0, "string", None, None, None),
+    "template": (0, "template", None, None, None),
+    "end": (0, None, None, None, None),
 }
 
 def tokenize(program, start, end):