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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
#line 2 "grammar.rules"
/*************************************************************************
* Copyright (C) 2010 Tavian Barnes <tavianator@tavianator.com> *
* *
* This file is part of Dimension. *
* *
* Dimension is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 3 of the License, or (at *
* your option) any later version. *
* *
* Dimension is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*************************************************************************/
/*
* Start symbol
*/
SCENE: /* empty */
| SCENE SCENE_ITEM {
dmnsn_array_push(astree, &$2);
}
;
/* Top-level scene item */
SCENE_ITEM: GLOBAL_SETTINGS
| ATMOSPHERIC_EFFECT
| CAMERA
| OBJECT
;
/* Global settings */
GLOBAL_SETTINGS: "global_settings" "{"
GLOBAL_SETTINGS_ITEMS
"}"
{
$$ = $3;
}
;
GLOBAL_SETTINGS_ITEMS: /* empty */ {
$$ = dmnsn_new_astnode(DMNSN_AST_GLOBAL_SETTINGS, @$);
}
| GLOBAL_SETTINGS_ITEMS GLOBAL_SETTINGS_ITEM {
$$ = $1;
dmnsn_array_push($$.children, &$2);
}
;
GLOBAL_SETTINGS_ITEM: "adc_bailout" FLOAT {
$$ = dmnsn_new_astnode1(DMNSN_AST_ADC_BAILOUT, @$, $2);
}
| "ambient_light" COLOR {
$$ = dmnsn_new_astnode1(DMNSN_AST_AMBIENT, @$, $2);
}
| "assumed_gamma" FLOAT {
dmnsn_diagnostic(@1,
"WARNING: assumed_gamma not supported");
$$ = dmnsn_new_astnode1(DMNSN_AST_ASSUMED_GAMMA, @$, $2);
}
| "charset" GLOBAL_CHARSET {
dmnsn_diagnostic(@1,
"WARNING: charset not supported");
$$ = dmnsn_new_astnode1(DMNSN_AST_CHARSET, @$, $2);
}
| "max_intersections" INT {
dmnsn_diagnostic(@1,
"WARNING: max_intersections is"
" unnecessary for Dimension");
$$ = dmnsn_new_astnode1(DMNSN_AST_MAX_INTERSECTIONS, @$,
$2);
}
| "max_trace_level" INT {
$$ = dmnsn_new_astnode1(DMNSN_AST_MAX_TRACE_LEVEL, @$,
$2);
}
;
GLOBAL_CHARSET: "ascii" {
$$ = dmnsn_new_astleaf(DMNSN_AST_ASCII, @$);
}
| "utf8" {
$$ = dmnsn_new_astleaf(DMNSN_AST_UTF8, @$);
}
| "sys" {
$$ = dmnsn_new_astleaf(DMNSN_AST_SYS, @$);
}
/* Atmospheric effects */
ATMOSPHERIC_EFFECT: BACKGROUND
| SKY_SPHERE
;
BACKGROUND: "background" "{" COLOR "}" {
$$ = dmnsn_new_astnode1(DMNSN_AST_BACKGROUND, @$, $3);
}
;
SKY_SPHERE: "sky_sphere" "{"
SKY_SPHERE_ITEMS
"}"
{
$$ = $3;
}
;
SKY_SPHERE_ITEMS: /* empty */ {
$$ = dmnsn_new_astnode(DMNSN_AST_SKY_SPHERE, @$);
}
| SKY_SPHERE_ITEMS PIGMENT {
$$ = $1;
dmnsn_array_push($$.children, &$2);
}
| SKY_SPHERE_ITEMS TRANSFORMATION {
$$ = $1;
dmnsn_array_push($$.children, &$2);
}
;
|