Changes in / [5f782f7:33a25f9]
- Location:
- src/Parser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ExpressionNode.cc
r5f782f7 r33a25f9 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Sep 14 23:09:34201713 // Update Count : 6 9012 // Last Modified On : Wed Sep 13 14:54:19 2017 13 // Update Count : 683 14 14 // 15 15 … … 363 363 } // build_pfieldSel 364 364 365 Expression * build_addressOf( ExpressionNode * expr_node ) { 366 return new AddressExpr( maybeMoveBuild< Expression >(expr_node) ); 367 } // build_addressOf 368 369 Expression * build_sizeOfexpr( ExpressionNode * expr_node ) { 370 return new SizeofExpr( maybeMoveBuild< Expression >(expr_node) ); 371 } // build_sizeOfexpr 372 373 Expression * build_sizeOftype( DeclarationNode * decl_node ) { 374 return new SizeofExpr( maybeMoveBuildType( decl_node ) ); 375 } // build_sizeOftype 376 377 Expression * build_alignOfexpr( ExpressionNode * expr_node ) { 378 return new AlignofExpr( maybeMoveBuild< Expression >(expr_node) ); 379 } // build_alignOfexpr 380 381 Expression * build_alignOftype( DeclarationNode * decl_node ) { 382 return new AlignofExpr( maybeMoveBuildType( decl_node) ); 383 } // build_alignOftype 384 365 385 Expression * build_offsetOf( DeclarationNode * decl_node, NameExpr * member ) { 366 386 Expression * ret = new UntypedOffsetofExpr( maybeMoveBuildType( decl_node ), member->get_name() ); … … 403 423 } // build_cond 404 424 425 Expression * build_attrexpr( NameExpr * var, ExpressionNode * expr_node ) { 426 return new AttrExpr( var, maybeMoveBuild< Expression >(expr_node) ); 427 } // build_attrexpr 428 429 Expression * build_attrtype( NameExpr * var, DeclarationNode * decl_node ) { 430 return new AttrExpr( var, maybeMoveBuildType( decl_node ) ); 431 } // build_attrtype 432 405 433 Expression * build_tuple( ExpressionNode * expr_node ) { 406 434 list< Expression * > exprs; … … 414 442 return new UntypedExpr( maybeMoveBuild< Expression >(function), args, nullptr ); 415 443 } // build_func 444 445 Expression * build_range( ExpressionNode * low, ExpressionNode * high ) { 446 return new RangeExpr( maybeMoveBuild< Expression >( low ), maybeMoveBuild< Expression >( high ) ); 447 } // build_range 416 448 417 449 Expression * build_compoundLiteral( DeclarationNode * decl_node, InitializerNode * kids ) { -
src/Parser/ParseNode.h
r5f782f7 r33a25f9 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Sep 14 23:09:39201713 // Update Count : 8 1512 // Last Modified On : Wed Sep 13 12:35:10 2017 13 // Update Count : 807 14 14 // 15 15 … … 175 175 Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member ); 176 176 Expression * build_pfieldSel( ExpressionNode * expr_node, Expression * member ); 177 Expression * build_addressOf( ExpressionNode * expr_node ); 178 Expression * build_sizeOfexpr( ExpressionNode * expr_node ); 179 Expression * build_sizeOftype( DeclarationNode * decl_node ); 180 Expression * build_alignOfexpr( ExpressionNode * expr_node ); 181 Expression * build_alignOftype( DeclarationNode * decl_node ); 177 182 Expression * build_offsetOf( DeclarationNode * decl_node, NameExpr * member ); 178 183 Expression * build_and( ExpressionNode * expr_node1, ExpressionNode * expr_node2 ); … … 183 188 Expression * build_binary_ptr( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 ); 184 189 Expression * build_cond( ExpressionNode * expr_node1, ExpressionNode * expr_node2, ExpressionNode * expr_node3 ); 190 Expression * build_attrexpr( NameExpr * var, ExpressionNode * expr_node ); 191 Expression * build_attrtype( NameExpr * var, DeclarationNode * decl_node ); 185 192 Expression * build_tuple( ExpressionNode * expr_node = nullptr ); 186 193 Expression * build_func( ExpressionNode * function, ExpressionNode * expr_node ); 194 Expression * build_range( ExpressionNode * low, ExpressionNode * high ); 187 195 Expression * build_compoundLiteral( DeclarationNode * decl_node, InitializerNode * kids ); 188 196 -
src/Parser/parser.yy
r5f782f7 r33a25f9 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Sep 14 23:07:12201713 // Update Count : 28 1512 // Last Modified On : Wed Sep 13 11:01:20 2017 13 // Update Count : 2803 14 14 // 15 15 … … 563 563 switch ( $1 ) { 564 564 case OperKinds::AddressOf: 565 $$ = new ExpressionNode( new AddressExpr( maybeMoveBuild< Expression >( $2 )) );565 $$ = new ExpressionNode( build_addressOf( $2 ) ); 566 566 break; 567 567 case OperKinds::PointTo: … … 569 569 break; 570 570 case OperKinds::And: 571 $$ = new ExpressionNode( new AddressExpr( new AddressExpr( maybeMoveBuild< Expression >( $2 )) ) );571 $$ = new ExpressionNode( new AddressExpr( build_addressOf( $2 ) ) ); 572 572 break; 573 573 default: … … 582 582 { $$ = new ExpressionNode( build_unary_ptr( OperKinds::Decr, $2 ) ); } 583 583 | SIZEOF unary_expression 584 { $$ = new ExpressionNode( new SizeofExpr( maybeMoveBuild< Expression >( $2 )) ); }584 { $$ = new ExpressionNode( build_sizeOfexpr( $2 ) ); } 585 585 | SIZEOF '(' type_no_function ')' 586 { $$ = new ExpressionNode( new SizeofExpr( maybeMoveBuildType( $3 )) ); }586 { $$ = new ExpressionNode( build_sizeOftype( $3 ) ); } 587 587 | ALIGNOF unary_expression // GCC, variable alignment 588 { $$ = new ExpressionNode( new AlignofExpr( maybeMoveBuild< Expression >( $2 )) ); }588 { $$ = new ExpressionNode( build_alignOfexpr( $2 ) ); } 589 589 | ALIGNOF '(' type_no_function ')' // GCC, type alignment 590 { $$ = new ExpressionNode( new AlignofExpr( maybeMoveBuildType( $3 )) ); }590 { $$ = new ExpressionNode( build_alignOftype( $3 ) ); } 591 591 | OFFSETOF '(' type_no_function ',' no_attr_identifier ')' 592 592 { $$ = new ExpressionNode( build_offsetOf( $3, build_varref( $5 ) ) ); } 593 593 | ATTR_IDENTIFIER 594 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuild< Expression >( (ExpressionNode *)nullptr )) ); }594 { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), nullptr ) ); } 595 595 | ATTR_IDENTIFIER '(' argument_expression ')' 596 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuild< Expression >( $3 )) ); }596 { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), $3 ) ); } 597 597 | ATTR_IDENTIFIER '(' type ')' 598 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuildType( $3 )) ); }598 { $$ = new ExpressionNode( build_attrtype( build_varref( $1 ), $3 ) ); } 599 599 ; 600 600 … … 895 895 constant_expression { $$ = $1; } 896 896 | constant_expression ELLIPSIS constant_expression // GCC, subrange 897 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $1 ), maybeMoveBuild< Expression >( $3 )) ); }897 { $$ = new ExpressionNode( build_range( $1, $3 ) ); } 898 898 | subrange // CFA, subrange 899 899 ; … … 2089 2089 { $$ = $3; } 2090 2090 | '[' push constant_expression ELLIPSIS constant_expression pop ']' // GCC, multiple array elements 2091 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $3 ), maybeMoveBuild< Expression >( $5 )) ); }2091 { $$ = new ExpressionNode( build_range( $3, $5 ) ); } 2092 2092 | '.' '[' push field_list pop ']' // CFA, tuple field selector 2093 2093 { $$ = $4; } … … 2407 2407 subrange: 2408 2408 constant_expression '~' constant_expression // CFA, integer subrange 2409 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $1 ), maybeMoveBuild< Expression >( $3 )) ); }2409 { $$ = new ExpressionNode( build_range( $1, $3 ) ); } 2410 2410 ; 2411 2411
Note: See TracChangeset
for help on using the changeset viewer.