%token <val> NUM "number"
%token <string> STRING "string"
%token <string> QUOTED_STRING
-%destructor { xfree($$); } STRING QUOTED_STRING
+%token <string> ERROR "error"
+%destructor { xfree($$); } STRING QUOTED_STRING ERROR
%token LL_HDR "ll"
%token NETWORK_HDR "nh"
%destructor { expr_free($$); } list_expr
%type <expr> concat_expr map_lhs_expr
%destructor { expr_free($$); } concat_expr map_lhs_expr
+%type <expr> error_expr
+%destructor { expr_free($$); } error_expr
%type <expr> map_expr
%destructor { expr_free($$); } map_expr
| set_expr
| map_expr
| multiton_expr
+ | error_expr
+ ;
+
+error_expr : ERROR
+ {
+ $$ = NULL;
+ erec_queue(error(&@1, "bad value '%s'", $1),
+ state->msgs);
+ YYERROR;
+ }
;
set_expr : '{' set_list_expr '}'
{decstring} {
errno = 0;
yylval->val = strtoull(yytext, NULL, 0);
- if (errno != 0)
- BUG();
+ if (errno != 0) {
+ yylval->string = xstrdup(yytext);
+ return ERROR;
+ }
return NUM;
}
{hexstring} {
errno = 0;
yylval->val = strtoull(yytext, NULL, 0);
- if (errno != 0)
- BUG();
+ if (errno != 0) {
+ yylval->string = xstrdup(yytext);
+ return ERROR;
+ }
return NUM;
}