Changes in / [5f782f7:33a25f9]


Ignore:
Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ExpressionNode.cc

    r5f782f7 r33a25f9  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Sep 14 23:09:34 2017
    13 // Update Count     : 690
     12// Last Modified On : Wed Sep 13 14:54:19 2017
     13// Update Count     : 683
    1414//
    1515
     
    363363} // build_pfieldSel
    364364
     365Expression * build_addressOf( ExpressionNode * expr_node ) {
     366        return new AddressExpr( maybeMoveBuild< Expression >(expr_node) );
     367} // build_addressOf
     368
     369Expression * build_sizeOfexpr( ExpressionNode * expr_node ) {
     370        return new SizeofExpr( maybeMoveBuild< Expression >(expr_node) );
     371} // build_sizeOfexpr
     372
     373Expression * build_sizeOftype( DeclarationNode * decl_node ) {
     374        return new SizeofExpr( maybeMoveBuildType( decl_node ) );
     375} // build_sizeOftype
     376
     377Expression * build_alignOfexpr( ExpressionNode * expr_node ) {
     378        return new AlignofExpr( maybeMoveBuild< Expression >(expr_node) );
     379} // build_alignOfexpr
     380
     381Expression * build_alignOftype( DeclarationNode * decl_node ) {
     382        return new AlignofExpr( maybeMoveBuildType( decl_node) );
     383} // build_alignOftype
     384
    365385Expression * build_offsetOf( DeclarationNode * decl_node, NameExpr * member ) {
    366386        Expression * ret = new UntypedOffsetofExpr( maybeMoveBuildType( decl_node ), member->get_name() );
     
    403423} // build_cond
    404424
     425Expression * build_attrexpr( NameExpr * var, ExpressionNode * expr_node ) {
     426        return new AttrExpr( var, maybeMoveBuild< Expression >(expr_node) );
     427} // build_attrexpr
     428
     429Expression * build_attrtype( NameExpr * var, DeclarationNode * decl_node ) {
     430        return new AttrExpr( var, maybeMoveBuildType( decl_node ) );
     431} // build_attrtype
     432
    405433Expression * build_tuple( ExpressionNode * expr_node ) {
    406434        list< Expression * > exprs;
     
    414442        return new UntypedExpr( maybeMoveBuild< Expression >(function), args, nullptr );
    415443} // build_func
     444
     445Expression * build_range( ExpressionNode * low, ExpressionNode * high ) {
     446        return new RangeExpr( maybeMoveBuild< Expression >( low ), maybeMoveBuild< Expression >( high ) );
     447} // build_range
    416448
    417449Expression * build_compoundLiteral( DeclarationNode * decl_node, InitializerNode * kids ) {
  • src/Parser/ParseNode.h

    r5f782f7 r33a25f9  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Sep 14 23:09:39 2017
    13 // Update Count     : 815
     12// Last Modified On : Wed Sep 13 12:35:10 2017
     13// Update Count     : 807
    1414//
    1515
     
    175175Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member );
    176176Expression * build_pfieldSel( ExpressionNode * expr_node, Expression * member );
     177Expression * build_addressOf( ExpressionNode * expr_node );
     178Expression * build_sizeOfexpr( ExpressionNode * expr_node );
     179Expression * build_sizeOftype( DeclarationNode * decl_node );
     180Expression * build_alignOfexpr( ExpressionNode * expr_node );
     181Expression * build_alignOftype( DeclarationNode * decl_node );
    177182Expression * build_offsetOf( DeclarationNode * decl_node, NameExpr * member );
    178183Expression * build_and( ExpressionNode * expr_node1, ExpressionNode * expr_node2 );
     
    183188Expression * build_binary_ptr( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 );
    184189Expression * build_cond( ExpressionNode * expr_node1, ExpressionNode * expr_node2, ExpressionNode * expr_node3 );
     190Expression * build_attrexpr( NameExpr * var, ExpressionNode * expr_node );
     191Expression * build_attrtype( NameExpr * var, DeclarationNode * decl_node );
    185192Expression * build_tuple( ExpressionNode * expr_node = nullptr );
    186193Expression * build_func( ExpressionNode * function, ExpressionNode * expr_node );
     194Expression * build_range( ExpressionNode * low, ExpressionNode * high );
    187195Expression * build_compoundLiteral( DeclarationNode * decl_node, InitializerNode * kids );
    188196
  • src/Parser/parser.yy

    r5f782f7 r33a25f9  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Sep 14 23:07:12 2017
    13 // Update Count     : 2815
     12// Last Modified On : Wed Sep 13 11:01:20 2017
     13// Update Count     : 2803
    1414//
    1515
     
    563563                        switch ( $1 ) {
    564564                          case OperKinds::AddressOf:
    565                                 $$ = new ExpressionNode( new AddressExpr( maybeMoveBuild< Expression >( $2 ) ) );
     565                                $$ = new ExpressionNode( build_addressOf( $2 ) );
    566566                                break;
    567567                          case OperKinds::PointTo:
     
    569569                                break;
    570570                          case OperKinds::And:
    571                                 $$ = new ExpressionNode( new AddressExpr( new AddressExpr( maybeMoveBuild< Expression >( $2 ) ) ) );
     571                                $$ = new ExpressionNode( new AddressExpr( build_addressOf( $2 ) ) );
    572572                                break;
    573573                          default:
     
    582582                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::Decr, $2 ) ); }
    583583        | SIZEOF unary_expression
    584                 { $$ = new ExpressionNode( new SizeofExpr( maybeMoveBuild< Expression >( $2 ) ) ); }
     584                { $$ = new ExpressionNode( build_sizeOfexpr( $2 ) ); }
    585585        | SIZEOF '(' type_no_function ')'
    586                 { $$ = new ExpressionNode( new SizeofExpr( maybeMoveBuildType( $3 ) ) ); }
     586                { $$ = new ExpressionNode( build_sizeOftype( $3 ) ); }
    587587        | ALIGNOF unary_expression                                                      // GCC, variable alignment
    588                 { $$ = new ExpressionNode( new AlignofExpr( maybeMoveBuild< Expression >( $2 ) ) ); }
     588                { $$ = new ExpressionNode( build_alignOfexpr( $2 ) ); }
    589589        | ALIGNOF '(' type_no_function ')'                                      // GCC, type alignment
    590                 { $$ = new ExpressionNode( new AlignofExpr( maybeMoveBuildType( $3 ) ) ); }
     590                { $$ = new ExpressionNode( build_alignOftype( $3 ) ); }
    591591        | OFFSETOF '(' type_no_function ',' no_attr_identifier ')'
    592592                { $$ = new ExpressionNode( build_offsetOf( $3, build_varref( $5 ) ) ); }
    593593        | ATTR_IDENTIFIER
    594                 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuild< Expression >( (ExpressionNode *)nullptr ) ) ); }
     594                { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), nullptr ) ); }
    595595        | ATTR_IDENTIFIER '(' argument_expression ')'
    596                 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuild< Expression >( $3 ) ) ); }
     596                { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), $3 ) ); }
    597597        | ATTR_IDENTIFIER '(' type ')'
    598                 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuildType( $3 ) ) ); }
     598                { $$ = new ExpressionNode( build_attrtype( build_varref( $1 ), $3 ) ); }
    599599        ;
    600600
     
    895895        constant_expression                                                     { $$ = $1; }
    896896        | 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 ) ); }
    898898        | subrange                                                                                      // CFA, subrange
    899899        ;
     
    20892089                { $$ = $3; }
    20902090        | '[' 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 ) ); }
    20922092        | '.' '[' push field_list pop ']'                                       // CFA, tuple field selector
    20932093                { $$ = $4; }
     
    24072407subrange:
    24082408        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 ) ); }
    24102410        ;
    24112411
Note: See TracChangeset for help on using the changeset viewer.