diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-07-02 18:32:35 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-07-02 18:32:35 +0200 |
commit | 62e95c10ba84871fd5ad97fccd75664b07620013 (patch) | |
tree | 805addae179d86fa10507205ebe6887e872b81a1 /grammar/rscript.y | |
parent | 1ee14507b37bd7cb252341e7f6bdb6398407f1fd (diff) | |
download | rsyslog-62e95c10ba84871fd5ad97fccd75664b07620013.tar.gz rsyslog-62e95c10ba84871fd5ad97fccd75664b07620013.tar.xz rsyslog-62e95c10ba84871fd5ad97fccd75664b07620013.zip |
milestone: some support for rules in grammar
Diffstat (limited to 'grammar/rscript.y')
-rw-r--r-- | grammar/rscript.y | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/grammar/rscript.y b/grammar/rscript.y index 6954d38d..5bd8f0f9 100644 --- a/grammar/rscript.y +++ b/grammar/rscript.y @@ -19,30 +19,47 @@ %token <objType> BEGINOBJ %token ENDOBJ %token <s> CFSYSLINE +%token BEGIN_ACTION +%token <s> LEGACY_ACTION +%token <s> PRIFILT +%token <s> PROPFILT %type <nvlst> nv nvlst %type <obj> obj +%type <s> actlst +%type <s> act %% - /* conf: | conf global | conf action*/ -conf: +conf: /* empty (to end recursion) */ | obj conf | cfsysline conf + | rule conf -obj: BEGINOBJ nvlst ENDOBJ { printf("XXXX: global processed\n"); - $$ = cnfobjNew($1, $2); +obj: BEGINOBJ nvlst ENDOBJ { $$ = cnfobjNew($1, $2); cnfobjPrint($$); cnfobjDestruct($$); } +obj: BEGIN_ACTION nvlst ENDOBJ { struct cnfobj *t = cnfobjNew(CNFOBJ_ACTION, $2); + cnfobjPrint(t); + cnfobjDestruct(t); + printf("XXXX: this is an new-style action!\n"); + } cfsysline: CFSYSLINE { printf("XXXX: processing CFSYSLINE: %s\n", $1); } nvlst: { $$ = NULL; } - | nvlst nv { printf("XXXX: nvlst $1: %p, $2 %p\n", $1,$2); - $2->next = $1; - $$ = $2; - } + | nvlst nv { $2->next = $1; $$ = $2; } nv: NAME '=' VALUE { $$ = nvlstNew($1, $3); } +rule: PRIFILT actlst { printf("PRIFILT: %s\n", $1); free($1); } + | PROPFILT actlst + +actlst: act { printf("action (end actlst) %s\n", $1);$$=$1; } + | actlst '&' act { printf("in actionlist %s\n", $3); } +act: BEGIN_ACTION nvlst ENDOBJ { $$ = "obj"; } + | LEGACY_ACTION { printf("legacy action: '%s'\n", $1); + /*free($1);*/ + $$ = $1;} + %% int yyerror(char *s) { |