]> mj.ucw.cz Git - umpf.git/blobdiff - cond.y
unify BUFSIZE
[umpf.git] / cond.y
diff --git a/cond.y b/cond.y
index 42a663d1f9947ac78f022f867e894d51d4e71437..f46afe528f7b6869f7521ac0f10d1e5375677761 100644 (file)
--- a/cond.y
+++ b/cond.y
@@ -3,7 +3,7 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "brum.h"
+#include "umpf.h"
 
 static struct tree* tree_malloc(int type);
 
@@ -19,6 +19,7 @@ static struct tree* tree_malloc(int type);
 %token <str> CONST
 %token <n> NUM
 %token <str> VAR
+%token <str> KW_DISCARD
 %token <str> KW_PIPE KW_MAIL KW_COPY
 %token '(' ')' '{' '}' ';'
 %nonassoc KW_IF
@@ -127,6 +128,11 @@ cond:      '!' cond {
                                                $$->pt.cond.op = $2;    
                                                $$->pt.cond.type = OP_REL;      
                                        }
+       | ass_right {
+                               $$ = tree_malloc(ST_COND);
+                               $$->pt.cond.left = $1;  
+                               $$->pt.cond.type = JUST_BOOL;   
+               }
 ;
 
 rop:   '>'
@@ -146,7 +152,7 @@ ass:
                                        $$->pt.ass.left = tree_malloc(ST_LEAF);
                                        $$->pt.ass.left->pt.leaf.type = L_VAR;
                                        $$->pt.ass.left->pt.leaf.value = $1;
-
+                                       $$->pt.ass.left->pt.leaf.n = find_var($1, var_hash);
                                        $$->pt.ass.right = $3;
                                }
 ;
@@ -155,11 +161,13 @@ leaves:           VAR     {
                                $$ = tree_malloc(ST_LEAF);
                                $$->pt.leaf.type = L_VAR;
                                $$->pt.leaf.value = $1;
+                               $$->pt.leaf.n = find_var($1, var_hash);
                        }
                | CONST { 
                                $$ = tree_malloc(ST_LEAF);
                                $$->pt.leaf.type = L_CONST;
                                $$->pt.leaf.value = $1;
+                               $$->pt.leaf.n = store_const($1);
                        }
 ;
 
@@ -169,6 +177,12 @@ arrow:     left ARROW right ass_right  {
                                        $$->pt.arrow.kw_left = $1;
                                        $$->pt.arrow.kw_right = $3;
                                }
+       | left ARROW KW_DISCARD         { //FIXME: actually left does not make sense here 
+                                       $$ = tree_malloc(ST_ARROW);
+                                       $$->pt.arrow.s = NULL;
+                                       $$->pt.arrow.kw_left = NULL;
+                                       $$->pt.arrow.kw_right = "discard";
+                               }
 ;
 
 left:  /* empty */ { $$ = NULL;}