From patchwork Fri Jul 17 12:34:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4,of,6] parser: take suffix action if no infix action is defined From: Yuya Nishihara X-Patchwork-Id: 10026 Message-Id: <3cdc85527cbbe58d148e.1437136445@mimosa> To: mercurial-devel@selenic.com Date: Fri, 17 Jul 2015 21:34:05 +0900 # 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/parser.py b/mercurial/parser.py --- a/mercurial/parser.py +++ b/mercurial/parser.py @@ -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:]))