From 4fc36f394ec0988a18decb2d1916e3cebef18d22 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Sat, 26 Mar 2011 14:18:56 +0100 Subject: This adds (*,x) functionality. --- filter/config.Y | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'filter/config.Y') diff --git a/filter/config.Y b/filter/config.Y index b9aa67f8..d1dd081e 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -25,6 +25,19 @@ static int make_pair(int i1, int i2) return (u1 << 16) | u2; } +struct f_tree *f_generate_rev_wcard(int from, int to, int expr) +{ + struct f_tree * ret = NULL; + if(from <= to) { + ret = f_new_tree(); + ret->from.type = ret->to.type = T_PAIR; + ret->from.val.i = ret->to.val.i = make_pair(from, expr); + ret->left = f_generate_rev_wcard(from+1, to, expr); + } + return ret; + +} + CF_DECLS CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN, @@ -229,10 +242,10 @@ fipa: ; set_atom: - expr { $$.type = T_INT; $$.val.i = $1; } + expr { $$.type = T_INT; $$.val.i = $1; } /* 'SYM' included in 'expr' creates 3 reduce/shift conflicts */ | RTRID { $$.type = T_QUAD; $$.val.i = $1; } | fipa { $$ = $1; } - | ENUM { $$.type = $1 >> 16; $$.val.i = $1 & 0xffff; } + | ENUM { $$.type = $1 >> 16; $$.val.i = $1 & 0xffff; } ; set_item: @@ -254,12 +267,25 @@ set_item: $$->from.val.i = make_pair($2, $4); $$->to.val.i = make_pair($9, $11); } + | '(' '*' ',' '*' ')' { /* This is probably useless :-) */ + $$ = f_new_tree(); + $$->from.type = $$->to.type = T_PAIR; + $$->from.val.i = 0; + $$->to.val.i = 0xffffffff; + } | '(' expr ',' '*' ')' { $$ = f_new_tree(); $$->from.type = $$->to.type = T_PAIR; $$->from.val.i = make_pair($2, 0); $$->to.val.i = make_pair($2, 0xffff); } + | '(' '*' ',' expr ')' { + $$ = f_generate_rev_wcard(0, 0xffff, $4); + } + /* This causes 3 reduce/reduce conflicts + | '(' expr '.' '.' expr ',' expr ')' { + cf_error("Not implemented yet"); + }*/ | set_atom { $$ = f_new_tree(); $$->from = $1; -- cgit v1.2.3