mirror of
https://github.com/ascii-boxes/boxes.git
synced 2024-12-04 22:11:07 +01:00
Print useful error message on invalid design name
This commit is contained in:
parent
b7e3549d15
commit
34759334f7
@ -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)
|
int action_add_design(pass_to_bison *bison_args, char *design_primary_name, char *name_at_end)
|
||||||
{
|
{
|
||||||
design_t *tmp;
|
design_t *tmp;
|
||||||
char *p;
|
|
||||||
|
|
||||||
#ifdef PARSER_DEBUG
|
#ifdef PARSER_DEBUG
|
||||||
fprintf(stderr, "--------- ADDING DESIGN \"%s\".\n", design_primary_name);
|
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;
|
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->num_mandatory = 0;
|
||||||
bison_args->time_for_se_check = 0;
|
bison_args->time_for_se_check = 0;
|
||||||
bison_args->num_shapespec = 0;
|
bison_args->num_shapespec = 0;
|
||||||
|
@ -222,7 +222,14 @@ alias: ASCII_ID
|
|||||||
|
|
||||||
alias_list: alias | alias_list ',' alias;
|
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
|
design: YBOX design_id
|
||||||
{
|
{
|
||||||
|
20
test/174_non_ascii_design_name.cfg
Normal file
20
test/174_non_ascii_design_name.cfg
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
BOX käse
|
||||||
|
|
||||||
|
sample
|
||||||
|
cheese
|
||||||
|
ends
|
||||||
|
|
||||||
|
shapes {
|
||||||
|
w ("cheese")
|
||||||
|
}
|
||||||
|
|
||||||
|
elastic (
|
||||||
|
w
|
||||||
|
)
|
||||||
|
|
||||||
|
padding {
|
||||||
|
left 1
|
||||||
|
}
|
||||||
|
|
||||||
|
END käse
|
11
test/174_non_ascii_design_name.txt
Normal file
11
test/174_non_ascii_design_name.txt
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user