Patchwork [1,of,5] parser: remove unused binding parameter from suffix action

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 8, 2016, 3:25 p.m.
Message ID <bf733d2494a59338b16d.1470669920@mimosa>
Download mbox | patch
Permalink /patch/16198/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 8, 2016, 3:25 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1436098279 -32400
#      Sun Jul 05 21:11:19 2015 +0900
# Node ID bf733d2494a59338b16df8dbb7101de4697e1e90
# Parent  5e2365698d448c2a1d75f6a58e11ec65f66a0266
parser: remove unused binding parameter from suffix action

Because a suffix action never takes subsequent tokens, it should have
no binding strength nor closing character. I've tried if this value could
be used to resolve infix/suffix ambiguity of x^:y, but it appears not. So
I decided to resend this patch.

Patch

diff --git a/mercurial/parser.py b/mercurial/parser.py
--- a/mercurial/parser.py
+++ b/mercurial/parser.py
@@ -65,7 +65,7 @@  class parser(object):
             # handle infix rules, take as suffix if unambiguous
             infix, suffix = self._elements[token][3:]
             if suffix and not (infix and self._hasnewterm()):
-                expr = (suffix[0], expr)
+                expr = (suffix, expr)
             elif infix:
                 expr = (infix[0], expr, self._parseoperand(*infix[1:]))
             else:
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -149,18 +149,16 @@  elements = {
     "(": (21, None, ("group", 1, ")"), ("func", 1, ")"), None),
     "##": (20, None, None, ("_concat", 20), None),
     "~": (18, None, None, ("ancestor", 18), None),
-    "^": (18, None, None, ("parent", 18), ("parentpost", 18)),
+    "^": (18, None, None, ("parent", 18), "parentpost"),
     "-": (5, None, ("negate", 19), ("minus", 5), None),
-    "::": (17, None, ("dagrangepre", 17), ("dagrange", 17),
-           ("dagrangepost", 17)),
-    "..": (17, None, ("dagrangepre", 17), ("dagrange", 17),
-           ("dagrangepost", 17)),
-    ":": (15, "rangeall", ("rangepre", 15), ("range", 15), ("rangepost", 15)),
+    "::": (17, None, ("dagrangepre", 17), ("dagrange", 17), "dagrangepost"),
+    "..": (17, None, ("dagrangepre", 17), ("dagrange", 17), "dagrangepost"),
+    ":": (15, "rangeall", ("rangepre", 15), ("range", 15), "rangepost"),
     "not": (10, None, ("not", 10), None, None),
     "!": (10, None, ("not", 10), None, None),
     "and": (5, None, None, ("and", 5), None),
     "&": (5, None, None, ("and", 5), None),
-    "%": (5, None, None, ("only", 5), ("onlypost", 5)),
+    "%": (5, None, None, ("only", 5), "onlypost"),
     "or": (4, None, None, ("or", 4), None),
     "|": (4, None, None, ("or", 4), None),
     "+": (4, None, None, ("or", 4), None),