Change typealias separator from ":" to ":="
[babeltrace.git] / formats / ctf / metadata / ctf-parser.y
index fcc877ba7abacea65ef199f16b593a85bd119ec9..ad23ac64c8230e0ce88a639dd9081452c3963d1b 100644 (file)
@@ -1010,7 +1010,6 @@ postfix_expression:
                        $$->u.unary_expression.type = UNARY_STRING;
                        $$->u.unary_expression.u.string = yylval.gs->s;
                }
-
        |       DECIMAL_CONSTANT
                {
                        $$ = make_node(scanner, NODE_UNARY_EXPRESSION);
@@ -1178,7 +1177,7 @@ declaration:
                        _cds_list_splice_tail(&($1)->u.type_specifier_list.head, &list->u.type_specifier_list.head);
                        _cds_list_splice_tail(&($3)->tmp_head, &($$)->u._typedef.type_declarators);
                }
-       |       TYPEALIAS declaration_specifiers abstract_declarator_list COLON alias_declaration_specifiers alias_abstract_declarator_list SEMICOLON
+       |       TYPEALIAS declaration_specifiers abstract_declarator_list TYPEASSIGN alias_declaration_specifiers alias_abstract_declarator_list SEMICOLON
                {
                        struct ctf_node *list;
 
@@ -1433,14 +1432,12 @@ type_specifier:
                        $$ = make_node(scanner, NODE_TYPE_SPECIFIER);
                        $$->u.type_specifier.type = TYPESPEC_VARIANT;
                        $$->u.type_specifier.node = $2;
-                       $$ = $2;
                }
        |       STRUCT struct_type_specifier
                {
                        $$ = make_node(scanner, NODE_TYPE_SPECIFIER);
                        $$->u.type_specifier.type = TYPESPEC_STRUCT;
                        $$->u.type_specifier.node = $2;
-                       $$ = $2;
                }
        ;
 
@@ -1449,7 +1446,7 @@ struct_type_specifier:
                {
                        $$ = make_node(scanner, NODE_STRUCT);
                        $$->u._struct.has_body = 1;
-                       if (set_parent_node($2, $$))
+                       if ($2 && set_parent_node($2, $$))
                                reparent_error(scanner, "struct reparent error");
                }
        |       IDENTIFIER struct_declaration_begin struct_or_variant_declaration_list struct_declaration_end
@@ -1457,7 +1454,7 @@ struct_type_specifier:
                        $$ = make_node(scanner, NODE_STRUCT);
                        $$->u._struct.has_body = 1;
                        $$->u._struct.name = $1->s;
-                       if (set_parent_node($3, $$))
+                       if ($3 && set_parent_node($3, $$))
                                reparent_error(scanner, "struct reparent error");
                }
        |       ID_TYPE struct_declaration_begin struct_or_variant_declaration_list struct_declaration_end
@@ -1465,7 +1462,7 @@ struct_type_specifier:
                        $$ = make_node(scanner, NODE_STRUCT);
                        $$->u._struct.has_body = 1;
                        $$->u._struct.name = $1->s;
-                       if (set_parent_node($3, $$))
+                       if ($3 && set_parent_node($3, $$))
                                reparent_error(scanner, "struct reparent error");
                }
        |       IDENTIFIER
@@ -1497,7 +1494,7 @@ variant_type_specifier:
                {
                        $$ = make_node(scanner, NODE_VARIANT);
                        $$->u.variant.has_body = 1;
-                       if (set_parent_node($2, $$))
+                       if ($2 && set_parent_node($2, $$))
                                reparent_error(scanner, "variant reparent error");
                }
        |       LT IDENTIFIER GT variant_declaration_begin struct_or_variant_declaration_list variant_declaration_end
@@ -1505,7 +1502,7 @@ variant_type_specifier:
                        $$ = make_node(scanner, NODE_VARIANT);
                        $$->u.variant.has_body = 1;
                        $$->u.variant.choice = $2->s;
-                       if (set_parent_node($5, $$))
+                       if ($5 && set_parent_node($5, $$))
                                reparent_error(scanner, "variant reparent error");
                }
        |       LT ID_TYPE GT variant_declaration_begin struct_or_variant_declaration_list variant_declaration_end
@@ -1513,7 +1510,7 @@ variant_type_specifier:
                        $$ = make_node(scanner, NODE_VARIANT);
                        $$->u.variant.has_body = 1;
                        $$->u.variant.choice = $2->s;
-                       if (set_parent_node($5, $$))
+                       if ($5 && set_parent_node($5, $$))
                                reparent_error(scanner, "variant reparent error");
                }
        |       IDENTIFIER variant_declaration_begin struct_or_variant_declaration_list variant_declaration_end
@@ -1521,7 +1518,7 @@ variant_type_specifier:
                        $$ = make_node(scanner, NODE_VARIANT);
                        $$->u.variant.has_body = 1;
                        $$->u.variant.name = $1->s;
