diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-11-19 14:10:00 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-11-19 14:10:00 -0500 |
commit | 30cb9cb572cf8fa942faff7384580e5e2a06a7b3 (patch) | |
tree | 3cb5df5ad10f6e968b70e0ac347aab244ebca9dd /dimension | |
parent | 4899481ed7179d9c1c8e43b7b366b012d9b86218 (diff) | |
download | dimension-30cb9cb572cf8fa942faff7384580e5e2a06a7b3.tar.xz |
Parse charset.
Diffstat (limited to 'dimension')
-rw-r--r-- | dimension/common.terminals | 8 | ||||
-rw-r--r-- | dimension/grammar.epilogue | 4 | ||||
-rw-r--r-- | dimension/grammar.nonterminals | 1 | ||||
-rw-r--r-- | dimension/grammar.rules | 21 | ||||
-rw-r--r-- | dimension/lexer.l | 4 | ||||
-rw-r--r-- | dimension/parse.h | 4 | ||||
-rw-r--r-- | dimension/realize.c | 1 |
7 files changed, 36 insertions, 7 deletions
diff --git a/dimension/common.terminals b/dimension/common.terminals index 080278c..079aede 100644 --- a/dimension/common.terminals +++ b/dimension/common.terminals @@ -88,7 +88,7 @@ %token DMNSN_T_AREA_LIGHT %token DMNSN_T_ARRAY %token DMNSN_T_ASC "asc" -%token DMNSN_T_ASCII +%token DMNSN_T_ASCII "ascii" %token DMNSN_T_ASIN "asin" %token DMNSN_T_ASINH "asinh" %token DMNSN_T_ASSUMED_GAMMA "assumed_gamma" @@ -120,7 +120,7 @@ %token DMNSN_T_CAUSTICS %token DMNSN_T_CEIL "ceil" %token DMNSN_T_CELLS -%token DMNSN_T_CHARSET +%token DMNSN_T_CHARSET "charset" %token DMNSN_T_CHECKER "checker" %token DMNSN_T_CHR %token DMNSN_T_CIRCULAR @@ -425,7 +425,7 @@ %token DMNSN_T_SUBSTR %token DMNSN_T_SUM %token DMNSN_T_SUPERELLIPSOID -%token DMNSN_T_SYS +%token DMNSN_T_SYS "sys" %token DMNSN_T_T "t" %token DMNSN_T_TAN "tan" %token DMNSN_T_TANH "tanh" @@ -463,7 +463,7 @@ %token DMNSN_T_USE_ALPHA %token DMNSN_T_USE_COLOR %token DMNSN_T_USE_INDEX -%token DMNSN_T_UTF8 +%token DMNSN_T_UTF8 "utf8" %token DMNSN_T_UV_INDICES %token DMNSN_T_UV_MAPPING %token DMNSN_T_UV_VECTORS diff --git a/dimension/grammar.epilogue b/dimension/grammar.epilogue index 4e97d96..0eace5e 100644 --- a/dimension/grammar.epilogue +++ b/dimension/grammar.epilogue @@ -118,6 +118,10 @@ dmnsn_astnode_string(dmnsn_astnode_type astnode_type) dmnsn_astnode_map(DMNSN_AST_GLOBAL_SETTINGS, "global_settings"); dmnsn_astnode_map(DMNSN_AST_ASSUMED_GAMMA, "assumed_gamma"); + dmnsn_astnode_map(DMNSN_AST_CHARSET, "charset"); + dmnsn_astnode_map(DMNSN_AST_ASCII, "ascii"); + dmnsn_astnode_map(DMNSN_AST_UTF8, "utf8"); + dmnsn_astnode_map(DMNSN_AST_SYS, "sys"); dmnsn_astnode_map(DMNSN_AST_MAX_INTERSECTIONS, "max_intersections"); dmnsn_astnode_map(DMNSN_AST_MAX_TRACE_LEVEL, "max_trace_level"); diff --git a/dimension/grammar.nonterminals b/dimension/grammar.nonterminals index 896bff9..9ab8ee1 100644 --- a/dimension/grammar.nonterminals +++ b/dimension/grammar.nonterminals @@ -26,6 +26,7 @@ %type <astnode> GLOBAL_SETTINGS %type <astnode> GLOBAL_SETTINGS_ITEMS %type <astnode> GLOBAL_SETTINGS_ITEM +%type <astnode> GLOBAL_CHARSET /* Atmospheric effects */ %type <astnode> ATMOSPHERIC_EFFECT diff --git a/dimension/grammar.rules b/dimension/grammar.rules index 6c936aa..1ce3e1f 100644 --- a/dimension/grammar.rules +++ b/dimension/grammar.rules @@ -60,9 +60,10 @@ GLOBAL_SETTINGS_ITEM: "assumed_gamma" FLOAT { "WARNING: assumed_gamma not supported"); $$ = dmnsn_new_astnode1(DMNSN_AST_ASSUMED_GAMMA, @$, $2); } - | "max_trace_level" INT { - $$ = dmnsn_new_astnode1(DMNSN_AST_MAX_TRACE_LEVEL, @$, - $2); + | "charset" GLOBAL_CHARSET { + dmnsn_diagnostic(@1, + "WARNING: charset not supported"); + $$ = dmnsn_new_astnode1(DMNSN_AST_CHARSET, @$, $2); } | "max_intersections" INT { dmnsn_diagnostic(@1, @@ -71,8 +72,22 @@ GLOBAL_SETTINGS_ITEM: "assumed_gamma" FLOAT { $$ = 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_astnode(DMNSN_AST_ASCII, @$); + } + | "utf8" { + $$ = dmnsn_new_astnode(DMNSN_AST_UTF8, @$); + } + | "sys" { + $$ = dmnsn_new_astnode(DMNSN_AST_SYS, @$); + } + /* Atmospheric effects */ ATMOSPHERIC_EFFECT: BACKGROUND diff --git a/dimension/lexer.l b/dimension/lexer.l index 6efe58d..8216091 100644 --- a/dimension/lexer.l +++ b/dimension/lexer.l @@ -171,6 +171,7 @@ unsigned long wchar; "ambient" RETURN_TOKEN(DMNSN_T_AMBIENT); "angle" RETURN_TOKEN(DMNSN_T_ANGLE); "asc" RETURN_TOKEN(DMNSN_T_ASC); +"ascii" RETURN_TOKEN(DMNSN_T_ASCII); "asin" RETURN_TOKEN(DMNSN_T_ASIN); "asinh" RETURN_TOKEN(DMNSN_T_ASINH); "assumed_gamma" RETURN_TOKEN(DMNSN_T_ASSUMED_GAMMA); @@ -182,6 +183,7 @@ unsigned long wchar; "blue" RETURN_TOKEN(DMNSN_T_BLUE); "ceil" RETURN_TOKEN(DMNSN_T_CEIL); "camera" RETURN_TOKEN(DMNSN_T_CAMERA); +"charset" RETURN_TOKEN(DMNSN_T_CHARSET); "checker" RETURN_TOKEN(DMNSN_T_CHECKER); "color" RETURN_TOKEN(DMNSN_T_COLOR); "color_map" RETURN_TOKEN(DMNSN_T_COLOR_MAP); @@ -260,6 +262,7 @@ unsigned long wchar; "strcmp" RETURN_TOKEN(DMNSN_T_STRCMP); "strlen" RETURN_TOKEN(DMNSN_T_STRLEN); "sturm" RETURN_TOKEN(DMNSN_T_STURM); +"sys" RETURN_TOKEN(DMNSN_T_SYS); "t" RETURN_TOKEN(DMNSN_T_T); "tan" RETURN_TOKEN(DMNSN_T_TAN); "tanh" RETURN_TOKEN(DMNSN_T_TANH); @@ -272,6 +275,7 @@ unsigned long wchar; "u" RETURN_TOKEN(DMNSN_T_U); "union" RETURN_TOKEN(DMNSN_T_UNION); "up" RETURN_TOKEN(DMNSN_T_UP); +"utf8" RETURN_TOKEN(DMNSN_T_UTF8); "v" RETURN_TOKEN(DMNSN_T_V); "val" RETURN_TOKEN(DMNSN_T_VAL); "vaxis_rotate" RETURN_TOKEN(DMNSN_T_VAXIS_ROTATE); diff --git a/dimension/parse.h b/dimension/parse.h index a9d32e8..38e4eef 100644 --- a/dimension/parse.h +++ b/dimension/parse.h @@ -32,6 +32,10 @@ typedef enum { DMNSN_AST_GLOBAL_SETTINGS, DMNSN_AST_ASSUMED_GAMMA, + DMNSN_AST_CHARSET, + DMNSN_AST_ASCII, + DMNSN_AST_UTF8, + DMNSN_AST_SYS, DMNSN_AST_MAX_TRACE_LEVEL, DMNSN_AST_MAX_INTERSECTIONS, diff --git a/dimension/realize.c b/dimension/realize.c index 4e62316..15d4104 100644 --- a/dimension/realize.c +++ b/dimension/realize.c @@ -245,6 +245,7 @@ dmnsn_realize_global_settings(dmnsn_astnode astnode, dmnsn_scene *scene) break; case DMNSN_AST_ASSUMED_GAMMA: + case DMNSN_AST_CHARSET: case DMNSN_AST_MAX_INTERSECTIONS: /* Ignored settings */ break; |