summaryrefslogtreecommitdiffstats
path: root/dimension/grammar.y
diff options
context:
space:
mode:
Diffstat (limited to 'dimension/grammar.y')
-rw-r--r--dimension/grammar.y21
1 files changed, 19 insertions, 2 deletions
diff --git a/dimension/grammar.y b/dimension/grammar.y
index ddc7418..01e2c0f 100644
--- a/dimension/grammar.y
+++ b/dimension/grammar.y
@@ -270,7 +270,7 @@ yyerror(YYLTYPE *locp, dmnsn_array *astree, dmnsn_token_iterator *iterator,
%token DMNSN_T_AUTOSTOP
%token DMNSN_T_AVERAGE
%token DMNSN_T_B_SPLINE
-%token DMNSN_T_BACKGROUND
+%token DMNSN_T_BACKGROUND "background"
%token DMNSN_T_BEZIER_SPLINE
%token DMNSN_T_BICUBIC_PATCH
%token DMNSN_T_BLACK_HOLE
@@ -703,6 +703,10 @@ yyerror(YYLTYPE *locp, dmnsn_array *astree, dmnsn_token_iterator *iterator,
/* Transformations */
%type <astnode> TRANSFORMATION
+/* Atmospheric effects */
+%type <astnode> ATMOSPHERIC_EFFECT
+%type <astnode> BACKGROUND
+
/* Objects */
%type <astnode> OBJECT
%type <astnode> FINITE_SOLID_OBJECT
@@ -749,7 +753,8 @@ SCENE: /* empty */ { }
}
;
-SCENE_ITEM: OBJECT
+SCENE_ITEM: ATMOSPHERIC_EFFECT
+ | OBJECT
;
/* Transformations */
@@ -765,6 +770,16 @@ TRANSFORMATION: "rotate" VECTOR {
}
;
+/* Atmospheric effects */
+
+ATMOSPHERIC_EFFECT: BACKGROUND
+;
+
+BACKGROUND: "background" "{" COLOR "}" {
+ $$ = dmnsn_new_astnode1(DMNSN_AST_BACKGROUND, @$, $3);
+ }
+;
+
/* Objects */
OBJECT: FINITE_SOLID_OBJECT
@@ -1466,6 +1481,8 @@ dmnsn_astnode_string(dmnsn_astnode_type astnode_type)
dmnsn_astnode_map(DMNSN_AST_SCALE, "scale");
dmnsn_astnode_map(DMNSN_AST_TRANSLATION, "translate");
+ dmnsn_astnode_map(DMNSN_AST_BACKGROUND, "background");
+
dmnsn_astnode_map(DMNSN_AST_BOX, "box");
dmnsn_astnode_map(DMNSN_AST_SPHERE, "sphere");
dmnsn_astnode_map(DMNSN_AST_LIGHT_SOURCE, "light_source");