Patchwork [4,of,6] parser: take suffix action if no infix action is defined

mail settings
Submitter Yuya Nishihara
Date July 17, 2015, 12:34 p.m.
Message ID <3cdc85527cbbe58d148e.1437136445@mimosa>
Download mbox | patch
Permalink /patch/10026/
State Accepted
Headers show


Yuya Nishihara - July 17, 2015, 12:34 p.m.
# HG changeset patch
# User Yuya Nishihara <>
# Date 1436187701 -32400
#      Mon Jul 06 22:01:41 2015 +0900
# Node ID 3cdc85527cbbe58d148e3c2d9bdeb3281acb1976
# Parent  b1c727ea2cccd6c417f4315f60f91e08a7227ec8
parser: take suffix action if no infix action is defined

If no infix action is defined, a suffix action isn't ambiguous, so it should
be taken no matter if the next token can be an operand. This is exactly the
same flow as prefix/primary handling.

This change has no effect now because all suffix tokens have infix actions.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -62,7 +62,7 @@  class parser(object):
             token, value, pos = self._advance()
             # handle infix rules, take as suffix if unambiguous
             infix, suffix = self._elements[token][3:]
-            if suffix and not self._hasnewterm():
+            if suffix and not (infix and self._hasnewterm()):
                 expr = (suffix[0], expr)
             elif infix:
                 expr = (infix[0], expr, self._parseoperand(*infix[1:]))