comparison 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
comparison
equal deleted inserted replaced
366:84dc6d2ec6ba 367:34dfc9747f23
43 } 43 }
44 44
45 int lw_expr_intval(lw_expr_t e) 45 int lw_expr_intval(lw_expr_t e)
46 { 46 {
47 if (e -> type == lw_expr_type_int) 47 if (e -> type == lw_expr_type_int)
48 return e -> value;
49 return -1;
50 }
51
52 int lw_expr_specint(lw_expr_t e)
53 {
54 if (e -> type == lw_expr_type_special)
48 return e -> value; 55 return e -> value;
49 return -1; 56 return -1;
50 } 57 }
51 58
52 void lw_expr_set_term_parser(lw_expr_fn3_t *fn) 59 void lw_expr_set_term_parser(lw_expr_fn3_t *fn)
839 846
840 lw_expr_t lw_expr_parse(char **p, void *priv) 847 lw_expr_t lw_expr_parse(char **p, void *priv)
841 { 848 {
842 return lw_expr_parse_expr(p, priv, 0); 849 return lw_expr_parse_expr(p, priv, 0);
843 } 850 }
851
852 int lw_expr_testterms(lw_expr_t e, lw_expr_testfn_t *fn, void *priv)
853 {
854 struct lw_expr_opers *o;
855 int r;
856
857 for (o = e -> operands; o; o = o -> next)
858 {
859 r = lw_expr_testterms(o -> p, fn, priv);
860 if (r)
861 return r;
862 }
863 return (fn)(e, priv);
864 }