diff --git a/src/parsecode.c b/src/parsecode.c index 1b21c42..96f000f 100644 --- a/src/parsecode.c +++ b/src/parsecode.c @@ -695,7 +695,6 @@ int action_parent_config(pass_to_bison *bison_args, bxstr_t *filepath) int action_add_design(pass_to_bison *bison_args, char *design_primary_name, char *name_at_end) { design_t *tmp; - char *p; #ifdef PARSER_DEBUG fprintf(stderr, "--------- ADDING DESIGN \"%s\".\n", design_primary_name); @@ -714,15 +713,6 @@ int action_add_design(pass_to_bison *bison_args, char *design_primary_name, char return RC_ERROR; } - p = design_primary_name; - while (*p) { - if (*p < 32 || *p > 126) { /* CHECK this check may be unnecessary due to lexer's ASCII_ID */ - yyerror(bison_args, "box design name must consist of printable standard ASCII characters."); - return RC_ERROR; - } - ++p; - } - bison_args->num_mandatory = 0; bison_args->time_for_se_check = 0; bison_args->num_shapespec = 0; diff --git a/src/parser.y b/src/parser.y index 6fa8aff..73718d2 100644 --- a/src/parser.y +++ b/src/parser.y @@ -222,7 +222,14 @@ alias: ASCII_ID alias_list: alias | alias_list ',' alias; -design_id: ASCII_ID | ASCII_ID ',' alias_list; +design_id: ASCII_ID | ASCII_ID ',' alias_list + +| WORD + { + yyerror(bison_args, "box design name must consist of printable standard ASCII characters."); + YYERROR; + } +; design: YBOX design_id { diff --git a/test/174_non_ascii_design_name.cfg b/test/174_non_ascii_design_name.cfg new file mode 100644 index 0000000..b261a73 --- /dev/null +++ b/test/174_non_ascii_design_name.cfg @@ -0,0 +1,20 @@ + +BOX käse + +sample + cheese +ends + +shapes { + w ("cheese") +} + +elastic ( + w +) + +padding { + left 1 +} + +END käse diff --git a/test/174_non_ascii_design_name.txt b/test/174_non_ascii_design_name.txt new file mode 100644 index 0000000..480877e --- /dev/null +++ b/test/174_non_ascii_design_name.txt @@ -0,0 +1,11 @@ +:ARGS +-f 174_non_ascii_design_name.cfg +:INPUT +foo +:OUTPUT-FILTER +:EXPECTED-ERROR 1 +boxes: 174_non_ascii_design_name.cfg: line 2: box design name must consist of printable standard ASCII characters. +boxes: 174_non_ascii_design_name.cfg: line 2: skipping to next design +boxes: no valid data in config file -- 174_non_ascii_design_name.cfg +boxes: no valid designs found +:EOF