commit - 75a8c854e063f97e5a2605f5256a1ce15ffb2f24
commit + 43c08a530e595df40d8133b9a3f77318c2a04b44
blob - 51cf2780d3077e2b6c6f8202d840cfe73f46b425
blob + 0ac72ed607c755f9ef479ef7340a69603da1fba3
--- gotd/parse.y
+++ gotd/parse.y
%token <v.string> STRING
%token <v.number> NUMBER
-%type <v.number> boolean
%type <v.tv> timeout
%%
| grammar repository '\n'
;
-boolean : STRING {
- if (strcasecmp($1, "1") == 0 ||
- strcasecmp($1, "yes") == 0 ||
- strcasecmp($1, "on") == 0)
- $$ = 1;
- else if (strcasecmp($1, "0") == 0 ||
- strcasecmp($1, "off") == 0 ||
- strcasecmp($1, "no") == 0)
- $$ = 0;
- else {
- yyerror("invalid boolean value '%s'", $1);
- free($1);
- YYERROR;
- }
- free($1);
- }
- | ON { $$ = 1; }
- | NUMBER { $$ = $1; }
- ;
-
timeout : NUMBER {
if ($1 < 0) {
yyerror("invalid timeout: %lld", $1);