summaryrefslogtreecommitdiffstats
path: root/dimension/directives.rules
blob: 916039b78cb7679fcfa23f52cafa29782189003f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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