summaryrefslogtreecommitdiffstats
path: root/expr.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-20 08:48:20 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-20 08:48:20 +0000
commit0af8d22ff6e9fbd8eb89a1612ecf4604f058f78c (patch)
tree75456dcd5fd47274c2f5cd43eaebbbbe57865aab /expr.c
parente2e775add92fae835119d132da33ea4ae0a5ae62 (diff)
downloadrsyslog-0af8d22ff6e9fbd8eb89a1612ecf4604f058f78c.tar.gz
rsyslog-0af8d22ff6e9fbd8eb89a1612ecf4604f058f78c.tar.xz
rsyslog-0af8d22ff6e9fbd8eb89a1612ecf4604f058f78c.zip
created new class ctok_token
Diffstat (limited to 'expr.c')
-rw-r--r--expr.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/expr.c b/expr.c
index 5aada596..b059dac7 100644
--- a/expr.c
+++ b/expr.c
@@ -72,15 +72,15 @@ static rsRetVal
terminal(expr_t *pThis, ctok_t *ctok)
{
DEFiRet;
- ctok_token_t token;
+ ctok_token_t *pToken;
RUNLOG_STR("terminal");
ISOBJ_TYPE_assert(pThis, expr);
ISOBJ_TYPE_assert(ctok, ctok);
- CHKiRet(ctokGetNextToken(ctok, &token));
+ CHKiRet(ctokGetToken(ctok, &pToken));
- switch(token.tok) {
+ switch(pToken->tok) {
case ctok_SIMPSTR:
break;
default:
@@ -127,11 +127,23 @@ static rsRetVal
val(expr_t *pThis, ctok_t *ctok)
{
DEFiRet;
+ ctok_token_t *pToken;
RUNLOG_STR("val");
ISOBJ_TYPE_assert(pThis, expr);
ISOBJ_TYPE_assert(ctok, ctok);
+ CHKiRet(ctokGetToken(ctok, &pToken));
+ if(pToken->tok == ctok_PLUS || pToken->tok == ctok_MINUS) {
+ /* TODO: fill structure */
+ dbgprintf("plus/minus\n");
+ CHKiRet(ctok_tokenDestruct(&pToken)); /* no longer needed */
+ CHKiRet(ctokGetToken(ctok, &pToken)); /* get next one */
+ } else {
+ /* we could not process the token, so push it back */
+ CHKiRet(ctokUngetToken(ctok, pToken));
+ }
+
CHKiRet(term(pThis, ctok));
finalize_it:
@@ -207,7 +219,6 @@ rsRetVal exprConstructFinalize(expr_t *pThis)
ISOBJ_TYPE_assert(pThis, expr);
-finalize_it:
RETiRet;
}
@@ -230,6 +241,7 @@ exprEval(expr_t *pThis, msg_t *pMsg)
DEFiRet;
ISOBJ_TYPE_assert(pThis, expr);
+ ISOBJ_TYPE_assert(pMsg, msg);
RETiRet;
}