Submitter | Yuya Nishihara |
---|---|
Date | April 8, 2017, 1:06 p.m. |
Message ID | <50cbe5f6c63fb73cdb06.1491656797@mimosa> |
Download | mbox | patch |
Permalink | /patch/20022/ |
State | Accepted |
Headers | show |
Comments
On 4/8/17 2:06 PM, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1491219845 -32400 > # Mon Apr 03 20:44:05 2017 +0900 > # Node ID 50cbe5f6c63fb73cdb06f80c9ea5a7e263e0cc84 > # Parent 17d1ef430add6c1d1936ec33ce4be97f156a0efe > templater: adjust binding strengths to make room for key-value operator > > Changed as follows: > > - template ops (%, |): +10 > - arithmetic ops: +1 (but "negate" should be greater than "%") I don't understand your parenthetical clause: (but "negate" should be greater than "%") Why isn't it? "-" is 4 (was 3), but "5" is 16 (was 6). Why is this comment in here? Can you explain more, or remove it? > > diff --git a/mercurial/templater.py b/mercurial/templater.py > --- a/mercurial/templater.py > +++ b/mercurial/templater.py > @@ -33,12 +33,12 @@ from . import ( > elements = { > # token-type: binding-strength, primary, prefix, infix, suffix > "(": (20, None, ("group", 1, ")"), ("func", 1, ")"), None), > - "%": (6, None, None, ("%", 6), None), > - "|": (5, None, None, ("|", 5), None), > - "*": (4, None, None, ("*", 4), None), > - "/": (4, None, None, ("/", 4), None), > - "+": (3, None, None, ("+", 3), None), > - "-": (3, None, ("negate", 10), ("-", 3), None), > + "%": (16, None, None, ("%", 16), None), > + "|": (15, None, None, ("|", 15), None), > + "*": (5, None, None, ("*", 5), None), > + "/": (5, None, None, ("/", 5), None), > + "+": (4, None, None, ("+", 4), None), > + "-": (4, None, ("negate", 19), ("-", 4), None), > ",": (2, None, None, ("list", 2), None), > ")": (0, None, None, None, None), > "integer": (0, "integer", None, None, None), > _______________________________________________
On Mon, 10 Apr 2017 10:45:02 +0100, Ryan McElroy wrote: > On 4/8/17 2:06 PM, Yuya Nishihara wrote: > > # HG changeset patch > > # User Yuya Nishihara <yuya@tcha.org> > > # Date 1491219845 -32400 > > # Mon Apr 03 20:44:05 2017 +0900 > > # Node ID 50cbe5f6c63fb73cdb06f80c9ea5a7e263e0cc84 > > # Parent 17d1ef430add6c1d1936ec33ce4be97f156a0efe > > templater: adjust binding strengths to make room for key-value operator > > > > Changed as follows: > > > > - template ops (%, |): +10 > > - arithmetic ops: +1 (but "negate" should be greater than "%") > > I don't understand your parenthetical clause: (but "negate" should be > greater than "%") > > Why isn't it? "-" is 4 (was 3), but "5" is 16 (was 6). Why is this > comment in here? Can you explain more, or remove it? I meant "but the prefix 'negate' expression (not '-' token) should have higher binding value than the '%' token. That's why 'negate' was changed to 19." > > # token-type: binding-strength, primary, prefix, infix, suffix > > - "-": (3, None, ("negate", 10), ("-", 3), None), > > + "-": (4, None, ("negate", 19), ("-", 4), None),
On 4/10/17 1:22 PM, Yuya Nishihara wrote: > On Mon, 10 Apr 2017 10:45:02 +0100, Ryan McElroy wrote: >> On 4/8/17 2:06 PM, Yuya Nishihara wrote: >>> # HG changeset patch >>> # User Yuya Nishihara <yuya@tcha.org> >>> # Date 1491219845 -32400 >>> # Mon Apr 03 20:44:05 2017 +0900 >>> # Node ID 50cbe5f6c63fb73cdb06f80c9ea5a7e263e0cc84 >>> # Parent 17d1ef430add6c1d1936ec33ce4be97f156a0efe >>> templater: adjust binding strengths to make room for key-value operator >>> >>> Changed as follows: >>> >>> - template ops (%, |): +10 >>> - arithmetic ops: +1 (but "negate" should be greater than "%") >> I don't understand your parenthetical clause: (but "negate" should be >> greater than "%") >> >> Why isn't it? "-" is 4 (was 3), but "5" is 16 (was 6). Why is this >> comment in here? Can you explain more, or remove it? > I meant "but the prefix 'negate' expression (not '-' token) should have higher > binding value than the '%' token. That's why 'negate' was changed to 19." Ah, that makes sense! I didn't notice that the 3 became 19 on that line. I have marked these are pre-reviewed on patchwork. > >>> # token-type: binding-strength, primary, prefix, infix, suffix >>> - "-": (3, None, ("negate", 10), ("-", 3), None), >>> + "-": (4, None, ("negate", 19), ("-", 4), None),
On Mon, Apr 10, 2017 at 07:25:41PM +0100, Ryan McElroy wrote: > On 4/10/17 1:22 PM, Yuya Nishihara wrote: > >On Mon, 10 Apr 2017 10:45:02 +0100, Ryan McElroy wrote: > >>On 4/8/17 2:06 PM, Yuya Nishihara wrote: > >>># HG changeset patch > >>># User Yuya Nishihara <yuya@tcha.org> > >>># Date 1491219845 -32400 > >>># Mon Apr 03 20:44:05 2017 +0900 > >>># Node ID 50cbe5f6c63fb73cdb06f80c9ea5a7e263e0cc84 > >>># Parent 17d1ef430add6c1d1936ec33ce4be97f156a0efe > >>>templater: adjust binding strengths to make room for key-value operator > >>> > >>>Changed as follows: > >>> > >>> - template ops (%, |): +10 > >>> - arithmetic ops: +1 (but "negate" should be greater than "%") > >>I don't understand your parenthetical clause: (but "negate" should be > >>greater than "%") > >> > >>Why isn't it? "-" is 4 (was 3), but "5" is 16 (was 6). Why is this > >>comment in here? Can you explain more, or remove it? > >I meant "but the prefix 'negate' expression (not '-' token) should have higher > >binding value than the '%' token. That's why 'negate' was changed to 19." > > Ah, that makes sense! I didn't notice that the 3 became 19 on that line. > > I have marked these are pre-reviewed on patchwork. Queued per your very helpful review. > > > > >>> # token-type: binding-strength, primary, prefix, infix, suffix > >>>- "-": (3, None, ("negate", 10), ("-", 3), None), > >>>+ "-": (4, None, ("negate", 19), ("-", 4), None), > > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -33,12 +33,12 @@ from . import ( elements = { # token-type: binding-strength, primary, prefix, infix, suffix "(": (20, None, ("group", 1, ")"), ("func", 1, ")"), None), - "%": (6, None, None, ("%", 6), None), - "|": (5, None, None, ("|", 5), None), - "*": (4, None, None, ("*", 4), None), - "/": (4, None, None, ("/", 4), None), - "+": (3, None, None, ("+", 3), None), - "-": (3, None, ("negate", 10), ("-", 3), None), + "%": (16, None, None, ("%", 16), None), + "|": (15, None, None, ("|", 15), None), + "*": (5, None, None, ("*", 5), None), + "/": (5, None, None, ("/", 5), None), + "+": (4, None, None, ("+", 4), None), + "-": (4, None, ("negate", 19), ("-", 4), None), ",": (2, None, None, ("list", 2), None), ")": (0, None, None, None, None), "integer": (0, "integer", None, None, None),