On 08/29/2012 09:25 AM, Brad King wrote: >> I've pushed a generator-expression-refactor branch to my clone. It needs >> some clean-up, de-duplication etc, but I'm looking for feedback on the >> approach. >> >> In my branch, all parameters must be separated by ','. All commas and colons >> must appear literally in the expression. This makes escaping not-needed, and >> multiple-parameter-separators consistent accross all generators. > > Great. I'll take a look when I get a chance.
That looks like a good start. Pre-parsing the entire expression tree is the right approach. While quoting/escaping expanded values is not needed we still need it for the input, like STREQUAL comparing to "," for example. When we first designed generator expressions it was just for the basic "$<TARGET_FILE:tgt>"-type expressions. The format for target names was restricted so we didn't need to think about handling arbitrary content. The $<0:...> and $<1:...> expressions can have arbitrary content other than ">" but they always have exactly one "parameter" so there is no real parsing involved. When I mentioned the "$<RANGLE>" expression it was just as an example of what the current approach can do (a better name might be ANGLE-R). However, now that you're writing a real lexer/parser we need to think about how this new mini-language will work syntactically. There should be no need for $<ANGLE-R> if we have proper quoting rules. Consider bash syntax like echo $(echo 'nested command with )') where the quoting protects the close-parenthesis inside $(...) syntax. In order to allow more readable inputs we could consider allowing arbitrary whitespace to separate arguments, as in: $<STREQUAL "$<TARGET_PROPERTY:TYPE>" "EXECUTABLE"> just like the CMake language itself. If quoting is parsed as part of the syntax then it can be used for '>' too e.g. $<STREQUAL "a" ">"> where quoting protects argument contents as in bash. One way to distinguish expressions with free-form arguments from those without is whether there is a ':' or whitespace after the expression name. Comments? -Brad -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers