summaryrefslogtreecommitdiffstats
path: root/expr.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-02-20 18:54:20 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-02-20 18:54:20 +0000
commit44bb5af7ccef417a1d088527fc02af5f0e8d3dc5 (patch)
tree6a28892a1253b4f199a4f55c64b1a65fbdd38386 /expr.c
parentfa150f43db5f9673a5b9dfb0727767eca60e4453 (diff)
downloadrsyslog-44bb5af7ccef417a1d088527fc02af5f0e8d3dc5.tar.gz
rsyslog-44bb5af7ccef417a1d088527fc02af5f0e8d3dc5.tar.xz
rsyslog-44bb5af7ccef417a1d088527fc02af5f0e8d3dc5.zip
begun expr compile process, first steps done
Diffstat (limited to 'expr.c')
-rw-r--r--expr.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/expr.c b/expr.c
index e9df1a3f..46f755fa 100644
--- a/expr.c
+++ b/expr.c
@@ -59,6 +59,8 @@ terminal(expr_t *pThis, ctok_t *ctok)
{
DEFiRet;
ctok_token_t *pToken;
+ var_t *pVar;
+ rsCStrObj *pCStr;
ISOBJ_TYPE_assert(pThis, expr);
ISOBJ_TYPE_assert(ctok, ctok);
@@ -67,11 +69,17 @@ terminal(expr_t *pThis, ctok_t *ctok)
switch(pToken->tok) {
case ctok_SIMPSTR:
+ CHKiRet(varConstruct(&pVar));
+ CHKiRet(varConstructFinalize(pVar));
+ CHKiRet(ctok_tokenUnlinkCStr(pToken, &pCStr));
+ CHKiRet(varSetString(pVar, pCStr));
dbgoprint((obj_t*) pThis, "simpstr\n");
+ CHKiRet(vmprgAddVarOperation(pThis->pVmprg, opcode_PUSHCONSTANT, pVar)); /* add to program */
// push val
break;
case ctok_NUMBER:
dbgoprint((obj_t*) pThis, "number\n");
+ CHKiRet(vmprgAddVarOperation(pThis->pVmprg, opcode_PUSHCONSTANT, NULL)); /* add to program */
// push val
break;
case ctok_FUNCTION:
@@ -81,10 +89,12 @@ terminal(expr_t *pThis, ctok_t *ctok)
break;
case ctok_MSGVAR:
dbgoprint((obj_t*) pThis, "MSGVAR\n");
+ CHKiRet(vmprgAddVarOperation(pThis->pVmprg, opcode_PUSHMSGVAR, NULL)); /* add to program */
// push val
break;
case ctok_SYSVAR:
dbgoprint((obj_t*) pThis, "SYSVAR\n");
+ CHKiRet(vmprgAddVarOperation(pThis->pVmprg, opcode_PUSHSYSVAR, NULL)); /* add to program */
// push val
break;
case ctok_LPAREN:
@@ -96,7 +106,6 @@ terminal(expr_t *pThis, ctok_t *ctok)
ABORT_FINALIZE(RS_RET_SYNTAX_ERROR);
CHKiRet(ctok_tokenDestruct(&pToken)); /* "eat" processed token */
dbgoprint((obj_t*) pThis, "end expr, rparen eaten\n");
- /* fill structure */
break;
default:
dbgoprint((obj_t*) pThis, "invalid token %d\n", pToken->tok);