aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-06-29 11:11:43 +0000
committerOmar Polo <op@omarpolo.com>2021-06-29 11:11:43 +0000
commit8235a81c8f7f58eaa08655147963936a2290f691 (patch)
tree408448624498f318957cc45eb8a58cd407872d79
parent0be2a537e6e2b336a6e46cd1f5a13663ea939ea4 (diff)
give a name to the anonymous union
-rw-r--r--parse.y16
1 files changed, 8 insertions, 8 deletions
diff --git a/parse.y b/parse.y
index 0f17cb2..257744d 100644
--- a/parse.y
+++ b/parse.y
@@ -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: