Changes in / [9f4af04:e72fc60]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r9f4af04 re72fc60 763 763 // Switching to this behaviour may help check if a C compatibilty case uses comma-exprs in subscripts. 764 764 // 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 ) ) )) ) ); } 766 766 | postfix_expression '[' assignment_expression ']' 767 767 // CFA, comma_expression disallowed in this context because it results in a common user error: subscripting a … … 778 778 Token fn; 779 779 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 ) ) ) ); 781 781 } 782 782 | postfix_expression '(' argument_expression_list_opt ')' … … 784 784 | VA_ARG '(' primary_expression ',' declaration_specifier_nobody abstract_parameter_declarator_opt ')' 785 785 // { 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) )) ) ); } 788 788 | postfix_expression '`' identifier // CFA, postfix call 789 789 { $$ = new ExpressionNode( build_func( yylloc, new ExpressionNode( build_varref( yylloc, build_postfix_name( $3 ) ) ), $1 ) ); } … … 843 843 Token fn; 844 844 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 ) ) ); 846 846 } 847 847 ; … … 856 856 argument_expression 857 857 | argument_expression_list_opt ',' argument_expression 858 { $$ = $1->set_last( $3); }858 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 859 859 ; 860 860 … … 868 868 field_name_list: // CFA, tuple field selector 869 869 field 870 | field_name_list ',' field { $$ = $1->set_last( $3); }870 | field_name_list ',' field { $$ = (ExpressionNode *)($1->set_last( $3 )); } 871 871 ; 872 872 … … 1162 1162 // { $$ = new ExpressionNode( build_tuple( $3 ) ); } 1163 1163 '[' ',' 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 ) ) ); } 1165 1165 | '[' 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 ) ) )); } 1167 1167 ; 1168 1168 … … 1172 1172 { SemanticError( yylloc, "Eliding tuple element with '@' is currently unimplemented." ); $$ = nullptr; } 1173 1173 | tuple_expression_list ',' assignment_expression 1174 { $$ = $1->set_last( $3); }1174 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 1175 1175 | tuple_expression_list ',' '@' 1176 1176 { SemanticError( yylloc, "Eliding tuple element with '@' is currently unimplemented." ); $$ = nullptr; } … … 1307 1307 // therefore, are removed from the grammar even though C allows it. The change also applies to choose 1308 1308 // 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; 1310 1310 } 1311 1311 | SWITCH '(' comma_expression ')' '{' error '}' // CFA, invalid syntax rule error … … 1316 1316 { 1317 1317 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; 1319 1319 } 1320 1320 | CHOOSE '(' comma_expression ')' '{' error '}' // CFA, invalid syntax rule … … 1718 1718 cast_expression 1719 1719 | cast_expression_list ',' cast_expression 1720 // { $$ = (ExpressionNode *)($1->set_last( $3 )); } 1720 1721 { SemanticError( yylloc, "List of mutex member is currently unimplemented." ); $$ = nullptr; } 1721 1722 ; … … 1733 1734 { $$ = $3; } 1734 1735 | WAITFOR '(' cast_expression_list ':' argument_expression_list_opt ')' 1735 { $$ = $3->set_last( $5); }1736 { $$ = (ExpressionNode *)($3->set_last( $5 )); } 1736 1737 ; 1737 1738 … … 1889 1890 asm_operand 1890 1891 | asm_operands_list ',' asm_operand 1891 { $$ = $1->set_last( $3); }1892 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 1892 1893 ; 1893 1894 … … 1908 1909 { $$ = $1; } 1909 1910 | asm_clobbers_list_opt ',' string_literal 1910 { $$ = $1->set_last( $3); }1911 { $$ = (ExpressionNode *)( $1->set_last( $3 ) ); } 1911 1912 ; 1912 1913 … … 2974 2975 | initializer 2975 2976 | 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 ) )); } 2978 2979 ; 2979 2980 … … 2997 2998 designator 2998 2999 | designator_list designator 2999 { $$ = $1->set_last( $2); }3000 { $$ = (ExpressionNode *)($1->set_last( $2 )); } 3000 3001 //| designator_list designator { $$ = new ExpressionNode( $1, $2 ); } 3001 3002 ; … … 3126 3127 | assignment_expression 3127 3128 | 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 ) ) ) )); } 3129 3130 | type_list ',' assignment_expression 3130 { $$ = $1->set_last( $3); }3131 { $$ = (ExpressionNode *)( $1->set_last( $3 )); } 3131 3132 ; 3132 3133 … … 3965 3966 | assignment_expression upupeq assignment_expression 3966 3967 | 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 ) ) ) )); } 3968 3969 | 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 ) ) ) )); } 3970 3971 | array_type_list ',' assignment_expression upupeq assignment_expression 3971 3972 ;
Note:
See TracChangeset
for help on using the changeset viewer.