summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--grammar/grammar.y2
-rw-r--r--grammar/rainerscript.c17
-rw-r--r--grammar/rainerscript.h2
3 files changed, 20 insertions, 1 deletions
diff --git a/grammar/grammar.y b/grammar/grammar.y
index a9f179e0..f94cec04 100644
--- a/grammar/grammar.y
+++ b/grammar/grammar.y
@@ -161,7 +161,7 @@ block: stmt { $$ = $1; }
| '{' script '}' { $$ = $2; }
actlst: s_act { $$ = $1; }
| actlst '&' s_act { $$ = scriptAddStmt($1, $3); }
-s_act: BEGIN_ACTION nvlst ENDOBJ { $$ = cnfstmtNew(S_ACT);
+s_act: BEGIN_ACTION nvlst ENDOBJ { $$ = cnfstmtNewAct($2);
$$->printable="action()";
dbgprintf("RRRR: action object\n"); }
| LEGACY_ACTION { $$ = cnfstmtNew(S_ACT);
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index 0e3f30ae..6e3bae68 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -1677,6 +1677,23 @@ cnfstmtNewPROPFILT(char *propfilt, struct cnfstmt *t_then)
return cnfstmt;
}
+struct cnfstmt *
+cnfstmtNewAct(struct nvlst *lst)
+{
+ struct cnfstmt* cnfstmt;
+ if((cnfstmt = cnfstmtNew(S_ACT)) == NULL)
+ goto done;
+ if(actionNewInst(lst, &cnfstmt->d.act) != RS_RET_OK) {
+ // TODO:RS_RET_WARN?
+ parser_errmsg("errors occured in file '%s' around line %d",
+ cnfcurrfn, yylineno);
+ cnfstmt->nodetype = S_NOP; /* disable action! */
+ goto done;
+ }
+ cnfstmt->printable = (uchar*)"action()";
+done: return cnfstmt;
+}
+
struct cnfrule *
cnfruleNew(enum cnfFiltType filttype, struct cnfactlst *actlst)
{
diff --git a/grammar/rainerscript.h b/grammar/rainerscript.h
index 89d7c050..978f08ad 100644
--- a/grammar/rainerscript.h
+++ b/grammar/rainerscript.h
@@ -132,6 +132,7 @@ struct cnfactlst {
#define S_PROPFILT 4002
#define S_IF 4003
#define S_ACT 4004
+#define S_NOP 4005 /* usually used to disable some statement */
enum cnfFiltType { CNFFILT_NONE, CNFFILT_PRI, CNFFILT_PROP, CNFFILT_SCRIPT };
static inline char*
@@ -321,6 +322,7 @@ struct objlst* objlstAdd(struct objlst *root, struct cnfobj *o);
char *rmLeadingSpace(char *s);
struct cnfstmt * cnfstmtNewPRIFILT(char *prifilt, struct cnfstmt *t_then);
struct cnfstmt * cnfstmtNewPROPFILT(char *propfilt, struct cnfstmt *t_then);
+struct cnfstmt * cnfstmtNewAct(struct nvlst *lst);
rsRetVal initRainerscript(void);
/* debug helper */