Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rdb70fe4 rea0c5e3  
    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 : Mon Sep 11 18:12:00 2017
     13// Update Count     : 2787
    1414//
    1515
     
    5656#include "LinkageSpec.h"
    5757#include "Common/SemanticError.h"                                               // error_str
    58 #include "Common/utility.h"                                                             // for maybeMoveBuild, maybeBuild, CodeLo...
    5958
    6059extern DeclarationNode * parseTree;
     
    439438                { $$ = $2; }
    440439        | '(' compound_statement ')'                                            // GCC, lambda expression
    441                 { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); }
     440                { $$ = new ExpressionNode( build_valexpr( $2 ) ); }
    442441        | primary_expression '{' argument_expression_list '}' // CFA, constructor call
    443442                {
     
    563562                        switch ( $1 ) {
    564563                          case OperKinds::AddressOf:
    565                                 $$ = new ExpressionNode( new AddressExpr( maybeMoveBuild< Expression >( $2 ) ) );
     564                                $$ = new ExpressionNode( build_addressOf( $2 ) );
    566565                                break;
    567566                          case OperKinds::PointTo:
     
    569568                                break;
    570569                          case OperKinds::And:
    571                                 $$ = new ExpressionNode( new AddressExpr( new AddressExpr( maybeMoveBuild< Expression >( $2 ) ) ) );
     570                                $$ = new ExpressionNode( new AddressExpr( build_addressOf( $2 ) ) );
    572571                                break;
    573572                          default:
     
    582581                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::Decr, $2 ) ); }
    583582        | SIZEOF unary_expression
    584                 { $$ = new ExpressionNode( new SizeofExpr( maybeMoveBuild< Expression >( $2 ) ) ); }
     583                { $$ = new ExpressionNode( build_sizeOfexpr( $2 ) ); }
    585584        | SIZEOF '(' type_no_function ')'
    586                 { $$ = new ExpressionNode( new SizeofExpr( maybeMoveBuildType( $3 ) ) ); }
     585                { $$ = new ExpressionNode( build_sizeOftype( $3 ) ); }
    587586        | ALIGNOF unary_expression                                                      // GCC, variable alignment
    588                 { $$ = new ExpressionNode( new AlignofExpr( maybeMoveBuild< Expression >( $2 ) ) ); }
     587                { $$ = new ExpressionNode( build_alignOfexpr( $2 ) ); }
    589588        | ALIGNOF '(' type_no_function ')'                                      // GCC, type alignment
    590                 { $$ = new ExpressionNode( new AlignofExpr( maybeMoveBuildType( $3 ) ) ); }
     589                { $$ = new ExpressionNode( build_alignOftype( $3 ) ); }
    591590        | OFFSETOF '(' type_no_function ',' no_attr_identifier ')'
    592591                { $$ = new ExpressionNode( build_offsetOf( $3, build_varref( $5 ) ) ); }
    593592        | ATTR_IDENTIFIER
    594                 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuild< Expression >( (ExpressionNode *)nullptr ) ) ); }
     593                { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), nullptr ) ); }
    595594        | ATTR_IDENTIFIER '(' argument_expression ')'
    596                 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuild< Expression >( $3 ) ) ); }
     595                { $$ = new ExpressionNode( build_attrexpr( build_varref( $1 ), $3 ) ); }
    597596        | ATTR_IDENTIFIER '(' type ')'
    598                 { $$ = new ExpressionNode( new AttrExpr( build_varref( $1 ), maybeMoveBuildType( $3 ) ) ); }
     597                { $$ = new ExpressionNode( build_attrtype( build_varref( $1 ), $3 ) ); }
    599598        ;
    600599
     
    619618                // VIRTUAL cannot be opt because of look ahead issues
    620619        | '(' VIRTUAL ')' cast_expression
    621                 { $$ = new ExpressionNode( new VirtualCastExpr( maybeMoveBuild< Expression >( $4 ), maybeMoveBuildType( nullptr ) ) ); }
     620                { $$ = new ExpressionNode( build_virtual_cast( nullptr, $4 ) ); }
    622621        | '(' VIRTUAL type_no_function ')' cast_expression
    623                 { $$ = new ExpressionNode( new VirtualCastExpr( maybeMoveBuild< Expression >( $5 ), maybeMoveBuildType( $3 ) ) ); }
     622                { $$ = new ExpressionNode( build_virtual_cast( $3, $5 ) ); }
    624623//      | '(' type_no_function ')' tuple
    625624//              { $$ = new ExpressionNode( build_cast( $2, $4 ) ); }
     
    772771        assignment_expression
    773772        | comma_expression ',' assignment_expression
    774                 { $$ = new ExpressionNode( new CommaExpr( maybeMoveBuild< Expression >( $1 ), maybeMoveBuild< Expression >( $3 ) ) ); }
     773                { $$ = new ExpressionNode( build_comma( $1, $3 ) ); }
    775774        ;
    776775
     
    895894        constant_expression                                                     { $$ = $1; }
    896895        | constant_expression ELLIPSIS constant_expression      // GCC, subrange
    897                 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $1 ), maybeMoveBuild< Expression >( $3 ) ) ); }
     896                { $$ = new ExpressionNode( build_range( $1, $3 ) ); }
    898897        | subrange                                                                                      // CFA, subrange
    899898        ;
     
    11551154asm_operand:                                                                                    // GCC
    11561155        string_literal '(' constant_expression ')'
    1157                 { $$ = new ExpressionNode( new AsmExpr( maybeMoveBuild< Expression >( (ExpressionNode *)nullptr ), $1, maybeMoveBuild< Expression >( $3 ) ) ); }
     1156                { $$ = new ExpressionNode( build_asmexpr( 0, $1, $3 ) ); }
    11581157        | '[' constant_expression ']' string_literal '(' constant_expression ')'
    1159                 { $$ = new ExpressionNode( new AsmExpr( maybeMoveBuild< Expression >( $2 ), $4, maybeMoveBuild< Expression >( $6 ) ) ); }
     1158                { $$ = new ExpressionNode( build_asmexpr( $2, $4, $6 ) ); }
    11601159        ;
    11611160
     
    11661165                { $$ = new ExpressionNode( $1 ); }
    11671166        | asm_clobbers_list_opt ',' string_literal
    1168                 // set_last returns ParseNode *
     1167                // set_last return ParseNode *
    11691168                { $$ = (ExpressionNode *)$1->set_last( new ExpressionNode( $3 ) ); }
    11701169        ;
     
    20892088                { $$ = $3; }
    20902089        | '[' push constant_expression ELLIPSIS constant_expression pop ']' // GCC, multiple array elements
    2091                 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $3 ), maybeMoveBuild< Expression >( $5 ) ) ); }
     2090                { $$ = new ExpressionNode( build_range( $3, $5 ) ); }
    20922091        | '.' '[' push field_list pop ']'                                       // CFA, tuple field selector
    20932092                { $$ = $4; }
     
    21662165type_list:                                                                                              // CFA
    21672166        type
    2168                 { $$ = new ExpressionNode( new TypeExpr( maybeMoveBuildType( $1 ) ) ); }
     2167                { $$ = new ExpressionNode( build_typevalue( $1 ) ); }
    21692168        | assignment_expression
    21702169        | type_list ',' type
    2171                 { $$ = (ExpressionNode *)( $1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) ) ); }
     2170                { $$ = (ExpressionNode *)( $1->set_last( new ExpressionNode( build_typevalue( $3 ) ) ) ); }
    21722171        | type_list ',' assignment_expression
    21732172                { $$ = (ExpressionNode *)( $1->set_last( $3 )); }
     
    24072406subrange:
    24082407        constant_expression '~' constant_expression                     // CFA, integer subrange
    2409                 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $1 ), maybeMoveBuild< Expression >( $3 ) ) ); }
     2408                { $$ = new ExpressionNode( build_range( $1, $3 ) ); }
    24102409        ;
    24112410
Note: See TracChangeset for help on using the changeset viewer.