Sketch the header for level 1

Matt Mackall mpm at selenic.com
Mon Aug 5 13:10:18 CDT 2013


On Mon, 2013-08-05 at 15:52 +0300, Iulian Stana wrote:
> 2013/8/5 Idan Kamara <idankk86 at gmail.com>
> 
> > On Mon, Aug 5, 2013 at 11:29 AM, Giovanni Gherdovich <
> > g.gherdovich at gmail.com> wrote:
> >
> >> Hello Idan,
> >>
> >> Idan wrote:
> >> :::: On Fri, Aug 2, 2013 at 3:59 PM, Giovanni Gherdovich
> >> :::: <g.gherdovich at gmail.com>wrote:
> >> ::::
> >> :::: > Hello Idan,
> >> :::: > [...]
> >> :::: > You also say "the return value is unparsed."
> >>
> >> :::: > Well, it cannot be otherwise; the only "structured" piece of data
> >> is
> >> :::: > the content of the 'r' channel (read by hg_exitcode).
> >> :::: >
> >> :::: > The rest of the output, namely 'o' and 'e' channels, is just flat
> >> text.
> >> :::: > It cannot be parsed since the content and format can change from
> >> :::: > a hg release to the next. So the only way to deal with it is to
> >> take it as
> >> :::: > it is.
> >> :::: >
> >> ::::
> >> :::: That's not true and if it were these libraries we're trying to
> >> create around
> >> :::: hg wouldn't be all that useful.
> >> ::::
> >> :::: You can see here[1] that python-hglib test suite runs on hg versions
> >> going
> >> :::: back to 1.9.3 and have survived several big releases with only a few
> >> changes
> >> :::: in Mercurial's output during that time, which in some cases would
> >> have gone
> >> :::: unnoticed had python-hglib been more liberal in parsing the output.
> >>
> >> Actually now that you point this out, I can see that "import re" in
> >> http://selenic.com/repo/python-hglib/file/c13b99b01008/hglib/client.py
> >> and quite a lot of result for CTRL+F 're.' in that code.
> >>
> >> Ok, Iulian will implement some output parsing in level 1 functions.
> >> Err... How do people do regex matching in C?
> >>
> >
> > Most commands have a very simple output format, others support templating.
> > I doubt
> > there's a real need for regular expressions.
> >
> 
> Hmm, we can use some templates, or a specific pattern to parse data.
> For the moment I have 2 ideas how to return the parse data:
>   -  using some data structure but, will charged too much the code.
>   -  using some **char data that will match a specific pattern (like a
> table or a list of string)
> 
> >From my knowledge Flex C (http://flex.sourceforge.net/) it's a regular
> expression
> parser. Probably it's to much for this project. Please correct me.

The 'standard' regular expression library is PCRE:

http://www.pcre.org/

But I would recommend avoiding the need for external dependencies
outside of the standard C library. I agree with Idan that they shouldn't
really be needed.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list