commit 0b4ef8a6fd73f8d580e5edffbf035ec67fc96d18
parent c2da0fc2b8d4d134ccac985d3ac3573bb0d8f1f7
Author: Tomas Hlavaty <tom@logand.com>
Date: Fri, 9 Mar 2012 19:17:30 +0100
mk_relative introduced
Diffstat:
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/parse.y b/parse.y
@@ -41,6 +41,8 @@ Any ast;
#define YYSTYPE Any
+Any mk_relative(Any x);
+
%}
%token TRUE FALSE ID BOOL INT OCT HEX REAL
@@ -193,7 +195,7 @@ unary_exp: primary_exp | unary_op primary_exp {$$ = list2($1, $2);};
unary_op: PLUS | MINUS | NOT;
primary_exp: name | literal | LPAR exp RPAR {$$ = $2;};
literal: BOOL | INT | OCT | HEX | REAL;
-name: relname {$$ = cons(mk(RELATIVE, "relative"), $1);}
+name: relname {$$ = mk_relative($1);}
| SCOPE relname {$$ = cons(mk(ABSOLUTE, "absolute"), $2);};
relname: identifier {$$ = list1($1);} | identifier SCOPE relname {$$ = cons($1, $3);};
identifier: ID
diff --git a/unoidl2.c b/unoidl2.c
@@ -190,3 +190,9 @@ Any reverse(Any x, Any a) {
}
Any id(Any x) {return x;}
+
+Any mk_relative(Any x) {
+ Any h = NIL != cdr(x) ? mk(ABSOLUTE, "absolute") : mk(RELATIVE, "relative");
+ return cons(h, x);
+ //return cons(mk(RELATIVE, "relative"), $1);
+}