summaryrefslogtreecommitdiffstats
path: root/dimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-11-08 16:10:40 -0500
committerTavian Barnes <tavianator@gmail.com>2010-11-08 16:10:40 -0500
commita76d4f1fb96633e7f348ba6aa0c14b726e15e28e (patch)
treeaae8f28d884e7beca4441524c3a981c8340fde4f /dimension
parent1ae277f2094a21d93b1460bf466ff657201310c2 (diff)
downloaddimension-a76d4f1fb96633e7f348ba6aa0c14b726e15e28e.tar.xz
Add quick_color to pigments.
Diffstat (limited to 'dimension')
-rw-r--r--dimension/common.rules6
-rw-r--r--dimension/common.terminals2
-rw-r--r--dimension/directives.declarations2
-rw-r--r--dimension/grammar.declarations2
-rw-r--r--dimension/grammar.epilogue1
-rw-r--r--dimension/lexer.l2
-rw-r--r--dimension/parse.h1
-rw-r--r--dimension/realize.c8
8 files changed, 21 insertions, 3 deletions
diff --git a/dimension/common.rules b/dimension/common.rules
index 600ef80..74a40e4 100644
--- a/dimension/common.rules
+++ b/dimension/common.rules
@@ -572,6 +572,12 @@ PIGMENT_MODIFIERS: /* empty */ {
$$ = $1;
dmnsn_array_push($$.children, &$2);
}
+ | PIGMENT_MODIFIERS "quick_color" COLOR {
+ dmnsn_astnode quick_color
+ = dmnsn_new_astnode1(DMNSN_AST_QUICK_COLOR, @2, $3);
+ $$ = $1;
+ dmnsn_array_push($$.children, &quick_color);
+ }
;
COLOR_LIST2: /* empty */ {
diff --git a/dimension/common.terminals b/dimension/common.terminals
index 7b19a33..e2df8d1 100644
--- a/dimension/common.terminals
+++ b/dimension/common.terminals
@@ -356,7 +356,7 @@
%token DMNSN_T_QUADRIC
%token DMNSN_T_QUARTIC
%token DMNSN_T_QUATERNION
-%token DMNSN_T_QUICK_COLOR
+%token DMNSN_T_QUICK_COLOR "quick_color"
%token DMNSN_T_QUILTED
%token DMNSN_T_RADIAL
%token DMNSN_T_RADIANS "radians"
diff --git a/dimension/directives.declarations b/dimension/directives.declarations
index b1a984d..9f8c891 100644
--- a/dimension/directives.declarations
+++ b/dimension/directives.declarations
@@ -21,7 +21,7 @@
%name-prefix "dmnsn_ld_yy"
-%expect 15
+%expect 16
%expect-rr 6
%parse-param {const char *filename}
diff --git a/dimension/grammar.declarations b/dimension/grammar.declarations
index 987d9c9..58b995f 100644
--- a/dimension/grammar.declarations
+++ b/dimension/grammar.declarations
@@ -23,7 +23,7 @@
%name-prefix "dmnsn_yy"
-%expect 11
+%expect 12
%parse-param {const char *filename}
%parse-param {void *yyscanner}
diff --git a/dimension/grammar.epilogue b/dimension/grammar.epilogue
index 731d017..3856e1e 100644
--- a/dimension/grammar.epilogue
+++ b/dimension/grammar.epilogue
@@ -158,6 +158,7 @@ dmnsn_astnode_string(dmnsn_astnode_type astnode_type)
dmnsn_astnode_map(DMNSN_AST_COLOR_LIST, "color-list");
dmnsn_astnode_map(DMNSN_AST_COLOR_MAP, "color_map");
dmnsn_astnode_map(DMNSN_AST_COLOR_MAP_ENTRY, "color_map-entry");
+ dmnsn_astnode_map(DMNSN_AST_QUICK_COLOR, "quick_color");
dmnsn_astnode_map(DMNSN_AST_IMAGE_MAP, "image_map");
dmnsn_astnode_map(DMNSN_AST_PNG, "png");
diff --git a/dimension/lexer.l b/dimension/lexer.l
index 2f84620..7c06df2 100644
--- a/dimension/lexer.l
+++ b/dimension/lexer.l
@@ -239,6 +239,8 @@ unsigned long wchar;
"plane" RETURN_TOKEN(DMNSN_T_PLANE);
"png" RETURN_TOKEN(DMNSN_T_PNG);
"pow" RETURN_TOKEN(DMNSN_T_POW);
+"quick_color" RETURN_TOKEN(DMNSN_T_QUICK_COLOR);
+"quick_colour" RETURN_TOKEN(DMNSN_T_QUICK_COLOR);
"radians" RETURN_TOKEN(DMNSN_T_RADIANS);
"red" RETURN_TOKEN(DMNSN_T_RED);
"reflection" RETURN_TOKEN(DMNSN_T_REFLECTION);
diff --git a/dimension/parse.h b/dimension/parse.h
index 09ca685..5336d27 100644
--- a/dimension/parse.h
+++ b/dimension/parse.h
@@ -72,6 +72,7 @@ typedef enum {
DMNSN_AST_COLOR_LIST,
DMNSN_AST_COLOR_MAP,
DMNSN_AST_COLOR_MAP_ENTRY,
+ DMNSN_AST_QUICK_COLOR,
DMNSN_AST_IMAGE_MAP,
DMNSN_AST_PNG,
diff --git a/dimension/realize.c b/dimension/realize.c
index ab5f2a0..e6de1a4 100644
--- a/dimension/realize.c
+++ b/dimension/realize.c
@@ -589,6 +589,14 @@ dmnsn_realize_pigment_modifiers(dmnsn_astnode astnode, dmnsn_pigment *pigment)
);
break;
+ case DMNSN_AST_QUICK_COLOR:
+ {
+ dmnsn_astnode quick_color;
+ dmnsn_array_get(modifier->children, 0, &quick_color);
+ pigment->quick_color = dmnsn_realize_color(quick_color);
+ break;
+ }
+
case DMNSN_AST_COLOR_LIST:
case DMNSN_AST_COLOR_MAP:
/* Already handled by dmnsn_realize_pattern_pigment() */