Patchwork [2,of,2] parser: update documentation about tokenizer and elements

login
register
mail settings
Submitter Yuya Nishihara
Date June 21, 2015, 8:28 a.m.
Message ID <90851ca8141f20b498f4.1434875322@mimosa>
Download mbox | patch
Permalink /patch/9742/
State Accepted
Delegated to: Matt Mackall
Headers show

Comments

Yuya Nishihara - June 21, 2015, 8:28 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1434815769 -32400
#      Sun Jun 21 00:56:09 2015 +0900
# Node ID 90851ca8141f20b498f4d2239c6d5f5c2a1eaed0
# Parent  f872d2a17b67f9c34140cb9a94279ce910985cc4
parser: update documentation about tokenizer and elements
Augie Fackler - June 23, 2015, 2:18 p.m.
On Sun, Jun 21, 2015 at 05:28:42PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1434815769 -32400
> #      Sun Jun 21 00:56:09 2015 +0900
> # Node ID 90851ca8141f20b498f4d2239c6d5f5c2a1eaed0
> # Parent  f872d2a17b67f9c34140cb9a94279ce910985cc4
> parser: update documentation about tokenizer and elements

This all looks superficially fine to me, but I don't know the parser
well. mpm, can you look at this one?

>
> diff --git a/mercurial/parser.py b/mercurial/parser.py
> --- a/mercurial/parser.py
> +++ b/mercurial/parser.py
> @@ -10,8 +10,9 @@
>  # for background
>
>  # takes a tokenizer and elements
> -# tokenizer is an iterator that returns type, value pairs
> -# elements is a mapping of types to binding strength, prefix and infix actions
> +# tokenizer is an iterator that returns (type, value, pos) tuples
> +# elements is a mapping of types to binding strength, prefix, infix and
> +# optional suffix actions
>  # an action is a tree node name, a tree label, and an optional match
>  # __call__(program) parses program into a labeled tree
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
Pierre-Yves David - June 24, 2015, 12:07 a.m.
On 06/23/2015 07:18 AM, Augie Fackler wrote:
> On Sun, Jun 21, 2015 at 05:28:42PM +0900, Yuya Nishihara wrote:
>> # HG changeset patch
>> # User Yuya Nishihara <yuya@tcha.org>
>> # Date 1434815769 -32400
>> #      Sun Jun 21 00:56:09 2015 +0900
>> # Node ID 90851ca8141f20b498f4d2239c6d5f5c2a1eaed0
>> # Parent  f872d2a17b67f9c34140cb9a94279ce910985cc4
>> parser: update documentation about tokenizer and elements
>
> This all looks superficially fine to me, but I don't know the parser
> well. mpm, can you look at this one?

This has been lazying around on the list for a couple of day, I've no 
idea what I'm doing but it looks not-crazy and from a sensible guy.

Pushed to the clowncopter.

Patch

diff --git a/mercurial/parser.py b/mercurial/parser.py
--- a/mercurial/parser.py
+++ b/mercurial/parser.py
@@ -10,8 +10,9 @@ 
 # for background
 
 # takes a tokenizer and elements
-# tokenizer is an iterator that returns type, value pairs
-# elements is a mapping of types to binding strength, prefix and infix actions
+# tokenizer is an iterator that returns (type, value, pos) tuples
+# elements is a mapping of types to binding strength, prefix, infix and
+# optional suffix actions
 # an action is a tree node name, a tree label, and an optional match
 # __call__(program) parses program into a labeled tree