Changes in src/Parser/parser.yy [ea0c5e3:db70fe4]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
rea0c5e3 rdb70fe4 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 11 18:12:00201713 // Update Count : 2 78712 // Last Modified On : Thu Sep 14 23:07:12 2017 13 // Update Count : 2815 14 14 // 15 15 … … 56 56 #include "LinkageSpec.h" 57 57 #include "Common/SemanticError.h" // error_str 58 #include "Common/utility.h" // for maybeMoveBuild, maybeBuild, CodeLo... 58 59 59 60 extern DeclarationNode * parseTree; … … 438 439 { $$ = $2; } 439 440 | '(' compound_statement ')' // GCC, lambda expression 440 { $$ = new ExpressionNode( build_valexpr( $2) ); }441 { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); } 441 442 | primary_expression '{' argument_expression_list '}' // CFA, constructor call 442 443 { … … 562 563 switch ( $1 ) { 563 564 case OperKinds::AddressOf: 564 $$ = new ExpressionNode( build_addressOf( $2) );565 $$ = new ExpressionNode( new AddressExpr( maybeMoveBuild< Expression >( $2 ) ) ); 565 566 break; 566 567 case OperKinds::PointTo: … … 568 569 break; 569 570 case OperKinds::And: 570 $$ = new ExpressionNode( new AddressExpr( build_addressOf( $2) ) );571 $$ = new ExpressionNode( new AddressExpr( new AddressExpr( maybeMoveBuild< Expression >( $2 ) ) ) ); 571 572 break; 572 573 default: … … 581 582 { $$ = new ExpressionNode( build_unary_ptr( OperKinds::Decr, $2 ) ); } 582 583 | SIZEOF unary_expression 583 { $$ = new ExpressionNode( build_sizeOfexpr( $2) ); }584 { $$ = new ExpressionNode( new SizeofExpr( maybeMoveBuild< Expression >( $2 ) ) ); } 584 585 | SIZEOF '(' type_no_function ')' 585 { $$ = new ExpressionNode( build_sizeOftype( $3) ); }586 { $$ = new ExpressionNode( new SizeofExpr( maybeMoveBuildType( $3 ) ) ); } 586 587 | ALIGNOF unary_expression // GCC, variable alignment 587 { $$ = new ExpressionNode( build_alignOfexpr( $2) ); }588 { $$ = new ExpressionNode( new AlignofExpr( maybeMoveBuild< Expression >( $2 ) ) ); } 588 589 | ALIGNOF '(' type_no_function ')' // GCC, type alignment 589 { $$ = new ExpressionNode( build_alignOftype( $3) ); }590 { $$ = new ExpressionNode( new AlignofExpr( maybeMoveBuildType( $3 ) ) ); } 590 591 | OFFSETOF '(' type_no_function ',' no_attr_identifier ')' 591 592 { $$ = new ExpressionNode( build_offsetOf( $3, build_varref( $5 ) ) ); } 592 593 | ATTR_IDENTIFIER 593 { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), nullptr) ); }594 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuild< Expression >( (ExpressionNode *)nullptr ) ) ); } 594 595 | ATTR_IDENTIFIER '(' argument_expression ')' 595 { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), $3) ); }596 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuild< Expression >( $3 ) ) ); } 596 597 | ATTR_IDENTIFIER '(' type ')' 597 { $$ = new ExpressionNode( build_attrtype( build_varref( $1 ), $3) ); }598 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuildType( $3 ) ) ); } 598 599 ; 599 600 … … 618 619 // VIRTUAL cannot be opt because of look ahead issues 619 620 | '(' VIRTUAL ')' cast_expression 620 { $$ = new ExpressionNode( build_virtual_cast( nullptr, $4) ); }621 { $$ = new ExpressionNode( new VirtualCastExpr( maybeMoveBuild< Expression >( $4 ), maybeMoveBuildType( nullptr ) ) ); } 621 622 | '(' VIRTUAL type_no_function ')' cast_expression 622 { $$ = new ExpressionNode( build_virtual_cast( $3, $5) ); }623 { $$ = new ExpressionNode( new VirtualCastExpr( maybeMoveBuild< Expression >( $5 ), maybeMoveBuildType( $3 ) ) ); } 623 624 // | '(' type_no_function ')' tuple 624 625 // { $$ = new ExpressionNode( build_cast( $2, $4 ) ); } … … 771 772 assignment_expression 772 773 | comma_expression ',' assignment_expression 773 { $$ = new ExpressionNode( build_comma( $1, $3) ); }774 { $$ = new ExpressionNode( new CommaExpr( maybeMoveBuild< Expression >( $1 ), maybeMoveBuild< Expression >( $3 ) ) ); } 774 775 ; 775 776 … … 894 895 constant_expression { $$ = $1; } 895 896 | constant_expression ELLIPSIS constant_expression // GCC, subrange 896 { $$ = new ExpressionNode( build_range( $1, $3) ); }897 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $1 ), maybeMoveBuild< Expression >( $3 ) ) ); } 897 898 | subrange // CFA, subrange 898 899 ; … … 1154 1155 asm_operand: // GCC 1155 1156 string_literal '(' constant_expression ')' 1156 { $$ = new ExpressionNode( build_asmexpr( 0, $1, $3) ); }1157 { $$ = new ExpressionNode( new AsmExpr( maybeMoveBuild< Expression >( (ExpressionNode *)nullptr ), $1, maybeMoveBuild< Expression >( $3 ) ) ); } 1157 1158 | '[' constant_expression ']' string_literal '(' constant_expression ')' 1158 { $$ = new ExpressionNode( build_asmexpr( $2, $4, $6) ); }1159 { $$ = new ExpressionNode( new AsmExpr( maybeMoveBuild< Expression >( $2 ), $4, maybeMoveBuild< Expression >( $6 ) ) ); } 1159 1160 ; 1160 1161 … … 1165 1166 { $$ = new ExpressionNode( $1 ); } 1166 1167 | asm_clobbers_list_opt ',' string_literal 1167 // set_last return ParseNode *1168 // set_last returns ParseNode * 1168 1169 { $$ = (ExpressionNode *)$1->set_last( new ExpressionNode( $3 ) ); } 1169 1170 ; … … 2088 2089 { $$ = $3; } 2089 2090 | '[' push constant_expression ELLIPSIS constant_expression pop ']' // GCC, multiple array elements 2090 { $$ = new ExpressionNode( build_range( $3, $5) ); }2091 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $3 ), maybeMoveBuild< Expression >( $5 ) ) ); } 2091 2092 | '.' '[' push field_list pop ']' // CFA, tuple field selector 2092 2093 { $$ = $4; } … … 2165 2166 type_list: // CFA 2166 2167 type 2167 { $$ = new ExpressionNode( build_typevalue( $1) ); }2168 { $$ = new ExpressionNode( new TypeExpr( maybeMoveBuildType( $1 ) ) ); } 2168 2169 | assignment_expression 2169 2170 | type_list ',' type 2170 { $$ = (ExpressionNode *)( $1->set_last( new ExpressionNode( build_typevalue( $3) ) ) ); }2171 { $$ = (ExpressionNode *)( $1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) ) ); } 2171 2172 | type_list ',' assignment_expression 2172 2173 { $$ = (ExpressionNode *)( $1->set_last( $3 )); } … … 2406 2407 subrange: 2407 2408 constant_expression '~' constant_expression // CFA, integer subrange 2408 { $$ = new ExpressionNode( build_range( $1, $3) ); }2409 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $1 ), maybeMoveBuild< Expression >( $3 ) ) ); } 2409 2410 ; 2410 2411
Note:
See TracChangeset
for help on using the changeset viewer.