summaryrefslogtreecommitdiffstats
path: root/dimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-04-16 14:06:31 -0400
committerTavian Barnes <tavianator@gmail.com>2010-04-16 14:06:31 -0400
commit23229722b2abd0021c697e3f6e43f74b51e4ee41 (patch)
tree85111795e08a24a46788afc90b4b2d98620705a4 /dimension
parent7577a2b69f9a77962912753b6768b38db4e3c454 (diff)
downloaddimension-23229722b2abd0021c697e3f6e43f74b51e4ee41.tar.xz
Implement image_{width,height}.
Diffstat (limited to 'dimension')
-rw-r--r--dimension/common.rules8
-rw-r--r--dimension/common.terminals4
-rw-r--r--dimension/lexer.l2
-rw-r--r--dimension/main.c2
4 files changed, 14 insertions, 2 deletions
diff --git a/dimension/common.rules b/dimension/common.rules
index 732a277..075b276 100644
--- a/dimension/common.rules
+++ b/dimension/common.rules
@@ -669,6 +669,14 @@ ARITH_EXPR: FLOAT_LITERAL
| "vrotate" "(" ARITH_EXPR "," ARITH_EXPR ")" {
$$ = dmnsn_new_astnode2(DMNSN_AST_VROTATE, @$, $3, $5);
}
+ | "image_height" {
+ $$ = dmnsn_new_astnode(DMNSN_AST_IDENTIFIER, @$);
+ $$.ptr = dmnsn_strdup("image_height");
+ }
+ | "image_width" {
+ $$ = dmnsn_new_astnode(DMNSN_AST_IDENTIFIER, @$);
+ $$.ptr = dmnsn_strdup("image_width");
+ }
| "pi" { $$ = dmnsn_new_astnode(DMNSN_AST_PI, @$); }
| "true" { $$ = dmnsn_new_astnode(DMNSN_AST_TRUE, @$); }
| "on" { $$ = dmnsn_new_astnode(DMNSN_AST_TRUE, @$); }
diff --git a/dimension/common.terminals b/dimension/common.terminals
index 05ab8b8..fd62320 100644
--- a/dimension/common.terminals
+++ b/dimension/common.terminals
@@ -225,10 +225,10 @@
%token DMNSN_T_HYPERCOMPLEX
%token DMNSN_T_HOLLOW
%token DMNSN_T_IFF
-%token DMNSN_T_IMAGE_HEIGHT
+%token DMNSN_T_IMAGE_HEIGHT "image_height"
%token DMNSN_T_IMAGE_MAP "image_map"
%token DMNSN_T_IMAGE_PATTERN
-%token DMNSN_T_IMAGE_WIDTH
+%token DMNSN_T_IMAGE_WIDTH "image_width"
%token DMNSN_T_INITIAL_CLOCK
%token DMNSN_T_INITIAL_FRAME
%token DMNSN_T_INSIDE
diff --git a/dimension/lexer.l b/dimension/lexer.l
index 18b4202..2684868 100644
--- a/dimension/lexer.l
+++ b/dimension/lexer.l
@@ -199,7 +199,9 @@ unsigned long wchar;
"gray" RETURN_TOKEN(DMNSN_T_GRAY);
"grey" RETURN_TOKEN(DMNSN_T_GRAY);
"green" RETURN_TOKEN(DMNSN_T_GREEN);
+"image_height" RETURN_TOKEN(DMNSN_T_IMAGE_HEIGHT);
"image_map" RETURN_TOKEN(DMNSN_T_IMAGE_MAP);
+"image_width" RETURN_TOKEN(DMNSN_T_IMAGE_WIDTH);
"int" RETURN_TOKEN(DMNSN_T_INT);
"interior" RETURN_TOKEN(DMNSN_T_INTERIOR);
"intersection" RETURN_TOKEN(DMNSN_T_INTERSECTION);
diff --git a/dimension/main.c b/dimension/main.c
index 2bd4e10..1ea8a72 100644
--- a/dimension/main.c
+++ b/dimension/main.c
@@ -196,6 +196,8 @@ main(int argc, char **argv) {
dmnsn_symbol_table *symtable = dmnsn_new_symbol_table();
dmnsn_declare_symbol(symtable, "$file", dmnsn_new_ast_string(input));
dmnsn_declare_symbol(symtable, "version", dmnsn_new_ast_float(3.6));
+ dmnsn_declare_symbol(symtable, "image_width", dmnsn_new_ast_integer(width));
+ dmnsn_declare_symbol(symtable, "image_height", dmnsn_new_ast_integer(height));
/* Debugging option - output the abstract syntax tree as an S-expression */
if (parse) {