Changes in / [9f4af04:e72fc60]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r9f4af04 re72fc60  
    763763                // Switching to this behaviour may help check if a C compatibilty case uses comma-exprs in subscripts.
    764764                // Current: Commas in subscripts make tuples.
    765                 { $$ = new ExpressionNode( build_binary_val( yylloc, OperKinds::Index, $1, new ExpressionNode( build_tuple( yylloc, $3->set_last( $5 ) ) ) ) ); }
     765                { $$ = new ExpressionNode( build_binary_val( yylloc, OperKinds::Index, $1, new ExpressionNode( build_tuple( yylloc, (ExpressionNode *)($3->set_last( $5 ) ) )) ) ); }
    766766        | postfix_expression '[' assignment_expression ']'
    767767                // CFA, comma_expression disallowed in this context because it results in a common user error: subscripting a
     
    778778                        Token fn;
    779779                        fn.str = new std::string( "?{}" );                      // location undefined - use location of '{'?
    780                         $$ = new ExpressionNode( new ast::ConstructorExpr( yylloc, build_func( yylloc, new ExpressionNode( build_varref( yylloc, fn ) ), $1->set_last( $3 ) ) ) );
     780                        $$ = new ExpressionNode( new ast::ConstructorExpr( yylloc, build_func( yylloc, new ExpressionNode( build_varref( yylloc, fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) ) );
    781781                }
    782782        | postfix_expression '(' argument_expression_list_opt ')'
     
    784784        | VA_ARG '(' primary_expression ',' declaration_specifier_nobody abstract_parameter_declarator_opt ')'
    785785                // { SemanticError( yylloc, "va_arg is currently unimplemented." ); $$ = nullptr; }
    786                 { $$ = new ExpressionNode( build_func( yylloc, new ExpressionNode( build_varref( yylloc, new string( "__builtin_va_arg" ) ) ),
    787                                                                                            $3->set_last( (ExpressionNode *)($6 ? $6->addType( $5 ) : $5) ) ) ); }
     786                { $$ = new ExpressionNode( build_func( yylloc, new ExpressionNode( build_varref( yylloc, new string( "__builtin_va_arg") ) ),
     787                                                                                           (ExpressionNode *)($3->set_last( (ExpressionNode *)($6 ? $6->addType( $5 ) : $5) )) ) ); }
    788788        | postfix_expression '`' identifier                                     // CFA, postfix call
    789789                { $$ = new ExpressionNode( build_func( yylloc, new ExpressionNode( build_varref( yylloc, build_postfix_name( $3 ) ) ), $1 ) ); }
     
    843843                        Token fn;
    844844                        fn.str = new string( "^?{}" );                          // location undefined
    845                         $$ = new ExpressionNode( build_func( yylloc, new ExpressionNode( build_varref( yylloc, fn ) ), $2->set_last( $4 ) ) );
     845                        $$ = new ExpressionNode( build_func( yylloc, new ExpressionNode( build_varref( yylloc, fn ) ), (ExpressionNode *)( $2 )->set_last( $4 ) ) );
    846846                }
    847847        ;
     
    856856        argument_expression
    857857        | argument_expression_list_opt ',' argument_expression
    858                 { $$ = $1->set_last( $3 ); }
     858                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    859859        ;
    860860
     
    868868field_name_list:                                                                                // CFA, tuple field selector
    869869        field
    870         | field_name_list ',' field                                     { $$ = $1->set_last( $3 ); }
     870        | field_name_list ',' field                                     { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    871871        ;
    872872
     
    11621162//              { $$ = new ExpressionNode( build_tuple( $3 ) ); }
    11631163        '[' ',' tuple_expression_list ']'
    1164                 { $$ = new ExpressionNode( build_tuple( yylloc, (new ExpressionNode( nullptr ))->set_last( $3 ) ) ); }
     1164                { $$ = new ExpressionNode( build_tuple( yylloc, (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $3 ) ) ); }
    11651165        | '[' push assignment_expression pop ',' tuple_expression_list ']'
    1166                 { $$ = new ExpressionNode( build_tuple( yylloc, $3->set_last( $6 ) ) ); }
     1166                { $$ = new ExpressionNode( build_tuple( yylloc, (ExpressionNode *)($3->set_last( $6 ) ) )); }
    11671167        ;
    11681168
     
    11721172                { SemanticError( yylloc, "Eliding tuple element with '@' is currently unimplemented." ); $$ = nullptr; }
    11731173        | tuple_expression_list ',' assignment_expression
    1174                 { $$ = $1->set_last( $3 ); }
     1174                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    11751175        | tuple_expression_list ',' '@'
    11761176                { SemanticError( yylloc, "Eliding tuple element with '@' is currently unimplemented." ); $$ = nullptr; }
     
    13071307                        // therefore, are removed from the grammar even though C allows it. The change also applies to choose
    13081308                        // statement.
    1309                         $$ = $7 ? new StatementNode( build_compound( yylloc, (new StatementNode( $7 ))->set_last( sw ) ) ) : sw;
     1309                        $$ = $7 ? new StatementNode( build_compound( yylloc, (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
    13101310                }
    13111311        | SWITCH '(' comma_expression ')' '{' error '}'         // CFA, invalid syntax rule error
     
    13161316                {
    13171317                        StatementNode *sw = new StatementNode( build_switch( yylloc, false, $3, $8 ) );
    1318                         $$ = $7 ? new StatementNode( build_compound( yylloc, (new StatementNode( $7 ))->set_last( sw ) ) ) : sw;
     1318                        $$ = $7 ? new StatementNode( build_compound( yylloc, (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
    13191319                }
    13201320        | CHOOSE '(' comma_expression ')' '{' error '}'         // CFA, invalid syntax rule
     
    17181718        cast_expression
    17191719        | cast_expression_list ',' cast_expression
     1720                // { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    17201721                { SemanticError( yylloc, "List of mutex member is currently unimplemented." ); $$ = nullptr; }
    17211722        ;
     
    17331734                { $$ = $3; }
    17341735        | WAITFOR '(' cast_expression_list ':' argument_expression_list_opt ')'
    1735                 { $$ = $3->set_last( $5 ); }
     1736                { $$ = (ExpressionNode *)($3->set_last( $5 )); }
    17361737        ;
    17371738
     
    18891890        asm_operand
    18901891        | asm_operands_list ',' asm_operand
    1891                 { $$ = $1->set_last( $3 ); }
     1892                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    18921893        ;
    18931894
     
    19081909                { $$ = $1; }
    19091910        | asm_clobbers_list_opt ',' string_literal
    1910                 { $$ = $1->set_last( $3 ); }
     1911                { $$ = (ExpressionNode *)( $1->set_last( $3 ) ); }
    19111912        ;
    19121913
     
    29742975        | initializer
    29752976        | designation initializer                                       { $$ = $2->set_designators( $1 ); }
    2976         | initializer_list_opt ',' initializer          { $$ = $1->set_last( $3 ); }
    2977         | initializer_list_opt ',' designation initializer { $$ = $1->set_last( $4->set_designators( $3 ) ); }
     2977        | initializer_list_opt ',' initializer          { $$ = (InitializerNode *)( $1->set_last( $3 ) ); }
     2978        | initializer_list_opt ',' designation initializer { $$ = (InitializerNode *)($1->set_last( $4->set_designators( $3 ) )); }
    29782979        ;
    29792980
     
    29972998        designator
    29982999        | designator_list designator
    2999                 { $$ = $1->set_last( $2 ); }
     3000                { $$ = (ExpressionNode *)($1->set_last( $2 )); }
    30003001        //| designator_list designator                                          { $$ = new ExpressionNode( $1, $2 ); }
    30013002        ;
     
    31263127        | assignment_expression
    31273128        | type_list ',' type
    3128                 { $$ = $1->set_last( new ExpressionNode( new ast::TypeExpr( yylloc, maybeMoveBuildType( $3 ) ) ) ); }
     3129                { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new ast::TypeExpr( yylloc, maybeMoveBuildType( $3 ) ) ) )); }
    31293130        | type_list ',' assignment_expression
    3130                 { $$ = $1->set_last( $3 ); }
     3131                { $$ = (ExpressionNode *)( $1->set_last( $3 )); }
    31313132        ;
    31323133
     
    39653966        | assignment_expression upupeq assignment_expression
    39663967        | array_type_list ',' basic_type_name
    3967                 { $$ = $1->set_last( new ExpressionNode( new ast::TypeExpr( yylloc, maybeMoveBuildType( $3 ) ) ) ); }
     3968                { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new ast::TypeExpr( yylloc, maybeMoveBuildType( $3 ) ) ) )); }
    39683969        | array_type_list ',' type_name
    3969                 { $$ = $1->set_last( new ExpressionNode( new ast::TypeExpr( yylloc, maybeMoveBuildType( $3 ) ) ) ); }
     3970                { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new ast::TypeExpr( yylloc, maybeMoveBuildType( $3 ) ) ) )); }
    39703971        | array_type_list ',' assignment_expression upupeq assignment_expression
    39713972        ;
Note: See TracChangeset for help on using the changeset viewer.