summaryrefslogtreecommitdiffstats
path: root/grammar/utils.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-07-04 09:36:12 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-07-04 09:36:12 +0200
commit25cd9f59ad3a0daa2662e44b2e844116ad487450 (patch)
tree07dc9e1f4df3e8fe6d6d7a0d647e4c80e938fcd8 /grammar/utils.c
parent71003f146cc2dacfa8fc7c084404f3399812b64a (diff)
downloadrsyslog-25cd9f59ad3a0daa2662e44b2e844116ad487450.tar.gz
rsyslog-25cd9f59ad3a0daa2662e44b2e844116ad487450.tar.bz2
rsyslog-25cd9f59ad3a0daa2662e44b2e844116ad487450.zip
milestone: added comparison ops, prepring for flex include processing
Diffstat (limited to 'grammar/utils.c')
-rw-r--r--grammar/utils.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/grammar/utils.c b/grammar/utils.c
index 4087bd81..d09a34a9 100644
--- a/grammar/utils.c
+++ b/grammar/utils.c
@@ -4,6 +4,7 @@
#include <ctype.h>
#include <libestr.h>
#include "utils.h"
+#include "parserif.h"
#include "rscript.tab.h"
void
@@ -345,7 +346,7 @@ cnfexprEval(struct cnfexpr *expr, struct exprret *ret)
case NOT:
cnfexprEval(expr->r, &r);
ret->datatype = 'N';
- ret->d.n = !exprret2Number(&l);
+ ret->d.n = !exprret2Number(&r);
break;
case 'N':
ret->datatype = 'N';
@@ -428,6 +429,30 @@ cnfexprPrint(struct cnfexpr *expr, int indent)
printf(">\n");
cnfexprPrint(expr->r, indent+1);
break;
+ case CMP_CONTAINS:
+ cnfexprPrint(expr->l, indent+1);
+ doIndent(indent);
+ printf("CONTAINS\n");
+ cnfexprPrint(expr->r, indent+1);
+ break;
+ case CMP_CONTAINSI:
+ cnfexprPrint(expr->l, indent+1);
+ doIndent(indent);
+ printf("CONTAINS_I\n");
+ cnfexprPrint(expr->r, indent+1);
+ break;
+ case CMP_STARTSWITH:
+ cnfexprPrint(expr->l, indent+1);
+ doIndent(indent);
+ printf("STARTSWITH\n");
+ cnfexprPrint(expr->r, indent+1);
+ break;
+ case CMP_STARTSWITHI:
+ cnfexprPrint(expr->l, indent+1);
+ doIndent(indent);
+ printf("STARTSWITH_I\n");
+ cnfexprPrint(expr->r, indent+1);
+ break;
case OR:
cnfexprPrint(expr->l, indent+1);
doIndent(indent);
@@ -500,3 +525,16 @@ cstrPrint(char *text, es_str_t *estr)
free(str);
}
+
+int
+main(int argc, char *argv[])
+{
+ int r;
+
+ cnfSetLexFile(argc == 1 ? NULL : argv[1]);
+ yydebug = 0;
+ r = yyparse();
+ printf("yyparse() returned %d\n", r);
+ return r;
+}
+