Mercurial > hg-old > index.cgi
diff lwlib/lw_expr.c @ 367:34dfc9747f23
Reduction passes complete
author | lost@starbug |
---|---|
date | Thu, 15 Apr 2010 21:56:06 -0600 |
parents | 1649bc7bda5a |
children | 6b33faa21a0a |
line wrap: on
line diff
--- a/lwlib/lw_expr.c Wed Apr 14 21:02:53 2010 -0600 +++ b/lwlib/lw_expr.c Thu Apr 15 21:56:06 2010 -0600 @@ -49,6 +49,13 @@ return -1; } +int lw_expr_specint(lw_expr_t e) +{ + if (e -> type == lw_expr_type_special) + return e -> value; + return -1; +} + void lw_expr_set_term_parser(lw_expr_fn3_t *fn) { parse_term = fn; @@ -841,3 +848,17 @@ { return lw_expr_parse_expr(p, priv, 0); } + +int lw_expr_testterms(lw_expr_t e, lw_expr_testfn_t *fn, void *priv) +{ + struct lw_expr_opers *o; + int r; + + for (o = e -> operands; o; o = o -> next) + { + r = lw_expr_testterms(o -> p, fn, priv); + if (r) + return r; + } + return (fn)(e, priv); +}