summaryrefslogtreecommitdiffstats
path: root/dimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-11-25 20:27:05 -0500
committerTavian Barnes <tavianator@gmail.com>2009-11-25 20:27:05 -0500
commit02c0213ab823a0c838d295017298cf8cd3493342 (patch)
tree50acf3e6283d070139a34a78741ee8f87ce774a3 /dimension
parent1c899d86c393faf021298d08471f0dd48d5306d7 (diff)
downloaddimension-02c0213ab823a0c838d295017298cf8cd3493342.tar.xz
Add vector promotion.
Diffstat (limited to 'dimension')
-rw-r--r--dimension/grammar.y15
1 files changed, 9 insertions, 6 deletions
diff --git a/dimension/grammar.y b/dimension/grammar.y
index 5f82028..ddc7418 100644
--- a/dimension/grammar.y
+++ b/dimension/grammar.y
@@ -225,10 +225,6 @@ yyerror(YYLTYPE *locp, dmnsn_array *astree, dmnsn_token_iterator *iterator,
%token DMNSN_T_NOT_EQUAL "!="
/* Operators */
-%left "&"
-%left "|"
-%left "==" "!="
-%left "<" "<=" ">" ">="
%left "+" "-"
%left "*" "/"
%left "."
@@ -971,6 +967,10 @@ VECTOR: VECTOR_EXPR {
$$ = dmnsn_eval_vector($1);
dmnsn_delete_astnode($1);
}
+ | FLOAT_EXPR {
+ $$ = dmnsn_eval_vector($1);
+ dmnsn_delete_astnode($1);
+ }
;
VECTOR_EXPR: VECTOR_LITERAL
@@ -980,10 +980,13 @@ VECTOR_EXPR: VECTOR_LITERAL
| VECTOR_EXPR "-" VECTOR_EXPR {
$$ = dmnsn_new_astnode2(DMNSN_AST_SUB, @$, $1, $3);
}
- | VECTOR_EXPR "*" VECTOR_EXPR {
+ | VECTOR_EXPR "*" FLOAT_EXPR {
+ $$ = dmnsn_new_astnode2(DMNSN_AST_MUL, @$, $1, $3);
+ }
+ | FLOAT_EXPR "*" VECTOR_EXPR {
$$ = dmnsn_new_astnode2(DMNSN_AST_MUL, @$, $1, $3);
}
- | VECTOR_EXPR "/" VECTOR_EXPR {
+ | VECTOR_EXPR "/" FLOAT_EXPR {
$$ = dmnsn_new_astnode2(DMNSN_AST_DIV, @$, $1, $3);
}
| "+" VECTOR_EXPR %prec DMNSN_T_NEGATE { $$ = $2; }