summaryrefslogtreecommitdiffstats
path: root/dimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-11-19 14:00:11 -0500
committerTavian Barnes <tavianator@gmail.com>2010-11-19 14:07:42 -0500
commit4899481ed7179d9c1c8e43b7b366b012d9b86218 (patch)
tree0301b4cdb86da07fa46b376e855a483c196c0302 /dimension
parente220611617c71d9bbb142fb88a85d7c4c41b6b07 (diff)
downloaddimension-4899481ed7179d9c1c8e43b7b366b012d9b86218.tar.xz
Parse max_intersections.
Diffstat (limited to 'dimension')
-rw-r--r--dimension/common.terminals2
-rw-r--r--dimension/grammar.epilogue7
-rw-r--r--dimension/grammar.rules11
-rw-r--r--dimension/lexer.l1
-rw-r--r--dimension/parse.h1
-rw-r--r--dimension/realize.c9
6 files changed, 21 insertions, 10 deletions
diff --git a/dimension/common.terminals b/dimension/common.terminals
index e2df8d1..080278c 100644
--- a/dimension/common.terminals
+++ b/dimension/common.terminals
@@ -274,7 +274,7 @@
%token DMNSN_T_MAX "max"
%token DMNSN_T_MAX_EXTENT
%token DMNSN_T_MAX_GRADIENT
-%token DMNSN_T_MAX_INTERSECTIONS
+%token DMNSN_T_MAX_INTERSECTIONS "max_intersections"
%token DMNSN_T_MAX_ITERATION
%token DMNSN_T_MAX_SAMPLE
%token DMNSN_T_MAX_TRACE
diff --git a/dimension/grammar.epilogue b/dimension/grammar.epilogue
index 6aef4fe..4e97d96 100644
--- a/dimension/grammar.epilogue
+++ b/dimension/grammar.epilogue
@@ -116,9 +116,10 @@ dmnsn_astnode_string(dmnsn_astnode_type astnode_type)
dmnsn_astnode_map(DMNSN_AST_NONE, "none");
- dmnsn_astnode_map(DMNSN_AST_GLOBAL_SETTINGS, "global_settings");
- dmnsn_astnode_map(DMNSN_AST_ASSUMED_GAMMA, "assumed_gamma");
- dmnsn_astnode_map(DMNSN_AST_MAX_TRACE_LEVEL, "max_trace_level");
+ dmnsn_astnode_map(DMNSN_AST_GLOBAL_SETTINGS, "global_settings");
+ dmnsn_astnode_map(DMNSN_AST_ASSUMED_GAMMA, "assumed_gamma");
+ dmnsn_astnode_map(DMNSN_AST_MAX_INTERSECTIONS, "max_intersections");
+ dmnsn_astnode_map(DMNSN_AST_MAX_TRACE_LEVEL, "max_trace_level");
dmnsn_astnode_map(DMNSN_AST_BACKGROUND, "background");
diff --git a/dimension/grammar.rules b/dimension/grammar.rules
index 0963a1e..6c936aa 100644
--- a/dimension/grammar.rules
+++ b/dimension/grammar.rules
@@ -61,8 +61,15 @@ GLOBAL_SETTINGS_ITEM: "assumed_gamma" FLOAT {
$$ = dmnsn_new_astnode1(DMNSN_AST_ASSUMED_GAMMA, @$, $2);
}
| "max_trace_level" INT {
- $$ = dmnsn_new_astnode1(DMNSN_AST_MAX_TRACE_LEVEL,
- @$, $2);
+ $$ = dmnsn_new_astnode1(DMNSN_AST_MAX_TRACE_LEVEL, @$,
+ $2);
+ }
+ | "max_intersections" INT {
+ dmnsn_diagnostic(@1,
+ "WARNING: max_intersections is"
+ " unnecessary for Dimension");
+ $$ = dmnsn_new_astnode1(DMNSN_AST_MAX_INTERSECTIONS, @$,
+ $2);
}
;
diff --git a/dimension/lexer.l b/dimension/lexer.l
index 7c06df2..6efe58d 100644
--- a/dimension/lexer.l
+++ b/dimension/lexer.l
@@ -222,6 +222,7 @@ unsigned long wchar;
"light_source" RETURN_TOKEN(DMNSN_T_LIGHT_SOURCE);
"matrix" RETURN_TOKEN(DMNSN_T_MATRIX);
"max" RETURN_TOKEN(DMNSN_T_MAX);
+"max_intersections" RETURN_TOKEN(DMNSN_T_MAX_INTERSECTIONS);
"max_trace_level" RETURN_TOKEN(DMNSN_T_MAX_TRACE_LEVEL);
"merge" RETURN_TOKEN(DMNSN_T_MERGE);
"min" RETURN_TOKEN(DMNSN_T_MIN);
diff --git a/dimension/parse.h b/dimension/parse.h
index ad8787a..a9d32e8 100644
--- a/dimension/parse.h
+++ b/dimension/parse.h
@@ -33,6 +33,7 @@ typedef enum {
DMNSN_AST_GLOBAL_SETTINGS,
DMNSN_AST_ASSUMED_GAMMA,
DMNSN_AST_MAX_TRACE_LEVEL,
+ DMNSN_AST_MAX_INTERSECTIONS,
DMNSN_AST_BACKGROUND,
diff --git a/dimension/realize.c b/dimension/realize.c
index 8ac8279..4e62316 100644
--- a/dimension/realize.c
+++ b/dimension/realize.c
@@ -239,15 +239,16 @@ dmnsn_realize_global_settings(dmnsn_astnode astnode, dmnsn_scene *scene)
dmnsn_astnode child;
switch (item->type) {
- case DMNSN_AST_ASSUMED_GAMMA:
- /* assumed_gamma not supported */
- break;
-
case DMNSN_AST_MAX_TRACE_LEVEL:
dmnsn_array_get(item->children, 0, &child);
scene->reclimit = dmnsn_realize_integer(child);
break;
+ case DMNSN_AST_ASSUMED_GAMMA:
+ case DMNSN_AST_MAX_INTERSECTIONS:
+ /* Ignored settings */
+ break;
+
default:
dmnsn_assert(false, "Invalid global settings item.");
}