diff options
author | Omar Polo <op@omarpolo.com> | 2021-06-29 11:11:43 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-06-29 11:11:43 +0000 |
commit | 8235a81c8f7f58eaa08655147963936a2290f691 (patch) | |
tree | 408448624498f318957cc45eb8a58cd407872d79 /parse.y | |
parent | 0be2a537e6e2b336a6e46cd1f5a13663ea939ea4 (diff) |
give a name to the anonymous union
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -31,7 +31,7 @@ typedef struct { union { char *str; int num; - }; + } v; int lineno; int colno; } yystype; @@ -77,9 +77,9 @@ void add_param(char *, char *, int); %token TERR -%token <str> TSTRING -%token <num> TNUM -%token <num> TBOOL +%token <v.str> TSTRING +%token <v.num> TNUM +%token <v.num> TBOOL %% @@ -453,20 +453,20 @@ eow: } c = *buf; if (!nonkw && (c == '-' || isdigit(c))) { - yylval.num = parse_portno(buf); + yylval.v.num = parse_portno(buf); return TNUM; } if (!nonkw && !strcmp(buf, "on")) { - yylval.num = 1; + yylval.v.num = 1; return TBOOL; } if (!nonkw && !strcmp(buf, "off")) { - yylval.num = 0; + yylval.v.num = 0; return TBOOL; } if ((str = strdup(buf)) == NULL) err(1, "%s", __func__); - yylval.str = str; + yylval.v.str = str; return TSTRING; eof: |