diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-07-03 18:13:23 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-07-03 18:13:23 +0200 |
commit | 719962c1f0f1ee1a6d5b5389417fb68adcde431b (patch) | |
tree | caef20ab6f3c5e0407a9e78e41980126e642c4e5 /grammar/utils.h | |
parent | 65076e28dfed0765e51c69be81a7842331aae1d2 (diff) | |
download | rsyslog-719962c1f0f1ee1a6d5b5389417fb68adcde431b.tar.gz rsyslog-719962c1f0f1ee1a6d5b5389417fb68adcde431b.tar.bz2 rsyslog-719962c1f0f1ee1a6d5b5389417fb68adcde431b.zip |
milestone: added grammar for arithmetic expressions
Diffstat (limited to 'grammar/utils.h')
-rw-r--r-- | grammar/utils.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/grammar/utils.h b/grammar/utils.h index 2a6ba10a..a402d4b2 100644 --- a/grammar/utils.h +++ b/grammar/utils.h @@ -58,6 +58,30 @@ struct cnfactlst { } data; }; +/* the following structures support expressions, and may (very much later + * be the sole foundation for the AST. + */ +struct cnfexpr { + int nodetype; + struct cnfexpr *l; + struct cnfexpr *r; +}; + +struct cnfnumval { + int nodetype; + long long val; +}; + +struct cnfstringval { + int nodetype; + es_str_t *estr; +}; + +/* future extensions +struct x { + int nodetype; +}; +*/ void readConfFile(FILE *fp, es_str_t **str); struct nvlst* nvlstNew(es_str_t *name, es_str_t *value); @@ -71,6 +95,10 @@ void cnfactlstDestruct(struct cnfactlst *actlst); void cnfactlstPrint(struct cnfactlst *actlst); struct cnfactlst* cnfactlstAddSysline(struct cnfactlst* actlst, char *line); struct cnfactlst* cnfactlstReverse(struct cnfactlst *actlst); +struct cnfexpr* cnfexprNew(int nodetype, struct cnfexpr *l, struct cnfexpr *r); +void cnfexprPrint(struct cnfexpr *expr, int indent); +struct cnfnumval* cnfnumvalNew(long long val); +struct cnfstringval* cnfstringvalNew(es_str_t *estr); /* debug helper */ void cstrPrint(char *text, es_str_t *estr); |