Commit Graph

3 Commits

Author SHA1 Message Date
Stephen Kelly 4bacff7a4c GenEx: Test early determination of AND and OR
It should be possible for example to do this:

 "$<AND:${FOO},$<BOOL:${TGT}>,$<BOOL:$<TARGET_PROPERTY:${TGT},PROP>"

such that it works simliarly to the C code:

 if (foo && tgt && tgt->prop())
   {
   }

The example of generator expression code is a little bit contrived as
it could be written other ways with the same functionality. Nevertheless,
as these cases already work and are intentional, test for them.
2012-10-20 14:23:47 +02:00
Stephen Kelly f1eacf0e07 cmGeneratorExpression: Re-write for multi-stage evaluation
The expressions may be parsed and then cached and evaluated multiple
times.  They are evaluated lazily so that literals such as ',' can be
treated as universal parameter separators, and can be processed from
results without appearing literally, and without interfering with the
parsing/evaluation of the entire expression.
2012-09-18 17:02:23 -04:00
Brad King ebf05abda1 Add boolean generator expressions
Add generator expressions that combine and use boolean test results:

 $<0:...>         = empty string (ignores "...")
 $<1:...>         = content of "..."
 $<AND:?[,?]...>  = '1' if all '?' are '1', else '0'
 $<OR:?[,?]...>   = '0' if all '?' are '0', else '1'
 $<NOT:?>         = '0' if '?' is '1', else '1'

These will be useful to evaluate (future) boolean query expressions and
condition content on the results.  Include tests and documentation.
2012-08-15 11:44:49 -04:00