summaryrefslogtreecommitdiffstats
path: root/dimension/directives.rules
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-02-01 21:27:12 -0500
committerTavian Barnes <tavianator@gmail.com>2010-02-01 21:27:12 -0500
commit40752ebfb3ec8355b4f17681f8aab0ca7f6992f4 (patch)
treed5c1a693cc5468e2d1688fc5ee49e1ea6e7e06e1 /dimension/directives.rules
parent58634f3410db1ff16f6e21d9d0e1fcfaa17b2453 (diff)
downloaddimension-40752ebfb3ec8355b4f17681f8aab0ca7f6992f4.tar.xz
Implement #declare, #local, and #undef in middle tier.
Oh God this is ugly...
Diffstat (limited to 'dimension/directives.rules')
-rw-r--r--dimension/directives.rules35
1 files changed, 35 insertions, 0 deletions
diff --git a/dimension/directives.rules b/dimension/directives.rules
new file mode 100644
index 0000000..916039b
--- /dev/null
+++ b/dimension/directives.rules
@@ -0,0 +1,35 @@
+/*
+ * Start symbol
+ */
+
+LANGUAGE_DIRECTIVE: "#declare" "identifier" "=" RVALUE {
+ dmnsn_declare_symbol(symtable, $2, $4);
+ free($2);
+ dmnsn_delete_astnode($4);
+ }
+ | "#local" "identifier" "=" RVALUE {
+ dmnsn_local_symbol(symtable, $2, $4);
+ free($2);
+ dmnsn_delete_astnode($4);
+ }
+ | "#undef" "identifier" {
+ dmnsn_undef_symbol(symtable, $2);
+ free($2);
+ }
+
+RVALUE: ARITH_EXPR ";" %dprec 2 {
+ $$ = dmnsn_eval($1, symtable);
+ dmnsn_delete_astnode($1);
+
+ if ($$.type == DMNSN_AST_NONE) {
+ dmnsn_delete_astnode($$);
+ YYERROR;
+ }
+ }
+ | COLOR ";" %dprec 1
+ | OBJECT
+ | TEXTURE
+ | PIGMENT
+ | FINISH
+ | CAMERA
+ | TRANSFORMATION