[cmake-developers] slow regex implementation in RegularExpression
Alexander Neundorf
neundorf at kde.org
Fri Nov 18 02:19:08 EST 2011
On Thursday 17 November 2011, Alexandru Ciobanu wrote:
> On 2011-11-17, at 3:26 PM, Alexander Neundorf wrote:
> >> [ Regular expressions syntax ]
> >> In terms of regular expressions syntax, the only difference that I've
> >> seen is that TRE treats the curly brackets "{" and "}" as special
> >> characters, because it uses them for its "approximate matching".
> >> Details here: http://laurikari.net/tre/documentation/regex-syntax/
> >>
> >> The only CMake component that uses curly brackets in a regexp is:
> >> Modules/FindJNI.cmake
> >>
> >> but it was trivial to fix because they were used as mere delimiters.
> >
> > Well, but there are cmake files out there (i.e. all existing cmake-based
> > projects) which also must behave basically exactly the same as before,
> > otherwise their builds might break.
> >
> > Not sure how to achieve this.
> > A policy ?
>
> Actually it is very easy to make it transparent and thus not need to modify
> any .cmake files.
>
> We just need to escape the curly brackets:
> { -> \{
> } -> \}
> in the regular expression before compiling it.
>
> This way we'll have full compatibility with previous regexp syntax.
Hmm, I think there are more differences:
http://laurikari.net/tre/documentation/regex-syntax/
Currently AFAIK cmake doesn't support all that, e.g. [[:digit:]] or \\d.
So, currently a regex could contain "[[:digit:]]", which matches something
right now, and something else then.
There are more.
It is nice that this implementation supports more, but it potentially
introduces changes in behaviour i.e. incompatibilities.
Alex
More information about the cmake-developers
mailing list