Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rb048dc3 r2f0a0678  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu May 24 18:11:59 2018
    13 // Update Count     : 3369
     12// Last Modified On : Tue May 22 08:41:57 2018
     13// Update Count     : 3353
    1414//
    1515
     
    837837//      '[' push assignment_expression pop ']'
    838838//              { $$ = new ExpressionNode( build_tuple( $3 ) ); }
    839         '[' push ',' tuple_expression_list pop ']'
    840                 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $4 ) ) ); }
    841         | '[' push assignment_expression ',' tuple_expression_list pop ']'
    842                 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)$3->set_last( $5 ) ) ); }
     839        '[' ',' tuple_expression_list ']'
     840                { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $3 ) ) ); }
     841        | '[' assignment_expression ',' tuple_expression_list ']'
     842                { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)$2->set_last( $4 ) ) ); }
    843843        ;
    844844
     
    866866        labeled_statement
    867867        | compound_statement
    868         | expression_statement
     868        | expression_statement                                          { $$ = $1; }
    869869        | selection_statement
    870870        | iteration_statement
     
    11831183        type_specifier_nobody
    11841184        | type_specifier_nobody declarator
    1185                 { $$ = $2->addType( $1 ); }
     1185                {
     1186                        $$ = $2->addType( $1 );
     1187                }
    11861188        | type_specifier_nobody variable_abstract_declarator
    11871189                { $$ = $2->addType( $1 ); }
    11881190        | cfa_abstract_declarator_tuple no_attr_identifier      // CFA
    1189                 { $$ = $1->addName( $2 ); }
     1191                {
     1192                        $$ = $1->addName( $2 );
     1193                }
    11901194        | cfa_abstract_declarator_tuple                                         // CFA
    11911195        ;
     
    12651269
    12661270declaration_list_opt:                                                                   // used at beginning of switch statement
    1267         pop     // empty
     1271        pop
    12681272                { $$ = nullptr; }
    12691273        | declaration_list
     
    13001304
    13011305local_label_list:                                                                               // GCC, local label
    1302         no_attr_identifier_or_type_name
    1303         | local_label_list ',' no_attr_identifier_or_type_name
     1306        no_attr_identifier_or_type_name                         {}
     1307        | local_label_list ',' no_attr_identifier_or_type_name {}
    13041308        ;
    13051309
     
    13961400                // type_specifier can resolve to just TYPEDEFname (e.g., typedef int T; int f( T );). Therefore this must be
    13971401                // flattened to allow lookahead to the '(' without having to reduce identifier_or_type_name.
    1398         cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')'
     1402        cfa_abstract_tuple identifier_or_type_name '(' cfa_parameter_type_list_opt ')'
    13991403                // To obtain LR(1 ), this rule must be factored out from function return type (see cfa_abstract_declarator).
    1400                 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); }
    1401         | cfa_function_return identifier_or_type_name '(' push cfa_parameter_type_list_opt pop ')'
    1402                 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); }
     1404                { $$ = DeclarationNode::newFunction( $2, $1, $4, 0 ); }
     1405        | cfa_function_return identifier_or_type_name '(' cfa_parameter_type_list_opt ')'
     1406                { $$ = DeclarationNode::newFunction( $2, $1, $4, 0 ); }
    14031407        ;
    14041408
    14051409cfa_function_return:                                                                    // CFA
    1406         '[' push cfa_parameter_list pop ']'
    1407                 { $$ = DeclarationNode::newTuple( $3 ); }
    1408         | '[' push cfa_parameter_list pop ',' push cfa_abstract_parameter_list pop ']'
    1409                 // To obtain LR(1 ), the last cfa_abstract_parameter_list is added into this flattened rule to lookahead to the ']'.
    1410                 { $$ = DeclarationNode::newTuple( $3->appendList( $7 ) ); }
     1410        '[' cfa_parameter_list ']'
     1411                { $$ = DeclarationNode::newTuple( $2 ); }
     1412        | '[' cfa_parameter_list ',' cfa_abstract_parameter_list ']'
     1413                // To obtain LR(1 ), the last cfa_abstract_parameter_list is added into this flattened rule to lookahead to the
     1414                // ']'.
     1415                { $$ = DeclarationNode::newTuple( $2->appendList( $4 ) ); }
    14111416        ;
    14121417
     
    15821587
    15831588forall:
    1584         FORALL '(' push type_parameter_list pop ')'                                     // CFA
    1585                 { $$ = DeclarationNode::newForall( $4 ); }
     1589        FORALL '('
     1590                {
     1591                        typedefTable.enterScope();
     1592                }
     1593          type_parameter_list ')'                                                       // CFA
     1594                {
     1595                        typedefTable.leaveScope();
     1596                        $$ = DeclarationNode::newForall( $4 );
     1597                }
    15861598        ;
    15871599
     
    19581970        | cfa_abstract_parameter_list
    19591971        | cfa_parameter_list
    1960         | cfa_parameter_list pop ',' push cfa_abstract_parameter_list
    1961                 { $$ = $1->appendList( $5 ); }
    1962         | cfa_abstract_parameter_list pop ',' push ELLIPSIS
     1972        | cfa_parameter_list ',' cfa_abstract_parameter_list
     1973                { $$ = $1->appendList( $3 ); }
     1974        | cfa_abstract_parameter_list ',' ELLIPSIS
    19631975                { $$ = $1->addVarArgs(); }
    1964         | cfa_parameter_list pop ',' push ELLIPSIS
     1976        | cfa_parameter_list ',' ELLIPSIS
    19651977                { $$ = $1->addVarArgs(); }
    19661978        ;
     
    19701982                // factored out from cfa_parameter_list, flattening the rules to get lookahead to the ']'.
    19711983        cfa_parameter_declaration
    1972         | cfa_abstract_parameter_list pop ',' push cfa_parameter_declaration
    1973                 { $$ = $1->appendList( $5 ); }
    1974         | cfa_parameter_list pop ',' push cfa_parameter_declaration
    1975                 { $$ = $1->appendList( $5 ); }
    1976         | cfa_parameter_list pop ',' push cfa_abstract_parameter_list pop ',' push cfa_parameter_declaration
    1977                 { $$ = $1->appendList( $5 )->appendList( $9 ); }
     1984        | cfa_abstract_parameter_list ',' cfa_parameter_declaration
     1985                { $$ = $1->appendList( $3 ); }
     1986        | cfa_parameter_list ',' cfa_parameter_declaration
     1987                { $$ = $1->appendList( $3 ); }
     1988        | cfa_parameter_list ',' cfa_abstract_parameter_list ',' cfa_parameter_declaration
     1989                { $$ = $1->appendList( $3 )->appendList( $5 ); }
    19781990        ;
    19791991
    19801992cfa_abstract_parameter_list:                                                    // CFA, new & old style abstract
    19811993        cfa_abstract_parameter_declaration
    1982         | cfa_abstract_parameter_list pop ',' push cfa_abstract_parameter_declaration
    1983                 { $$ = $1->appendList( $5 ); }
     1994        | cfa_abstract_parameter_list ',' cfa_abstract_parameter_declaration
     1995                { $$ = $1->appendList( $3 ); }
    19841996        ;
    19851997
     
    21302142        '.' no_attr_identifier                                                          // C99, field name
    21312143                { $$ = new ExpressionNode( build_varref( $2 ) ); }
    2132         | '[' push assignment_expression pop ']'                        // C99, single array element
     2144        | '[' assignment_expression ']'                                         // C99, single array element
    21332145                // assignment_expression used instead of constant_expression because of shift/reduce conflicts with tuple.
     2146                { $$ = $2; }
     2147        | '[' subrange ']'                                                                      // CFA, multiple array elements
     2148                { $$ = $2; }
     2149        | '[' constant_expression ELLIPSIS constant_expression ']' // GCC, multiple array elements
     2150                { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $2 ), maybeMoveBuild< Expression >( $4 ) ) ); }
     2151        | '.' '[' field_list ']'                                                        // CFA, tuple field selector
    21342152                { $$ = $3; }
    2135         | '[' push subrange pop ']'                                                     // CFA, multiple array elements
    2136                 { $$ = $3; }
    2137         | '[' push constant_expression ELLIPSIS constant_expression pop ']' // GCC, multiple array elements
    2138                 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $3 ), maybeMoveBuild< Expression >( $5 ) ) ); }
    2139         | '.' '[' push field_list pop ']'                                       // CFA, tuple field selector
    2140                 { $$ = $4; }
    21412153        ;
    21422154
     
    22572269        TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}'
    22582270                { $$ = DeclarationNode::newTrait( $2, $5, 0 ); }
    2259         | TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' push trait_declaration_list '}'
     2271        | TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{'
     2272                { typedefTable.enterScope(); }
     2273          trait_declaration_list '}'
    22602274                { $$ = DeclarationNode::newTrait( $2, $5, $10 ); }
    22612275        ;
     
    22742288cfa_trait_declaring_list:                                                               // CFA
    22752289        cfa_variable_specifier
     2290                { $$ = $1; }
    22762291        | cfa_function_specifier
     2292                { $$ = $1; }
    22772293        | cfa_trait_declaring_list pop ',' push identifier_or_type_name
    22782294                { $$ = $1->appendList( $1->cloneType( $5 ) ); }
     
    23332349                }
    23342350        | type_qualifier_list
    2335                 { if ( $1->type->forall ) xxx = forall = true; } // remember generic type
     2351                {
     2352                        if ( $1->type->forall ) xxx = forall = true; // remember generic type
     2353                }
    23362354          push '{' external_definition_list '}'                         // CFA, namespace
    23372355                {
     
    23462364                }
    23472365        | declaration_qualifier_list
    2348                 { if ( $1->type->forall ) xxx = forall = true; } // remember generic type
     2366                {
     2367                        if ( $1->type->forall ) xxx = forall = true; // remember generic type
     2368                }
    23492369          push '{' external_definition_list '}'                         // CFA, namespace
    23502370                {
     
    23862406                // declaration must still have a type_specifier.  OBSOLESCENT (see 1)
    23872407        | function_declarator compound_statement
    2388                 { $$ = $1->addFunctionBody( $2 ); }
     2408                {
     2409                        typedefTable.leaveScope();
     2410                        $$ = $1->addFunctionBody( $2 );
     2411                }
    23892412        | KR_function_declarator KR_declaration_list_opt compound_statement
    2390                 { $$ = $1->addOldDeclList( $2 )->addFunctionBody( $3 ); }
     2413                {
     2414                        typedefTable.leaveScope();
     2415                        $$ = $1->addOldDeclList( $2 )->addFunctionBody( $3 );
     2416                }
    23912417        ;
    23922418
     
    24012427        cfa_function_declaration with_clause_opt compound_statement     // CFA
    24022428                {
     2429                        typedefTable.leaveScope();
    24032430                        // Add the function body to the last identifier in the function definition list, i.e., foo3:
    24042431                        //   [const double] foo1(), foo2( int ), foo3( double ) { return 3.0; }
     
    24092436                {
    24102437                        rebindForall( $1, $2 );
     2438                        typedefTable.leaveScope();
    24112439                        $$ = $2->addFunctionBody( $4, $3 )->addType( $1 );
    24122440                }
     
    24142442                {
    24152443                        rebindForall( $1, $2 );
     2444                        typedefTable.leaveScope();
    24162445                        $$ = $2->addFunctionBody( $4, $3 )->addType( $1 );
    24172446                }
    24182447                // handles default int return type, OBSOLESCENT (see 1)
    24192448        | type_qualifier_list function_declarator with_clause_opt compound_statement
    2420                 { $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 ); }
     2449                {
     2450                        typedefTable.leaveScope();
     2451                        $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 );
     2452                }
    24212453                // handles default int return type, OBSOLESCENT (see 1)
    24222454        | declaration_qualifier_list function_declarator with_clause_opt compound_statement
    2423                 { $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 ); }
     2455                {
     2456                        typedefTable.leaveScope();
     2457                        $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 );
     2458                }
    24242459                // handles default int return type, OBSOLESCENT (see 1)
    24252460        | declaration_qualifier_list type_qualifier_list function_declarator with_clause_opt compound_statement
    2426                 { $$ = $3->addFunctionBody( $5, $4 )->addQualifiers( $2 )->addQualifiers( $1 ); }
     2461                {
     2462                        typedefTable.leaveScope();
     2463                        $$ = $3->addFunctionBody( $5, $4 )->addQualifiers( $2 )->addQualifiers( $1 );
     2464                }
    24272465
    24282466                // Old-style K&R function definition, OBSOLESCENT (see 4)
     
    24302468                {
    24312469                        rebindForall( $1, $2 );
     2470                        typedefTable.leaveScope();
    24322471                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addType( $1 );
    24332472                }
    24342473                // handles default int return type, OBSOLESCENT (see 1)
    24352474        | type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    2436                 { $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 ); }
     2475                {
     2476                        typedefTable.leaveScope();
     2477                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 );
     2478                }
    24372479                // handles default int return type, OBSOLESCENT (see 1)
    24382480        | declaration_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    2439                 { $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 ); }
     2481                {
     2482                        typedefTable.leaveScope();
     2483                        $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 );
     2484                }
    24402485                // handles default int return type, OBSOLESCENT (see 1)
    24412486        | declaration_qualifier_list type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement
    2442                 { $$ = $3->addOldDeclList( $4 )->addFunctionBody( $6, $5 )->addQualifiers( $2 )->addQualifiers( $1 ); }
     2487                {
     2488                        typedefTable.leaveScope();
     2489                        $$ = $3->addOldDeclList( $4 )->addFunctionBody( $6, $5 )->addQualifiers( $2 )->addQualifiers( $1 );
     2490                }
    24432491        ;
    24442492
     
    26372685        paren_identifier '(' identifier_list ')'                        // function_declarator handles empty parameter
    26382686                { $$ = $1->addIdList( $3 ); }
    2639         | '(' KR_function_ptr ')' '(' push parameter_type_list_opt pop ')'
    2640                 { $$ = $2->addParamList( $6 ); }
     2687        | '(' KR_function_ptr ')' '(' parameter_type_list_opt ')'
     2688                { $$ = $2->addParamList( $5 ); }
    26412689        | '(' KR_function_no_ptr ')'                                            // redundant parenthesis
    26422690                { $$ = $2; }
     
    27562804
    27572805identifier_parameter_function:
    2758         paren_identifier '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
    2759                 { $$ = $1->addParamList( $4 ); }
    2760         | '(' identifier_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
    2761                 { $$ = $2->addParamList( $6 ); }
     2806        paren_identifier '(' parameter_type_list_opt ')'        // empty parameter list OBSOLESCENT (see 3)
     2807                { $$ = $1->addParamList( $3 ); }
     2808        | '(' identifier_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
     2809                { $$ = $2->addParamList( $5 ); }
    27622810        | '(' identifier_parameter_function ')'                         // redundant parenthesis
    27632811                { $$ = $2; }
     
    28092857
    28102858type_parameter_function:
    2811         typedef '(' push parameter_type_list_opt pop ')'        // empty parameter list OBSOLESCENT (see 3)
    2812                 { $$ = $1->addParamList( $4 ); }
    2813         | '(' type_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
    2814                 { $$ = $2->addParamList( $6 ); }
     2859        typedef '(' parameter_type_list_opt ')'                         // empty parameter list OBSOLESCENT (see 3)
     2860                { $$ = $1->addParamList( $3 ); }
     2861        | '(' type_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
     2862                { $$ = $2->addParamList( $5 ); }
    28152863        ;
    28162864
     
    28592907
    28602908abstract_function:
    2861         '(' push parameter_type_list_opt pop ')'                        // empty parameter list OBSOLESCENT (see 3)
    2862                 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); }
    2863         | '(' abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
    2864                 { $$ = $2->addParamList( $6 ); }
     2909        '(' parameter_type_list_opt ')'                                         // empty parameter list OBSOLESCENT (see 3)
     2910                { $$ = DeclarationNode::newFunction( nullptr, nullptr, $2, nullptr ); }
     2911        | '(' abstract_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
     2912                { $$ = $2->addParamList( $5 ); }
    28652913        | '(' abstract_function ')'                                                     // redundant parenthesis
    28662914                { $$ = $2; }
     
    28772925
    28782926multi_array_dimension:
    2879         '[' push assignment_expression pop ']'
    2880                 { $$ = DeclarationNode::newArray( $3, 0, false ); }
    2881         | '[' push '*' pop ']'                                                          // C99
     2927        '[' assignment_expression ']'
     2928                { $$ = DeclarationNode::newArray( $2, 0, false ); }
     2929        | '[' '*' ']'                                                                           // C99
    28822930                { $$ = DeclarationNode::newVarArray( 0 ); }
    2883         | multi_array_dimension '[' push assignment_expression pop ']'
    2884                 { $$ = $1->addArray( DeclarationNode::newArray( $4, 0, false ) ); }
    2885         | multi_array_dimension '[' push '*' pop ']'            // C99
     2931        | multi_array_dimension '[' assignment_expression ']'
     2932                { $$ = $1->addArray( DeclarationNode::newArray( $3, 0, false ) ); }
     2933        | multi_array_dimension '[' '*' ']'                                     // C99
    28862934                { $$ = $1->addArray( DeclarationNode::newVarArray( 0 ) ); }
    28872935        ;
     
    29502998
    29512999abstract_parameter_function:
    2952         '(' push parameter_type_list_opt pop ')'                        // empty parameter list OBSOLESCENT (see 3)
    2953                 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); }
    2954         | '(' abstract_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
    2955                 { $$ = $2->addParamList( $6 ); }
     3000        '(' parameter_type_list_opt ')'                                         // empty parameter list OBSOLESCENT (see 3)
     3001                { $$ = DeclarationNode::newFunction( nullptr, nullptr, $2, nullptr ); }
     3002        | '(' abstract_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
     3003                { $$ = $2->addParamList( $5 ); }
    29563004        | '(' abstract_parameter_function ')'                           // redundant parenthesis
    29573005                { $$ = $2; }
     
    29753023                { $$ = DeclarationNode::newArray( 0, 0, false ); }
    29763024        // multi_array_dimension handles the '[' '*' ']' case
    2977         | '[' push type_qualifier_list '*' pop ']'                      // remaining C99
    2978                 { $$ = DeclarationNode::newVarArray( $3 ); }
    2979         | '[' push type_qualifier_list pop ']'
    2980                 { $$ = DeclarationNode::newArray( 0, $3, false ); }
     3025        | '[' type_qualifier_list '*' ']'                                       // remaining C99
     3026                { $$ = DeclarationNode::newVarArray( $2 ); }
     3027        | '[' type_qualifier_list ']'
     3028                { $$ = DeclarationNode::newArray( 0, $2, false ); }
    29813029        // multi_array_dimension handles the '[' assignment_expression ']' case
    2982         | '[' push type_qualifier_list assignment_expression pop ']'
    2983                 { $$ = DeclarationNode::newArray( $4, $3, false ); }
    2984         | '[' push STATIC type_qualifier_list_opt assignment_expression pop ']'
    2985                 { $$ = DeclarationNode::newArray( $5, $4, true ); }
    2986         | '[' push type_qualifier_list STATIC assignment_expression pop ']'
    2987                 { $$ = DeclarationNode::newArray( $5, $3, true ); }
     3030        | '[' type_qualifier_list assignment_expression ']'
     3031                { $$ = DeclarationNode::newArray( $3, $2, false ); }
     3032        | '[' STATIC type_qualifier_list_opt assignment_expression ']'
     3033                { $$ = DeclarationNode::newArray( $4, $3, true ); }
     3034        | '[' type_qualifier_list STATIC assignment_expression ']'
     3035                { $$ = DeclarationNode::newArray( $4, $2, true ); }
    29883036        ;
    29893037
     
    30293077
    30303078variable_abstract_function:
    3031         '(' variable_abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3)
    3032                 { $$ = $2->addParamList( $6 ); }
     3079        '(' variable_abstract_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3)
     3080                { $$ = $2->addParamList( $5 ); }
    30333081        | '(' variable_abstract_function ')'                            // redundant parenthesis
    30343082                { $$ = $2; }
     
    30933141
    30943142cfa_array_parameter_1st_dimension:
    3095         '[' push type_qualifier_list '*' pop ']'                        // remaining C99
    3096                 { $$ = DeclarationNode::newVarArray( $3 ); }
    3097         | '[' push type_qualifier_list assignment_expression pop ']'
    3098                 { $$ = DeclarationNode::newArray( $4, $3, false ); }
    3099         | '[' push declaration_qualifier_list assignment_expression pop ']'
     3143        '[' type_qualifier_list '*' ']'                                         // remaining C99
     3144                { $$ = DeclarationNode::newVarArray( $2 ); }
     3145        | '[' type_qualifier_list assignment_expression ']'
     3146                { $$ = DeclarationNode::newArray( $3, $2, false ); }
     3147        | '[' declaration_qualifier_list assignment_expression ']'
    31003148                // declaration_qualifier_list must be used because of shift/reduce conflict with
    31013149                // assignment_expression, so a semantic check is necessary to preclude them as a type_qualifier cannot
    31023150                // appear in this context.
    3103                 { $$ = DeclarationNode::newArray( $4, $3, true ); }
    3104         | '[' push declaration_qualifier_list type_qualifier_list assignment_expression pop ']'
    3105                 { $$ = DeclarationNode::newArray( $5, $4->addQualifiers( $3 ), true ); }
     3151                { $$ = DeclarationNode::newArray( $3, $2, true ); }
     3152        | '[' declaration_qualifier_list type_qualifier_list assignment_expression ']'
     3153                { $$ = DeclarationNode::newArray( $4, $3->addQualifiers( $3 ), true ); }
    31063154        ;
    31073155
     
    31723220
    31733221cfa_abstract_tuple:                                                                             // CFA
    3174         '[' push cfa_abstract_parameter_list pop ']'
    3175                 { $$ = DeclarationNode::newTuple( $3 ); }
     3222        '[' cfa_abstract_parameter_list ']'
     3223                { $$ = DeclarationNode::newTuple( $2 ); }
    31763224        ;
    31773225
     
    31793227//      '[' ']' '(' cfa_parameter_type_list_opt ')'
    31803228//              { $$ = DeclarationNode::newFunction( nullptr, DeclarationNode::newTuple( nullptr ), $4, nullptr ); }
    3181         cfa_abstract_tuple '(' push cfa_parameter_type_list_opt pop ')'
    3182                 { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); }
    3183         | cfa_function_return '(' push cfa_parameter_type_list_opt pop ')'
    3184                 { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); }
     3229        cfa_abstract_tuple '(' cfa_parameter_type_list_opt ')'
     3230                { $$ = DeclarationNode::newFunction( nullptr, $1, $3, nullptr ); }
     3231        | cfa_function_return '(' cfa_parameter_type_list_opt ')'
     3232                { $$ = DeclarationNode::newFunction( nullptr, $1, $3, nullptr ); }
    31853233        ;
    31863234
Note: See TracChangeset for help on using the changeset viewer.