[cmake-developers] dev/custom-parsers topic (was: Branches on next)
Ben Boeckel
ben.boeckel at kitware.com
Tue Feb 11 16:14:56 EST 2014
On Tue, Feb 11, 2014 at 15:54:40 -0500, Brad King wrote:
> Why does each level in the openstack need to hold its "lookup"
> member? Can't everything be stored in-place in the work buffer?
> Each openstack level just needs to track the start character in
> the work buffer. When that level is closed the work buffer
> should contain the exact lookup string from the open position
> to the end. Then PUSH((x)) can be replaced with just
> "work.append(x)".
The problem is stuff like x${CMAKE_${LANG}_FLAGS}. While parsing, we
need to store "x" in the result, then "CMAKE_" in another place. When
"LANG" is expanded, it goes into the "CMAKE_" buffer which can't be
stored in-place anymore. When the last '}' is reached, we take the
latest buffer, put the last parts to parse into it then lookup that
variable.
Some things that have crossed my mind for further changes is to just
store the result at the bottom of the stack and check that .size() == 1
at the end. This avoids .empty() checks for each hunk and makes the code
smaller. Some logic last/lookup.start when the lookup string is empty
could also possibly be changed, but I've haven't done so yet.
--Ben
More information about the cmake-developers
mailing list