Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r7cf8006 r1e30df7  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Nov  2 21:31:21 2022
    13 // Update Count     : 5810
     12// Last Modified On : Sat Oct  8 08:21:18 2022
     13// Update Count     : 5709
    1414//
    1515
     
    278278
    279279// Types declaration for productions
    280 
    281280%union {
    282281        Token tok;
     
    291290        CondCtl * ifctl;
    292291        ForCtrl * fctl;
    293         OperKinds compop;
     292        enum OperKinds compop;
    294293        LabelNode * label;
    295294        InitializerNode * in;
     
    297296        std::string * str;
    298297        bool flag;
    299         EnumHiding hide;
    300298        CatchStmt::Kind catch_kind;
    301299        GenericExpr * genexpr;
     
    307305%token TYPEDEF
    308306%token EXTERN STATIC AUTO REGISTER
    309 %token THREADLOCALGCC THREADLOCALC11                                    // GCC, C11
     307%token THREADLOCALGCC THREADLOCALC11                                            // GCC, C11
    310308%token INLINE FORTRAN                                                                   // C99, extension ISO/IEC 9899:1999 Section J.5.9(1)
    311309%token NORETURN                                                                                 // C11
     
    320318%token DECIMAL32 DECIMAL64 DECIMAL128                                   // GCC
    321319%token ZERO_T ONE_T                                                                             // CFA
    322 %token SIZEOF TYPEOF VA_LIST VA_ARG AUTO_TYPE                   // GCC
     320%token SIZEOF TYPEOF VALIST AUTO_TYPE                                   // GCC
    323321%token OFFSETOF BASETYPEOF TYPEID                                               // CFA
    324322%token ENUM STRUCT UNION
     
    366364%type<constant> string_literal
    367365%type<str> string_literal_list
    368 
    369 %type<hide> hide_opt                                    visible_hide_opt
    370366
    371367// expressions
     
    413409// declarations
    414410%type<decl> abstract_declarator abstract_ptr abstract_array abstract_function array_dimension multi_array_dimension
    415 %type<decl> abstract_parameter_declarator_opt abstract_parameter_declarator abstract_parameter_ptr abstract_parameter_array abstract_parameter_function array_parameter_dimension array_parameter_1st_dimension
     411%type<decl> abstract_parameter_declarator abstract_parameter_ptr abstract_parameter_array abstract_parameter_function array_parameter_dimension array_parameter_1st_dimension
    416412%type<decl> abstract_parameter_declaration
    417413
     
    702698        primary_expression
    703699        | postfix_expression '[' assignment_expression ',' tuple_expression_list ']'
    704                 // Historic, transitional: Disallow commas in subscripts.
    705                 // Switching to this behaviour may help check if a C compatibilty case uses comma-exprs in subscripts.
    706                 // Current: Commas in subscripts make tuples.
     700                        // Historic, transitional: Disallow commas in subscripts.
     701                        // Switching to this behaviour may help check if a C compatibilty case uses comma-exprs in subscripts.
     702                        // Current: Commas in subscripts make tuples.
    707703                { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, new ExpressionNode( build_tuple( (ExpressionNode *)($3->set_last( $5 ) ) )) ) ); }
    708704        | postfix_expression '[' assignment_expression ']'
     
    724720        | postfix_expression '(' argument_expression_list_opt ')'
    725721                { $$ = new ExpressionNode( build_func( $1, $3 ) ); }
    726         | VA_ARG '(' primary_expression ',' declaration_specifier_nobody abstract_parameter_declarator_opt ')'
    727                 // { SemanticError( yylloc, "va_arg is currently unimplemented." ); $$ = nullptr; }
    728                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( new string( "__builtin_va_arg") ) ),
    729                                                                                            (ExpressionNode *)($3->set_last( (ExpressionNode *)($6 ? $6->addType( $5 ) : $5) )) ) ); }
    730722        | postfix_expression '`' identifier                                     // CFA, postfix call
    731723                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( build_postfix_name( $3 ) ) ), $1 ) ); }
     
    21642156        | LONG
    21652157                { $$ = DeclarationNode::newLength( DeclarationNode::Long ); }
    2166         | VA_LIST                                                                                       // GCC, __builtin_va_list
     2158        | VALIST                                                                                        // GCC, __builtin_va_list
    21672159                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
    21682160        | AUTO_TYPE
     
    25572549        | ENUM attribute_list_opt identifier
    25582550                { typedefTable.makeTypedef( *$3 ); }
    2559           hide_opt '{' enumerator_list comma_opt '}'
    2560           { $$ = DeclarationNode::newEnum( $3, $7, true, false )->addQualifiers( $2 ); }
     2551          '{' enumerator_list comma_opt '}'
     2552                { $$ = DeclarationNode::newEnum( $3, $6, true, false )->addQualifiers( $2 ); }
    25612553        | ENUM attribute_list_opt typedef_name                          // unqualified type name
    2562           hide_opt '{' enumerator_list comma_opt '}'
    2563                 { $$ = DeclarationNode::newEnum( $3->name, $6, true, false )->addQualifiers( $2 ); }
     2554          '{' enumerator_list comma_opt '}'
     2555                { $$ = DeclarationNode::newEnum( $3->name, $5, true, false )->addQualifiers( $2 ); }
    25642556        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}'
    25652557                {
     
    25782570                        typedefTable.makeTypedef( *$6 );
    25792571                }
    2580           hide_opt '{' enumerator_list comma_opt '}'
    2581                 {
    2582                         $$ = DeclarationNode::newEnum( $6, $11, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 );
     2572          '{' enumerator_list comma_opt '}'
     2573                {
     2574                        $$ = DeclarationNode::newEnum( $6, $10, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 );
    25832575                }
    25842576        | ENUM '(' ')' attribute_list_opt identifier attribute_list_opt
    2585           hide_opt '{' enumerator_list comma_opt '}'
    2586                 {
    2587                         $$ = DeclarationNode::newEnum( $5, $9, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 );
    2588                 }
    2589         | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt typedef_name attribute_list_opt
    2590           hide_opt '{' enumerator_list comma_opt '}'
    2591                 {
    2592                         $$ = DeclarationNode::newEnum( $6->name, $10, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 );
    2593                 }
    2594         | ENUM '(' ')' attribute_list_opt typedef_name attribute_list_opt
    2595           hide_opt '{' enumerator_list comma_opt '}'
    2596                 {
    2597                         $$ = DeclarationNode::newEnum( $5->name, $9, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 );
     2577          '{' enumerator_list comma_opt '}'
     2578                {
     2579                        $$ = DeclarationNode::newEnum( $5, $8, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 );
     2580                }
     2581        | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt typedef_name attribute_list_opt '{' enumerator_list comma_opt '}'
     2582                {
     2583                        $$ = DeclarationNode::newEnum( $6->name, $9, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 );
     2584                }
     2585        | ENUM '(' ')' attribute_list_opt typedef_name attribute_list_opt '{' enumerator_list comma_opt '}'
     2586                {
     2587                        $$ = DeclarationNode::newEnum( $5->name, $8, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 );
    25982588                }
    25992589        | enum_type_nobody
    2600         ;
    2601 
    2602 hide_opt:
    2603         // empty
    2604                 { $$ = EnumHiding::Visible; }
    2605         | '!'
    2606                 { $$ = EnumHiding::Hide; }
    26072590        ;
    26082591
     
    26152598
    26162599enumerator_list:
    2617         visible_hide_opt identifier_or_type_name enumerator_value_opt
    2618                 { $$ = DeclarationNode::newEnumValueGeneric( $2, $3 ); }
     2600        identifier_or_type_name enumerator_value_opt
     2601                { $$ = DeclarationNode::newEnumValueGeneric( $1, $2 ); }
    26192602        | INLINE type_name
    26202603                { $$ = DeclarationNode::newEnumInLine( *$2->type->symbolic.name ); }
    2621         | enumerator_list ',' visible_hide_opt identifier_or_type_name enumerator_value_opt
    2622                 { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( $4, $5 ) ); }
     2604        | enumerator_list ',' identifier_or_type_name enumerator_value_opt
     2605                { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( $3, $4 ) ); }
    26232606        | enumerator_list ',' INLINE type_name enumerator_value_opt
    26242607                { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( new string("inline"), nullptr ) ); }
    2625         ;
    2626 
    2627 visible_hide_opt:
    2628         hide_opt
    2629         | '^'
    2630                 { $$ = EnumHiding::Visible; }
    26312608        ;
    26322609
     
    36993676// functions.
    37003677
    3701 abstract_parameter_declarator_opt:
    3702         // empty
    3703                 { $$ = nullptr; }
    3704         | abstract_parameter_declarator
    3705         ;
    3706 
    37073678abstract_parameter_declarator:
    37083679        abstract_parameter_ptr
Note: See TracChangeset for help on using the changeset viewer.