[arch-general] PKGBUILD parser

Andre "Osku" Schmidt andre.osku.schmidt at googlemail.com
Sun May 9 11:49:31 EDT 2010


On Sun, May 9, 2010 at 4:57 PM, Kaiting Chen <kaitocracy at gmail.com> wrote:
> Just to let you know dude, you can't parse that with a regular expression. A
> regular expression is modeled / parsed by a finite automaton = a state
> machine with a finite number of states. Braces allow nesting which creates a
> source with potentially an infinite number of states consider,
>
> a() { echo 1; b() { echo 2; }; }
>
> Potentially I could next expressions like that endlessly. 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.


More information about the arch-general mailing list