Changeset: 8cc5f372f9ab for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8cc5f372f9ab
Modified Files:
        monetdb5/extras/jaql/jaql.c
        monetdb5/extras/jaql/jaqltree.h
        monetdb5/extras/jaql/parser/jaql.l
        monetdb5/extras/jaql/parser/jaql.y
Branch: Jul2012
Log Message:

jaql: introduce null symbol


diffs (79 lines):

diff --git a/monetdb5/extras/jaql/jaql.c b/monetdb5/extras/jaql/jaql.c
--- a/monetdb5/extras/jaql/jaql.c
+++ b/monetdb5/extras/jaql/jaql.c
@@ -1296,6 +1296,15 @@ make_bool(char b)
        return res;
 }
 
+tree *
+make_null(void)
+{
+       tree *res = GDKzalloc(sizeof(tree));
+       res->type = j_null;
+       
+       return res;
+}
+
 /* creates a function call, with the optional arguments given */
 tree *
 make_func_call(char *name, tree *args)
@@ -1786,6 +1795,9 @@ printtree(stream *out, tree *t, int leve
                        case j_bool:
                                mnstr_printf(out, "%s ", t->nval == 0 ? "false" 
: "true");
                                break;
+                       case j_null:
+                               mnstr_printf(out, "null ");
+                               break;
                        case j_func:
                                if (op) {
                                        mnstr_printf(out, "j_func( %s, ", 
t->sval);
diff --git a/monetdb5/extras/jaql/jaqltree.h b/monetdb5/extras/jaql/jaqltree.h
--- a/monetdb5/extras/jaql/jaqltree.h
+++ b/monetdb5/extras/jaql/jaqltree.h
@@ -57,6 +57,7 @@ enum treetype {
        j_func,
        j_pred,
        j_operation,
+       j_null,
        j_bool,
        j_num,
        j_dbl,
@@ -151,6 +152,7 @@ tree *make_number(long long int n);
 tree *make_double(double d);
 tree *make_string(char *s);
 tree *make_bool(char b);
+tree *make_null(void);
 tree *make_func_call(char *name, tree *args);
 tree *make_func_arg(tree *arg);
 tree *append_func_arg(tree *oarg, tree *narg);
diff --git a/monetdb5/extras/jaql/parser/jaql.l 
b/monetdb5/extras/jaql/parser/jaql.l
--- a/monetdb5/extras/jaql/parser/jaql.l
+++ b/monetdb5/extras/jaql/parser/jaql.l
@@ -136,6 +136,7 @@ and        return AND;
 or         return OR;
 true       return TRUE;
 false      return FALSE;
+null       return NIL;
 "."        return '.';
 ":"        return ':';
 ","        return ',';
diff --git a/monetdb5/extras/jaql/parser/jaql.y 
b/monetdb5/extras/jaql/parser/jaql.y
--- a/monetdb5/extras/jaql/parser/jaql.y
+++ b/monetdb5/extras/jaql/parser/jaql.y
@@ -60,7 +60,7 @@ jaql_import void GDKfree(const char *);
 %token EACH FILTER TRANSFORM EXPAND GROUP INTO BY AS JOIN WHERE IN
 %token SORT TOP DESC ASC EXPLAIN PLAN PLANF DEBUG UNROLL PRESERVE
 
-%token ARROW ASSIGN EQUALS NEQUAL TRUE FALSE
+%token ARROW ASSIGN EQUALS NEQUAL TRUE FALSE NIL
 %token GREATER GEQUAL LESS LEQUAL NOT AND OR
 
 %token <j_ident>  IDENT
@@ -312,6 +312,7 @@ literal: NUMBER      {$$ = make_number($
           | STRING      {$$ = make_string($1);}
           | TRUE        {$$ = make_bool(1);}
           | FALSE       {$$ = make_bool(0);}
+          | NIL         {$$ = make_null();}
           ;
 
 arith_op: '+'        {$$ = make_op(j_plus);}
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to