From 40752ebfb3ec8355b4f17681f8aab0ca7f6992f4 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 1 Feb 2010 21:27:12 -0500 Subject: Implement #declare, #local, and #undef in middle tier. Oh God this is ugly... --- dimension/directives.rules | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 dimension/directives.rules (limited to 'dimension/directives.rules') 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 -- cgit v1.2.3