implemented union parsing
This commit is contained in:
parent
664affc6d3
commit
d6d2230f14
3 changed files with 19 additions and 1 deletions
10
parser.c
10
parser.c
|
|
@ -684,6 +684,10 @@ static member *parse_member(parser *p)
|
|||
if (match(p, TOKEN_STRUCT)) {
|
||||
type = parse_struct(p);
|
||||
}
|
||||
if (match(p, TOKEN_UNION)) {
|
||||
type = parse_struct(p);
|
||||
type->type = NODE_UNION;
|
||||
}
|
||||
if (!type) {
|
||||
type = parse_factor(p);
|
||||
if (!type) {
|
||||
|
|
@ -899,6 +903,12 @@ static ast_node *parse_statement(parser *p)
|
|||
{
|
||||
return parse_struct(p);
|
||||
}
|
||||
else if (match(p, TOKEN_UNION))
|
||||
{
|
||||
ast_node *u = parse_struct(p);
|
||||
u->type = NODE_UNION;
|
||||
return u;
|
||||
}
|
||||
else
|
||||
{
|
||||
ast_node *expr = parse_expression(p);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue