Skip to content

cmake.xml: improve the generator to produce optimized regexes

Split strings containing <variadic_part> by _ char and build a tree of name components. Having this tree it's possible to reduce common parts of regular expressions and transform the remainder into an alt group. For example, the following list of variables to match

CMAKE_<some>_ONE
CMAKE_<some>_TWO
CMAKE_<some>_BLAH_SATU
CMAKE_<some>_BLAH_DUA

give the following regex to match:

CMAKE_&var_ref;_(BLAH_(SATU|DUA)|ONE|TWO)

instead of the naive way used before:

CMAKE_&var_ref;_ONE|CMAKE_&var_ref;_TWO|CMAKE_&var_ref;_BLAH_SATU|CMAKE_&var_ref;_BLAH_DUA

Also, add some features missed before.

Merge request reports