1 /*** dexpr.h -- helper for date expressions */ 2 #if !defined INCLUDED_dexpr_h_ 3 #define INCLUDED_dexpr_h_ 4 5 #include "dt-core.h" 6 #include "token.h" 7 8 typedef struct dexpr_s *dexpr_t; 9 typedef const struct dexpr_s *const_dexpr_t; 10 11 typedef struct dexkv_s *dexkv_t; 12 typedef const struct dexkv_s *const_dexkv_t; 13 14 typedef enum { 15 DEX_UNK, 16 DEX_VAL, 17 DEX_CONJ, 18 /* must be last as other types will be considered inferior */ 19 DEX_DISJ, 20 } dex_type_t; 21 22 struct dexkv_s { 23 struct dt_spec_s sp; 24 oper_t op:3; 25 union { 26 struct dt_dt_s d; 27 signed int s; 28 }; 29 }; 30 31 struct dexpr_s { 32 dex_type_t type:31; 33 unsigned int nega:1; 34 dexpr_t left; 35 union { 36 struct dexkv_s kv[1]; 37 struct { 38 dexpr_t right; 39 dexpr_t up; 40 }; 41 }; 42 }; 43 44 45 /* parser routine */ 46 extern int dexpr_parse(dexpr_t *root, const char *s, size_t l); 47 48 #endif /* INCLUDED_dexpr_h_ */ 49