summaryrefslogtreecommitdiffstats
path: root/filter
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>1999-03-09 15:45:27 +0100
committerPavel Machek <pavel@ucw.cz>1999-03-09 15:45:27 +0100
commit2575593e0fa9fb84a4cc481928c32519b3fea2cd (patch)
tree7a6f086ed79cb169fff2e61b7be0340dec4b9823 /filter
parent1aa5cf1c6171393d4be4447eada173d4e1eb983a (diff)
downloadbird-2575593e0fa9fb84a4cc481928c32519b3fea2cd.tar
bird-2575593e0fa9fb84a4cc481928c32519b3fea2cd.zip
Resolved conflicts, you no longer need to wrap constants in const()
Diffstat (limited to 'filter')
-rw-r--r--filter/config.Y34
1 files changed, 27 insertions, 7 deletions
diff --git a/filter/config.Y b/filter/config.Y
index bdaedaa..103acd8 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -22,6 +22,7 @@ CF_DECLS
CF_KEYWORDS(FUNCTION, FILTER, PRINTDEBUG, INT, PRINT, CONST, VAR, PUTS, DIE, IF)
%type <x> term
+%type <x> block
%type <x> cmds
CF_GRAMMAR
@@ -65,6 +66,15 @@ cmds:
}
;
+block:
+ term ';' {
+ $$=$1;
+ }
+ | '{' cmds '}' {
+ $$=$2;
+ }
+ ;
+
term:
/* EMPTY */ {
$$ = NULL;
@@ -75,13 +85,7 @@ term:
$$->arg1 = $1;
$$->arg2 = $3;
}
- | IF '(' term ')' '{' cmds '}' {
- $$ = f_new_inst();
- $$->code = '?';
- $$->arg1 = $3;
- $$->arg2 = $6;
- }
- | IF '(' term ')' term {
+ | IF '(' term ')' block {
$$ = f_new_inst();
$$->code = '?';
$$->arg1 = $3;
@@ -93,6 +97,17 @@ term:
printf( "New variable\n" );
$$ = NULL;
}
+ | SYM {
+ $$ = f_new_inst();
+ switch ($1->class) {
+ case SYM_VARIABLE_INT:
+ $$->code = 'i';
+ $$->arg1 = &($1->aux);
+ break;
+ default:
+ cf_error("Can not use this class of symbol as variable" );
+ }
+ }
| VAR '(' SYM ')' {
$$ = f_new_inst();
switch ($3->class) {
@@ -104,6 +119,11 @@ term:
cf_error("Can not use this class of symbol as variable" );
}
}
+ | NUM {
+ $$ = f_new_inst();
+ $$->code = 'c';
+ $$->arg1 = $1
+ }
| CONST '(' expr ')' {
$$ = f_new_inst();
$$->code = 'c';