-                       if (set_parent_node($3, $$))
+                       if ($3 && set_parent_node($3, $$))
                                reparent_error(scanner, "variant reparent error");
                }
        |       IDENTIFIER LT IDENTIFIER GT variant_declaration_begin struct_or_variant_declaration_list variant_declaration_end
@@ -1530,7 +1527,7 @@ variant_type_specifier:
                        $$->u.variant.has_body = 1;
                        $$->u.variant.name = $1->s;
                        $$->u.variant.choice = $3->s;
-                       if (set_parent_node($6, $$))
+                       if ($6 && set_parent_node($6, $$))
                                reparent_error(scanner, "variant reparent error");
                }
        |       IDENTIFIER LT IDENTIFIER GT
@@ -1546,7 +1543,7 @@ variant_type_specifier:
                        $$->u.variant.has_body = 1;
                        $$->u.variant.name = $1->s;
                        $$->u.variant.choice = $3->s;
-                       if (set_parent_node($6, $$))
+                       if ($6 && set_parent_node($6, $$))
                                reparent_error(scanner, "variant reparent error");
                }
        |       IDENTIFIER LT ID_TYPE GT
@@ -1561,7 +1558,7 @@ variant_type_specifier:
                        $$ = make_node(scanner, NODE_VARIANT);
                        $$->u.variant.has_body = 1;
                        $$->u.variant.name = $1->s;
-                       if (set_parent_node($3, $$))
+                       if ($3 && set_parent_node($3, $$))
                                reparent_error(scanner, "variant reparent error");
                }
        |       ID_TYPE LT IDENTIFIER GT variant_declaration_begin struct_or_variant_declaration_list variant_declaration_end
@@ -1570,7 +1567,7 @@ variant_type_specifier:
                        $$->u.variant.has_body = 1;
                        $$->u.variant.name = $1->s;
                        $$->u.variant.choice = $3->s;
-                       if (set_parent_node($6, $$))
+                       if ($6 && set_parent_node($6, $$))
                                reparent_error(scanner, "variant reparent error");
                }
        |       ID_TYPE LT IDENTIFIER GT
@@ -1586,7 +1583,7 @@ variant_type_specifier:
                        $$->u.variant.has_body = 1;
                        $$->u.variant.name = $1->s;
                        $$->u.variant.choice = $3->s;
-                       if (set_parent_node($6, $$))
+                       if ($6 && set_parent_node($6, $$))
                                reparent_error(scanner, "variant reparent error");
                }
        |       ID_TYPE LT ID_TYPE GT
@@ -1806,7 +1803,7 @@ struct_or_variant_declaration:
                        ($$)->u.struct_or_variant_declaration.type_specifier_list = list;
                        _cds_list_splice_tail(&($3)->tmp_head, &($$)->u._typedef.type_declarators);
                }
-       |       TYPEALIAS declaration_specifiers abstract_declarator_list COLON alias_declaration_specifiers alias_abstract_declarator_list SEMICOLON
+       |       TYPEALIAS declaration_specifiers abstract_declarator_list TYPEASSIGN alias_declaration_specifiers alias_abstract_declarator_list SEMICOLON
                {
                        struct ctf_node *list;
 
@@ -2191,9 +2188,8 @@ ctf_assignment_expression:
                                reparent_error(scanner, "ctf_assignment_expression left expects string");
                        _cds_list_splice_tail(&($3)->tmp_head, &($$)->u.ctf_expression.right);
                }
-       |       unary_expression TYPEASSIGN type_specifier      /* Only allow struct */
+       |       unary_expression TYPEASSIGN declaration_specifiers      /* Only allow struct */
                {
-                       struct ctf_node *list;
                        /*
                         * Because we have left and right, cannot use
                         * set_parent_node.
@@ -2202,9 +2198,7 @@ ctf_assignment_expression:
                        _cds_list_splice_tail(&($1)->tmp_head, &($$)->u.ctf_expression.left);
                        if ($1->u.unary_expression.type != UNARY_STRING)
                                reparent_error(scanner, "ctf_assignment_expression left expects string");
-                       list = make_node(scanner, NODE_TYPE_SPECIFIER_LIST);
-                       cds_list_add_tail(&($3)->siblings, &list->u.type_specifier_list.head);
-                       cds_list_add_tail(&list->siblings, &($$)->u.ctf_expression.right);
+                       cds_list_add_tail(&($3)->siblings, &($$)->u.ctf_expression.right);
                }
        |       declaration_specifiers TYPEDEF declaration_specifiers type_declarator_list
                {
@@ -2237,7 +2231,7 @@ ctf_assignment_expression:
                        ($$)->u.struct_or_variant_declaration.type_specifier_list = list;
                        _cds_list_splice_tail(&($3)->tmp_head, &($$)->u._typedef.type_declarators);
                }
-       |       TYPEALIAS declaration_specifiers abstract_declarator_list COLON alias_declaration_specifiers alias_abstract_declarator_list
+       |       TYPEALIAS declaration_specifiers abstract_declarator_list TYPEASSIGN alias_declaration_specifiers alias_abstract_declarator_list
                {
                        struct ctf_node *list;
 
This page took 0.02705 seconds and 4 git commands to generate.