[arch-general] PKGBUILD parser

Kaiting Chen kaitocracy at gmail.com
Mon May 10 16:25:51 EDT 2010


Interesting I didn't realize that. But then it's not really a 'regular'
expression then. They should call it a 'limited-context-free' expression...

Kaiting.

On Mon, May 10, 2010 at 2:21 PM, C Anthony Risinger <anthony at extof.me>wrote:

> On Mon, May 10, 2010 at 1:14 PM, Pierre Chapuis <catwell at archlinux.us>
> wrote:
> >
> > "Andre "Osku" Schmidt" <andre.osku.schmidt at googlemail.com> a écrit :
> >
> >>> A regular
> >>> expression will never be able to parse that.because it can never decide
> >>> which brace is the final one. This might be better explained here.
> >>>
> >>>
> http://stackoverflow.com/questions/133601/can-regular-expressions-be-used-to-match-nested-patterns
> >>
> >>thank you. i'll continue my journey on parsing this another way.
> >
> > Actually if you read the page linked above completely you will notice
> that it says that you can. Regexps like POSIX that use finite automata can't
> but PCRE (that are everywhere) can, at least recent versions. That's also
> why they are slower.
>
> yes via a "recursive" expression.  another option would be to use a
> multipass setup (i havent looked at the OP's code) to break the
> problem into smaller chunks instead of trying to to it all in one
> expression (i.e. use an expression to count the braces/etc. and build
> another expression dynamically based off the results of the first)
>



-- 
Kiwis and Limes: http://kaitocracy.blogspot.com/


More information about the arch-general mailing list