Changes in / [12bc63a:fc4a0fa]


Ignore:
Location:
src
Files:
5 added
2 deleted
43 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r12bc63a rfc4a0fa  
    309309                                                        UntypedExpr * newExpr = new UntypedExpr( new NameExpr( "*?" ) );
    310310                                                        newExpr->get_args().push_back( *arg );
    311                                                         Type * type = InitTweak::getPointerBase( (*arg)->get_result() );
     311                                                        assert( (*arg)->get_results().size() == 1 );
     312                                                        Type * type = InitTweak::getPointerBase( (*arg)->get_results().front() );
    312313                                                        assert( type );
    313                                                         newExpr->set_result( type->clone() );
     314                                                        newExpr->get_results().push_back( type->clone() );
    314315                                                        *arg = newExpr;
    315316                                                } // if
     
    526527                extension( castExpr );
    527528                output << "(";
    528                 if ( castExpr->get_result()->isVoid() ) {
     529                if ( castExpr->get_results().empty() ) {
    529530                        output << "(void)" ;
    530                 } else if ( ! castExpr->get_result()->get_isLvalue() ) {
     531                } else if ( ! castExpr->get_results().front()->get_isLvalue() ) {
    531532                        // at least one result type of cast, but not an lvalue
    532533                        output << "(";
    533                         output << genType( castExpr->get_result(), "" );
     534                        output << genType( castExpr->get_results().front(), "" );
    534535                        output << ")";
    535536                } else {
     
    653654                asmExpr->get_operand()->accept( *this );
    654655                output << " )";
    655         }
    656 
    657         void CodeGenerator::visit( StmtExpr * stmtExpr ) {
    658                 output << "(";
    659                 stmtExpr->get_statements()->accept( *this );
    660                 output << ")";
    661656        }
    662657
  • src/CodeGen/CodeGenerator.h

    r12bc63a rfc4a0fa  
    7373                virtual void visit( TypeExpr *typeExpr );
    7474                virtual void visit( AsmExpr * );
    75                 virtual void visit( StmtExpr * );
    7675
    7776                //*** Statements
  • src/ControlStruct/Mutate.cc

    r12bc63a rfc4a0fa  
    2323#include "MLEMutator.h"
    2424#include "ForExprMutator.h"
     25#include "LabelTypeChecker.h"
    2526//#include "ExceptMutator.h"
    2627
     
    4041
    4142                //ExceptMutator exc;
     43                // LabelTypeChecker lbl;
    4244
    4345                mutateAll( translationUnit, formut );
    4446                acceptAll( translationUnit, lfix );
    4547                //mutateAll( translationUnit, exc );
     48                //acceptAll( translationUnit, lbl );
    4649        }
    4750} // namespace CodeGen
  • src/ControlStruct/module.mk

    r12bc63a rfc4a0fa  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk --
     8## module.mk -- 
    99##
    1010## Author           : Richard C. Bilson
     
    1919        ControlStruct/MLEMutator.cc \
    2020        ControlStruct/Mutate.cc \
    21         ControlStruct/ForExprMutator.cc
     21        ControlStruct/ForExprMutator.cc \
     22        ControlStruct/LabelTypeChecker.cc
    2223
  • src/GenPoly/Box.cc

    r12bc63a rfc4a0fa  
    782782
    783783                        // add size/align for generic types to parameter list
    784                         if ( ! appExpr->get_function()->has_result() ) return;
    785                         FunctionType *funcType = getFunctionType( appExpr->get_function()->get_result() );
     784                        if ( appExpr->get_function()->get_results().empty() ) return;
     785                        FunctionType *funcType = getFunctionType( appExpr->get_function()->get_results().front() );
    786786                        assert( funcType );
    787787
     
    799799                        for ( ; fnParm != funcType->get_parameters().end() && fnArg != appExpr->get_args().end(); ++fnParm, ++fnArg ) {
    800800                                VariableExpr *fnArgBase = getBaseVar( *fnArg );
    801                                 if ( ! fnArgBase ) continue; // xxx - previously had check for non-empty fnArgBase results
    802                                 passArgTypeVars( appExpr, (*fnParm)->get_type(), fnArgBase->get_result(), arg, exprTyVars, seenTypes );
     801                                if ( ! fnArgBase || fnArgBase->get_results().empty() ) continue;
     802                                passArgTypeVars( appExpr, (*fnParm)->get_type(), fnArgBase->get_results().front(), arg, exprTyVars, seenTypes );
    803803                        }
    804804                }
     
    890890                        Type * adapteeType = new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) );
    891891                        appExpr->get_args().push_front( new CastExpr( appExpr->get_function(), adapteeType ) );
    892                         appExpr->set_function( new NameExpr( adapterName ) ); // xxx - result is never set on NameExpr
     892                        appExpr->set_function( new NameExpr( adapterName ) );
    893893
    894894                        return ret;
     
    896896
    897897                void Pass1::boxParam( Type *param, Expression *&arg, const TyVarMap &exprTyVars ) {
    898                         assert( arg->has_result() );
     898                        assert( ! arg->get_results().empty() );
    899899                        if ( isPolyType( param, exprTyVars ) ) {
    900                                 if ( isPolyType( arg->get_result() ) ) {
     900                                if ( isPolyType( arg->get_results().front() ) ) {
    901901                                        // if the argument's type is polymorphic, we don't need to box again!
    902902                                        return;
    903                                 } else if ( arg->get_result()->get_isLvalue() ) {
     903                                } else if ( arg->get_results().front()->get_isLvalue() ) {
    904904                                        // VariableExpr and MemberExpr are lvalues; need to check this isn't coming from the second arg of a comma expression though (not an lvalue)
    905905                                        // xxx - need to test that this code is still reachable
     
    987987                                        UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
    988988                                        deref->get_args().push_back( new CastExpr( new VariableExpr( param ), new PointerType( Type::Qualifiers(), arg->get_type()->clone() ) ) );
    989                                         deref->set_result( arg->get_type()->clone() );
     989                                        deref->get_results().push_back( arg->get_type()->clone() );
    990990                                        return deref;
    991991                                } // if
     
    11241124                        } // if
    11251125                        addAssign->get_args().push_back( new NameExpr( sizeofName( mangleType( polyType ) ) ) );
    1126                         addAssign->set_result( appExpr->get_result()->clone() );
     1126                        addAssign->get_results().front() = appExpr->get_results().front()->clone();
    11271127                        if ( appExpr->get_env() ) {
    11281128                                addAssign->set_env( appExpr->get_env() );
     
    11381138                                if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic ) {
    11391139                                        if ( varExpr->get_var()->get_name() == "?[?]" ) {
    1140                                                 assert( appExpr->has_result() );
     1140                                                assert( ! appExpr->get_results().empty() );
    11411141                                                assert( appExpr->get_args().size() == 2 );
    1142                                                 Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env );
    1143                                                 Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_result(), scopeTyVars, env );
     1142                                                Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), scopeTyVars, env );
     1143                                                Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), scopeTyVars, env );
    11441144                                                assert( ! baseType1 || ! baseType2 ); // the arguments cannot both be polymorphic pointers
    11451145                                                UntypedExpr *ret = 0;
     
    11611161                                                } // if
    11621162                                                if ( baseType1 || baseType2 ) {
    1163                                                         ret->set_result( appExpr->get_result()->clone() );
     1163                                                        ret->get_results().push_front( appExpr->get_results().front()->clone() );
    11641164                                                        if ( appExpr->get_env() ) {
    11651165                                                                ret->set_env( appExpr->get_env() );
     
    11711171                                                } // if
    11721172                                        } else if ( varExpr->get_var()->get_name() == "*?" ) {
    1173                                                 assert( appExpr->has_result() );
     1173                                                assert( ! appExpr->get_results().empty() );
    11741174                                                assert( ! appExpr->get_args().empty() );
    1175                                                 if ( isPolyType( appExpr->get_result(), scopeTyVars, env ) ) {
     1175                                                if ( isPolyType( appExpr->get_results().front(), scopeTyVars, env ) ) {
    11761176                                                        Expression *ret = appExpr->get_args().front();
    1177                                                         delete ret->get_result();
    1178                                                         ret->set_result( appExpr->get_result()->clone() );
     1177                                                        delete ret->get_results().front();
     1178                                                        ret->get_results().front() = appExpr->get_results().front()->clone();
    11791179                                                        if ( appExpr->get_env() ) {
    11801180                                                                ret->set_env( appExpr->get_env() );
     
    11861186                                                } // if
    11871187                                        } else if ( varExpr->get_var()->get_name() == "?++" || varExpr->get_var()->get_name() == "?--" ) {
    1188                                                 assert( appExpr->has_result() );
     1188                                                assert( ! appExpr->get_results().empty() );
    11891189                                                assert( appExpr->get_args().size() == 1 );
    1190                                                 if ( Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env ) ) {
    1191                                                         Type *tempType = appExpr->get_result()->clone();
     1190                                                if ( Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env ) ) {
     1191                                                        Type *tempType = appExpr->get_results().front()->clone();
    11921192                                                        if ( env ) {
    11931193                                                                env->apply( tempType );
     
    12061206                                                } // if
    12071207                                        } else if ( varExpr->get_var()->get_name() == "++?" || varExpr->get_var()->get_name() == "--?" ) {
    1208                                                 assert( appExpr->has_result() );
     1208                                                assert( ! appExpr->get_results().empty() );
    12091209                                                assert( appExpr->get_args().size() == 1 );
    1210                                                 if ( Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env ) ) {
     1210                                                if ( Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env ) ) {
    12111211                                                        return makeIncrDecrExpr( appExpr, baseType, varExpr->get_var()->get_name() == "++?" );
    12121212                                                } // if
    12131213                                        } else if ( varExpr->get_var()->get_name() == "?+?" || varExpr->get_var()->get_name() == "?-?" ) {
    1214                                                 assert( appExpr->has_result() );
     1214                                                assert( ! appExpr->get_results().empty() );
    12151215                                                assert( appExpr->get_args().size() == 2 );
    1216                                                 Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env );
    1217                                                 Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_result(), scopeTyVars, env );
     1216                                                Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), scopeTyVars, env );
     1217                                                Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), scopeTyVars, env );
    12181218                                                if ( baseType1 && baseType2 ) {
    12191219                                                        UntypedExpr *divide = new UntypedExpr( new NameExpr( "?/?" ) );
    12201220                                                        divide->get_args().push_back( appExpr );
    12211221                                                        divide->get_args().push_back( new SizeofExpr( baseType1->clone() ) );
    1222                                                         divide->set_result( appExpr->get_result()->clone() );
     1222                                                        divide->get_results().push_front( appExpr->get_results().front()->clone() );
    12231223                                                        if ( appExpr->get_env() ) {
    12241224                                                                divide->set_env( appExpr->get_env() );
     
    12381238                                                } // if
    12391239                                        } else if ( varExpr->get_var()->get_name() == "?+=?" || varExpr->get_var()->get_name() == "?-=?" ) {
    1240                                                 assert( appExpr->has_result() );
     1240                                                assert( ! appExpr->get_results().empty() );
    12411241                                                assert( appExpr->get_args().size() == 2 );
    1242                                                 Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env );
     1242                                                Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env );
    12431243                                                if ( baseType ) {
    12441244                                                        UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
     
    12661266                        useRetval = oldUseRetval;
    12671267
    1268                         assert( appExpr->get_function()->has_result() );
    1269                         PointerType *pointer = safe_dynamic_cast< PointerType *>( appExpr->get_function()->get_result() );
    1270                         FunctionType *function = safe_dynamic_cast< FunctionType *>( pointer->get_base() );
     1268                        assert( ! appExpr->get_function()->get_results().empty() );
     1269                        PointerType *pointer = dynamic_cast< PointerType *>( appExpr->get_function()->get_results().front() );
     1270                        assert( pointer );
     1271                        FunctionType *function = dynamic_cast< FunctionType *>( pointer->get_base() );
     1272                        assert( function );
    12711273
    12721274                        if ( Expression *newExpr = handleIntrinsics( appExpr ) ) {
     
    13061308
    13071309                Expression *Pass1::mutate( UntypedExpr *expr ) {
    1308                         if ( expr->has_result() && isPolyType( expr->get_result(), scopeTyVars, env ) ) {
     1310                        if ( ! expr->get_results().empty() && isPolyType( expr->get_results().front(), scopeTyVars, env ) ) {
    13091311                                if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) {
    13101312                                        if ( name->get_name() == "*?" ) {
     
    13201322
    13211323                Expression *Pass1::mutate( AddressExpr *addrExpr ) {
    1322                         assert( addrExpr->get_arg()->has_result() && ! addrExpr->get_arg()->get_result()->isVoid() );
     1324                        assert( ! addrExpr->get_arg()->get_results().empty() );
    13231325
    13241326                        bool needs = false;
    13251327                        if ( UntypedExpr *expr = dynamic_cast< UntypedExpr *>( addrExpr->get_arg() ) ) {
    1326                                 if ( expr->has_result() && isPolyType( expr->get_result(), scopeTyVars, env ) ) {
     1328                                if ( ! expr->get_results().empty() && isPolyType( expr->get_results().front(), scopeTyVars, env ) ) {
    13271329                                        if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) {
    13281330                                                if ( name->get_name() == "*?" ) {
    13291331                                                        if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr->get_args().front() ) ) {
    1330                                                                 assert( appExpr->get_function()->has_result() );
    1331                                                                 PointerType *pointer = safe_dynamic_cast< PointerType *>( appExpr->get_function()->get_result() );
    1332                                                                 FunctionType *function = safe_dynamic_cast< FunctionType *>( pointer->get_base() );
     1332                                                                assert( ! appExpr->get_function()->get_results().empty() );
     1333                                                                PointerType *pointer = dynamic_cast< PointerType *>( appExpr->get_function()->get_results().front() );
     1334                                                                assert( pointer );
     1335                                                                FunctionType *function = dynamic_cast< FunctionType *>( pointer->get_base() );
     1336                                                                assert( function );
    13331337                                                                needs = needsAdapter( function, scopeTyVars );
    13341338                                                        } // if
     
    13391343                        // isPolyType check needs to happen before mutating addrExpr arg, so pull it forward
    13401344                        // out of the if condition.
    1341                         bool polytype = isPolyType( addrExpr->get_arg()->get_result(), scopeTyVars, env );
     1345                        bool polytype = isPolyType( addrExpr->get_arg()->get_results().front(), scopeTyVars, env );
    13421346                        addrExpr->set_arg( mutateExpression( addrExpr->get_arg() ) );
    13431347                        if ( polytype || needs ) {
    13441348                                Expression *ret = addrExpr->get_arg();
    1345                                 delete ret->get_result();
    1346                                 ret->set_result( addrExpr->get_result()->clone() );
     1349                                delete ret->get_results().front();
     1350                                ret->get_results().front() = addrExpr->get_results().front()->clone();
    13471351                                addrExpr->set_arg( 0 );
    13481352                                delete addrExpr;
     
    13821386                Statement * Pass1::mutate( ReturnStmt *returnStmt ) {
    13831387                        if ( retval && returnStmt->get_expr() ) {
    1384                                 assert( returnStmt->get_expr()->has_result() && ! returnStmt->get_expr()->get_result()->isVoid() );
     1388                                assert( ! returnStmt->get_expr()->get_results().empty() );
    13851389                                // ***** Code Removal ***** After introducing a temporary variable for all return expressions, the following code appears superfluous.
    13861390                                // if ( returnStmt->get_expr()->get_results().front()->get_isLvalue() ) {
     
    14621466                                // replace return statement with appropriate assignment to out parameter
    14631467                                Expression *retParm = new NameExpr( retval->get_name() );
    1464                                 retParm->set_result( new PointerType( Type::Qualifiers(), retval->get_type()->clone() ) );
     1468                                retParm->get_results().push_back( new PointerType( Type::Qualifiers(), retval->get_type()->clone() ) );
    14651469                                assignExpr->get_args().push_back( retParm );
    14661470                                assignExpr->get_args().push_back( returnStmt->get_expr() );
  • src/GenPoly/Lvalue.cc

    r12bc63a rfc4a0fa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Lvalue.cc --
     7// Lvalue.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    4141                  public:
    4242                        Pass1();
    43 
     43 
    4444                        virtual Expression *mutate( ApplicationExpr *appExpr );
    4545                        virtual Statement *mutate( ReturnStmt *appExpr );
     
    9999                        appExpr->get_function()->acceptMutator( *this );
    100100                        mutateAll( appExpr->get_args(), *this );
     101 
     102                        assert( ! appExpr->get_function()->get_results().empty() );
    101103
    102                         PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
    103                         FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
     104                        PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() );
     105                        assert( pointer );
     106                        FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
     107                        assert( function );
    104108
    105109                        Type *funType = isLvalueRet( function );
    106110                        if ( funType && ! isIntrinsicApp( appExpr ) ) {
    107111                                Expression *expr = appExpr;
    108                                 Type *appType = appExpr->get_result();
     112                                Type *appType = appExpr->get_results().front();
    109113                                if ( isPolyType( funType ) && ! isPolyType( appType ) ) {
    110114                                        // make sure cast for polymorphic type is inside dereference
     
    112116                                }
    113117                                UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
    114                                 deref->set_result( appType->clone() );
    115                                 appExpr->set_result( new PointerType( Type::Qualifiers(), appType ) );
     118                                deref->get_results().push_back( appType->clone() );
     119                                appExpr->get_results().front() = new PointerType( Type::Qualifiers(), appType );
    116120                                deref->get_args().push_back( expr );
    117121                                return deref;
     
    123127                Statement * Pass1::mutate(ReturnStmt *retStmt) {
    124128                        if ( retval && retStmt->get_expr() ) {
    125                                 if ( retStmt->get_expr()->get_result()->get_isLvalue() ) {
     129                                assert( ! retStmt->get_expr()->get_results().empty() );
     130                                if ( retStmt->get_expr()->get_results().front()->get_isLvalue() ) {
    126131                                        // ***** Code Removal ***** because casts may be stripped already
    127132
     
    150155                                retParm->set_type( new PointerType( Type::Qualifiers(), retParm->get_type() ) );
    151156                        } // if
    152 
     157 
    153158                        Visitor::visit( funType );
    154159                }
  • src/GenPoly/Specialize.cc

    r12bc63a rfc4a0fa  
    147147
    148148        Expression * Specialize::doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams ) {
    149                 assert( actual->has_result() );
    150                 if ( needsSpecialization( formalType, actual->get_result(), env ) ) {
     149                assert( ! actual->get_results().empty() ); // using front, should have this assert
     150                if ( needsSpecialization( formalType, actual->get_results().front(), env ) ) {
    151151                        FunctionType *funType;
    152152                        if ( ( funType = getFunctionType( formalType ) ) ) {
     
    171171        void Specialize::handleExplicitParams( ApplicationExpr *appExpr ) {
    172172                // create thunks for the explicit parameters
    173                 assert( appExpr->get_function()->has_result() );
    174                 FunctionType *function = getFunctionType( appExpr->get_function()->get_result() );
     173                assert( ! appExpr->get_function()->get_results().empty() );
     174                FunctionType *function = getFunctionType( appExpr->get_function()->get_results().front() );
    175175                assert( function );
    176176                std::list< DeclarationWithType* >::iterator formal;
     
    200200        Expression * Specialize::mutate( AddressExpr *addrExpr ) {
    201201                addrExpr->get_arg()->acceptMutator( *this );
    202                 assert( addrExpr->has_result() );
    203                 addrExpr->set_arg( doSpecialization( addrExpr->get_result(), addrExpr->get_arg() ) );
     202                assert( ! addrExpr->get_results().empty() );
     203                addrExpr->set_arg( doSpecialization( addrExpr->get_results().front(), addrExpr->get_arg() ) );
    204204                return addrExpr;
    205205        }
     
    207207        Expression * Specialize::mutate( CastExpr *castExpr ) {
    208208                castExpr->get_arg()->acceptMutator( *this );
    209                 if ( castExpr->get_result()->isVoid() ) {
     209                if ( castExpr->get_results().empty() ) {
    210210                        // can't specialize if we don't have a return value
    211211                        return castExpr;
    212212                }
    213                 Expression *specialized = doSpecialization( castExpr->get_result(), castExpr->get_arg() );
     213                Expression *specialized = doSpecialization( castExpr->get_results().front(), castExpr->get_arg() );
    214214                if ( specialized != castExpr->get_arg() ) {
    215215                        // assume here that the specialization incorporates the cast
  • src/InitTweak/FixInit.cc

    r12bc63a rfc4a0fa  
    391391                                CP_CTOR_PRINT( std::cerr << "Type Substitution: " << *impCpCtorExpr->get_env() << std::endl; )
    392392                                // xxx - need to handle tuple arguments
    393                                 assert( arg->has_result() );
    394                                 Type * result = arg->get_result();
     393                                assert( ! arg->get_results().empty() );
     394                                Type * result = arg->get_results().front();
    395395                                if ( skipCopyConstruct( result ) ) continue; // skip certain non-copyable types
    396396                                // type may involve type variables, so apply type substitution to get temporary variable's actual type
     
    423423                        // level. Trying to pass that environment along.
    424424                        callExpr->set_env( impCpCtorExpr->get_env()->clone() );
    425                         Type * result = appExpr->get_result();
    426                         if ( ! result->isVoid() ) {
    427                                 // need to flatten result type and construct each
     425                        for ( Type * result : appExpr->get_results() ) {
    428426                                result = result->clone();
    429427                                impCpCtorExpr->get_env()->apply( result );
     
    481479                                // know the result type of the assignment is the type of the LHS (minus the pointer), so
    482480                                // add that onto the assignment expression so that later steps have the necessary information
    483                                 assign->set_result( returnDecl->get_type()->clone() );
     481                                assign->add_result( returnDecl->get_type()->clone() );
    484482
    485483                                Expression * retExpr = new CommaExpr( assign, new VariableExpr( returnDecl ) );
    486                                 if ( callExpr->get_result()->get_isLvalue() ) {
     484                                if ( callExpr->get_results().front()->get_isLvalue() ) {
    487485                                        // lvalue returning functions are funny. Lvalue.cc inserts a *? in front of any lvalue returning
    488486                                        // non-intrinsic function. Add an AddressExpr to the call to negate the derefence and change the
     
    502500                                        UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) );
    503501                                        deref->get_args().push_back( retExpr );
    504                                         deref->set_result( resultType );
     502                                        deref->add_result( resultType );
    505503                                        retExpr = deref;
    506504                                } // if
     
    941939                Expression * FixCtorExprs::mutate( ConstructorExpr * ctorExpr ) {
    942940                        static UniqueName tempNamer( "_tmp_ctor_expr" );
    943                         assert( ctorExpr->has_result() && ctorExpr->get_result()->size() == 1 );
    944                         ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr );
     941                        assert( ctorExpr->get_results().size() == 1 );
     942                        ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_results().front()->clone(), nullptr );
    945943                        addDeclaration( tmp );
    946944
     
    954952                        assign->get_args().push_back( new VariableExpr( tmp ) );
    955953                        assign->get_args().push_back( firstArg );
    956                         assign->set_result( ctorExpr->get_result()->clone() );
     954                        cloneAll( ctorExpr->get_results(), assign->get_results() );
    957955                        firstArg = assign;
    958956
  • src/InitTweak/InitTweak.cc

    r12bc63a rfc4a0fa  
    340340                return allofCtorDtor( stmt, []( Expression * callExpr ){
    341341                        if ( ApplicationExpr * appExpr = isIntrinsicCallExpr( callExpr ) ) {
    342                                 FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_result() );
     342                                assert( ! appExpr->get_function()->get_results().empty() );
     343                                FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_results().front() );
    343344                                assert( funcType );
    344345                                return funcType->get_parameters().size() == 1;
     
    387388                                return memberExpr->get_member()->get_name();
    388389                        } else if ( UntypedMemberExpr * memberExpr = dynamic_cast< UntypedMemberExpr * > ( func ) ) {
    389                                 return funcName( memberExpr->get_member() );
     390                                return memberExpr->get_member();
    390391                        } else {
    391392                                assertf( false, "Unexpected expression type being called as a function in call expression" );
     
    450451                // virtual void visit( LogicalExpr *logicalExpr );
    451452                // virtual void visit( ConditionalExpr *conditionalExpr );
     453                virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; }
     454                virtual void visit( SolvedTupleExpr *tupleExpr ) { isConstExpr = false; }
    452455                virtual void visit( TypeExpr *typeExpr ) { isConstExpr = false; }
    453456                virtual void visit( AsmExpr *asmExpr ) { isConstExpr = false; }
    454457                virtual void visit( UntypedValofExpr *valofExpr ) { isConstExpr = false; }
    455458                virtual void visit( CompoundLiteralExpr *compLitExpr ) { isConstExpr = false; }
    456                 virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; }
    457                 virtual void visit( TupleAssignExpr *tupleExpr ) { isConstExpr = false; }
    458459
    459460                bool isConstExpr;
  • src/Makefile.in

    r12bc63a rfc4a0fa  
    104104        ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) \
    105105        ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) \
     106        ControlStruct/driver_cfa_cpp-LabelTypeChecker.$(OBJEXT) \
    106107        GenPoly/driver_cfa_cpp-Box.$(OBJEXT) \
    107108        GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT) \
     
    188189        SynTree/driver_cfa_cpp-Attribute.$(OBJEXT) \
    189190        Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT) \
    190         Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT)
     191        Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT)
    191192am_driver_cfa_cpp_OBJECTS = $(am__objects_1)
    192193driver_cfa_cpp_OBJECTS = $(am_driver_cfa_cpp_OBJECTS)
     
    360361        ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
    361362        ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
    362         ControlStruct/ForExprMutator.cc GenPoly/Box.cc \
     363        ControlStruct/ForExprMutator.cc \
     364        ControlStruct/LabelTypeChecker.cc GenPoly/Box.cc \
    363365        GenPoly/GenPoly.cc GenPoly/PolyMutator.cc \
    364366        GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc GenPoly/Specialize.cc \
     
    400402        SynTree/AddStmtVisitor.cc SynTree/TypeSubstitution.cc \
    401403        SynTree/Attribute.cc Tuples/TupleAssignment.cc \
    402         Tuples/TupleExpansion.cc
     404        Tuples/NameMatcher.cc
    403405MAINTAINERCLEANFILES = Parser/parser.output ${libdir}/${notdir \
    404406        ${cfa_cpplib_PROGRAMS}}
     
    533535        ControlStruct/$(DEPDIR)/$(am__dirstamp)
    534536ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT):  \
     537        ControlStruct/$(am__dirstamp) \
     538        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     539ControlStruct/driver_cfa_cpp-LabelTypeChecker.$(OBJEXT):  \
    535540        ControlStruct/$(am__dirstamp) \
    536541        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     
    764769Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT):  \
    765770        Tuples/$(am__dirstamp) Tuples/$(DEPDIR)/$(am__dirstamp)
    766 Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT): \
    767         Tuples/$(am__dirstamp) Tuples/$(DEPDIR)/$(am__dirstamp)
     771Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT): Tuples/$(am__dirstamp) \
     772        Tuples/$(DEPDIR)/$(am__dirstamp)
    768773driver/$(am__dirstamp):
    769774        @$(MKDIR_P) driver
     
    786791        -rm -f ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT)
    787792        -rm -f ControlStruct/driver_cfa_cpp-LabelGenerator.$(OBJEXT)
     793        -rm -f ControlStruct/driver_cfa_cpp-LabelTypeChecker.$(OBJEXT)
    788794        -rm -f ControlStruct/driver_cfa_cpp-MLEMutator.$(OBJEXT)
    789795        -rm -f ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT)
     
    871877        -rm -f SynTree/driver_cfa_cpp-Visitor.$(OBJEXT)
    872878        -rm -f SynTree/driver_cfa_cpp-VoidType.$(OBJEXT)
     879        -rm -f Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT)
    873880        -rm -f Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT)
    874         -rm -f Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT)
    875881
    876882distclean-compile:
     
    890896@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po@am__quote@
    891897@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Po@am__quote@
     898@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Po@am__quote@
    892899@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-MLEMutator.Po@am__quote@
    893900@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Po@am__quote@
     
    975982@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po@am__quote@
    976983@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Po@am__quote@
     984@AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po@am__quote@
    977985@AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Po@am__quote@
    978 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po@am__quote@
    979986
    980987.cc.o:
     
    12041211@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-ForExprMutator.obj `if test -f 'ControlStruct/ForExprMutator.cc'; then $(CYGPATH_W) 'ControlStruct/ForExprMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ForExprMutator.cc'; fi`
    12051212
     1213ControlStruct/driver_cfa_cpp-LabelTypeChecker.o: ControlStruct/LabelTypeChecker.cc
     1214@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelTypeChecker.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.o `test -f 'ControlStruct/LabelTypeChecker.cc' || echo '$(srcdir)/'`ControlStruct/LabelTypeChecker.cc
     1215@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Po
     1216@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/LabelTypeChecker.cc' object='ControlStruct/driver_cfa_cpp-LabelTypeChecker.o' libtool=no @AMDEPBACKSLASH@
     1217@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1218@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.o `test -f 'ControlStruct/LabelTypeChecker.cc' || echo '$(srcdir)/'`ControlStruct/LabelTypeChecker.cc
     1219
     1220ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj: ControlStruct/LabelTypeChecker.cc
     1221@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj `if test -f 'ControlStruct/LabelTypeChecker.cc'; then $(CYGPATH_W) 'ControlStruct/LabelTypeChecker.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/LabelTypeChecker.cc'; fi`
     1222@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Po
     1223@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/LabelTypeChecker.cc' object='ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj' libtool=no @AMDEPBACKSLASH@
     1224@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1225@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj `if test -f 'ControlStruct/LabelTypeChecker.cc'; then $(CYGPATH_W) 'ControlStruct/LabelTypeChecker.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/LabelTypeChecker.cc'; fi`
     1226
    12061227GenPoly/driver_cfa_cpp-Box.o: GenPoly/Box.cc
    12071228@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Box.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Tpo -c -o GenPoly/driver_cfa_cpp-Box.o `test -f 'GenPoly/Box.cc' || echo '$(srcdir)/'`GenPoly/Box.cc
     
    23802401@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleAssignment.obj `if test -f 'Tuples/TupleAssignment.cc'; then $(CYGPATH_W) 'Tuples/TupleAssignment.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleAssignment.cc'; fi`
    23812402
    2382 Tuples/driver_cfa_cpp-TupleExpansion.o: Tuples/TupleExpansion.cc
    2383 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-TupleExpansion.o -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo -c -o Tuples/driver_cfa_cpp-TupleExpansion.o `test -f 'Tuples/TupleExpansion.cc' || echo '$(srcdir)/'`Tuples/TupleExpansion.cc
    2384 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po
    2385 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/TupleExpansion.cc' object='Tuples/driver_cfa_cpp-TupleExpansion.o' libtool=no @AMDEPBACKSLASH@
    2386 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2387 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleExpansion.o `test -f 'Tuples/TupleExpansion.cc' || echo '$(srcdir)/'`Tuples/TupleExpansion.cc
    2388 
    2389 Tuples/driver_cfa_cpp-TupleExpansion.obj: Tuples/TupleExpansion.cc
    2390 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-TupleExpansion.obj -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo -c -o Tuples/driver_cfa_cpp-TupleExpansion.obj `if test -f 'Tuples/TupleExpansion.cc'; then $(CYGPATH_W) 'Tuples/TupleExpansion.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleExpansion.cc'; fi`
    2391 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po
    2392 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/TupleExpansion.cc' object='Tuples/driver_cfa_cpp-TupleExpansion.obj' libtool=no @AMDEPBACKSLASH@
    2393 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2394 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleExpansion.obj `if test -f 'Tuples/TupleExpansion.cc'; then $(CYGPATH_W) 'Tuples/TupleExpansion.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleExpansion.cc'; fi`
     2403Tuples/driver_cfa_cpp-NameMatcher.o: Tuples/NameMatcher.cc
     2404@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-NameMatcher.o -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo -c -o Tuples/driver_cfa_cpp-NameMatcher.o `test -f 'Tuples/NameMatcher.cc' || echo '$(srcdir)/'`Tuples/NameMatcher.cc
     2405@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po
     2406@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/NameMatcher.cc' object='Tuples/driver_cfa_cpp-NameMatcher.o' libtool=no @AMDEPBACKSLASH@
     2407@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2408@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-NameMatcher.o `test -f 'Tuples/NameMatcher.cc' || echo '$(srcdir)/'`Tuples/NameMatcher.cc
     2409
     2410Tuples/driver_cfa_cpp-NameMatcher.obj: Tuples/NameMatcher.cc
     2411@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-NameMatcher.obj -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo -c -o Tuples/driver_cfa_cpp-NameMatcher.obj `if test -f 'Tuples/NameMatcher.cc'; then $(CYGPATH_W) 'Tuples/NameMatcher.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/NameMatcher.cc'; fi`
     2412@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po
     2413@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/NameMatcher.cc' object='Tuples/driver_cfa_cpp-NameMatcher.obj' libtool=no @AMDEPBACKSLASH@
     2414@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2415@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-NameMatcher.obj `if test -f 'Tuples/NameMatcher.cc'; then $(CYGPATH_W) 'Tuples/NameMatcher.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/NameMatcher.cc'; fi`
    23952416
    23962417.ll.cc:
  • src/Parser/ExpressionNode.cc

    r12bc63a rfc4a0fa  
    200200}
    201201
    202 Expression *build_fieldSel( ExpressionNode *expr_node, Expression *member ) {
    203         UntypedMemberExpr *ret = new UntypedMemberExpr( member, maybeMoveBuild< Expression >(expr_node) );
    204         return ret;
    205 }
    206 
    207 Expression *build_pfieldSel( ExpressionNode *expr_node, Expression *member ) {
     202Expression *build_fieldSel( ExpressionNode *expr_node, NameExpr *member ) {
     203        UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), maybeMoveBuild< Expression >(expr_node) );
     204        delete member;
     205        return ret;
     206}
     207
     208Expression *build_pfieldSel( ExpressionNode *expr_node, NameExpr *member ) {
    208209        UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
    209210        deref->get_args().push_back( maybeMoveBuild< Expression >(expr_node) );
    210         UntypedMemberExpr *ret = new UntypedMemberExpr( member, deref );
     211        UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), deref );
     212        delete member;
    211213        return ret;
    212214}
  • src/Parser/ParseNode.h

    r12bc63a rfc4a0fa  
    165165
    166166Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node );
    167 Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member );
    168 Expression * build_pfieldSel( ExpressionNode * expr_node, Expression * member );
     167Expression * build_fieldSel( ExpressionNode * expr_node, NameExpr * member );
     168Expression * build_pfieldSel( ExpressionNode * expr_node, NameExpr * member );
    169169Expression * build_addressOf( ExpressionNode * expr_node );
    170170Expression * build_sizeOfexpr( ExpressionNode * expr_node );
  • src/Parser/parser.cc

    r12bc63a rfc4a0fa  
    10231023       0,   300,   300,   304,   311,   312,   313,   317,   318,   319,
    10241024     323,   324,   328,   329,   333,   334,   338,   342,   343,   354,
    1025      356,   358,   360,   365,   366,   372,   376,   378,   380,   382,
    1026      384,   386,   388,   390,   399,   400,   406,   407,   411,   412,
    1027      416,   420,   422,   424,   426,   431,   434,   436,   438,   443,
    1028      456,   458,   460,   462,   464,   466,   468,   470,   472,   474,
    1029      476,   483,   484,   490,   491,   492,   493,   497,   498,   500,
    1030      505,   506,   508,   510,   515,   516,   518,   523,   524,   526,
    1031      531,   532,   534,   536,   538,   543,   544,   546,   551,   552,
    1032      557,   558,   563,   564,   569,   570,   575,   576,   581,   582,
    1033      585,   587,   592,   597,   598,   600,   606,   607,   611,   612,
    1034      613,   614,   615,   616,   617,   618,   619,   620,   621,   622,
    1035      628,   630,   632,   634,   639,   640,   645,   646,   652,   653,
    1036      659,   660,   661,   662,   663,   664,   665,   666,   667,   677,
    1037      684,   686,   696,   697,   702,   704,   710,   712,   716,   717,
    1038      722,   727,   730,   732,   734,   744,   746,   757,   758,   760,
    1039      764,   766,   770,   771,   776,   777,   781,   786,   787,   791,
    1040      793,   799,   800,   804,   806,   808,   810,   816,   817,   821,
    1041      823,   828,   830,   832,   837,   839,   844,   846,   850,   853,
    1042      857,   860,   864,   866,   868,   870,   875,   877,   879,   884,
    1043      886,   888,   890,   892,   897,   899,   901,   903,   908,   920,
    1044      921,   926,   928,   933,   937,   939,   941,   943,   945,   951,
    1045      952,   958,   959,   963,   964,   969,   971,   977,   978,   980,
    1046      985,   990,  1000,  1002,  1006,  1007,  1012,  1014,  1018,  1019,
    1047     1023,  1025,  1029,  1030,  1034,  1035,  1039,  1040,  1055,  1056,
    1048     1057,  1058,  1059,  1063,  1068,  1075,  1085,  1090,  1095,  1103,
    1049     1108,  1113,  1118,  1123,  1131,  1153,  1158,  1165,  1167,  1174,
    1050     1179,  1184,  1195,  1200,  1205,  1210,  1215,  1224,  1229,  1237,
    1051     1238,  1239,  1240,  1246,  1251,  1259,  1260,  1261,  1262,  1266,
    1052     1267,  1268,  1269,  1274,  1275,  1284,  1285,  1290,  1291,  1296,
    1053     1298,  1300,  1302,  1304,  1307,  1306,  1318,  1319,  1321,  1331,
    1054     1332,  1337,  1339,  1341,  1343,  1345,  1348,  1350,  1353,  1358,
    1055     1360,  1362,  1364,  1366,  1368,  1370,  1372,  1374,  1376,  1378,
    1056     1380,  1382,  1388,  1389,  1391,  1393,  1395,  1400,  1401,  1407,
    1057     1408,  1410,  1412,  1417,  1419,  1421,  1423,  1428,  1429,  1431,
    1058     1433,  1438,  1439,  1441,  1446,  1447,  1449,  1451,  1456,  1458,
    1059     1460,  1465,  1466,  1470,  1472,  1478,  1477,  1481,  1483,  1488,
    1060     1490,  1496,  1497,  1502,  1503,  1505,  1506,  1515,  1516,  1518,
    1061     1520,  1525,  1527,  1533,  1534,  1536,  1539,  1542,  1547,  1548,
    1062     1553,  1558,  1562,  1564,  1570,  1569,  1576,  1578,  1584,  1585,
    1063     1593,  1594,  1598,  1599,  1600,  1602,  1604,  1611,  1612,  1614,
    1064     1616,  1621,  1622,  1628,  1629,  1633,  1634,  1639,  1640,  1641,
    1065     1643,  1651,  1652,  1654,  1657,  1659,  1663,  1664,  1665,  1667,
    1066     1669,  1673,  1678,  1686,  1687,  1696,  1698,  1703,  1704,  1705,
    1067     1709,  1710,  1711,  1715,  1716,  1717,  1721,  1722,  1723,  1728,
    1068     1729,  1730,  1731,  1737,  1738,  1740,  1745,  1746,  1751,  1752,
    1069     1753,  1754,  1755,  1770,  1771,  1776,  1777,  1783,  1785,  1788,
    1070     1790,  1792,  1815,  1816,  1818,  1820,  1825,  1826,  1828,  1833,
    1071     1838,  1839,  1845,  1844,  1848,  1852,  1854,  1856,  1862,  1863,
    1072     1868,  1873,  1875,  1880,  1882,  1883,  1885,  1890,  1892,  1894,
    1073     1899,  1901,  1906,  1911,  1919,  1925,  1924,  1938,  1939,  1944,
    1074     1945,  1949,  1954,  1959,  1967,  1972,  1983,  1984,  1989,  1990,
    1075     1996,  1997,  2001,  2002,  2003,  2006,  2005,  2016,  2025,  2031,
    1076     2037,  2046,  2052,  2058,  2064,  2070,  2078,  2084,  2092,  2098,
    1077     2107,  2108,  2109,  2113,  2117,  2119,  2124,  2125,  2129,  2130,
    1078     2135,  2141,  2142,  2145,  2147,  2148,  2152,  2153,  2154,  2155,
    1079     2189,  2191,  2192,  2194,  2199,  2204,  2209,  2211,  2213,  2218,
    1080     2220,  2222,  2224,  2229,  2231,  2240,  2242,  2243,  2248,  2250,
    1081     2252,  2257,  2259,  2261,  2266,  2268,  2270,  2279,  2280,  2281,
    1082     2285,  2287,  2289,  2294,  2296,  2298,  2303,  2305,  2307,  2322,
    1083     2324,  2325,  2327,  2332,  2333,  2338,  2340,  2342,  2347,  2349,
    1084     2351,  2353,  2358,  2360,  2362,  2372,  2374,  2375,  2377,  2382,
    1085     2384,  2386,  2391,  2393,  2395,  2397,  2402,  2404,  2406,  2437,
    1086     2439,  2440,  2442,  2447,  2452,  2460,  2462,  2464,  2469,  2471,
    1087     2476,  2478,  2492,  2493,  2495,  2500,  2502,  2504,  2506,  2508,
    1088     2513,  2514,  2516,  2518,  2523,  2525,  2527,  2533,  2535,  2537,
    1089     2541,  2543,  2545,  2547,  2561,  2562,  2564,  2569,  2571,  2573,
    1090     2575,  2577,  2582,  2583,  2585,  2587,  2592,  2594,  2596,  2602,
    1091     2603,  2605,  2614,  2617,  2619,  2622,  2624,  2626,  2639,  2640,
    1092     2642,  2647,  2649,  2651,  2653,  2655,  2660,  2661,  2663,  2665,
    1093     2670,  2672,  2680,  2681,  2682,  2687,  2688,  2692,  2694,  2696,
    1094     2698,  2700,  2702,  2709,  2711,  2713,  2715,  2717,  2719,  2721,
    1095     2723,  2725,  2727,  2732,  2734,  2736,  2741,  2767,  2768,  2770,
    1096     2774,  2775,  2779,  2781,  2783,  2785,  2787,  2789,  2796,  2798,
    1097     2800,  2802,  2804,  2806,  2811,  2816,  2818,  2820,  2838,  2840,
    1098     2845,  2846
     1025     356,   358,   360,   365,   366,   372,   376,   378,   379,   381,
     1026     382,   384,   386,   388,   397,   398,   404,   405,   409,   410,
     1027     414,   418,   420,   422,   424,   429,   432,   434,   436,   441,
     1028     454,   456,   458,   460,   462,   464,   466,   468,   470,   472,
     1029     474,   481,   482,   488,   489,   490,   491,   495,   496,   498,
     1030     503,   504,   506,   508,   513,   514,   516,   521,   522,   524,
     1031     529,   530,   532,   534,   536,   541,   542,   544,   549,   550,
     1032     555,   556,   561,   562,   567,   568,   573,   574,   579,   580,
     1033     583,   585,   590,   595,   596,   598,   604,   605,   609,   610,
     1034     611,   612,   613,   614,   615,   616,   617,   618,   619,   620,
     1035     626,   628,   630,   632,   637,   638,   643,   644,   650,   651,
     1036     657,   658,   659,   660,   661,   662,   663,   664,   665,   675,
     1037     682,   684,   694,   695,   700,   702,   708,   710,   714,   715,
     1038     720,   725,   728,   730,   732,   742,   744,   755,   756,   758,
     1039     762,   764,   768,   769,   774,   775,   779,   784,   785,   789,
     1040     791,   797,   798,   802,   804,   806,   808,   814,   815,   819,
     1041     821,   826,   828,   830,   835,   837,   842,   844,   848,   851,
     1042     855,   858,   862,   864,   866,   868,   873,   875,   877,   882,
     1043     884,   886,   888,   890,   895,   897,   899,   901,   906,   918,
     1044     919,   924,   926,   931,   935,   937,   939,   941,   943,   949,
     1045     950,   956,   957,   961,   962,   967,   969,   975,   976,   978,
     1046     983,   988,   998,  1000,  1004,  1005,  1010,  1012,  1016,  1017,
     1047    1021,  1023,  1027,  1028,  1032,  1033,  1037,  1038,  1053,  1054,
     1048    1055,  1056,  1057,  1061,  1066,  1073,  1083,  1088,  1093,  1101,
     1049    1106,  1111,  1116,  1121,  1129,  1151,  1156,  1163,  1165,  1172,
     1050    1177,  1182,  1193,  1198,  1203,  1208,  1213,  1222,  1227,  1235,
     1051    1236,  1237,  1238,  1244,  1249,  1257,  1258,  1259,  1260,  1264,
     1052    1265,  1266,  1267,  1272,  1273,  1282,  1283,  1288,  1289,  1294,
     1053    1296,  1298,  1300,  1302,  1305,  1304,  1316,  1317,  1319,  1329,
     1054    1330,  1335,  1337,  1339,  1341,  1343,  1346,  1348,  1351,  1356,
     1055    1358,  1360,  1362,  1364,  1366,  1368,  1370,  1372,  1374,  1376,
     1056    1378,  1380,  1386,  1387,  1389,  1391,  1393,  1398,  1399,  1405,
     1057    1406,  1408,  1410,  1415,  1417,  1419,  1421,  1426,  1427,  1429,
     1058    1431,  1436,  1437,  1439,  1444,  1445,  1447,  1449,  1454,  1456,
     1059    1458,  1463,  1464,  1468,  1470,  1476,  1475,  1479,  1481,  1486,
     1060    1488,  1494,  1495,  1500,  1501,  1503,  1504,  1513,  1514,  1516,
     1061    1518,  1523,  1525,  1531,  1532,  1534,  1537,  1540,  1545,  1546,
     1062    1551,  1556,  1560,  1562,  1568,  1567,  1574,  1576,  1582,  1583,
     1063    1591,  1592,  1596,  1597,  1598,  1600,  1602,  1609,  1610,  1612,
     1064    1614,  1619,  1620,  1626,  1627,  1631,  1632,  1637,  1638,  1639,
     1065    1641,  1649,  1650,  1652,  1655,  1657,  1661,  1662,  1663,  1665,
     1066    1667,  1671,  1676,  1684,  1685,  1694,  1696,  1701,  1702,  1703,
     1067    1707,  1708,  1709,  1713,  1714,  1715,  1719,  1720,  1721,  1726,
     1068    1727,  1728,  1729,  1735,  1736,  1738,  1743,  1744,  1749,  1750,
     1069    1751,  1752,  1753,  1768,  1769,  1774,  1775,  1781,  1783,  1786,
     1070    1788,  1790,  1813,  1814,  1816,  1818,  1823,  1824,  1826,  1831,
     1071    1836,  1837,  1843,  1842,  1846,  1850,  1852,  1854,  1860,  1861,
     1072    1866,  1871,  1873,  1878,  1880,  1881,  1883,  1888,  1890,  1892,
     1073    1897,  1899,  1904,  1909,  1917,  1923,  1922,  1936,  1937,  1942,
     1074    1943,  1947,  1952,  1957,  1965,  1970,  1981,  1982,  1987,  1988,
     1075    1994,  1995,  1999,  2000,  2001,  2004,  2003,  2014,  2023,  2029,
     1076    2035,  2044,  2050,  2056,  2062,  2068,  2076,  2082,  2090,  2096,
     1077    2105,  2106,  2107,  2111,  2115,  2117,  2122,  2123,  2127,  2128,
     1078    2133,  2139,  2140,  2143,  2145,  2146,  2150,  2151,  2152,  2153,
     1079    2187,  2189,  2190,  2192,  2197,  2202,  2207,  2209,  2211,  2216,
     1080    2218,  2220,  2222,  2227,  2229,  2238,  2240,  2241,  2246,  2248,
     1081    2250,  2255,  2257,  2259,  2264,  2266,  2268,  2277,  2278,  2279,
     1082    2283,  2285,  2287,  2292,  2294,  2296,  2301,  2303,  2305,  2320,
     1083    2322,  2323,  2325,  2330,  2331,  2336,  2338,  2340,  2345,  2347,
     1084    2349,  2351,  2356,  2358,  2360,  2370,  2372,  2373,  2375,  2380,
     1085    2382,  2384,  2389,  2391,  2393,  2395,  2400,  2402,  2404,  2435,
     1086    2437,  2438,  2440,  2445,  2450,  2458,  2460,  2462,  2467,  2469,
     1087    2474,  2476,  2490,  2491,  2493,  2498,  2500,  2502,  2504,  2506,
     1088    2511,  2512,  2514,  2516,  2521,  2523,  2525,  2531,  2533,  2535,
     1089    2539,  2541,  2543,  2545,  2559,  2560,  2562,  2567,  2569,  2571,
     1090    2573,  2575,  2580,  2581,  2583,  2585,  2590,  2592,  2594,  2600,
     1091    2601,  2603,  2612,  2615,  2617,  2620,  2622,  2624,  2637,  2638,
     1092    2640,  2645,  2647,  2649,  2651,  2653,  2658,  2659,  2661,  2663,
     1093    2668,  2670,  2678,  2679,  2680,  2685,  2686,  2690,  2692,  2694,
     1094    2696,  2698,  2700,  2707,  2709,  2711,  2713,  2715,  2717,  2719,
     1095    2721,  2723,  2725,  2730,  2732,  2734,  2739,  2765,  2766,  2768,
     1096    2772,  2773,  2777,  2779,  2781,  2783,  2785,  2787,  2794,  2796,
     1097    2798,  2800,  2802,  2804,  2809,  2814,  2816,  2818,  2836,  2838,
     1098    2843,  2844
    10991099};
    11001100#endif
     
    50775077    break;
    50785078
    5079   case 27:
    5080 
    5081 /* Line 1806 of yacc.c  */
    5082 #line 379 "parser.yy"
    5083     { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(1) - (7)].en), build_tuple( (yyvsp[(5) - (7)].en) ) ) ); }
    5084     break;
    5085 
    50865079  case 28:
    50875080
    50885081/* Line 1806 of yacc.c  */
    5089 #line 381 "parser.yy"
     5082#line 380 "parser.yy"
    50905083    { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(1) - (3)].en), build_varref( (yyvsp[(3) - (3)].tok) ) ) ); }
    50915084    break;
    50925085
    5093   case 29:
     5086  case 30:
    50945087
    50955088/* Line 1806 of yacc.c  */
    50965089#line 383 "parser.yy"
    5097     { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(1) - (7)].en), build_tuple( (yyvsp[(5) - (7)].en) ) ) ); }
    5098     break;
    5099 
    5100   case 30:
     5090    { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, (yyvsp[(1) - (2)].en) ) ); }
     5091    break;
     5092
     5093  case 31:
    51015094
    51025095/* Line 1806 of yacc.c  */
    51035096#line 385 "parser.yy"
    5104     { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, (yyvsp[(1) - (2)].en) ) ); }
    5105     break;
    5106 
    5107   case 31:
     5097    { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::DecrPost, (yyvsp[(1) - (2)].en) ) ); }
     5098    break;
     5099
     5100  case 32:
    51085101
    51095102/* Line 1806 of yacc.c  */
    51105103#line 387 "parser.yy"
    5111     { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::DecrPost, (yyvsp[(1) - (2)].en) ) ); }
    5112     break;
    5113 
    5114   case 32:
     5104    { (yyval.en) = new ExpressionNode( build_compoundLiteral( (yyvsp[(2) - (7)].decl), new InitializerNode( (yyvsp[(5) - (7)].in), true ) ) ); }
     5105    break;
     5106
     5107  case 33:
    51155108
    51165109/* Line 1806 of yacc.c  */
    51175110#line 389 "parser.yy"
    5118     { (yyval.en) = new ExpressionNode( build_compoundLiteral( (yyvsp[(2) - (7)].decl), new InitializerNode( (yyvsp[(5) - (7)].in), true ) ) ); }
    5119     break;
    5120 
    5121   case 33:
    5122 
    5123 /* Line 1806 of yacc.c  */
    5124 #line 391 "parser.yy"
    51255111    {
    51265112                        Token fn;
     
    51335119
    51345120/* Line 1806 of yacc.c  */
    5135 #line 401 "parser.yy"
     5121#line 399 "parser.yy"
    51365122    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) )); }
    51375123    break;
     
    51405126
    51415127/* Line 1806 of yacc.c  */
    5142 #line 406 "parser.yy"
     5128#line 404 "parser.yy"
    51435129    { (yyval.en) = 0; }
    51445130    break;
     
    51475133
    51485134/* Line 1806 of yacc.c  */
    5149 #line 412 "parser.yy"
     5135#line 410 "parser.yy"
    51505136    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); }
    51515137    break;
     
    51545140
    51555141/* Line 1806 of yacc.c  */
    5156 #line 417 "parser.yy"
     5142#line 415 "parser.yy"
    51575143    { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (1)].tok) ) ); }
    51585144    break;
     
    51615147
    51625148/* Line 1806 of yacc.c  */
     5149#line 419 "parser.yy"
     5150    { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); }
     5151    break;
     5152
     5153  case 42:
     5154
     5155/* Line 1806 of yacc.c  */
    51635156#line 421 "parser.yy"
    5164     { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); }
    5165     break;
    5166 
    5167   case 42:
     5157    { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(5) - (7)].en), build_varref( (yyvsp[(1) - (7)].tok) ) ) ); }
     5158    break;
     5159
     5160  case 43:
    51685161
    51695162/* Line 1806 of yacc.c  */
    51705163#line 423 "parser.yy"
    5171     { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(5) - (7)].en), build_varref( (yyvsp[(1) - (7)].tok) ) ) ); }
    5172     break;
    5173 
    5174   case 43:
     5164    { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); }
     5165    break;
     5166
     5167  case 44:
    51755168
    51765169/* Line 1806 of yacc.c  */
    51775170#line 425 "parser.yy"
    5178     { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); }
    5179     break;
    5180 
    5181   case 44:
    5182 
    5183 /* Line 1806 of yacc.c  */
    5184 #line 427 "parser.yy"
    51855171    { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(5) - (7)].en), build_varref( (yyvsp[(1) - (7)].tok) ) ) ); }
    51865172    break;
     
    51895175
    51905176/* Line 1806 of yacc.c  */
     5177#line 433 "parser.yy"
     5178    { (yyval.en) = (yyvsp[(1) - (1)].en); }
     5179    break;
     5180
     5181  case 47:
     5182
     5183/* Line 1806 of yacc.c  */
    51915184#line 435 "parser.yy"
    5192     { (yyval.en) = (yyvsp[(1) - (1)].en); }
    5193     break;
    5194 
    5195   case 47:
     5185    { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); }
     5186    break;
     5187
     5188  case 48:
    51965189
    51975190/* Line 1806 of yacc.c  */
    51985191#line 437 "parser.yy"
    5199     { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); }
    5200     break;
    5201 
    5202   case 48:
    5203 
    5204 /* Line 1806 of yacc.c  */
    5205 #line 439 "parser.yy"
    52065192    { (yyval.en) = (yyvsp[(2) - (2)].en)->set_extension( true ); }
    52075193    break;
     
    52105196
    52115197/* Line 1806 of yacc.c  */
    5212 #line 444 "parser.yy"
     5198#line 442 "parser.yy"
    52135199    {
    52145200                        switch ( (yyvsp[(1) - (2)].op) ) {
     
    52285214
    52295215/* Line 1806 of yacc.c  */
     5216#line 455 "parser.yy"
     5217    { (yyval.en) = new ExpressionNode( build_unary_val( (yyvsp[(1) - (2)].op), (yyvsp[(2) - (2)].en) ) ); }
     5218    break;
     5219
     5220  case 51:
     5221
     5222/* Line 1806 of yacc.c  */
    52305223#line 457 "parser.yy"
    5231     { (yyval.en) = new ExpressionNode( build_unary_val( (yyvsp[(1) - (2)].op), (yyvsp[(2) - (2)].en) ) ); }
    5232     break;
    5233 
    5234   case 51:
     5224    { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Incr, (yyvsp[(2) - (2)].en) ) ); }
     5225    break;
     5226
     5227  case 52:
    52355228
    52365229/* Line 1806 of yacc.c  */
    52375230#line 459 "parser.yy"
    5238     { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Incr, (yyvsp[(2) - (2)].en) ) ); }
    5239     break;
    5240 
    5241   case 52:
     5231    { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Decr, (yyvsp[(2) - (2)].en) ) ); }
     5232    break;
     5233
     5234  case 53:
    52425235
    52435236/* Line 1806 of yacc.c  */
    52445237#line 461 "parser.yy"
    5245     { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Decr, (yyvsp[(2) - (2)].en) ) ); }
    5246     break;
    5247 
    5248   case 53:
     5238    { (yyval.en) = new ExpressionNode( build_sizeOfexpr( (yyvsp[(2) - (2)].en) ) ); }
     5239    break;
     5240
     5241  case 54:
    52495242
    52505243/* Line 1806 of yacc.c  */
    52515244#line 463 "parser.yy"
    5252     { (yyval.en) = new ExpressionNode( build_sizeOfexpr( (yyvsp[(2) - (2)].en) ) ); }
    5253     break;
    5254 
    5255   case 54:
     5245    { (yyval.en) = new ExpressionNode( build_sizeOftype( (yyvsp[(3) - (4)].decl) ) ); }
     5246    break;
     5247
     5248  case 55:
    52565249
    52575250/* Line 1806 of yacc.c  */
    52585251#line 465 "parser.yy"
    5259     { (yyval.en) = new ExpressionNode( build_sizeOftype( (yyvsp[(3) - (4)].decl) ) ); }
    5260     break;
    5261 
    5262   case 55:
     5252    { (yyval.en) = new ExpressionNode( build_alignOfexpr( (yyvsp[(2) - (2)].en) ) ); }
     5253    break;
     5254
     5255  case 56:
    52635256
    52645257/* Line 1806 of yacc.c  */
    52655258#line 467 "parser.yy"
    5266     { (yyval.en) = new ExpressionNode( build_alignOfexpr( (yyvsp[(2) - (2)].en) ) ); }
    5267     break;
    5268 
    5269   case 56:
     5259    { (yyval.en) = new ExpressionNode( build_alignOftype( (yyvsp[(3) - (4)].decl) ) ); }
     5260    break;
     5261
     5262  case 57:
    52705263
    52715264/* Line 1806 of yacc.c  */
    52725265#line 469 "parser.yy"
    5273     { (yyval.en) = new ExpressionNode( build_alignOftype( (yyvsp[(3) - (4)].decl) ) ); }
    5274     break;
    5275 
    5276   case 57:
     5266    { (yyval.en) = new ExpressionNode( build_offsetOf( (yyvsp[(3) - (6)].decl), build_varref( (yyvsp[(5) - (6)].tok) ) ) ); }
     5267    break;
     5268
     5269  case 58:
    52775270
    52785271/* Line 1806 of yacc.c  */
    52795272#line 471 "parser.yy"
    5280     { (yyval.en) = new ExpressionNode( build_offsetOf( (yyvsp[(3) - (6)].decl), build_varref( (yyvsp[(5) - (6)].tok) ) ) ); }
    5281     break;
    5282 
    5283   case 58:
     5273    { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (1)].tok) ), nullptr ) ); }
     5274    break;
     5275
     5276  case 59:
    52845277
    52855278/* Line 1806 of yacc.c  */
    52865279#line 473 "parser.yy"
    5287     { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (1)].tok) ), nullptr ) ); }
    5288     break;
    5289 
    5290   case 59:
     5280    { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].en) ) ); }
     5281    break;
     5282
     5283  case 60:
    52915284
    52925285/* Line 1806 of yacc.c  */
    52935286#line 475 "parser.yy"
    5294     { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].en) ) ); }
    5295     break;
    5296 
    5297   case 60:
    5298 
    5299 /* Line 1806 of yacc.c  */
    5300 #line 477 "parser.yy"
    53015287    { (yyval.en) = new ExpressionNode( build_attrtype( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].decl) ) ); }
    53025288    break;
     
    53055291
    53065292/* Line 1806 of yacc.c  */
    5307 #line 483 "parser.yy"
     5293#line 481 "parser.yy"
    53085294    { (yyval.op) = OperKinds::PointTo; }
    53095295    break;
     
    53125298
    53135299/* Line 1806 of yacc.c  */
    5314 #line 484 "parser.yy"
     5300#line 482 "parser.yy"
    53155301    { (yyval.op) = OperKinds::AddressOf; }
    53165302    break;
     
    53195305
    53205306/* Line 1806 of yacc.c  */
     5307#line 488 "parser.yy"
     5308    { (yyval.op) = OperKinds::UnPlus; }
     5309    break;
     5310
     5311  case 64:
     5312
     5313/* Line 1806 of yacc.c  */
     5314#line 489 "parser.yy"
     5315    { (yyval.op) = OperKinds::UnMinus; }
     5316    break;
     5317
     5318  case 65:
     5319
     5320/* Line 1806 of yacc.c  */
    53215321#line 490 "parser.yy"
    5322     { (yyval.op) = OperKinds::UnPlus; }
    5323     break;
    5324 
    5325   case 64:
     5322    { (yyval.op) = OperKinds::Neg; }
     5323    break;
     5324
     5325  case 66:
    53265326
    53275327/* Line 1806 of yacc.c  */
    53285328#line 491 "parser.yy"
    5329     { (yyval.op) = OperKinds::UnMinus; }
    5330     break;
    5331 
    5332   case 65:
    5333 
    5334 /* Line 1806 of yacc.c  */
    5335 #line 492 "parser.yy"
    5336     { (yyval.op) = OperKinds::Neg; }
    5337     break;
    5338 
    5339   case 66:
    5340 
    5341 /* Line 1806 of yacc.c  */
    5342 #line 493 "parser.yy"
    53435329    { (yyval.op) = OperKinds::BitNeg; }
    53445330    break;
    53455331
    53465332  case 68:
     5333
     5334/* Line 1806 of yacc.c  */
     5335#line 497 "parser.yy"
     5336    { (yyval.en) = new ExpressionNode( build_cast( (yyvsp[(2) - (4)].decl), (yyvsp[(4) - (4)].en) ) ); }
     5337    break;
     5338
     5339  case 69:
    53475340
    53485341/* Line 1806 of yacc.c  */
     
    53515344    break;
    53525345
    5353   case 69:
    5354 
    5355 /* Line 1806 of yacc.c  */
    5356 #line 501 "parser.yy"
    5357     { (yyval.en) = new ExpressionNode( build_cast( (yyvsp[(2) - (4)].decl), (yyvsp[(4) - (4)].en) ) ); }
    5358     break;
    5359 
    53605346  case 71:
    53615347
    53625348/* Line 1806 of yacc.c  */
     5349#line 505 "parser.yy"
     5350    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Mul, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5351    break;
     5352
     5353  case 72:
     5354
     5355/* Line 1806 of yacc.c  */
    53635356#line 507 "parser.yy"
    5364     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Mul, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5365     break;
    5366 
    5367   case 72:
     5357    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Div, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5358    break;
     5359
     5360  case 73:
    53685361
    53695362/* Line 1806 of yacc.c  */
    53705363#line 509 "parser.yy"
    5371     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Div, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5372     break;
    5373 
    5374   case 73:
    5375 
    5376 /* Line 1806 of yacc.c  */
    5377 #line 511 "parser.yy"
    53785364    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Mod, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53795365    break;
     
    53825368
    53835369/* Line 1806 of yacc.c  */
     5370#line 515 "parser.yy"
     5371    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Plus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5372    break;
     5373
     5374  case 76:
     5375
     5376/* Line 1806 of yacc.c  */
    53845377#line 517 "parser.yy"
    5385     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Plus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5386     break;
    5387 
    5388   case 76:
    5389 
    5390 /* Line 1806 of yacc.c  */
    5391 #line 519 "parser.yy"
    53925378    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Minus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53935379    break;
     
    53965382
    53975383/* Line 1806 of yacc.c  */
     5384#line 523 "parser.yy"
     5385    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5386    break;
     5387
     5388  case 79:
     5389
     5390/* Line 1806 of yacc.c  */
    53985391#line 525 "parser.yy"
    5399     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5400     break;
    5401 
    5402   case 79:
    5403 
    5404 /* Line 1806 of yacc.c  */
    5405 #line 527 "parser.yy"
    54065392    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::RShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    54075393    break;
     
    54105396
    54115397/* Line 1806 of yacc.c  */
     5398#line 531 "parser.yy"
     5399    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5400    break;
     5401
     5402  case 82:
     5403
     5404/* Line 1806 of yacc.c  */
    54125405#line 533 "parser.yy"
    5413     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5414     break;
    5415 
    5416   case 82:
     5406    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::GThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5407    break;
     5408
     5409  case 83:
    54175410
    54185411/* Line 1806 of yacc.c  */
    54195412#line 535 "parser.yy"
    5420     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::GThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5421     break;
    5422 
    5423   case 83:
     5413    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5414    break;
     5415
     5416  case 84:
    54245417
    54255418/* Line 1806 of yacc.c  */
    54265419#line 537 "parser.yy"
    5427     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5428     break;
    5429 
    5430   case 84:
    5431 
    5432 /* Line 1806 of yacc.c  */
    5433 #line 539 "parser.yy"
    54345420    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::GEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    54355421    break;
     
    54385424
    54395425/* Line 1806 of yacc.c  */
     5426#line 543 "parser.yy"
     5427    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Eq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5428    break;
     5429
     5430  case 87:
     5431
     5432/* Line 1806 of yacc.c  */
    54405433#line 545 "parser.yy"
    5441     { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Eq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5442     break;
    5443 
    5444   case 87:
    5445 
    5446 /* Line 1806 of yacc.c  */
    5447 #line 547 "parser.yy"
    54485434    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Neq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    54495435    break;
     
    54525438
    54535439/* Line 1806 of yacc.c  */
    5454 #line 553 "parser.yy"
     5440#line 551 "parser.yy"
    54555441    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::BitAnd, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    54565442    break;
     
    54595445
    54605446/* Line 1806 of yacc.c  */
    5461 #line 559 "parser.yy"
     5447#line 557 "parser.yy"
    54625448    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Xor, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    54635449    break;
     
    54665452
    54675453/* Line 1806 of yacc.c  */
    5468 #line 565 "parser.yy"
     5454#line 563 "parser.yy"
    54695455    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::BitOr, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    54705456    break;
     
    54735459
    54745460/* Line 1806 of yacc.c  */
    5475 #line 571 "parser.yy"
     5461#line 569 "parser.yy"
    54765462    { (yyval.en) = new ExpressionNode( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), true ) ); }
    54775463    break;
     
    54805466
    54815467/* Line 1806 of yacc.c  */
    5482 #line 577 "parser.yy"
     5468#line 575 "parser.yy"
    54835469    { (yyval.en) = new ExpressionNode( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), false ) ); }
    54845470    break;
     
    54875473
    54885474/* Line 1806 of yacc.c  */
    5489 #line 583 "parser.yy"
     5475#line 581 "parser.yy"
    54905476    { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (5)].en), (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].en) ) ); }
    54915477    break;
     
    54945480
    54955481/* Line 1806 of yacc.c  */
     5482#line 584 "parser.yy"
     5483    { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (4)].en), (yyvsp[(1) - (4)].en), (yyvsp[(4) - (4)].en) ) ); }
     5484    break;
     5485
     5486  case 101:
     5487
     5488/* Line 1806 of yacc.c  */
    54965489#line 586 "parser.yy"
    5497     { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (4)].en), (yyvsp[(1) - (4)].en), (yyvsp[(4) - (4)].en) ) ); }
    5498     break;
    5499 
    5500   case 101:
    5501 
    5502 /* Line 1806 of yacc.c  */
    5503 #line 588 "parser.yy"
    55045490    { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (5)].en), (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].en) ) ); }
    55055491    break;
     
    55085494
    55095495/* Line 1806 of yacc.c  */
     5496#line 597 "parser.yy"
     5497    { (yyval.en) = new ExpressionNode( build_binary_ptr( (yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     5498    break;
     5499
     5500  case 105:
     5501
     5502/* Line 1806 of yacc.c  */
    55105503#line 599 "parser.yy"
    5511     { (yyval.en) = new ExpressionNode( build_binary_ptr( (yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    5512     break;
    5513 
    5514   case 105:
    5515 
    5516 /* Line 1806 of yacc.c  */
    5517 #line 601 "parser.yy"
    55185504    { (yyval.en) = ( (yyvsp[(2) - (2)].en) == 0 ) ? (yyvsp[(1) - (2)].en) : new ExpressionNode( build_binary_ptr( OperKinds::Assign, (yyvsp[(1) - (2)].en), (yyvsp[(2) - (2)].en) ) ); }
    55195505    break;
     
    55225508
    55235509/* Line 1806 of yacc.c  */
    5524 #line 606 "parser.yy"
     5510#line 604 "parser.yy"
    55255511    { (yyval.en) = nullptr; }
    55265512    break;
     
    55295515
    55305516/* Line 1806 of yacc.c  */
     5517#line 609 "parser.yy"
     5518    { (yyval.op) = OperKinds::Assign; }
     5519    break;
     5520
     5521  case 109:
     5522
     5523/* Line 1806 of yacc.c  */
     5524#line 610 "parser.yy"
     5525    { (yyval.op) = OperKinds::AtAssn; }
     5526    break;
     5527
     5528  case 110:
     5529
     5530/* Line 1806 of yacc.c  */
    55315531#line 611 "parser.yy"
    5532     { (yyval.op) = OperKinds::Assign; }
    5533     break;
    5534 
    5535   case 109:
     5532    { (yyval.op) = OperKinds::MulAssn; }
     5533    break;
     5534
     5535  case 111:
    55365536
    55375537/* Line 1806 of yacc.c  */
    55385538#line 612 "parser.yy"
    5539     { (yyval.op) = OperKinds::AtAssn; }
    5540     break;
    5541 
    5542   case 110:
     5539    { (yyval.op) = OperKinds::DivAssn; }
     5540    break;
     5541
     5542  case 112:
    55435543
    55445544/* Line 1806 of yacc.c  */
    55455545#line 613 "parser.yy"
    5546     { (yyval.op) = OperKinds::MulAssn; }
    5547     break;
    5548 
    5549   case 111:
     5546    { (yyval.op) = OperKinds::ModAssn; }
     5547    break;
     5548
     5549  case 113:
    55505550
    55515551/* Line 1806 of yacc.c  */
    55525552#line 614 "parser.yy"
    5553     { (yyval.op) = OperKinds::DivAssn; }
    5554     break;
    5555 
    5556   case 112:
     5553    { (yyval.op) = OperKinds::PlusAssn; }
     5554    break;
     5555
     5556  case 114:
    55575557
    55585558/* Line 1806 of yacc.c  */
    55595559#line 615 "parser.yy"
    5560     { (yyval.op) = OperKinds::ModAssn; }
    5561     break;
    5562 
    5563   case 113:
     5560    { (yyval.op) = OperKinds::MinusAssn; }
     5561    break;
     5562
     5563  case 115:
    55645564
    55655565/* Line 1806 of yacc.c  */
    55665566#line 616 "parser.yy"
    5567     { (yyval.op) = OperKinds::PlusAssn; }
    5568     break;
    5569 
    5570   case 114:
     5567    { (yyval.op) = OperKinds::LSAssn; }
     5568    break;
     5569
     5570  case 116:
    55715571
    55725572/* Line 1806 of yacc.c  */
    55735573#line 617 "parser.yy"
    5574     { (yyval.op) = OperKinds::MinusAssn; }
    5575     break;
    5576 
    5577   case 115:
     5574    { (yyval.op) = OperKinds::RSAssn; }
     5575    break;
     5576
     5577  case 117:
    55785578
    55795579/* Line 1806 of yacc.c  */
    55805580#line 618 "parser.yy"
    5581     { (yyval.op) = OperKinds::LSAssn; }
    5582     break;
    5583 
    5584   case 116:
     5581    { (yyval.op) = OperKinds::AndAssn; }
     5582    break;
     5583
     5584  case 118:
    55855585
    55865586/* Line 1806 of yacc.c  */
    55875587#line 619 "parser.yy"
    5588     { (yyval.op) = OperKinds::RSAssn; }
    5589     break;
    5590 
    5591   case 117:
     5588    { (yyval.op) = OperKinds::ERAssn; }
     5589    break;
     5590
     5591  case 119:
    55925592
    55935593/* Line 1806 of yacc.c  */
    55945594#line 620 "parser.yy"
    5595     { (yyval.op) = OperKinds::AndAssn; }
    5596     break;
    5597 
    5598   case 118:
    5599 
    5600 /* Line 1806 of yacc.c  */
    5601 #line 621 "parser.yy"
    5602     { (yyval.op) = OperKinds::ERAssn; }
    5603     break;
    5604 
    5605   case 119:
    5606 
    5607 /* Line 1806 of yacc.c  */
    5608 #line 622 "parser.yy"
    56095595    { (yyval.op) = OperKinds::OrAssn; }
    56105596    break;
     
    56135599
    56145600/* Line 1806 of yacc.c  */
     5601#line 627 "parser.yy"
     5602    { (yyval.en) = new ExpressionNode( build_tuple() ); }
     5603    break;
     5604
     5605  case 121:
     5606
     5607/* Line 1806 of yacc.c  */
    56155608#line 629 "parser.yy"
    5616     { (yyval.en) = new ExpressionNode( build_tuple() ); }
    5617     break;
    5618 
    5619   case 121:
     5609    { (yyval.en) = new ExpressionNode( build_tuple( (yyvsp[(3) - (5)].en) ) ); }
     5610    break;
     5611
     5612  case 122:
    56205613
    56215614/* Line 1806 of yacc.c  */
    56225615#line 631 "parser.yy"
    5623     { (yyval.en) = new ExpressionNode( build_tuple( (yyvsp[(3) - (5)].en) ) ); }
    5624     break;
    5625 
    5626   case 122:
     5616    { (yyval.en) = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( (yyvsp[(4) - (6)].en) ) ) ); }
     5617    break;
     5618
     5619  case 123:
    56275620
    56285621/* Line 1806 of yacc.c  */
    56295622#line 633 "parser.yy"
    5630     { (yyval.en) = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( (yyvsp[(4) - (6)].en) ) ) ); }
    5631     break;
    5632 
    5633   case 123:
    5634 
    5635 /* Line 1806 of yacc.c  */
    5636 #line 635 "parser.yy"
    56375623    { (yyval.en) = new ExpressionNode( build_tuple( (ExpressionNode *)(yyvsp[(3) - (7)].en)->set_last( (yyvsp[(5) - (7)].en) ) ) ); }
    56385624    break;
     
    56415627
    56425628/* Line 1806 of yacc.c  */
    5643 #line 641 "parser.yy"
     5629#line 639 "parser.yy"
    56445630    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); }
    56455631    break;
     
    56485634
    56495635/* Line 1806 of yacc.c  */
    5650 #line 647 "parser.yy"
     5636#line 645 "parser.yy"
    56515637    { (yyval.en) = new ExpressionNode( build_comma( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56525638    break;
     
    56555641
    56565642/* Line 1806 of yacc.c  */
    5657 #line 652 "parser.yy"
     5643#line 650 "parser.yy"
    56585644    { (yyval.en) = 0; }
    56595645    break;
     
    56625648
    56635649/* Line 1806 of yacc.c  */
    5664 #line 661 "parser.yy"
     5650#line 659 "parser.yy"
    56655651    { (yyval.sn) = (yyvsp[(1) - (1)].sn); }
    56665652    break;
     
    56695655
    56705656/* Line 1806 of yacc.c  */
    5671 #line 668 "parser.yy"
     5657#line 666 "parser.yy"
    56725658    {
    56735659                        Token fn;
     
    56805666
    56815667/* Line 1806 of yacc.c  */
    5682 #line 678 "parser.yy"
     5668#line 676 "parser.yy"
    56835669    {
    56845670                        (yyval.sn) = (yyvsp[(4) - (4)].sn)->add_label( (yyvsp[(1) - (4)].tok) );
     
    56895675
    56905676/* Line 1806 of yacc.c  */
    5691 #line 685 "parser.yy"
     5677#line 683 "parser.yy"
    56925678    { (yyval.sn) = new StatementNode( build_compound( (StatementNode *)0 ) ); }
    56935679    break;
     
    56965682
    56975683/* Line 1806 of yacc.c  */
    5698 #line 692 "parser.yy"
     5684#line 690 "parser.yy"
    56995685    { (yyval.sn) = new StatementNode( build_compound( (yyvsp[(5) - (7)].sn) ) ); }
    57005686    break;
     
    57035689
    57045690/* Line 1806 of yacc.c  */
    5705 #line 698 "parser.yy"
     5691#line 696 "parser.yy"
    57065692    { if ( (yyvsp[(1) - (3)].sn) != 0 ) { (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(3) - (3)].sn) ); (yyval.sn) = (yyvsp[(1) - (3)].sn); } }
    57075693    break;
     
    57105696
    57115697/* Line 1806 of yacc.c  */
     5698#line 701 "parser.yy"
     5699    { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); }
     5700    break;
     5701
     5702  case 145:
     5703
     5704/* Line 1806 of yacc.c  */
    57125705#line 703 "parser.yy"
    5713     { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); }
    5714     break;
    5715 
    5716   case 145:
    5717 
    5718 /* Line 1806 of yacc.c  */
    5719 #line 705 "parser.yy"
    57205706    {   // mark all fields in list
    57215707                        for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() )
     
    57285714
    57295715/* Line 1806 of yacc.c  */
    5730 #line 711 "parser.yy"
     5716#line 709 "parser.yy"
    57315717    { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); }
    57325718    break;
     
    57355721
    57365722/* Line 1806 of yacc.c  */
    5737 #line 718 "parser.yy"
     5723#line 716 "parser.yy"
    57385724    { if ( (yyvsp[(1) - (2)].sn) != 0 ) { (yyvsp[(1) - (2)].sn)->set_last( (yyvsp[(2) - (2)].sn) ); (yyval.sn) = (yyvsp[(1) - (2)].sn); } }
    57395725    break;
     
    57425728
    57435729/* Line 1806 of yacc.c  */
    5744 #line 723 "parser.yy"
     5730#line 721 "parser.yy"
    57455731    { (yyval.sn) = new StatementNode( build_expr( (yyvsp[(1) - (2)].en) ) ); }
    57465732    break;
     
    57495735
    57505736/* Line 1806 of yacc.c  */
     5737#line 727 "parser.yy"
     5738    { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn), nullptr ) ); }
     5739    break;
     5740
     5741  case 152:
     5742
     5743/* Line 1806 of yacc.c  */
    57515744#line 729 "parser.yy"
    5752     { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn), nullptr ) ); }
    5753     break;
    5754 
    5755   case 152:
     5745    { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].sn), (yyvsp[(7) - (7)].sn) ) ); }
     5746    break;
     5747
     5748  case 153:
    57565749
    57575750/* Line 1806 of yacc.c  */
    57585751#line 731 "parser.yy"
    5759     { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].sn), (yyvsp[(7) - (7)].sn) ) ); }
    5760     break;
    5761 
    5762   case 153:
     5752    { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
     5753    break;
     5754
     5755  case 154:
    57635756
    57645757/* Line 1806 of yacc.c  */
    57655758#line 733 "parser.yy"
    5766     { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
    5767     break;
    5768 
    5769   case 154:
    5770 
    5771 /* Line 1806 of yacc.c  */
    5772 #line 735 "parser.yy"
    57735759    {
    57745760                        StatementNode *sw = new StatementNode( build_switch( (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) ) );
     
    57855771
    57865772/* Line 1806 of yacc.c  */
     5773#line 743 "parser.yy"
     5774    { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
     5775    break;
     5776
     5777  case 156:
     5778
     5779/* Line 1806 of yacc.c  */
    57875780#line 745 "parser.yy"
    5788     { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
    5789     break;
    5790 
    5791   case 156:
    5792 
    5793 /* Line 1806 of yacc.c  */
    5794 #line 747 "parser.yy"
    57955781    {
    57965782                        StatementNode *sw = new StatementNode( build_switch( (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) ) );
     
    58025788
    58035789/* Line 1806 of yacc.c  */
     5790#line 755 "parser.yy"
     5791    { (yyval.en) = (yyvsp[(1) - (1)].en); }
     5792    break;
     5793
     5794  case 158:
     5795
     5796/* Line 1806 of yacc.c  */
    58045797#line 757 "parser.yy"
    5805     { (yyval.en) = (yyvsp[(1) - (1)].en); }
    5806     break;
    5807 
    5808   case 158:
    5809 
    5810 /* Line 1806 of yacc.c  */
    5811 #line 759 "parser.yy"
    58125798    { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    58135799    break;
     
    58165802
    58175803/* Line 1806 of yacc.c  */
     5804#line 762 "parser.yy"
     5805    { (yyval.sn) = new StatementNode( build_case( (yyvsp[(1) - (1)].en) ) ); }
     5806    break;
     5807
     5808  case 161:
     5809
     5810/* Line 1806 of yacc.c  */
    58185811#line 764 "parser.yy"
    5819     { (yyval.sn) = new StatementNode( build_case( (yyvsp[(1) - (1)].en) ) ); }
    5820     break;
    5821 
    5822   case 161:
    5823 
    5824 /* Line 1806 of yacc.c  */
    5825 #line 766 "parser.yy"
    58265812    { (yyval.sn) = (StatementNode *)((yyvsp[(1) - (3)].sn)->set_last( new StatementNode( build_case( (yyvsp[(3) - (3)].en) ) ) ) ); }
    58275813    break;
     
    58305816
    58315817/* Line 1806 of yacc.c  */
    5832 #line 770 "parser.yy"
     5818#line 768 "parser.yy"
    58335819    { (yyval.sn) = (yyvsp[(2) - (3)].sn); }
    58345820    break;
     
    58375823
    58385824/* Line 1806 of yacc.c  */
    5839 #line 771 "parser.yy"
     5825#line 769 "parser.yy"
    58405826    { (yyval.sn) = new StatementNode( build_default() ); }
    58415827    break;
     
    58445830
    58455831/* Line 1806 of yacc.c  */
    5846 #line 777 "parser.yy"
     5832#line 775 "parser.yy"
    58475833    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (2)].sn)->set_last( (yyvsp[(2) - (2)].sn) )); }
    58485834    break;
     
    58515837
    58525838/* Line 1806 of yacc.c  */
    5853 #line 781 "parser.yy"
     5839#line 779 "parser.yy"
    58545840    { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(2) - (2)].sn) ) ) ); }
    58555841    break;
     
    58585844
    58595845/* Line 1806 of yacc.c  */
    5860 #line 786 "parser.yy"
     5846#line 784 "parser.yy"
    58615847    { (yyval.sn) = 0; }
    58625848    break;
     
    58655851
    58665852/* Line 1806 of yacc.c  */
     5853#line 790 "parser.yy"
     5854    { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(2) - (2)].sn) ) ) ); }
     5855    break;
     5856
     5857  case 170:
     5858
     5859/* Line 1806 of yacc.c  */
    58675860#line 792 "parser.yy"
    5868     { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(2) - (2)].sn) ) ) ); }
    5869     break;
    5870 
    5871   case 170:
    5872 
    5873 /* Line 1806 of yacc.c  */
    5874 #line 794 "parser.yy"
    58755861    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(3) - (3)].sn) ) ) ) ) ); }
    58765862    break;
     
    58795865
    58805866/* Line 1806 of yacc.c  */
    5881 #line 799 "parser.yy"
     5867#line 797 "parser.yy"
    58825868    { (yyval.sn) = 0; }
    58835869    break;
     
    58865872
    58875873/* Line 1806 of yacc.c  */
     5874#line 803 "parser.yy"
     5875    { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( (yyvsp[(2) - (2)].sn) ); }
     5876    break;
     5877
     5878  case 174:
     5879
     5880/* Line 1806 of yacc.c  */
    58885881#line 805 "parser.yy"
    5889     { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( (yyvsp[(2) - (2)].sn) ); }
    5890     break;
    5891 
    5892   case 174:
     5882    { (yyval.sn) = (yyvsp[(1) - (3)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(2) - (3)].sn)->set_last( (yyvsp[(3) - (3)].sn) ) ) ) ); }
     5883    break;
     5884
     5885  case 175:
    58935886
    58945887/* Line 1806 of yacc.c  */
    58955888#line 807 "parser.yy"
    5896     { (yyval.sn) = (yyvsp[(1) - (3)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(2) - (3)].sn)->set_last( (yyvsp[(3) - (3)].sn) ) ) ) ); }
    5897     break;
    5898 
    5899   case 175:
     5889    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( (yyvsp[(3) - (3)].sn) ))); }
     5890    break;
     5891
     5892  case 176:
    59005893
    59015894/* Line 1806 of yacc.c  */
    59025895#line 809 "parser.yy"
    5903     { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( (yyvsp[(3) - (3)].sn) ))); }
    5904     break;
    5905 
    5906   case 176:
    5907 
    5908 /* Line 1806 of yacc.c  */
    5909 #line 811 "parser.yy"
    59105896    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (4)].sn)->set_last( (yyvsp[(2) - (4)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(3) - (4)].sn)->set_last( (yyvsp[(4) - (4)].sn) ) ) ) ) ) ); }
    59115897    break;
     
    59145900
    59155901/* Line 1806 of yacc.c  */
    5916 #line 816 "parser.yy"
     5902#line 814 "parser.yy"
    59175903    { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Break ) ); }
    59185904    break;
    59195905
    59205906  case 179:
     5907
     5908/* Line 1806 of yacc.c  */
     5909#line 820 "parser.yy"
     5910    { (yyval.sn) = 0; }
     5911    break;
     5912
     5913  case 180:
    59215914
    59225915/* Line 1806 of yacc.c  */
     
    59255918    break;
    59265919
    5927   case 180:
    5928 
    5929 /* Line 1806 of yacc.c  */
    5930 #line 824 "parser.yy"
    5931     { (yyval.sn) = 0; }
    5932     break;
    5933 
    59345920  case 181:
    59355921
    59365922/* Line 1806 of yacc.c  */
     5923#line 827 "parser.yy"
     5924    { (yyval.sn) = new StatementNode( build_while( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
     5925    break;
     5926
     5927  case 182:
     5928
     5929/* Line 1806 of yacc.c  */
    59375930#line 829 "parser.yy"
    5938     { (yyval.sn) = new StatementNode( build_while( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
    5939     break;
    5940 
    5941   case 182:
     5931    { (yyval.sn) = new StatementNode( build_while( (yyvsp[(5) - (7)].en), (yyvsp[(2) - (7)].sn), true ) ); }
     5932    break;
     5933
     5934  case 183:
    59425935
    59435936/* Line 1806 of yacc.c  */
    59445937#line 831 "parser.yy"
    5945     { (yyval.sn) = new StatementNode( build_while( (yyvsp[(5) - (7)].en), (yyvsp[(2) - (7)].sn), true ) ); }
    5946     break;
    5947 
    5948   case 183:
    5949 
    5950 /* Line 1806 of yacc.c  */
    5951 #line 833 "parser.yy"
    59525938    { (yyval.sn) = new StatementNode( build_for( (yyvsp[(4) - (6)].fctl), (yyvsp[(6) - (6)].sn) ) ); }
    59535939    break;
     
    59565942
    59575943/* Line 1806 of yacc.c  */
     5944#line 836 "parser.yy"
     5945    { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].en) ); }
     5946    break;
     5947
     5948  case 185:
     5949
     5950/* Line 1806 of yacc.c  */
    59585951#line 838 "parser.yy"
    5959     { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].en) ); }
    5960     break;
    5961 
    5962   case 185:
    5963 
    5964 /* Line 1806 of yacc.c  */
    5965 #line 840 "parser.yy"
    59665952    { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (4)].decl), (yyvsp[(2) - (4)].en), (yyvsp[(4) - (4)].en) ); }
    59675953    break;
     
    59705956
    59715957/* Line 1806 of yacc.c  */
    5972 #line 845 "parser.yy"
     5958#line 843 "parser.yy"
    59735959    { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Goto ) ); }
    59745960    break;
     
    59775963
    59785964/* Line 1806 of yacc.c  */
    5979 #line 849 "parser.yy"
     5965#line 847 "parser.yy"
    59805966    { (yyval.sn) = new StatementNode( build_computedgoto( (yyvsp[(3) - (4)].en) ) ); }
    59815967    break;
     
    59845970
    59855971/* Line 1806 of yacc.c  */
    5986 #line 852 "parser.yy"
     5972#line 850 "parser.yy"
    59875973    { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Continue ) ); }
    59885974    break;
     
    59915977
    59925978/* Line 1806 of yacc.c  */
    5993 #line 856 "parser.yy"
     5979#line 854 "parser.yy"
    59945980    { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Continue ) ); }
    59955981    break;
     
    59985984
    59995985/* Line 1806 of yacc.c  */
    6000 #line 859 "parser.yy"
     5986#line 857 "parser.yy"
    60015987    { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Break ) ); }
    60025988    break;
     
    60055991
    60065992/* Line 1806 of yacc.c  */
     5993#line 861 "parser.yy"
     5994    { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Break ) ); }
     5995    break;
     5996
     5997  case 192:
     5998
     5999/* Line 1806 of yacc.c  */
    60076000#line 863 "parser.yy"
    6008     { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Break ) ); }
    6009     break;
    6010 
    6011   case 192:
     6001    { (yyval.sn) = new StatementNode( build_return( (yyvsp[(2) - (3)].en) ) ); }
     6002    break;
     6003
     6004  case 193:
    60126005
    60136006/* Line 1806 of yacc.c  */
    60146007#line 865 "parser.yy"
    6015     { (yyval.sn) = new StatementNode( build_return( (yyvsp[(2) - (3)].en) ) ); }
    6016     break;
    6017 
    6018   case 193:
     6008    { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (3)].en) ) ); }
     6009    break;
     6010
     6011  case 194:
    60196012
    60206013/* Line 1806 of yacc.c  */
     
    60236016    break;
    60246017
    6025   case 194:
     6018  case 195:
    60266019
    60276020/* Line 1806 of yacc.c  */
    60286021#line 869 "parser.yy"
    6029     { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (3)].en) ) ); }
    6030     break;
    6031 
    6032   case 195:
    6033 
    6034 /* Line 1806 of yacc.c  */
    6035 #line 871 "parser.yy"
    60366022    { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (5)].en) ) ); }
    60376023    break;
     
    60406026
    60416027/* Line 1806 of yacc.c  */
     6028#line 874 "parser.yy"
     6029    { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), (yyvsp[(3) - (3)].sn), 0 ) ); }
     6030    break;
     6031
     6032  case 197:
     6033
     6034/* Line 1806 of yacc.c  */
    60426035#line 876 "parser.yy"
    6043     { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), (yyvsp[(3) - (3)].sn), 0 ) ); }
    6044     break;
    6045 
    6046   case 197:
     6036    { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), 0, (yyvsp[(3) - (3)].sn) ) ); }
     6037    break;
     6038
     6039  case 198:
    60476040
    60486041/* Line 1806 of yacc.c  */
    60496042#line 878 "parser.yy"
    6050     { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), 0, (yyvsp[(3) - (3)].sn) ) ); }
    6051     break;
    6052 
    6053   case 198:
    6054 
    6055 /* Line 1806 of yacc.c  */
    6056 #line 880 "parser.yy"
    60576043    { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (4)].sn), (yyvsp[(3) - (4)].sn), (yyvsp[(4) - (4)].sn) ) ); }
    60586044    break;
     
    60616047
    60626048/* Line 1806 of yacc.c  */
     6049#line 885 "parser.yy"
     6050    { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); }
     6051    break;
     6052
     6053  case 201:
     6054
     6055/* Line 1806 of yacc.c  */
    60636056#line 887 "parser.yy"
     6057    { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (6)].sn)->set_last( new StatementNode( build_catch( 0, (yyvsp[(6) - (6)].sn), true ) ) ); }
     6058    break;
     6059
     6060  case 202:
     6061
     6062/* Line 1806 of yacc.c  */
     6063#line 889 "parser.yy"
    60646064    { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); }
    60656065    break;
    60666066
    6067   case 201:
    6068 
    6069 /* Line 1806 of yacc.c  */
    6070 #line 889 "parser.yy"
     6067  case 203:
     6068
     6069/* Line 1806 of yacc.c  */
     6070#line 891 "parser.yy"
    60716071    { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (6)].sn)->set_last( new StatementNode( build_catch( 0, (yyvsp[(6) - (6)].sn), true ) ) ); }
    60726072    break;
    60736073
    6074   case 202:
    6075 
    6076 /* Line 1806 of yacc.c  */
    6077 #line 891 "parser.yy"
    6078     { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); }
    6079     break;
    6080 
    6081   case 203:
    6082 
    6083 /* Line 1806 of yacc.c  */
    6084 #line 893 "parser.yy"
    6085     { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (6)].sn)->set_last( new StatementNode( build_catch( 0, (yyvsp[(6) - (6)].sn), true ) ) ); }
    6086     break;
    6087 
    60886074  case 204:
    60896075
    60906076/* Line 1806 of yacc.c  */
     6077#line 896 "parser.yy"
     6078    { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); }
     6079    break;
     6080
     6081  case 205:
     6082
     6083/* Line 1806 of yacc.c  */
    60916084#line 898 "parser.yy"
     6085    { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (10)].sn)->set_last( new StatementNode( build_catch( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ) ); }
     6086    break;
     6087
     6088  case 206:
     6089
     6090/* Line 1806 of yacc.c  */
     6091#line 900 "parser.yy"
    60926092    { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); }
    60936093    break;
    60946094
    6095   case 205:
    6096 
    6097 /* Line 1806 of yacc.c  */
    6098 #line 900 "parser.yy"
     6095  case 207:
     6096
     6097/* Line 1806 of yacc.c  */
     6098#line 902 "parser.yy"
    60996099    { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (10)].sn)->set_last( new StatementNode( build_catch( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ) ); }
    61006100    break;
    61016101
    6102   case 206:
    6103 
    6104 /* Line 1806 of yacc.c  */
    6105 #line 902 "parser.yy"
    6106     { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); }
    6107     break;
    6108 
    6109   case 207:
    6110 
    6111 /* Line 1806 of yacc.c  */
    6112 #line 904 "parser.yy"
    6113     { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (10)].sn)->set_last( new StatementNode( build_catch( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ) ); }
    6114     break;
    6115 
    61166102  case 208:
    61176103
    61186104/* Line 1806 of yacc.c  */
    6119 #line 909 "parser.yy"
     6105#line 907 "parser.yy"
    61206106    {
    61216107                        (yyval.sn) = new StatementNode( build_finally( (yyvsp[(2) - (2)].sn) ) );
     
    61266112
    61276113/* Line 1806 of yacc.c  */
    6128 #line 922 "parser.yy"
     6114#line 920 "parser.yy"
    61296115    {
    61306116                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    61366122
    61376123/* Line 1806 of yacc.c  */
     6124#line 925 "parser.yy"
     6125    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
     6126    break;
     6127
     6128  case 212:
     6129
     6130/* Line 1806 of yacc.c  */
    61386131#line 927 "parser.yy"
    6139     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    6140     break;
    6141 
    6142   case 212:
    6143 
    6144 /* Line 1806 of yacc.c  */
    6145 #line 929 "parser.yy"
    61466132    {
    61476133                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    61536139
    61546140/* Line 1806 of yacc.c  */
     6141#line 936 "parser.yy"
     6142    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (6)].flag), (yyvsp[(4) - (6)].constant), 0 ) ); }
     6143    break;
     6144
     6145  case 215:
     6146
     6147/* Line 1806 of yacc.c  */
    61556148#line 938 "parser.yy"
    6156     { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (6)].flag), (yyvsp[(4) - (6)].constant), 0 ) ); }
    6157     break;
    6158 
    6159   case 215:
     6149    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (8)].flag), (yyvsp[(4) - (8)].constant), (yyvsp[(6) - (8)].en) ) ); }
     6150    break;
     6151
     6152  case 216:
    61606153
    61616154/* Line 1806 of yacc.c  */
    61626155#line 940 "parser.yy"
    6163     { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (8)].flag), (yyvsp[(4) - (8)].constant), (yyvsp[(6) - (8)].en) ) ); }
    6164     break;
    6165 
    6166   case 216:
     6156    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (10)].flag), (yyvsp[(4) - (10)].constant), (yyvsp[(6) - (10)].en), (yyvsp[(8) - (10)].en) ) ); }
     6157    break;
     6158
     6159  case 217:
    61676160
    61686161/* Line 1806 of yacc.c  */
    61696162#line 942 "parser.yy"
    6170     { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (10)].flag), (yyvsp[(4) - (10)].constant), (yyvsp[(6) - (10)].en), (yyvsp[(8) - (10)].en) ) ); }
    6171     break;
    6172 
    6173   case 217:
     6163    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (12)].flag), (yyvsp[(4) - (12)].constant), (yyvsp[(6) - (12)].en), (yyvsp[(8) - (12)].en), (yyvsp[(10) - (12)].en) ) ); }
     6164    break;
     6165
     6166  case 218:
    61746167
    61756168/* Line 1806 of yacc.c  */
    61766169#line 944 "parser.yy"
    6177     { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (12)].flag), (yyvsp[(4) - (12)].constant), (yyvsp[(6) - (12)].en), (yyvsp[(8) - (12)].en), (yyvsp[(10) - (12)].en) ) ); }
    6178     break;
    6179 
    6180   case 218:
    6181 
    6182 /* Line 1806 of yacc.c  */
    6183 #line 946 "parser.yy"
    61846170    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (14)].flag), (yyvsp[(5) - (14)].constant), 0, (yyvsp[(8) - (14)].en), (yyvsp[(10) - (14)].en), (yyvsp[(12) - (14)].label) ) ); }
    61856171    break;
     
    61886174
    61896175/* Line 1806 of yacc.c  */
     6176#line 949 "parser.yy"
     6177    { (yyval.flag) = false; }
     6178    break;
     6179
     6180  case 220:
     6181
     6182/* Line 1806 of yacc.c  */
    61906183#line 951 "parser.yy"
    6191     { (yyval.flag) = false; }
    6192     break;
    6193 
    6194   case 220:
    6195 
    6196 /* Line 1806 of yacc.c  */
    6197 #line 953 "parser.yy"
    61986184    { (yyval.flag) = true; }
    61996185    break;
     
    62026188
    62036189/* Line 1806 of yacc.c  */
    6204 #line 958 "parser.yy"
     6190#line 956 "parser.yy"
    62056191    { (yyval.en) = 0; }
    62066192    break;
     
    62096195
    62106196/* Line 1806 of yacc.c  */
    6211 #line 965 "parser.yy"
     6197#line 963 "parser.yy"
    62126198    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); }
    62136199    break;
     
    62166202
    62176203/* Line 1806 of yacc.c  */
     6204#line 968 "parser.yy"
     6205    { (yyval.en) = new ExpressionNode( build_asmexpr( 0, (yyvsp[(1) - (4)].constant), (yyvsp[(3) - (4)].en) ) ); }
     6206    break;
     6207
     6208  case 226:
     6209
     6210/* Line 1806 of yacc.c  */
    62186211#line 970 "parser.yy"
    6219     { (yyval.en) = new ExpressionNode( build_asmexpr( 0, (yyvsp[(1) - (4)].constant), (yyvsp[(3) - (4)].en) ) ); }
    6220     break;
    6221 
    6222   case 226:
    6223 
    6224 /* Line 1806 of yacc.c  */
    6225 #line 972 "parser.yy"
    62266212    { (yyval.en) = new ExpressionNode( build_asmexpr( (yyvsp[(2) - (7)].en), (yyvsp[(4) - (7)].constant), (yyvsp[(6) - (7)].en) ) ); }
    62276213    break;
     
    62306216
    62316217/* Line 1806 of yacc.c  */
     6218#line 975 "parser.yy"
     6219    { (yyval.en) = 0; }
     6220    break;
     6221
     6222  case 228:
     6223
     6224/* Line 1806 of yacc.c  */
    62326225#line 977 "parser.yy"
    6233     { (yyval.en) = 0; }
    6234     break;
    6235 
    6236   case 228:
     6226    { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); }
     6227    break;
     6228
     6229  case 229:
    62376230
    62386231/* Line 1806 of yacc.c  */
    62396232#line 979 "parser.yy"
    6240     { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); }
    6241     break;
    6242 
    6243   case 229:
    6244 
    6245 /* Line 1806 of yacc.c  */
    6246 #line 981 "parser.yy"
    62476233    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( new ExpressionNode( (yyvsp[(3) - (3)].constant) ) ); }
    62486234    break;
     
    62516237
    62526238/* Line 1806 of yacc.c  */
    6253 #line 986 "parser.yy"
     6239#line 984 "parser.yy"
    62546240    {
    62556241                        (yyval.label) = new LabelNode(); (yyval.label)->labels.push_back( *(yyvsp[(1) - (1)].tok) );
     
    62616247
    62626248/* Line 1806 of yacc.c  */
    6263 #line 991 "parser.yy"
     6249#line 989 "parser.yy"
    62646250    {
    62656251                        (yyval.label) = (yyvsp[(1) - (3)].label); (yyvsp[(1) - (3)].label)->labels.push_back( *(yyvsp[(3) - (3)].tok) );
     
    62716257
    62726258/* Line 1806 of yacc.c  */
    6273 #line 1001 "parser.yy"
     6259#line 999 "parser.yy"
    62746260    { (yyval.decl) = 0; }
    62756261    break;
     
    62786264
    62796265/* Line 1806 of yacc.c  */
    6280 #line 1008 "parser.yy"
     6266#line 1006 "parser.yy"
    62816267    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); }
    62826268    break;
     
    62856271
    62866272/* Line 1806 of yacc.c  */
    6287 #line 1013 "parser.yy"
     6273#line 1011 "parser.yy"
    62886274    { (yyval.decl) = 0; }
    62896275    break;
     
    62926278
    62936279/* Line 1806 of yacc.c  */
    6294 #line 1020 "parser.yy"
     6280#line 1018 "parser.yy"
    62956281    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); }
    62966282    break;
     
    62996285
    63006286/* Line 1806 of yacc.c  */
    6301 #line 1034 "parser.yy"
     6287#line 1032 "parser.yy"
    63026288    {}
    63036289    break;
     
    63066292
    63076293/* Line 1806 of yacc.c  */
    6308 #line 1035 "parser.yy"
     6294#line 1033 "parser.yy"
    63096295    {}
    63106296    break;
     
    63136299
    63146300/* Line 1806 of yacc.c  */
    6315 #line 1064 "parser.yy"
     6301#line 1062 "parser.yy"
    63166302    {
    63176303                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    63236309
    63246310/* Line 1806 of yacc.c  */
    6325 #line 1071 "parser.yy"
     6311#line 1069 "parser.yy"
    63266312    {
    63276313                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    63336319
    63346320/* Line 1806 of yacc.c  */
    6335 #line 1076 "parser.yy"
     6321#line 1074 "parser.yy"
    63366322    {
    63376323                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (6)].tok), TypedefTable::ID );
     
    63436329
    63446330/* Line 1806 of yacc.c  */
    6345 #line 1086 "parser.yy"
     6331#line 1084 "parser.yy"
    63466332    {
    63476333                        typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) );
     
    63536339
    63546340/* Line 1806 of yacc.c  */
    6355 #line 1091 "parser.yy"
     6341#line 1089 "parser.yy"
    63566342    {
    63576343                        typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) );
     
    63636349
    63646350/* Line 1806 of yacc.c  */
    6365 #line 1096 "parser.yy"
     6351#line 1094 "parser.yy"
    63666352    {
    63676353                        typedefTable.setNextIdentifier( *(yyvsp[(3) - (4)].tok) );
     
    63736359
    63746360/* Line 1806 of yacc.c  */
    6375 #line 1104 "parser.yy"
     6361#line 1102 "parser.yy"
    63766362    {
    63776363                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    63836369
    63846370/* Line 1806 of yacc.c  */
    6385 #line 1109 "parser.yy"
     6371#line 1107 "parser.yy"
    63866372    {
    63876373                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    63936379
    63946380/* Line 1806 of yacc.c  */
    6395 #line 1114 "parser.yy"
     6381#line 1112 "parser.yy"
    63966382    {
    63976383                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    64036389
    64046390/* Line 1806 of yacc.c  */
    6405 #line 1119 "parser.yy"
     6391#line 1117 "parser.yy"
    64066392    {
    64076393                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    64136399
    64146400/* Line 1806 of yacc.c  */
    6415 #line 1124 "parser.yy"
     6401#line 1122 "parser.yy"
    64166402    {
    64176403                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::ID );
     
    64236409
    64246410/* Line 1806 of yacc.c  */
    6425 #line 1132 "parser.yy"
     6411#line 1130 "parser.yy"
    64266412    {
    64276413                        (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(3) - (8)].tok), DeclarationNode::newTuple( 0 ), (yyvsp[(6) - (8)].decl), 0, true );
     
    64326418
    64336419/* Line 1806 of yacc.c  */
    6434 #line 1155 "parser.yy"
     6420#line 1153 "parser.yy"
    64356421    {
    64366422                        (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true );
     
    64416427
    64426428/* Line 1806 of yacc.c  */
    6443 #line 1159 "parser.yy"
     6429#line 1157 "parser.yy"
    64446430    {
    64456431                        (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true );
     
    64506436
    64516437/* Line 1806 of yacc.c  */
    6452 #line 1166 "parser.yy"
     6438#line 1164 "parser.yy"
    64536439    { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); }
    64546440    break;
     
    64576443
    64586444/* Line 1806 of yacc.c  */
    6459 #line 1170 "parser.yy"
     6445#line 1168 "parser.yy"
    64606446    { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (9)].decl)->appendList( (yyvsp[(7) - (9)].decl) ) ); }
    64616447    break;
     
    64646450
    64656451/* Line 1806 of yacc.c  */
    6466 #line 1175 "parser.yy"
     6452#line 1173 "parser.yy"
    64676453    {
    64686454                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    64746460
    64756461/* Line 1806 of yacc.c  */
    6476 #line 1180 "parser.yy"
     6462#line 1178 "parser.yy"
    64776463    {
    64786464                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    64846470
    64856471/* Line 1806 of yacc.c  */
    6486 #line 1185 "parser.yy"
     6472#line 1183 "parser.yy"
    64876473    {
    64886474                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::TD );
     
    64946480
    64956481/* Line 1806 of yacc.c  */
    6496 #line 1196 "parser.yy"
     6482#line 1194 "parser.yy"
    64976483    {
    64986484                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    65046490
    65056491/* Line 1806 of yacc.c  */
    6506 #line 1201 "parser.yy"
     6492#line 1199 "parser.yy"
    65076493    {
    65086494                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    65146500
    65156501/* Line 1806 of yacc.c  */
    6516 #line 1206 "parser.yy"
     6502#line 1204 "parser.yy"
    65176503    {
    65186504                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    65246510
    65256511/* Line 1806 of yacc.c  */
    6526 #line 1211 "parser.yy"
     6512#line 1209 "parser.yy"
    65276513    {
    65286514                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    65346520
    65356521/* Line 1806 of yacc.c  */
    6536 #line 1216 "parser.yy"
     6522#line 1214 "parser.yy"
    65376523    {
    65386524                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    65446530
    65456531/* Line 1806 of yacc.c  */
    6546 #line 1225 "parser.yy"
     6532#line 1223 "parser.yy"
    65476533    {
    65486534                        typedefTable.addToEnclosingScope( *(yyvsp[(2) - (4)].tok), TypedefTable::TD );
     
    65546540
    65556541/* Line 1806 of yacc.c  */
    6556 #line 1230 "parser.yy"
     6542#line 1228 "parser.yy"
    65576543    {
    65586544                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (7)].tok), TypedefTable::TD );
     
    65646550
    65656551/* Line 1806 of yacc.c  */
    6566 #line 1247 "parser.yy"
     6552#line 1245 "parser.yy"
    65676553    {
    65686554                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    65746560
    65756561/* Line 1806 of yacc.c  */
    6576 #line 1252 "parser.yy"
     6562#line 1250 "parser.yy"
    65776563    {
    65786564                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    65846570
    65856571/* Line 1806 of yacc.c  */
    6586 #line 1274 "parser.yy"
     6572#line 1272 "parser.yy"
    65876573    { (yyval.decl) = 0; }
    65886574    break;
     
    65916577
    65926578/* Line 1806 of yacc.c  */
    6593 #line 1286 "parser.yy"
     6579#line 1284 "parser.yy"
    65946580    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    65956581    break;
     
    65986584
    65996585/* Line 1806 of yacc.c  */
     6586#line 1295 "parser.yy"
     6587    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Const ); }
     6588    break;
     6589
     6590  case 300:
     6591
     6592/* Line 1806 of yacc.c  */
    66006593#line 1297 "parser.yy"
    6601     { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Const ); }
    6602     break;
    6603 
    6604   case 300:
     6594    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Restrict ); }
     6595    break;
     6596
     6597  case 301:
    66056598
    66066599/* Line 1806 of yacc.c  */
    66076600#line 1299 "parser.yy"
    6608     { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Restrict ); }
    6609     break;
    6610 
    6611   case 301:
     6601    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Volatile ); }
     6602    break;
     6603
     6604  case 302:
    66126605
    66136606/* Line 1806 of yacc.c  */
    66146607#line 1301 "parser.yy"
    6615     { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Volatile ); }
    6616     break;
    6617 
    6618   case 302:
     6608    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Lvalue ); }
     6609    break;
     6610
     6611  case 303:
    66196612
    66206613/* Line 1806 of yacc.c  */
    66216614#line 1303 "parser.yy"
    6622     { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Lvalue ); }
    6623     break;
    6624 
    6625   case 303:
     6615    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Atomic ); }
     6616    break;
     6617
     6618  case 304:
    66266619
    66276620/* Line 1806 of yacc.c  */
    66286621#line 1305 "parser.yy"
    6629     { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Atomic ); }
    6630     break;
    6631 
    6632   case 304:
    6633 
    6634 /* Line 1806 of yacc.c  */
    6635 #line 1307 "parser.yy"
    66366622    {
    66376623                        typedefTable.enterScope();
     
    66426628
    66436629/* Line 1806 of yacc.c  */
    6644 #line 1311 "parser.yy"
     6630#line 1309 "parser.yy"
    66456631    {
    66466632                        typedefTable.leaveScope();
     
    66526638
    66536639/* Line 1806 of yacc.c  */
     6640#line 1318 "parser.yy"
     6641    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     6642    break;
     6643
     6644  case 308:
     6645
     6646/* Line 1806 of yacc.c  */
    66546647#line 1320 "parser.yy"
     6648    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
     6649    break;
     6650
     6651  case 310:
     6652
     6653/* Line 1806 of yacc.c  */
     6654#line 1331 "parser.yy"
    66556655    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    66566656    break;
    66576657
    6658   case 308:
    6659 
    6660 /* Line 1806 of yacc.c  */
    6661 #line 1322 "parser.yy"
     6658  case 311:
     6659
     6660/* Line 1806 of yacc.c  */
     6661#line 1336 "parser.yy"
     6662    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Extern ); }
     6663    break;
     6664
     6665  case 312:
     6666
     6667/* Line 1806 of yacc.c  */
     6668#line 1338 "parser.yy"
     6669    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Static ); }
     6670    break;
     6671
     6672  case 313:
     6673
     6674/* Line 1806 of yacc.c  */
     6675#line 1340 "parser.yy"
     6676    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Auto ); }
     6677    break;
     6678
     6679  case 314:
     6680
     6681/* Line 1806 of yacc.c  */
     6682#line 1342 "parser.yy"
     6683    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Register ); }
     6684    break;
     6685
     6686  case 315:
     6687
     6688/* Line 1806 of yacc.c  */
     6689#line 1345 "parser.yy"
     6690    { (yyval.decl) = new DeclarationNode; (yyval.decl)->isInline = true; }
     6691    break;
     6692
     6693  case 316:
     6694
     6695/* Line 1806 of yacc.c  */
     6696#line 1347 "parser.yy"
     6697    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Fortran ); }
     6698    break;
     6699
     6700  case 317:
     6701
     6702/* Line 1806 of yacc.c  */
     6703#line 1350 "parser.yy"
     6704    { (yyval.decl) = new DeclarationNode; (yyval.decl)->isNoreturn = true; }
     6705    break;
     6706
     6707  case 318:
     6708
     6709/* Line 1806 of yacc.c  */
     6710#line 1352 "parser.yy"
     6711    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Threadlocal ); }
     6712    break;
     6713
     6714  case 319:
     6715
     6716/* Line 1806 of yacc.c  */
     6717#line 1357 "parser.yy"
     6718    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Char ); }
     6719    break;
     6720
     6721  case 320:
     6722
     6723/* Line 1806 of yacc.c  */
     6724#line 1359 "parser.yy"
     6725    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Double ); }
     6726    break;
     6727
     6728  case 321:
     6729
     6730/* Line 1806 of yacc.c  */
     6731#line 1361 "parser.yy"
     6732    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Float ); }
     6733    break;
     6734
     6735  case 322:
     6736
     6737/* Line 1806 of yacc.c  */
     6738#line 1363 "parser.yy"
     6739    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Int ); }
     6740    break;
     6741
     6742  case 323:
     6743
     6744/* Line 1806 of yacc.c  */
     6745#line 1365 "parser.yy"
     6746    { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Long ); }
     6747    break;
     6748
     6749  case 324:
     6750
     6751/* Line 1806 of yacc.c  */
     6752#line 1367 "parser.yy"
     6753    { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Short ); }
     6754    break;
     6755
     6756  case 325:
     6757
     6758/* Line 1806 of yacc.c  */
     6759#line 1369 "parser.yy"
     6760    { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Signed ); }
     6761    break;
     6762
     6763  case 326:
     6764
     6765/* Line 1806 of yacc.c  */
     6766#line 1371 "parser.yy"
     6767    { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); }
     6768    break;
     6769
     6770  case 327:
     6771
     6772/* Line 1806 of yacc.c  */
     6773#line 1373 "parser.yy"
     6774    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     6775    break;
     6776
     6777  case 328:
     6778
     6779/* Line 1806 of yacc.c  */
     6780#line 1375 "parser.yy"
     6781    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
     6782    break;
     6783
     6784  case 329:
     6785
     6786/* Line 1806 of yacc.c  */
     6787#line 1377 "parser.yy"
     6788    { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
     6789    break;
     6790
     6791  case 330:
     6792
     6793/* Line 1806 of yacc.c  */
     6794#line 1379 "parser.yy"
     6795    { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
     6796    break;
     6797
     6798  case 331:
     6799
     6800/* Line 1806 of yacc.c  */
     6801#line 1381 "parser.yy"
     6802    { (yyval.decl) = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
     6803    break;
     6804
     6805  case 333:
     6806
     6807/* Line 1806 of yacc.c  */
     6808#line 1388 "parser.yy"
     6809    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
     6810    break;
     6811
     6812  case 334:
     6813
     6814/* Line 1806 of yacc.c  */
     6815#line 1390 "parser.yy"
     6816    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     6817    break;
     6818
     6819  case 335:
     6820
     6821/* Line 1806 of yacc.c  */
     6822#line 1392 "parser.yy"
    66626823    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    66636824    break;
    66646825
    6665   case 310:
    6666 
    6667 /* Line 1806 of yacc.c  */
    6668 #line 1333 "parser.yy"
     6826  case 336:
     6827
     6828/* Line 1806 of yacc.c  */
     6829#line 1394 "parser.yy"
     6830    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addType( (yyvsp[(1) - (3)].decl) ); }
     6831    break;
     6832
     6833  case 338:
     6834
     6835/* Line 1806 of yacc.c  */
     6836#line 1400 "parser.yy"
     6837    { (yyval.decl) = (yyvsp[(2) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
     6838    break;
     6839
     6840  case 340:
     6841
     6842/* Line 1806 of yacc.c  */
     6843#line 1407 "parser.yy"
     6844    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
     6845    break;
     6846
     6847  case 341:
     6848
     6849/* Line 1806 of yacc.c  */
     6850#line 1409 "parser.yy"
    66696851    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    66706852    break;
    66716853
    6672   case 311:
    6673 
    6674 /* Line 1806 of yacc.c  */
    6675 #line 1338 "parser.yy"
    6676     { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Extern ); }
    6677     break;
    6678 
    6679   case 312:
    6680 
    6681 /* Line 1806 of yacc.c  */
    6682 #line 1340 "parser.yy"
    6683     { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Static ); }
    6684     break;
    6685 
    6686   case 313:
    6687 
    6688 /* Line 1806 of yacc.c  */
    6689 #line 1342 "parser.yy"
    6690     { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Auto ); }
    6691     break;
    6692 
    6693   case 314:
    6694 
    6695 /* Line 1806 of yacc.c  */
    6696 #line 1344 "parser.yy"
    6697     { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Register ); }
    6698     break;
    6699 
    6700   case 315:
    6701 
    6702 /* Line 1806 of yacc.c  */
    6703 #line 1347 "parser.yy"
    6704     { (yyval.decl) = new DeclarationNode; (yyval.decl)->isInline = true; }
    6705     break;
    6706 
    6707   case 316:
    6708 
    6709 /* Line 1806 of yacc.c  */
    6710 #line 1349 "parser.yy"
    6711     { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Fortran ); }
    6712     break;
    6713 
    6714   case 317:
    6715 
    6716 /* Line 1806 of yacc.c  */
    6717 #line 1352 "parser.yy"
    6718     { (yyval.decl) = new DeclarationNode; (yyval.decl)->isNoreturn = true; }
    6719     break;
    6720 
    6721   case 318:
    6722 
    6723 /* Line 1806 of yacc.c  */
    6724 #line 1354 "parser.yy"
    6725     { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Threadlocal ); }
    6726     break;
    6727 
    6728   case 319:
    6729 
    6730 /* Line 1806 of yacc.c  */
    6731 #line 1359 "parser.yy"
    6732     { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Char ); }
    6733     break;
    6734 
    6735   case 320:
    6736 
    6737 /* Line 1806 of yacc.c  */
    6738 #line 1361 "parser.yy"
    6739     { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Double ); }
    6740     break;
    6741 
    6742   case 321:
    6743 
    6744 /* Line 1806 of yacc.c  */
    6745 #line 1363 "parser.yy"
    6746     { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Float ); }
    6747     break;
    6748 
    6749   case 322:
    6750 
    6751 /* Line 1806 of yacc.c  */
    6752 #line 1365 "parser.yy"
    6753     { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Int ); }
    6754     break;
    6755 
    6756   case 323:
    6757 
    6758 /* Line 1806 of yacc.c  */
    6759 #line 1367 "parser.yy"
    6760     { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Long ); }
    6761     break;
    6762 
    6763   case 324:
    6764 
    6765 /* Line 1806 of yacc.c  */
    6766 #line 1369 "parser.yy"
    6767     { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Short ); }
    6768     break;
    6769 
    6770   case 325:
    6771 
    6772 /* Line 1806 of yacc.c  */
    6773 #line 1371 "parser.yy"
    6774     { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Signed ); }
    6775     break;
    6776 
    6777   case 326:
    6778 
    6779 /* Line 1806 of yacc.c  */
    6780 #line 1373 "parser.yy"
    6781     { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); }
    6782     break;
    6783 
    6784   case 327:
    6785 
    6786 /* Line 1806 of yacc.c  */
    6787 #line 1375 "parser.yy"
    6788     { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Void ); }
    6789     break;
    6790 
    6791   case 328:
    6792 
    6793 /* Line 1806 of yacc.c  */
    6794 #line 1377 "parser.yy"
    6795     { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
    6796     break;
    6797 
    6798   case 329:
    6799 
    6800 /* Line 1806 of yacc.c  */
    6801 #line 1379 "parser.yy"
    6802     { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
    6803     break;
    6804 
    6805   case 330:
    6806 
    6807 /* Line 1806 of yacc.c  */
    6808 #line 1381 "parser.yy"
    6809     { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
    6810     break;
    6811 
    6812   case 331:
    6813 
    6814 /* Line 1806 of yacc.c  */
    6815 #line 1383 "parser.yy"
    6816     { (yyval.decl) = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
    6817     break;
    6818 
    6819   case 333:
    6820 
    6821 /* Line 1806 of yacc.c  */
    6822 #line 1390 "parser.yy"
     6854  case 342:
     6855
     6856/* Line 1806 of yacc.c  */
     6857#line 1411 "parser.yy"
     6858    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addType( (yyvsp[(2) - (2)].decl) ); }
     6859    break;
     6860
     6861  case 343:
     6862
     6863/* Line 1806 of yacc.c  */
     6864#line 1416 "parser.yy"
     6865    { (yyval.decl) = (yyvsp[(3) - (4)].decl); }
     6866    break;
     6867
     6868  case 344:
     6869
     6870/* Line 1806 of yacc.c  */
     6871#line 1418 "parser.yy"
     6872    { (yyval.decl) = DeclarationNode::newTypeof( (yyvsp[(3) - (4)].en) ); }
     6873    break;
     6874
     6875  case 345:
     6876
     6877/* Line 1806 of yacc.c  */
     6878#line 1420 "parser.yy"
     6879    { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].decl) ); }
     6880    break;
     6881
     6882  case 346:
     6883
     6884/* Line 1806 of yacc.c  */
     6885#line 1422 "parser.yy"
     6886    { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); }
     6887    break;
     6888
     6889  case 348:
     6890
     6891/* Line 1806 of yacc.c  */
     6892#line 1428 "parser.yy"
    68236893    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    68246894    break;
    68256895
    6826   case 334:
    6827 
    6828 /* Line 1806 of yacc.c  */
    6829 #line 1392 "parser.yy"
     6896  case 349:
     6897
     6898/* Line 1806 of yacc.c  */
     6899#line 1430 "parser.yy"
    68306900    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    68316901    break;
    68326902
    6833   case 335:
    6834 
    6835 /* Line 1806 of yacc.c  */
    6836 #line 1394 "parser.yy"
     6903  case 350:
     6904
     6905/* Line 1806 of yacc.c  */
     6906#line 1432 "parser.yy"
    68376907    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    68386908    break;
    68396909
    6840   case 336:
    6841 
    6842 /* Line 1806 of yacc.c  */
    6843 #line 1396 "parser.yy"
    6844     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addType( (yyvsp[(1) - (3)].decl) ); }
    6845     break;
    6846 
    6847   case 338:
    6848 
    6849 /* Line 1806 of yacc.c  */
    6850 #line 1402 "parser.yy"
    6851     { (yyval.decl) = (yyvsp[(2) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    6852     break;
    6853 
    6854   case 340:
    6855 
    6856 /* Line 1806 of yacc.c  */
    6857 #line 1409 "parser.yy"
     6910  case 352:
     6911
     6912/* Line 1806 of yacc.c  */
     6913#line 1438 "parser.yy"
    68586914    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    68596915    break;
    68606916
    6861   case 341:
    6862 
    6863 /* Line 1806 of yacc.c  */
    6864 #line 1411 "parser.yy"
     6917  case 353:
     6918
     6919/* Line 1806 of yacc.c  */
     6920#line 1440 "parser.yy"
    68656921    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    68666922    break;
    68676923
    6868   case 342:
    6869 
    6870 /* Line 1806 of yacc.c  */
    6871 #line 1413 "parser.yy"
    6872     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addType( (yyvsp[(2) - (2)].decl) ); }
    6873     break;
    6874 
    6875   case 343:
    6876 
    6877 /* Line 1806 of yacc.c  */
    6878 #line 1418 "parser.yy"
    6879     { (yyval.decl) = (yyvsp[(3) - (4)].decl); }
    6880     break;
    6881 
    6882   case 344:
    6883 
    6884 /* Line 1806 of yacc.c  */
    6885 #line 1420 "parser.yy"
    6886     { (yyval.decl) = DeclarationNode::newTypeof( (yyvsp[(3) - (4)].en) ); }
    6887     break;
    6888 
    6889   case 345:
    6890 
    6891 /* Line 1806 of yacc.c  */
    6892 #line 1422 "parser.yy"
    6893     { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].decl) ); }
    6894     break;
    6895 
    6896   case 346:
    6897 
    6898 /* Line 1806 of yacc.c  */
    6899 #line 1424 "parser.yy"
    6900     { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); }
    6901     break;
    6902 
    6903   case 348:
    6904 
    6905 /* Line 1806 of yacc.c  */
    6906 #line 1430 "parser.yy"
     6924  case 355:
     6925
     6926/* Line 1806 of yacc.c  */
     6927#line 1446 "parser.yy"
    69076928    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    69086929    break;
    69096930
    6910   case 349:
    6911 
    6912 /* Line 1806 of yacc.c  */
    6913 #line 1432 "parser.yy"
     6931  case 356:
     6932
     6933/* Line 1806 of yacc.c  */
     6934#line 1448 "parser.yy"
    69146935    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    69156936    break;
    69166937
    6917   case 350:
    6918 
    6919 /* Line 1806 of yacc.c  */
    6920 #line 1434 "parser.yy"
     6938  case 357:
     6939
     6940/* Line 1806 of yacc.c  */
     6941#line 1450 "parser.yy"
    69216942    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    69226943    break;
    69236944
    6924   case 352:
    6925 
    6926 /* Line 1806 of yacc.c  */
    6927 #line 1440 "parser.yy"
    6928     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    6929     break;
    6930 
    6931   case 353:
    6932 
    6933 /* Line 1806 of yacc.c  */
    6934 #line 1442 "parser.yy"
     6945  case 358:
     6946
     6947/* Line 1806 of yacc.c  */
     6948#line 1455 "parser.yy"
     6949    { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(1) - (1)].tok) ); }
     6950    break;
     6951
     6952  case 359:
     6953
     6954/* Line 1806 of yacc.c  */
     6955#line 1457 "parser.yy"
     6956    { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(2) - (2)].tok) )->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
     6957    break;
     6958
     6959  case 360:
     6960
     6961/* Line 1806 of yacc.c  */
     6962#line 1459 "parser.yy"
    69356963    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    69366964    break;
    69376965
    6938   case 355:
    6939 
    6940 /* Line 1806 of yacc.c  */
    6941 #line 1448 "parser.yy"
    6942     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    6943     break;
    6944 
    6945   case 356:
    6946 
    6947 /* Line 1806 of yacc.c  */
    6948 #line 1450 "parser.yy"
    6949     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    6950     break;
    6951 
    6952   case 357:
    6953 
    6954 /* Line 1806 of yacc.c  */
    6955 #line 1452 "parser.yy"
    6956     { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    6957     break;
    6958 
    6959   case 358:
    6960 
    6961 /* Line 1806 of yacc.c  */
    6962 #line 1457 "parser.yy"
    6963     { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(1) - (1)].tok) ); }
    6964     break;
    6965 
    6966   case 359:
    6967 
    6968 /* Line 1806 of yacc.c  */
    6969 #line 1459 "parser.yy"
    6970     { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(2) - (2)].tok) )->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    6971     break;
    6972 
    6973   case 360:
    6974 
    6975 /* Line 1806 of yacc.c  */
    6976 #line 1461 "parser.yy"
    6977     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    6978     break;
    6979 
    69806966  case 363:
    69816967
    69826968/* Line 1806 of yacc.c  */
     6969#line 1469 "parser.yy"
     6970    { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (4)].aggKey), 0, 0, (yyvsp[(3) - (4)].decl), true ); }
     6971    break;
     6972
     6973  case 364:
     6974
     6975/* Line 1806 of yacc.c  */
    69836976#line 1471 "parser.yy"
    6984     { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (4)].aggKey), 0, 0, (yyvsp[(3) - (4)].decl), true ); }
    6985     break;
    6986 
    6987   case 364:
    6988 
    6989 /* Line 1806 of yacc.c  */
    6990 #line 1473 "parser.yy"
    69916977    {
    69926978                        typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) );
     
    69986984
    69996985/* Line 1806 of yacc.c  */
     6986#line 1476 "parser.yy"
     6987    { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); }
     6988    break;
     6989
     6990  case 366:
     6991
     6992/* Line 1806 of yacc.c  */
    70006993#line 1478 "parser.yy"
    7001     { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); }
    7002     break;
    7003 
    7004   case 366:
     6994    { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (6)].aggKey), (yyvsp[(2) - (6)].tok), 0, (yyvsp[(5) - (6)].decl), true ); }
     6995    break;
     6996
     6997  case 367:
    70056998
    70066999/* Line 1806 of yacc.c  */
    70077000#line 1480 "parser.yy"
    7008     { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (6)].aggKey), (yyvsp[(2) - (6)].tok), 0, (yyvsp[(5) - (6)].decl), true ); }
    7009     break;
    7010 
    7011   case 367:
     7001    { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (7)].aggKey), 0, (yyvsp[(3) - (7)].en), (yyvsp[(6) - (7)].decl), false ); }
     7002    break;
     7003
     7004  case 368:
    70127005
    70137006/* Line 1806 of yacc.c  */
    70147007#line 1482 "parser.yy"
    7015     { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (7)].aggKey), 0, (yyvsp[(3) - (7)].en), (yyvsp[(6) - (7)].decl), false ); }
    7016     break;
    7017 
    7018   case 368:
    7019 
    7020 /* Line 1806 of yacc.c  */
    7021 #line 1484 "parser.yy"
    70227008    { (yyval.decl) = (yyvsp[(2) - (2)].decl); }
    70237009    break;
     
    70267012
    70277013/* Line 1806 of yacc.c  */
     7014#line 1487 "parser.yy"
     7015    { (yyval.aggKey) = DeclarationNode::Struct; }
     7016    break;
     7017
     7018  case 370:
     7019
     7020/* Line 1806 of yacc.c  */
    70287021#line 1489 "parser.yy"
    7029     { (yyval.aggKey) = DeclarationNode::Struct; }
    7030     break;
    7031 
    7032   case 370:
    7033 
    7034 /* Line 1806 of yacc.c  */
    7035 #line 1491 "parser.yy"
    70367022    { (yyval.aggKey) = DeclarationNode::Union; }
    70377023    break;
     
    70407026
    70417027/* Line 1806 of yacc.c  */
     7028#line 1494 "parser.yy"
     7029    { (yyval.decl) = 0; }
     7030    break;
     7031
     7032  case 372:
     7033
     7034/* Line 1806 of yacc.c  */
    70427035#line 1496 "parser.yy"
    7043     { (yyval.decl) = 0; }
    7044     break;
    7045 
    7046   case 372:
    7047 
    7048 /* Line 1806 of yacc.c  */
    7049 #line 1498 "parser.yy"
    70507036    { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); }
    70517037    break;
     
    70547040
    70557041/* Line 1806 of yacc.c  */
    7056 #line 1504 "parser.yy"
     7042#line 1502 "parser.yy"
    70577043    { (yyval.decl) = (yyvsp[(2) - (3)].decl)->set_extension( true ); }
    70587044    break;
     
    70617047
    70627048/* Line 1806 of yacc.c  */
    7063 #line 1507 "parser.yy"
     7049#line 1505 "parser.yy"
    70647050    {   // mark all fields in list
    70657051                        for ( DeclarationNode *iter = (yyvsp[(2) - (3)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() )
     
    70727058
    70737059/* Line 1806 of yacc.c  */
     7060#line 1515 "parser.yy"
     7061    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addName( (yyvsp[(2) - (2)].tok) ); }
     7062    break;
     7063
     7064  case 379:
     7065
     7066/* Line 1806 of yacc.c  */
    70747067#line 1517 "parser.yy"
    7075     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addName( (yyvsp[(2) - (2)].tok) ); }
    7076     break;
    7077 
    7078   case 379:
     7068    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(1) - (3)].decl)->cloneType( (yyvsp[(3) - (3)].tok) ) ); }
     7069    break;
     7070
     7071  case 380:
    70797072
    70807073/* Line 1806 of yacc.c  */
    70817074#line 1519 "parser.yy"
    7082     { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(1) - (3)].decl)->cloneType( (yyvsp[(3) - (3)].tok) ) ); }
    7083     break;
    7084 
    7085   case 380:
    7086 
    7087 /* Line 1806 of yacc.c  */
    7088 #line 1521 "parser.yy"
    70897075    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(1) - (2)].decl)->cloneType( 0 ) ); }
    70907076    break;
     
    70937079
    70947080/* Line 1806 of yacc.c  */
     7081#line 1524 "parser.yy"
     7082    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
     7083    break;
     7084
     7085  case 382:
     7086
     7087/* Line 1806 of yacc.c  */
    70957088#line 1526 "parser.yy"
    7096     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    7097     break;
    7098 
    7099   case 382:
    7100 
    7101 /* Line 1806 of yacc.c  */
    7102 #line 1528 "parser.yy"
    71037089    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(1) - (4)].decl)->cloneBaseType( (yyvsp[(4) - (4)].decl) ) ); }
    71047090    break;
     
    71077093
    71087094/* Line 1806 of yacc.c  */
     7095#line 1531 "parser.yy"
     7096    { (yyval.decl) = DeclarationNode::newName( 0 ); /* XXX */ }
     7097    break;
     7098
     7099  case 384:
     7100
     7101/* Line 1806 of yacc.c  */
    71097102#line 1533 "parser.yy"
    7110     { (yyval.decl) = DeclarationNode::newName( 0 ); /* XXX */ }
    7111     break;
    7112 
    7113   case 384:
    7114 
    7115 /* Line 1806 of yacc.c  */
    7116 #line 1535 "parser.yy"
    71177103    { (yyval.decl) = DeclarationNode::newBitfield( (yyvsp[(1) - (1)].en) ); }
    71187104    break;
     
    71217107
    71227108/* Line 1806 of yacc.c  */
    7123 #line 1538 "parser.yy"
     7109#line 1536 "parser.yy"
    71247110    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); }
    71257111    break;
     
    71287114
    71297115/* Line 1806 of yacc.c  */
    7130 #line 1541 "parser.yy"
     7116#line 1539 "parser.yy"
    71317117    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); }
    71327118    break;
     
    71357121
    71367122/* Line 1806 of yacc.c  */
     7123#line 1545 "parser.yy"
     7124    { (yyval.en) = 0; }
     7125    break;
     7126
     7127  case 389:
     7128
     7129/* Line 1806 of yacc.c  */
    71377130#line 1547 "parser.yy"
    7138     { (yyval.en) = 0; }
    7139     break;
    7140 
    7141   case 389:
    7142 
    7143 /* Line 1806 of yacc.c  */
    7144 #line 1549 "parser.yy"
    71457131    { (yyval.en) = (yyvsp[(1) - (1)].en); }
    71467132    break;
     
    71497135
    71507136/* Line 1806 of yacc.c  */
    7151 #line 1554 "parser.yy"
     7137#line 1552 "parser.yy"
    71527138    { (yyval.en) = (yyvsp[(2) - (2)].en); }
    71537139    break;
     
    71567142
    71577143/* Line 1806 of yacc.c  */
     7144#line 1561 "parser.yy"
     7145    { (yyval.decl) = DeclarationNode::newEnum( 0, (yyvsp[(3) - (5)].decl) ); }
     7146    break;
     7147
     7148  case 393:
     7149
     7150/* Line 1806 of yacc.c  */
    71587151#line 1563 "parser.yy"
    7159     { (yyval.decl) = DeclarationNode::newEnum( 0, (yyvsp[(3) - (5)].decl) ); }
    7160     break;
    7161 
    7162   case 393:
    7163 
    7164 /* Line 1806 of yacc.c  */
    7165 #line 1565 "parser.yy"
    71667152    {
    71677153                        typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) );
     
    71737159
    71747160/* Line 1806 of yacc.c  */
     7161#line 1568 "parser.yy"
     7162    { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); }
     7163    break;
     7164
     7165  case 395:
     7166
     7167/* Line 1806 of yacc.c  */
    71757168#line 1570 "parser.yy"
    7176     { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); }
    7177     break;
    7178 
    7179   case 395:
    7180 
    7181 /* Line 1806 of yacc.c  */
    7182 #line 1572 "parser.yy"
    71837169    { (yyval.decl) = DeclarationNode::newEnum( (yyvsp[(2) - (7)].tok), (yyvsp[(5) - (7)].decl) ); }
    71847170    break;
     
    71877173
    71887174/* Line 1806 of yacc.c  */
     7175#line 1575 "parser.yy"
     7176    { (yyval.decl) = DeclarationNode::newEnumConstant( (yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].en) ); }
     7177    break;
     7178
     7179  case 397:
     7180
     7181/* Line 1806 of yacc.c  */
    71897182#line 1577 "parser.yy"
    7190     { (yyval.decl) = DeclarationNode::newEnumConstant( (yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].en) ); }
    7191     break;
    7192 
    7193   case 397:
    7194 
    7195 /* Line 1806 of yacc.c  */
    7196 #line 1579 "parser.yy"
    71977183    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( DeclarationNode::newEnumConstant( (yyvsp[(3) - (4)].tok), (yyvsp[(4) - (4)].en) ) ); }
    71987184    break;
     
    72017187
    72027188/* Line 1806 of yacc.c  */
     7189#line 1582 "parser.yy"
     7190    { (yyval.en) = 0; }
     7191    break;
     7192
     7193  case 399:
     7194
     7195/* Line 1806 of yacc.c  */
    72037196#line 1584 "parser.yy"
    7204     { (yyval.en) = 0; }
    7205     break;
    7206 
    7207   case 399:
    7208 
    7209 /* Line 1806 of yacc.c  */
    7210 #line 1586 "parser.yy"
    72117197    { (yyval.en) = (yyvsp[(2) - (2)].en); }
    72127198    break;
     
    72157201
    72167202/* Line 1806 of yacc.c  */
    7217 #line 1593 "parser.yy"
     7203#line 1591 "parser.yy"
    72187204    { (yyval.decl) = 0; }
    72197205    break;
     
    72227208
    72237209/* Line 1806 of yacc.c  */
     7210#line 1599 "parser.yy"
     7211    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
     7212    break;
     7213
     7214  case 405:
     7215
     7216/* Line 1806 of yacc.c  */
    72247217#line 1601 "parser.yy"
    7225     { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    7226     break;
    7227 
    7228   case 405:
     7218    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }
     7219    break;
     7220
     7221  case 406:
    72297222
    72307223/* Line 1806 of yacc.c  */
     
    72337226    break;
    72347227
    7235   case 406:
    7236 
    7237 /* Line 1806 of yacc.c  */
    7238 #line 1605 "parser.yy"
    7239     { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }
    7240     break;
    7241 
    72427228  case 408:
     7229
     7230/* Line 1806 of yacc.c  */
     7231#line 1611 "parser.yy"
     7232    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
     7233    break;
     7234
     7235  case 409:
    72437236
    72447237/* Line 1806 of yacc.c  */
     
    72477240    break;
    72487241
    7249   case 409:
     7242  case 410:
    72507243
    72517244/* Line 1806 of yacc.c  */
    72527245#line 1615 "parser.yy"
     7246    { (yyval.decl) = (yyvsp[(1) - (9)].decl)->appendList( (yyvsp[(5) - (9)].decl) )->appendList( (yyvsp[(9) - (9)].decl) ); }
     7247    break;
     7248
     7249  case 412:
     7250
     7251/* Line 1806 of yacc.c  */
     7252#line 1621 "parser.yy"
    72537253    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    72547254    break;
    72557255
    7256   case 410:
    7257 
    7258 /* Line 1806 of yacc.c  */
    7259 #line 1617 "parser.yy"
    7260     { (yyval.decl) = (yyvsp[(1) - (9)].decl)->appendList( (yyvsp[(5) - (9)].decl) )->appendList( (yyvsp[(9) - (9)].decl) ); }
    7261     break;
    7262 
    7263   case 412:
    7264 
    7265 /* Line 1806 of yacc.c  */
    7266 #line 1623 "parser.yy"
     7256  case 413:
     7257
     7258/* Line 1806 of yacc.c  */
     7259#line 1626 "parser.yy"
     7260    { (yyval.decl) = 0; }
     7261    break;
     7262
     7263  case 416:
     7264
     7265/* Line 1806 of yacc.c  */
     7266#line 1633 "parser.yy"
     7267    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }
     7268    break;
     7269
     7270  case 419:
     7271
     7272/* Line 1806 of yacc.c  */
     7273#line 1640 "parser.yy"
    72677274    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    72687275    break;
    72697276
    7270   case 413:
    7271 
    7272 /* Line 1806 of yacc.c  */
    7273 #line 1628 "parser.yy"
    7274     { (yyval.decl) = 0; }
    7275     break;
    7276 
    7277   case 416:
    7278 
    7279 /* Line 1806 of yacc.c  */
    7280 #line 1635 "parser.yy"
    7281     { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }
    7282     break;
    7283 
    7284   case 419:
     7277  case 420:
    72857278
    72867279/* Line 1806 of yacc.c  */
     
    72897282    break;
    72907283
    7291   case 420:
    7292 
    7293 /* Line 1806 of yacc.c  */
    7294 #line 1644 "parser.yy"
    7295     { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    7296     break;
    7297 
    72987284  case 422:
    72997285
    73007286/* Line 1806 of yacc.c  */
    7301 #line 1653 "parser.yy"
     7287#line 1651 "parser.yy"
    73027288    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); }
    73037289    break;
     
    73067292
    73077293/* Line 1806 of yacc.c  */
     7294#line 1654 "parser.yy"
     7295    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); }
     7296    break;
     7297
     7298  case 424:
     7299
     7300/* Line 1806 of yacc.c  */
    73087301#line 1656 "parser.yy"
    7309     { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); }
    7310     break;
    7311 
    7312   case 424:
    7313 
    7314 /* Line 1806 of yacc.c  */
    7315 #line 1658 "parser.yy"
    73167302    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addName( (yyvsp[(3) - (4)].tok) )->addQualifiers( (yyvsp[(1) - (4)].decl) ); }
    73177303    break;
     
    73207306
    73217307/* Line 1806 of yacc.c  */
    7322 #line 1668 "parser.yy"
     7308#line 1666 "parser.yy"
    73237309    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    73247310    break;
     
    73277313
    73287314/* Line 1806 of yacc.c  */
    7329 #line 1674 "parser.yy"
     7315#line 1672 "parser.yy"
    73307316    {
    73317317                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    73377323
    73387324/* Line 1806 of yacc.c  */
    7339 #line 1679 "parser.yy"
     7325#line 1677 "parser.yy"
    73407326    {
    73417327                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    73477333
    73487334/* Line 1806 of yacc.c  */
    7349 #line 1688 "parser.yy"
     7335#line 1686 "parser.yy"
    73507336    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    73517337    break;
     
    73547340
    73557341/* Line 1806 of yacc.c  */
     7342#line 1695 "parser.yy"
     7343    { (yyval.decl) = DeclarationNode::newName( (yyvsp[(1) - (1)].tok) ); }
     7344    break;
     7345
     7346  case 436:
     7347
     7348/* Line 1806 of yacc.c  */
    73567349#line 1697 "parser.yy"
    7357     { (yyval.decl) = DeclarationNode::newName( (yyvsp[(1) - (1)].tok) ); }
    7358     break;
    7359 
    7360   case 436:
    7361 
    7362 /* Line 1806 of yacc.c  */
    7363 #line 1699 "parser.yy"
    73647350    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( DeclarationNode::newName( (yyvsp[(3) - (3)].tok) ) ); }
    73657351    break;
     
    73687354
    73697355/* Line 1806 of yacc.c  */
    7370 #line 1724 "parser.yy"
     7356#line 1722 "parser.yy"
    73717357    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    73727358    break;
     
    73757361
    73767362/* Line 1806 of yacc.c  */
    7377 #line 1732 "parser.yy"
     7363#line 1730 "parser.yy"
    73787364    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    73797365    break;
     
    73827368
    73837369/* Line 1806 of yacc.c  */
     7370#line 1735 "parser.yy"
     7371    { (yyval.in) = 0; }
     7372    break;
     7373
     7374  case 454:
     7375
     7376/* Line 1806 of yacc.c  */
    73847377#line 1737 "parser.yy"
     7378    { (yyval.in) = (yyvsp[(2) - (2)].in); }
     7379    break;
     7380
     7381  case 455:
     7382
     7383/* Line 1806 of yacc.c  */
     7384#line 1739 "parser.yy"
     7385    { (yyval.in) = (yyvsp[(2) - (2)].in)->set_maybeConstructed( false ); }
     7386    break;
     7387
     7388  case 456:
     7389
     7390/* Line 1806 of yacc.c  */
     7391#line 1743 "parser.yy"
     7392    { (yyval.in) = new InitializerNode( (yyvsp[(1) - (1)].en) ); }
     7393    break;
     7394
     7395  case 457:
     7396
     7397/* Line 1806 of yacc.c  */
     7398#line 1744 "parser.yy"
     7399    { (yyval.in) = new InitializerNode( (yyvsp[(2) - (4)].in), true ); }
     7400    break;
     7401
     7402  case 458:
     7403
     7404/* Line 1806 of yacc.c  */
     7405#line 1749 "parser.yy"
    73857406    { (yyval.in) = 0; }
    73867407    break;
    73877408
    7388   case 454:
    7389 
    7390 /* Line 1806 of yacc.c  */
    7391 #line 1739 "parser.yy"
    7392     { (yyval.in) = (yyvsp[(2) - (2)].in); }
    7393     break;
    7394 
    7395   case 455:
    7396 
    7397 /* Line 1806 of yacc.c  */
    7398 #line 1741 "parser.yy"
    7399     { (yyval.in) = (yyvsp[(2) - (2)].in)->set_maybeConstructed( false ); }
    7400     break;
    7401 
    7402   case 456:
    7403 
    7404 /* Line 1806 of yacc.c  */
    7405 #line 1745 "parser.yy"
    7406     { (yyval.in) = new InitializerNode( (yyvsp[(1) - (1)].en) ); }
    7407     break;
    7408 
    7409   case 457:
    7410 
    7411 /* Line 1806 of yacc.c  */
    7412 #line 1746 "parser.yy"
    7413     { (yyval.in) = new InitializerNode( (yyvsp[(2) - (4)].in), true ); }
    7414     break;
    7415 
    7416   case 458:
     7409  case 460:
    74177410
    74187411/* Line 1806 of yacc.c  */
    74197412#line 1751 "parser.yy"
    7420     { (yyval.in) = 0; }
    7421     break;
    7422 
    7423   case 460:
    7424 
    7425 /* Line 1806 of yacc.c  */
    7426 #line 1753 "parser.yy"
    74277413    { (yyval.in) = (yyvsp[(2) - (2)].in)->set_designators( (yyvsp[(1) - (2)].en) ); }
    74287414    break;
     
    74317417
    74327418/* Line 1806 of yacc.c  */
     7419#line 1752 "parser.yy"
     7420    { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (3)].in)->set_last( (yyvsp[(3) - (3)].in) ) ); }
     7421    break;
     7422
     7423  case 462:
     7424
     7425/* Line 1806 of yacc.c  */
    74337426#line 1754 "parser.yy"
    7434     { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (3)].in)->set_last( (yyvsp[(3) - (3)].in) ) ); }
    7435     break;
    7436 
    7437   case 462:
    7438 
    7439 /* Line 1806 of yacc.c  */
    7440 #line 1756 "parser.yy"
    74417427    { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (4)].in)->set_last( (yyvsp[(4) - (4)].in)->set_designators( (yyvsp[(3) - (4)].en) ) ) ); }
    74427428    break;
     
    74457431
    74467432/* Line 1806 of yacc.c  */
    7447 #line 1772 "parser.yy"
     7433#line 1770 "parser.yy"
    74487434    { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (2)].tok) ) ); }
    74497435    break;
     
    74527438
    74537439/* Line 1806 of yacc.c  */
    7454 #line 1778 "parser.yy"
     7440#line 1776 "parser.yy"
    74557441    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (2)].en)->set_last( (yyvsp[(2) - (2)].en) ) ); }
    74567442    break;
     
    74597445
    74607446/* Line 1806 of yacc.c  */
    7461 #line 1784 "parser.yy"
     7447#line 1782 "parser.yy"
    74627448    { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(2) - (2)].tok) ) ); }
    74637449    break;
    74647450
    74657451  case 468:
     7452
     7453/* Line 1806 of yacc.c  */
     7454#line 1785 "parser.yy"
     7455    { (yyval.en) = (yyvsp[(3) - (5)].en); }
     7456    break;
     7457
     7458  case 469:
    74667459
    74677460/* Line 1806 of yacc.c  */
     
    74707463    break;
    74717464
    7472   case 469:
     7465  case 470:
    74737466
    74747467/* Line 1806 of yacc.c  */
    74757468#line 1789 "parser.yy"
    7476     { (yyval.en) = (yyvsp[(3) - (5)].en); }
    7477     break;
    7478 
    7479   case 470:
     7469    { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].en) ) ); }
     7470    break;
     7471
     7472  case 471:
    74807473
    74817474/* Line 1806 of yacc.c  */
    74827475#line 1791 "parser.yy"
    7483     { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].en) ) ); }
    7484     break;
    7485 
    7486   case 471:
    7487 
    7488 /* Line 1806 of yacc.c  */
    7489 #line 1793 "parser.yy"
    74907476    { (yyval.en) = (yyvsp[(4) - (6)].en); }
    74917477    break;
     
    74947480
    74957481/* Line 1806 of yacc.c  */
     7482#line 1815 "parser.yy"
     7483    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
     7484    break;
     7485
     7486  case 474:
     7487
     7488/* Line 1806 of yacc.c  */
    74967489#line 1817 "parser.yy"
     7490    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     7491    break;
     7492
     7493  case 475:
     7494
     7495/* Line 1806 of yacc.c  */
     7496#line 1819 "parser.yy"
     7497    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
     7498    break;
     7499
     7500  case 477:
     7501
     7502/* Line 1806 of yacc.c  */
     7503#line 1825 "parser.yy"
    74977504    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    74987505    break;
    74997506
    7500   case 474:
    7501 
    7502 /* Line 1806 of yacc.c  */
    7503 #line 1819 "parser.yy"
     7507  case 478:
     7508
     7509/* Line 1806 of yacc.c  */
     7510#line 1827 "parser.yy"
    75047511    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    75057512    break;
    75067513
    7507   case 475:
    7508 
    7509 /* Line 1806 of yacc.c  */
    7510 #line 1821 "parser.yy"
    7511     { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    7512     break;
    7513 
    7514   case 477:
    7515 
    7516 /* Line 1806 of yacc.c  */
    7517 #line 1827 "parser.yy"
    7518     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    7519     break;
    7520 
    7521   case 478:
    7522 
    7523 /* Line 1806 of yacc.c  */
    7524 #line 1829 "parser.yy"
    7525     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    7526     break;
    7527 
    75287514  case 479:
    75297515
    75307516/* Line 1806 of yacc.c  */
    7531 #line 1834 "parser.yy"
     7517#line 1832 "parser.yy"
    75327518    { (yyval.decl) = DeclarationNode::newFromTypeGen( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); }
    75337519    break;
     
    75367522
    75377523/* Line 1806 of yacc.c  */
    7538 #line 1840 "parser.yy"
     7524#line 1838 "parser.yy"
    75397525    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(3) - (4)].decl) ); }
    75407526    break;
     
    75437529
    75447530/* Line 1806 of yacc.c  */
     7531#line 1843 "parser.yy"
     7532    { typedefTable.addToEnclosingScope( *(yyvsp[(2) - (2)].tok), TypedefTable::TD ); }
     7533    break;
     7534
     7535  case 483:
     7536
     7537/* Line 1806 of yacc.c  */
    75457538#line 1845 "parser.yy"
    7546     { typedefTable.addToEnclosingScope( *(yyvsp[(2) - (2)].tok), TypedefTable::TD ); }
    7547     break;
    7548 
    7549   case 483:
    7550 
    7551 /* Line 1806 of yacc.c  */
    7552 #line 1847 "parser.yy"
    75537539    { (yyval.decl) = DeclarationNode::newTypeParam( (yyvsp[(1) - (4)].tclass), (yyvsp[(2) - (4)].tok) )->addAssertions( (yyvsp[(4) - (4)].decl) ); }
    75547540    break;
     
    75577543
    75587544/* Line 1806 of yacc.c  */
     7545#line 1851 "parser.yy"
     7546    { (yyval.tclass) = DeclarationNode::Otype; }
     7547    break;
     7548
     7549  case 486:
     7550
     7551/* Line 1806 of yacc.c  */
    75597552#line 1853 "parser.yy"
    7560     { (yyval.tclass) = DeclarationNode::Otype; }
    7561     break;
    7562 
    7563   case 486:
     7553    { (yyval.tclass) = DeclarationNode::Ftype; }
     7554    break;
     7555
     7556  case 487:
    75647557
    75657558/* Line 1806 of yacc.c  */
    75667559#line 1855 "parser.yy"
    7567     { (yyval.tclass) = DeclarationNode::Ftype; }
    7568     break;
    7569 
    7570   case 487:
    7571 
    7572 /* Line 1806 of yacc.c  */
    7573 #line 1857 "parser.yy"
    75747560    { (yyval.tclass) = DeclarationNode::Dtype; }
    75757561    break;
     
    75787564
    75797565/* Line 1806 of yacc.c  */
     7566#line 1860 "parser.yy"
     7567    { (yyval.decl) = 0; }
     7568    break;
     7569
     7570  case 489:
     7571
     7572/* Line 1806 of yacc.c  */
    75807573#line 1862 "parser.yy"
    7581     { (yyval.decl) = 0; }
    7582     break;
    7583 
    7584   case 489:
    7585 
    7586 /* Line 1806 of yacc.c  */
    7587 #line 1864 "parser.yy"
    75887574    { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); }
    75897575    break;
     
    75927578
    75937579/* Line 1806 of yacc.c  */
    7594 #line 1869 "parser.yy"
     7580#line 1867 "parser.yy"
    75957581    {
    75967582                        typedefTable.openTrait( *(yyvsp[(2) - (5)].tok) );
     
    76027588
    76037589/* Line 1806 of yacc.c  */
     7590#line 1872 "parser.yy"
     7591    { (yyval.decl) = (yyvsp[(4) - (5)].decl); }
     7592    break;
     7593
     7594  case 492:
     7595
     7596/* Line 1806 of yacc.c  */
    76047597#line 1874 "parser.yy"
    7605     { (yyval.decl) = (yyvsp[(4) - (5)].decl); }
    7606     break;
    7607 
    7608   case 492:
    7609 
    7610 /* Line 1806 of yacc.c  */
    7611 #line 1876 "parser.yy"
    76127598    { (yyval.decl) = 0; }
    76137599    break;
     
    76167602
    76177603/* Line 1806 of yacc.c  */
    7618 #line 1881 "parser.yy"
     7604#line 1879 "parser.yy"
    76197605    { (yyval.en) = new ExpressionNode( build_typevalue( (yyvsp[(1) - (1)].decl) ) ); }
    76207606    break;
     
    76237609
    76247610/* Line 1806 of yacc.c  */
     7611#line 1882 "parser.yy"
     7612    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( new ExpressionNode( build_typevalue( (yyvsp[(3) - (3)].decl) ) ) ) ); }
     7613    break;
     7614
     7615  case 496:
     7616
     7617/* Line 1806 of yacc.c  */
    76257618#line 1884 "parser.yy"
    7626     { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( new ExpressionNode( build_typevalue( (yyvsp[(3) - (3)].decl) ) ) ) ); }
    7627     break;
    7628 
    7629   case 496:
    7630 
    7631 /* Line 1806 of yacc.c  */
    7632 #line 1886 "parser.yy"
    76337619    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) )); }
    76347620    break;
     
    76377623
    76387624/* Line 1806 of yacc.c  */
     7625#line 1889 "parser.yy"
     7626    { (yyval.decl) = (yyvsp[(2) - (2)].decl); }
     7627    break;
     7628
     7629  case 498:
     7630
     7631/* Line 1806 of yacc.c  */
    76397632#line 1891 "parser.yy"
    7640     { (yyval.decl) = (yyvsp[(2) - (2)].decl); }
    7641     break;
    7642 
    7643   case 498:
     7633    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) ); }
     7634    break;
     7635
     7636  case 499:
    76447637
    76457638/* Line 1806 of yacc.c  */
    76467639#line 1893 "parser.yy"
    7647     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) ); }
    7648     break;
    7649 
    7650   case 499:
    7651 
    7652 /* Line 1806 of yacc.c  */
    7653 #line 1895 "parser.yy"
    76547640    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl)->copyStorageClasses( (yyvsp[(1) - (3)].decl) ) ); }
    76557641    break;
     
    76587644
    76597645/* Line 1806 of yacc.c  */
     7646#line 1898 "parser.yy"
     7647    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addAssertions( (yyvsp[(2) - (2)].decl) ); }
     7648    break;
     7649
     7650  case 501:
     7651
     7652/* Line 1806 of yacc.c  */
    76607653#line 1900 "parser.yy"
    7661     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addAssertions( (yyvsp[(2) - (2)].decl) ); }
    7662     break;
    7663 
    7664   case 501:
    7665 
    7666 /* Line 1806 of yacc.c  */
    7667 #line 1902 "parser.yy"
    76687654    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addAssertions( (yyvsp[(2) - (4)].decl) )->addType( (yyvsp[(4) - (4)].decl) ); }
    76697655    break;
     
    76727658
    76737659/* Line 1806 of yacc.c  */
    7674 #line 1907 "parser.yy"
     7660#line 1905 "parser.yy"
    76757661    {
    76767662                        typedefTable.addToEnclosingScope( *(yyvsp[(1) - (1)].tok), TypedefTable::TD );
     
    76827668
    76837669/* Line 1806 of yacc.c  */
    7684 #line 1912 "parser.yy"
     7670#line 1910 "parser.yy"
    76857671    {
    76867672                        typedefTable.addToEnclosingScope( *(yyvsp[(1) - (6)].tok), TypedefTable::TG );
     
    76927678
    76937679/* Line 1806 of yacc.c  */
    7694 #line 1920 "parser.yy"
     7680#line 1918 "parser.yy"
    76957681    {
    76967682                        typedefTable.addToEnclosingScope( *(yyvsp[(2) - (9)].tok), TypedefTable::ID );
     
    77027688
    77037689/* Line 1806 of yacc.c  */
    7704 #line 1925 "parser.yy"
     7690#line 1923 "parser.yy"
    77057691    {
    77067692                        typedefTable.enterTrait( *(yyvsp[(2) - (8)].tok) );
     
    77127698
    77137699/* Line 1806 of yacc.c  */
    7714 #line 1930 "parser.yy"
     7700#line 1928 "parser.yy"
    77157701    {
    77167702                        typedefTable.leaveTrait();
     
    77237709
    77247710/* Line 1806 of yacc.c  */
    7725 #line 1940 "parser.yy"
     7711#line 1938 "parser.yy"
    77267712    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); }
    77277713    break;
     
    77307716
    77317717/* Line 1806 of yacc.c  */
    7732 #line 1950 "parser.yy"
     7718#line 1948 "parser.yy"
    77337719    {
    77347720                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    77407726
    77417727/* Line 1806 of yacc.c  */
    7742 #line 1955 "parser.yy"
     7728#line 1953 "parser.yy"
    77437729    {
    77447730                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    77507736
    77517737/* Line 1806 of yacc.c  */
    7752 #line 1960 "parser.yy"
     7738#line 1958 "parser.yy"
    77537739    {
    77547740                        typedefTable.addToEnclosingScope2( *(yyvsp[(5) - (5)].tok), TypedefTable::ID );
     
    77607746
    77617747/* Line 1806 of yacc.c  */
    7762 #line 1968 "parser.yy"
     7748#line 1966 "parser.yy"
    77637749    {
    77647750                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    77707756
    77717757/* Line 1806 of yacc.c  */
    7772 #line 1973 "parser.yy"
     7758#line 1971 "parser.yy"
    77737759    {
    77747760                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    77807766
    77817767/* Line 1806 of yacc.c  */
     7768#line 1981 "parser.yy"
     7769    {}
     7770    break;
     7771
     7772  case 517:
     7773
     7774/* Line 1806 of yacc.c  */
    77827775#line 1983 "parser.yy"
     7776    { parseTree = parseTree != nullptr ? parseTree->appendList( (yyvsp[(1) - (1)].decl) ) : (yyvsp[(1) - (1)].decl);    }
     7777    break;
     7778
     7779  case 519:
     7780
     7781/* Line 1806 of yacc.c  */
     7782#line 1989 "parser.yy"
     7783    { (yyval.decl) = (yyvsp[(1) - (3)].decl) != nullptr ? (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ) : (yyvsp[(3) - (3)].decl); }
     7784    break;
     7785
     7786  case 520:
     7787
     7788/* Line 1806 of yacc.c  */
     7789#line 1994 "parser.yy"
     7790    { (yyval.decl) = 0; }
     7791    break;
     7792
     7793  case 524:
     7794
     7795/* Line 1806 of yacc.c  */
     7796#line 2002 "parser.yy"
    77837797    {}
    77847798    break;
    77857799
    7786   case 517:
    7787 
    7788 /* Line 1806 of yacc.c  */
    7789 #line 1985 "parser.yy"
    7790     { parseTree = parseTree != nullptr ? parseTree->appendList( (yyvsp[(1) - (1)].decl) ) : (yyvsp[(1) - (1)].decl);    }
    7791     break;
    7792 
    7793   case 519:
    7794 
    7795 /* Line 1806 of yacc.c  */
    7796 #line 1991 "parser.yy"
    7797     { (yyval.decl) = (yyvsp[(1) - (3)].decl) != nullptr ? (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ) : (yyvsp[(3) - (3)].decl); }
    7798     break;
    7799 
    7800   case 520:
    7801 
    7802 /* Line 1806 of yacc.c  */
    7803 #line 1996 "parser.yy"
    7804     { (yyval.decl) = 0; }
    7805     break;
    7806 
    7807   case 524:
     7800  case 525:
    78087801
    78097802/* Line 1806 of yacc.c  */
    78107803#line 2004 "parser.yy"
    7811     {}
    7812     break;
    7813 
    7814   case 525:
    7815 
    7816 /* Line 1806 of yacc.c  */
    7817 #line 2006 "parser.yy"
    78187804    {
    78197805                        linkageStack.push( linkage );                           // handle nested extern "C"/"Cforall"
     
    78257811
    78267812/* Line 1806 of yacc.c  */
    7827 #line 2011 "parser.yy"
     7813#line 2009 "parser.yy"
    78287814    {
    78297815                        linkage = linkageStack.top();
     
    78367822
    78377823/* Line 1806 of yacc.c  */
    7838 #line 2017 "parser.yy"
     7824#line 2015 "parser.yy"
    78397825    {   // mark all fields in list
    78407826                        for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() )
     
    78477833
    78487834/* Line 1806 of yacc.c  */
    7849 #line 2032 "parser.yy"
     7835#line 2030 "parser.yy"
    78507836    {
    78517837                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    78587844
    78597845/* Line 1806 of yacc.c  */
    7860 #line 2038 "parser.yy"
     7846#line 2036 "parser.yy"
    78617847    {
    78627848                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    78697855
    78707856/* Line 1806 of yacc.c  */
    7871 #line 2047 "parser.yy"
     7857#line 2045 "parser.yy"
    78727858    {
    78737859                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    78807866
    78817867/* Line 1806 of yacc.c  */
    7882 #line 2053 "parser.yy"
     7868#line 2051 "parser.yy"
    78837869    {
    78847870                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    78917877
    78927878/* Line 1806 of yacc.c  */
    7893 #line 2059 "parser.yy"
     7879#line 2057 "parser.yy"
    78947880    {
    78957881                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    79027888
    79037889/* Line 1806 of yacc.c  */
    7904 #line 2065 "parser.yy"
     7890#line 2063 "parser.yy"
    79057891    {
    79067892                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    79137899
    79147900/* Line 1806 of yacc.c  */
    7915 #line 2071 "parser.yy"
     7901#line 2069 "parser.yy"
    79167902    {
    79177903                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    79247910
    79257911/* Line 1806 of yacc.c  */
    7926 #line 2079 "parser.yy"
     7912#line 2077 "parser.yy"
    79277913    {
    79287914                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    79357921
    79367922/* Line 1806 of yacc.c  */
    7937 #line 2085 "parser.yy"
     7923#line 2083 "parser.yy"
    79387924    {
    79397925                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    79467932
    79477933/* Line 1806 of yacc.c  */
    7948 #line 2093 "parser.yy"
     7934#line 2091 "parser.yy"
    79497935    {
    79507936                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    79577943
    79587944/* Line 1806 of yacc.c  */
    7959 #line 2099 "parser.yy"
     7945#line 2097 "parser.yy"
    79607946    {
    79617947                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    79687954
    79697955/* Line 1806 of yacc.c  */
    7970 #line 2114 "parser.yy"
     7956#line 2112 "parser.yy"
    79717957    { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    79727958    break;
     
    79757961
    79767962/* Line 1806 of yacc.c  */
    7977 #line 2119 "parser.yy"
     7963#line 2117 "parser.yy"
    79787964    { delete (yyvsp[(3) - (5)].str); }
    79797965    break;
     
    79827968
    79837969/* Line 1806 of yacc.c  */
    7984 #line 2124 "parser.yy"
     7970#line 2122 "parser.yy"
    79857971    { (yyval.decl) = 0; }
    79867972    break;
     
    79897975
    79907976/* Line 1806 of yacc.c  */
    7991 #line 2131 "parser.yy"
     7977#line 2129 "parser.yy"
    79927978    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    79937979    break;
     
    79967982
    79977983/* Line 1806 of yacc.c  */
    7998 #line 2137 "parser.yy"
     7984#line 2135 "parser.yy"
    79997985    { (yyval.decl) = 0; }
    80007986    break;
     
    80037989
    80047990/* Line 1806 of yacc.c  */
    8005 #line 2148 "parser.yy"
     7991#line 2146 "parser.yy"
    80067992    { delete (yyvsp[(3) - (4)].en); }
    80077993    break;
     
    80107996
    80117997/* Line 1806 of yacc.c  */
     7998#line 2150 "parser.yy"
     7999    { delete (yyvsp[(1) - (1)].tok); }
     8000    break;
     8001
     8002  case 557:
     8003
     8004/* Line 1806 of yacc.c  */
     8005#line 2151 "parser.yy"
     8006    { delete (yyvsp[(1) - (1)].decl); }
     8007    break;
     8008
     8009  case 558:
     8010
     8011/* Line 1806 of yacc.c  */
    80128012#line 2152 "parser.yy"
    8013     { delete (yyvsp[(1) - (1)].tok); }
    8014     break;
    8015 
    8016   case 557:
     8013    { delete (yyvsp[(1) - (1)].decl); }
     8014    break;
     8015
     8016  case 559:
    80178017
    80188018/* Line 1806 of yacc.c  */
     
    80218021    break;
    80228022
    8023   case 558:
    8024 
    8025 /* Line 1806 of yacc.c  */
    8026 #line 2154 "parser.yy"
    8027     { delete (yyvsp[(1) - (1)].decl); }
    8028     break;
    8029 
    8030   case 559:
    8031 
    8032 /* Line 1806 of yacc.c  */
    8033 #line 2155 "parser.yy"
    8034     { delete (yyvsp[(1) - (1)].decl); }
    8035     break;
    8036 
    80378023  case 560:
    80388024
    80398025/* Line 1806 of yacc.c  */
    8040 #line 2190 "parser.yy"
     8026#line 2188 "parser.yy"
    80418027    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    80428028    break;
    80438029
    80448030  case 562:
     8031
     8032/* Line 1806 of yacc.c  */
     8033#line 2191 "parser.yy"
     8034    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8035    break;
     8036
     8037  case 563:
    80458038
    80468039/* Line 1806 of yacc.c  */
     
    80498042    break;
    80508043
    8051   case 563:
    8052 
    8053 /* Line 1806 of yacc.c  */
    8054 #line 2195 "parser.yy"
    8055     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8056     break;
    8057 
    80588044  case 564:
    80598045
    80608046/* Line 1806 of yacc.c  */
    8061 #line 2200 "parser.yy"
     8047#line 2198 "parser.yy"
    80628048    {
    80638049                        typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) );
     
    80698055
    80708056/* Line 1806 of yacc.c  */
    8071 #line 2205 "parser.yy"
     8057#line 2203 "parser.yy"
    80728058    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    80738059    break;
     
    80768062
    80778063/* Line 1806 of yacc.c  */
     8064#line 2208 "parser.yy"
     8065    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8066    break;
     8067
     8068  case 567:
     8069
     8070/* Line 1806 of yacc.c  */
    80788071#line 2210 "parser.yy"
    8079     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8080     break;
    8081 
    8082   case 567:
     8072    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8073    break;
     8074
     8075  case 568:
    80838076
    80848077/* Line 1806 of yacc.c  */
    80858078#line 2212 "parser.yy"
    8086     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8087     break;
    8088 
    8089   case 568:
    8090 
    8091 /* Line 1806 of yacc.c  */
    8092 #line 2214 "parser.yy"
    80938079    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    80948080    break;
     
    80978083
    80988084/* Line 1806 of yacc.c  */
     8085#line 2217 "parser.yy"
     8086    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
     8087    break;
     8088
     8089  case 570:
     8090
     8091/* Line 1806 of yacc.c  */
    80998092#line 2219 "parser.yy"
    8100     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    8101     break;
    8102 
    8103   case 570:
     8093    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8094    break;
     8095
     8096  case 571:
    81048097
    81058098/* Line 1806 of yacc.c  */
     
    81088101    break;
    81098102
    8110   case 571:
     8103  case 572:
    81118104
    81128105/* Line 1806 of yacc.c  */
    81138106#line 2223 "parser.yy"
     8107    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8108    break;
     8109
     8110  case 573:
     8111
     8112/* Line 1806 of yacc.c  */
     8113#line 2228 "parser.yy"
     8114    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
     8115    break;
     8116
     8117  case 574:
     8118
     8119/* Line 1806 of yacc.c  */
     8120#line 2230 "parser.yy"
     8121    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8122    break;
     8123
     8124  case 575:
     8125
     8126/* Line 1806 of yacc.c  */
     8127#line 2239 "parser.yy"
     8128    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8129    break;
     8130
     8131  case 577:
     8132
     8133/* Line 1806 of yacc.c  */
     8134#line 2242 "parser.yy"
     8135    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8136    break;
     8137
     8138  case 578:
     8139
     8140/* Line 1806 of yacc.c  */
     8141#line 2247 "parser.yy"
     8142    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
     8143    break;
     8144
     8145  case 579:
     8146
     8147/* Line 1806 of yacc.c  */
     8148#line 2249 "parser.yy"
     8149    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
     8150    break;
     8151
     8152  case 580:
     8153
     8154/* Line 1806 of yacc.c  */
     8155#line 2251 "parser.yy"
     8156    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8157    break;
     8158
     8159  case 581:
     8160
     8161/* Line 1806 of yacc.c  */
     8162#line 2256 "parser.yy"
     8163    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8164    break;
     8165
     8166  case 582:
     8167
     8168/* Line 1806 of yacc.c  */
     8169#line 2258 "parser.yy"
     8170    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8171    break;
     8172
     8173  case 583:
     8174
     8175/* Line 1806 of yacc.c  */
     8176#line 2260 "parser.yy"
     8177    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8178    break;
     8179
     8180  case 584:
     8181
     8182/* Line 1806 of yacc.c  */
     8183#line 2265 "parser.yy"
    81148184    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    81158185    break;
    81168186
    8117   case 572:
    8118 
    8119 /* Line 1806 of yacc.c  */
    8120 #line 2225 "parser.yy"
    8121     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8122     break;
    8123 
    8124   case 573:
    8125 
    8126 /* Line 1806 of yacc.c  */
    8127 #line 2230 "parser.yy"
    8128     { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    8129     break;
    8130 
    8131   case 574:
    8132 
    8133 /* Line 1806 of yacc.c  */
    8134 #line 2232 "parser.yy"
    8135     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8136     break;
    8137 
    8138   case 575:
    8139 
    8140 /* Line 1806 of yacc.c  */
    8141 #line 2241 "parser.yy"
    8142     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8143     break;
    8144 
    8145   case 577:
    8146 
    8147 /* Line 1806 of yacc.c  */
    8148 #line 2244 "parser.yy"
    8149     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8150     break;
    8151 
    8152   case 578:
    8153 
    8154 /* Line 1806 of yacc.c  */
    8155 #line 2249 "parser.yy"
    8156     { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    8157     break;
    8158 
    8159   case 579:
    8160 
    8161 /* Line 1806 of yacc.c  */
    8162 #line 2251 "parser.yy"
    8163     { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    8164     break;
    8165 
    8166   case 580:
    8167 
    8168 /* Line 1806 of yacc.c  */
    8169 #line 2253 "parser.yy"
    8170     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8171     break;
    8172 
    8173   case 581:
    8174 
    8175 /* Line 1806 of yacc.c  */
    8176 #line 2258 "parser.yy"
    8177     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8178     break;
    8179 
    8180   case 582:
    8181 
    8182 /* Line 1806 of yacc.c  */
    8183 #line 2260 "parser.yy"
    8184     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8185     break;
    8186 
    8187   case 583:
    8188 
    8189 /* Line 1806 of yacc.c  */
    8190 #line 2262 "parser.yy"
    8191     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8192     break;
    8193 
    8194   case 584:
     8187  case 585:
    81958188
    81968189/* Line 1806 of yacc.c  */
     
    81998192    break;
    82008193
    8201   case 585:
     8194  case 586:
    82028195
    82038196/* Line 1806 of yacc.c  */
    82048197#line 2269 "parser.yy"
     8198    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8199    break;
     8200
     8201  case 590:
     8202
     8203/* Line 1806 of yacc.c  */
     8204#line 2284 "parser.yy"
     8205    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addIdList( (yyvsp[(3) - (4)].decl) ); }
     8206    break;
     8207
     8208  case 591:
     8209
     8210/* Line 1806 of yacc.c  */
     8211#line 2286 "parser.yy"
     8212    { (yyval.decl) = (yyvsp[(2) - (6)].decl)->addIdList( (yyvsp[(5) - (6)].decl) ); }
     8213    break;
     8214
     8215  case 592:
     8216
     8217/* Line 1806 of yacc.c  */
     8218#line 2288 "parser.yy"
     8219    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8220    break;
     8221
     8222  case 593:
     8223
     8224/* Line 1806 of yacc.c  */
     8225#line 2293 "parser.yy"
     8226    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8227    break;
     8228
     8229  case 594:
     8230
     8231/* Line 1806 of yacc.c  */
     8232#line 2295 "parser.yy"
     8233    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8234    break;
     8235
     8236  case 595:
     8237
     8238/* Line 1806 of yacc.c  */
     8239#line 2297 "parser.yy"
     8240    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
     8241    break;
     8242
     8243  case 596:
     8244
     8245/* Line 1806 of yacc.c  */
     8246#line 2302 "parser.yy"
    82058247    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    82068248    break;
    82078249
    8208   case 586:
    8209 
    8210 /* Line 1806 of yacc.c  */
    8211 #line 2271 "parser.yy"
    8212     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8213     break;
    8214 
    8215   case 590:
    8216 
    8217 /* Line 1806 of yacc.c  */
    8218 #line 2286 "parser.yy"
    8219     { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addIdList( (yyvsp[(3) - (4)].decl) ); }
    8220     break;
    8221 
    8222   case 591:
    8223 
    8224 /* Line 1806 of yacc.c  */
    8225 #line 2288 "parser.yy"
    8226     { (yyval.decl) = (yyvsp[(2) - (6)].decl)->addIdList( (yyvsp[(5) - (6)].decl) ); }
    8227     break;
    8228 
    8229   case 592:
    8230 
    8231 /* Line 1806 of yacc.c  */
    8232 #line 2290 "parser.yy"
    8233     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8234     break;
    8235 
    8236   case 593:
    8237 
    8238 /* Line 1806 of yacc.c  */
    8239 #line 2295 "parser.yy"
    8240     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8241     break;
    8242 
    8243   case 594:
    8244 
    8245 /* Line 1806 of yacc.c  */
    8246 #line 2297 "parser.yy"
    8247     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8248     break;
    8249 
    8250   case 595:
    8251 
    8252 /* Line 1806 of yacc.c  */
    8253 #line 2299 "parser.yy"
    8254     { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    8255     break;
    8256 
    8257   case 596:
     8250  case 597:
    82588251
    82598252/* Line 1806 of yacc.c  */
     
    82628255    break;
    82638256
    8264   case 597:
     8257  case 598:
    82658258
    82668259/* Line 1806 of yacc.c  */
    82678260#line 2306 "parser.yy"
    8268     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8269     break;
    8270 
    8271   case 598:
    8272 
    8273 /* Line 1806 of yacc.c  */
    8274 #line 2308 "parser.yy"
    82758261    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    82768262    break;
     
    82798265
    82808266/* Line 1806 of yacc.c  */
    8281 #line 2323 "parser.yy"
     8267#line 2321 "parser.yy"
    82828268    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    82838269    break;
    82848270
    82858271  case 601:
     8272
     8273/* Line 1806 of yacc.c  */
     8274#line 2324 "parser.yy"
     8275    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8276    break;
     8277
     8278  case 602:
    82868279
    82878280/* Line 1806 of yacc.c  */
     
    82908283    break;
    82918284
    8292   case 602:
    8293 
    8294 /* Line 1806 of yacc.c  */
    8295 #line 2328 "parser.yy"
    8296     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8297     break;
    8298 
    82998285  case 604:
    83008286
    83018287/* Line 1806 of yacc.c  */
    8302 #line 2334 "parser.yy"
     8288#line 2332 "parser.yy"
    83038289    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    83048290    break;
     
    83078293
    83088294/* Line 1806 of yacc.c  */
     8295#line 2337 "parser.yy"
     8296    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8297    break;
     8298
     8299  case 606:
     8300
     8301/* Line 1806 of yacc.c  */
    83098302#line 2339 "parser.yy"
    8310     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8311     break;
    8312 
    8313   case 606:
     8303    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8304    break;
     8305
     8306  case 607:
    83148307
    83158308/* Line 1806 of yacc.c  */
    83168309#line 2341 "parser.yy"
    8317     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8318     break;
    8319 
    8320   case 607:
    8321 
    8322 /* Line 1806 of yacc.c  */
    8323 #line 2343 "parser.yy"
    83248310    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    83258311    break;
     
    83288314
    83298315/* Line 1806 of yacc.c  */
     8316#line 2346 "parser.yy"
     8317    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
     8318    break;
     8319
     8320  case 609:
     8321
     8322/* Line 1806 of yacc.c  */
    83308323#line 2348 "parser.yy"
    8331     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    8332     break;
    8333 
    8334   case 609:
     8324    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8325    break;
     8326
     8327  case 610:
    83358328
    83368329/* Line 1806 of yacc.c  */
     
    83398332    break;
    83408333
    8341   case 610:
     8334  case 611:
    83428335
    83438336/* Line 1806 of yacc.c  */
    83448337#line 2352 "parser.yy"
    8345     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8346     break;
    8347 
    8348   case 611:
    8349 
    8350 /* Line 1806 of yacc.c  */
    8351 #line 2354 "parser.yy"
    83528338    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    83538339    break;
     
    83568342
    83578343/* Line 1806 of yacc.c  */
     8344#line 2357 "parser.yy"
     8345    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
     8346    break;
     8347
     8348  case 613:
     8349
     8350/* Line 1806 of yacc.c  */
    83588351#line 2359 "parser.yy"
    8359     { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    8360     break;
    8361 
    8362   case 613:
     8352    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
     8353    break;
     8354
     8355  case 614:
    83638356
    83648357/* Line 1806 of yacc.c  */
    83658358#line 2361 "parser.yy"
    8366     { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    8367     break;
    8368 
    8369   case 614:
    8370 
    8371 /* Line 1806 of yacc.c  */
    8372 #line 2363 "parser.yy"
    83738359    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    83748360    break;
     
    83778363
    83788364/* Line 1806 of yacc.c  */
    8379 #line 2373 "parser.yy"
     8365#line 2371 "parser.yy"
    83808366    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    83818367    break;
    83828368
    83838369  case 617:
     8370
     8371/* Line 1806 of yacc.c  */
     8372#line 2374 "parser.yy"
     8373    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8374    break;
     8375
     8376  case 618:
    83848377
    83858378/* Line 1806 of yacc.c  */
     
    83888381    break;
    83898382
    8390   case 618:
    8391 
    8392 /* Line 1806 of yacc.c  */
    8393 #line 2378 "parser.yy"
    8394     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8395     break;
    8396 
    83978383  case 619:
    83988384
    83998385/* Line 1806 of yacc.c  */
     8386#line 2381 "parser.yy"
     8387    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8388    break;
     8389
     8390  case 620:
     8391
     8392/* Line 1806 of yacc.c  */
    84008393#line 2383 "parser.yy"
    8401     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8402     break;
    8403 
    8404   case 620:
     8394    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8395    break;
     8396
     8397  case 621:
    84058398
    84068399/* Line 1806 of yacc.c  */
    84078400#line 2385 "parser.yy"
    8408     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8409     break;
    8410 
    8411   case 621:
    8412 
    8413 /* Line 1806 of yacc.c  */
    8414 #line 2387 "parser.yy"
    84158401    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    84168402    break;
     
    84198405
    84208406/* Line 1806 of yacc.c  */
     8407#line 2390 "parser.yy"
     8408    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
     8409    break;
     8410
     8411  case 623:
     8412
     8413/* Line 1806 of yacc.c  */
    84218414#line 2392 "parser.yy"
    8422     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    8423     break;
    8424 
    8425   case 623:
     8415    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8416    break;
     8417
     8418  case 624:
    84268419
    84278420/* Line 1806 of yacc.c  */
     
    84308423    break;
    84318424
    8432   case 624:
     8425  case 625:
    84338426
    84348427/* Line 1806 of yacc.c  */
    84358428#line 2396 "parser.yy"
    8436     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8437     break;
    8438 
    8439   case 625:
    8440 
    8441 /* Line 1806 of yacc.c  */
    8442 #line 2398 "parser.yy"
    84438429    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    84448430    break;
     
    84478433
    84488434/* Line 1806 of yacc.c  */
     8435#line 2401 "parser.yy"
     8436    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
     8437    break;
     8438
     8439  case 627:
     8440
     8441/* Line 1806 of yacc.c  */
    84498442#line 2403 "parser.yy"
    8450     { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    8451     break;
    8452 
    8453   case 627:
     8443    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
     8444    break;
     8445
     8446  case 628:
    84548447
    84558448/* Line 1806 of yacc.c  */
    84568449#line 2405 "parser.yy"
    8457     { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    8458     break;
    8459 
    8460   case 628:
    8461 
    8462 /* Line 1806 of yacc.c  */
    8463 #line 2407 "parser.yy"
    84648450    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    84658451    break;
     
    84688454
    84698455/* Line 1806 of yacc.c  */
    8470 #line 2438 "parser.yy"
     8456#line 2436 "parser.yy"
    84718457    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    84728458    break;
    84738459
    84748460  case 631:
     8461
     8462/* Line 1806 of yacc.c  */
     8463#line 2439 "parser.yy"
     8464    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8465    break;
     8466
     8467  case 632:
    84758468
    84768469/* Line 1806 of yacc.c  */
     
    84798472    break;
    84808473
    8481   case 632:
    8482 
    8483 /* Line 1806 of yacc.c  */
    8484 #line 2443 "parser.yy"
    8485     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8486     break;
    8487 
    84888474  case 633:
    84898475
    84908476/* Line 1806 of yacc.c  */
    8491 #line 2448 "parser.yy"
     8477#line 2446 "parser.yy"
    84928478    {
    84938479                        typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) );
     
    84998485
    85008486/* Line 1806 of yacc.c  */
    8501 #line 2453 "parser.yy"
     8487#line 2451 "parser.yy"
    85028488    {
    85038489                        typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) );
     
    85098495
    85108496/* Line 1806 of yacc.c  */
     8497#line 2459 "parser.yy"
     8498    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8499    break;
     8500
     8501  case 636:
     8502
     8503/* Line 1806 of yacc.c  */
    85118504#line 2461 "parser.yy"
    8512     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8513     break;
    8514 
    8515   case 636:
     8505    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8506    break;
     8507
     8508  case 637:
    85168509
    85178510/* Line 1806 of yacc.c  */
    85188511#line 2463 "parser.yy"
    8519     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8520     break;
    8521 
    8522   case 637:
    8523 
    8524 /* Line 1806 of yacc.c  */
    8525 #line 2465 "parser.yy"
    85268512    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    85278513    break;
     
    85308516
    85318517/* Line 1806 of yacc.c  */
     8518#line 2468 "parser.yy"
     8519    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
     8520    break;
     8521
     8522  case 639:
     8523
     8524/* Line 1806 of yacc.c  */
    85328525#line 2470 "parser.yy"
    8533     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    8534     break;
    8535 
    8536   case 639:
    8537 
    8538 /* Line 1806 of yacc.c  */
    8539 #line 2472 "parser.yy"
    85408526    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    85418527    break;
     
    85448530
    85458531/* Line 1806 of yacc.c  */
     8532#line 2475 "parser.yy"
     8533    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
     8534    break;
     8535
     8536  case 641:
     8537
     8538/* Line 1806 of yacc.c  */
    85468539#line 2477 "parser.yy"
    8547     { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    8548     break;
    8549 
    8550   case 641:
    8551 
    8552 /* Line 1806 of yacc.c  */
    8553 #line 2479 "parser.yy"
    85548540    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    85558541    break;
    85568542
    85578543  case 643:
     8544
     8545/* Line 1806 of yacc.c  */
     8546#line 2492 "parser.yy"
     8547    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8548    break;
     8549
     8550  case 644:
    85588551
    85598552/* Line 1806 of yacc.c  */
     
    85628555    break;
    85638556
    8564   case 644:
    8565 
    8566 /* Line 1806 of yacc.c  */
    8567 #line 2496 "parser.yy"
    8568     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8569     break;
    8570 
    85718557  case 645:
    85728558
    85738559/* Line 1806 of yacc.c  */
     8560#line 2499 "parser.yy"
     8561    { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
     8562    break;
     8563
     8564  case 646:
     8565
     8566/* Line 1806 of yacc.c  */
    85748567#line 2501 "parser.yy"
    8575     { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
    8576     break;
    8577 
    8578   case 646:
     8568    { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
     8569    break;
     8570
     8571  case 647:
    85798572
    85808573/* Line 1806 of yacc.c  */
    85818574#line 2503 "parser.yy"
    8582     { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
    8583     break;
    8584 
    8585   case 647:
     8575    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8576    break;
     8577
     8578  case 648:
    85868579
    85878580/* Line 1806 of yacc.c  */
    85888581#line 2505 "parser.yy"
    8589     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8590     break;
    8591 
    8592   case 648:
     8582    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8583    break;
     8584
     8585  case 649:
    85938586
    85948587/* Line 1806 of yacc.c  */
    85958588#line 2507 "parser.yy"
    8596     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8597     break;
    8598 
    8599   case 649:
    8600 
    8601 /* Line 1806 of yacc.c  */
    8602 #line 2509 "parser.yy"
    86038589    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    86048590    break;
    86058591
    86068592  case 651:
     8593
     8594/* Line 1806 of yacc.c  */
     8595#line 2513 "parser.yy"
     8596    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8597    break;
     8598
     8599  case 652:
    86078600
    86088601/* Line 1806 of yacc.c  */
     
    86118604    break;
    86128605
    8613   case 652:
     8606  case 653:
    86148607
    86158608/* Line 1806 of yacc.c  */
    86168609#line 2517 "parser.yy"
    8617     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8618     break;
    8619 
    8620   case 653:
    8621 
    8622 /* Line 1806 of yacc.c  */
    8623 #line 2519 "parser.yy"
    86248610    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    86258611    break;
     
    86288614
    86298615/* Line 1806 of yacc.c  */
     8616#line 2522 "parser.yy"
     8617    { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0 ); }
     8618    break;
     8619
     8620  case 655:
     8621
     8622/* Line 1806 of yacc.c  */
    86308623#line 2524 "parser.yy"
    8631     { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0 ); }
    8632     break;
    8633 
    8634   case 655:
     8624    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
     8625    break;
     8626
     8627  case 656:
    86358628
    86368629/* Line 1806 of yacc.c  */
    86378630#line 2526 "parser.yy"
    8638     { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    8639     break;
    8640 
    8641   case 656:
    8642 
    8643 /* Line 1806 of yacc.c  */
    8644 #line 2528 "parser.yy"
    86458631    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    86468632    break;
     
    86498635
    86508636/* Line 1806 of yacc.c  */
     8637#line 2532 "parser.yy"
     8638    { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }
     8639    break;
     8640
     8641  case 658:
     8642
     8643/* Line 1806 of yacc.c  */
    86518644#line 2534 "parser.yy"
    8652     { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }
    8653     break;
    8654 
    8655   case 658:
    8656 
    8657 /* Line 1806 of yacc.c  */
    8658 #line 2536 "parser.yy"
    86598645    { (yyval.decl) = DeclarationNode::newArray( 0, 0, false )->addArray( (yyvsp[(3) - (3)].decl) ); }
    86608646    break;
     
    86638649
    86648650/* Line 1806 of yacc.c  */
     8651#line 2540 "parser.yy"
     8652    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(3) - (5)].en), 0, false ); }
     8653    break;
     8654
     8655  case 661:
     8656
     8657/* Line 1806 of yacc.c  */
    86658658#line 2542 "parser.yy"
    8666     { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(3) - (5)].en), 0, false ); }
    8667     break;
    8668 
    8669   case 661:
     8659    { (yyval.decl) = DeclarationNode::newVarArray( 0 ); }
     8660    break;
     8661
     8662  case 662:
    86708663
    86718664/* Line 1806 of yacc.c  */
    86728665#line 2544 "parser.yy"
    8673     { (yyval.decl) = DeclarationNode::newVarArray( 0 ); }
    8674     break;
    8675 
    8676   case 662:
     8666    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newArray( (yyvsp[(4) - (6)].en), 0, false ) ); }
     8667    break;
     8668
     8669  case 663:
    86778670
    86788671/* Line 1806 of yacc.c  */
    86798672#line 2546 "parser.yy"
    8680     { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newArray( (yyvsp[(4) - (6)].en), 0, false ) ); }
    8681     break;
    8682 
    8683   case 663:
    8684 
    8685 /* Line 1806 of yacc.c  */
    8686 #line 2548 "parser.yy"
    86878673    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newVarArray( 0 ) ); }
    86888674    break;
    86898675
    86908676  case 665:
     8677
     8678/* Line 1806 of yacc.c  */
     8679#line 2561 "parser.yy"
     8680    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8681    break;
     8682
     8683  case 666:
    86918684
    86928685/* Line 1806 of yacc.c  */
     
    86958688    break;
    86968689
    8697   case 666:
    8698 
    8699 /* Line 1806 of yacc.c  */
    8700 #line 2565 "parser.yy"
    8701     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8702     break;
    8703 
    87048690  case 667:
    87058691
    87068692/* Line 1806 of yacc.c  */
     8693#line 2568 "parser.yy"
     8694    { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
     8695    break;
     8696
     8697  case 668:
     8698
     8699/* Line 1806 of yacc.c  */
    87078700#line 2570 "parser.yy"
    8708     { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
    8709     break;
    8710 
    8711   case 668:
     8701    { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
     8702    break;
     8703
     8704  case 669:
    87128705
    87138706/* Line 1806 of yacc.c  */
    87148707#line 2572 "parser.yy"
    8715     { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
    8716     break;
    8717 
    8718   case 669:
     8708    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8709    break;
     8710
     8711  case 670:
    87198712
    87208713/* Line 1806 of yacc.c  */
    87218714#line 2574 "parser.yy"
    8722     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8723     break;
    8724 
    8725   case 670:
     8715    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8716    break;
     8717
     8718  case 671:
    87268719
    87278720/* Line 1806 of yacc.c  */
    87288721#line 2576 "parser.yy"
    8729     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8730     break;
    8731 
    8732   case 671:
    8733 
    8734 /* Line 1806 of yacc.c  */
    8735 #line 2578 "parser.yy"
    87368722    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    87378723    break;
    87388724
    87398725  case 673:
     8726
     8727/* Line 1806 of yacc.c  */
     8728#line 2582 "parser.yy"
     8729    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8730    break;
     8731
     8732  case 674:
    87408733
    87418734/* Line 1806 of yacc.c  */
     
    87448737    break;
    87458738
    8746   case 674:
     8739  case 675:
    87478740
    87488741/* Line 1806 of yacc.c  */
    87498742#line 2586 "parser.yy"
    8750     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8751     break;
    8752 
    8753   case 675:
    8754 
    8755 /* Line 1806 of yacc.c  */
    8756 #line 2588 "parser.yy"
    87578743    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    87588744    break;
     
    87618747
    87628748/* Line 1806 of yacc.c  */
     8749#line 2591 "parser.yy"
     8750    { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0 ); }
     8751    break;
     8752
     8753  case 677:
     8754
     8755/* Line 1806 of yacc.c  */
    87638756#line 2593 "parser.yy"
    8764     { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0 ); }
    8765     break;
    8766 
    8767   case 677:
     8757    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
     8758    break;
     8759
     8760  case 678:
    87688761
    87698762/* Line 1806 of yacc.c  */
    87708763#line 2595 "parser.yy"
    8771     { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    8772     break;
    8773 
    8774   case 678:
    8775 
    8776 /* Line 1806 of yacc.c  */
    8777 #line 2597 "parser.yy"
    87788764    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    87798765    break;
     
    87828768
    87838769/* Line 1806 of yacc.c  */
    8784 #line 2604 "parser.yy"
     8770#line 2602 "parser.yy"
    87858771    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    87868772    break;
     
    87898775
    87908776/* Line 1806 of yacc.c  */
    8791 #line 2615 "parser.yy"
     8777#line 2613 "parser.yy"
    87928778    { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }
    87938779    break;
     
    87968782
    87978783/* Line 1806 of yacc.c  */
     8784#line 2616 "parser.yy"
     8785    { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }
     8786    break;
     8787
     8788  case 684:
     8789
     8790/* Line 1806 of yacc.c  */
    87988791#line 2618 "parser.yy"
    8799     { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }
    8800     break;
    8801 
    8802   case 684:
    8803 
    8804 /* Line 1806 of yacc.c  */
    8805 #line 2620 "parser.yy"
    88068792    { (yyval.decl) = DeclarationNode::newArray( 0, (yyvsp[(3) - (5)].decl), false ); }
    88078793    break;
     
    88108796
    88118797/* Line 1806 of yacc.c  */
     8798#line 2621 "parser.yy"
     8799    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }
     8800    break;
     8801
     8802  case 686:
     8803
     8804/* Line 1806 of yacc.c  */
    88128805#line 2623 "parser.yy"
    8813     { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }
    8814     break;
    8815 
    8816   case 686:
     8806    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl), true ); }
     8807    break;
     8808
     8809  case 687:
    88178810
    88188811/* Line 1806 of yacc.c  */
    88198812#line 2625 "parser.yy"
    8820     { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl), true ); }
    8821     break;
    8822 
    8823   case 687:
    8824 
    8825 /* Line 1806 of yacc.c  */
    8826 #line 2627 "parser.yy"
    88278813    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(3) - (7)].decl), true ); }
    88288814    break;
    88298815
    88308816  case 689:
     8817
     8818/* Line 1806 of yacc.c  */
     8819#line 2639 "parser.yy"
     8820    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
     8821    break;
     8822
     8823  case 690:
    88318824
    88328825/* Line 1806 of yacc.c  */
     
    88358828    break;
    88368829
    8837   case 690:
    8838 
    8839 /* Line 1806 of yacc.c  */
    8840 #line 2643 "parser.yy"
    8841     { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    8842     break;
    8843 
    88448830  case 691:
    88458831
    88468832/* Line 1806 of yacc.c  */
     8833#line 2646 "parser.yy"
     8834    { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
     8835    break;
     8836
     8837  case 692:
     8838
     8839/* Line 1806 of yacc.c  */
    88478840#line 2648 "parser.yy"
    8848     { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
    8849     break;
    8850 
    8851   case 692:
     8841    { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
     8842    break;
     8843
     8844  case 693:
    88528845
    88538846/* Line 1806 of yacc.c  */
    88548847#line 2650 "parser.yy"
    8855     { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
    8856     break;
    8857 
    8858   case 693:
     8848    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
     8849    break;
     8850
     8851  case 694:
    88598852
    88608853/* Line 1806 of yacc.c  */
    88618854#line 2652 "parser.yy"
    8862     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    8863     break;
    8864 
    8865   case 694:
     8855    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
     8856    break;
     8857
     8858  case 695:
    88668859
    88678860/* Line 1806 of yacc.c  */
    88688861#line 2654 "parser.yy"
    8869     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    8870     break;
    8871 
    8872   case 695:
    8873 
    8874 /* Line 1806 of yacc.c  */
    8875 #line 2656 "parser.yy"
    88768862    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    88778863    break;
    88788864
    88798865  case 697:
     8866
     8867/* Line 1806 of yacc.c  */
     8868#line 2660 "parser.yy"
     8869    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
     8870    break;
     8871
     8872  case 698:
    88808873
    88818874/* Line 1806 of yacc.c  */
     
    88848877    break;
    88858878
    8886   case 698:
     8879  case 699:
    88878880
    88888881/* Line 1806 of yacc.c  */
    88898882#line 2664 "parser.yy"
    8890     { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    8891     break;
    8892 
    8893   case 699:
    8894 
    8895 /* Line 1806 of yacc.c  */
    8896 #line 2666 "parser.yy"
    88978883    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    88988884    break;
     
    89018887
    89028888/* Line 1806 of yacc.c  */
     8889#line 2669 "parser.yy"
     8890    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
     8891    break;
     8892
     8893  case 701:
     8894
     8895/* Line 1806 of yacc.c  */
    89038896#line 2671 "parser.yy"
    8904     { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    8905     break;
    8906 
    8907   case 701:
    8908 
    8909 /* Line 1806 of yacc.c  */
    8910 #line 2673 "parser.yy"
    89118897    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    89128898    break;
     
    89158901
    89168902/* Line 1806 of yacc.c  */
    8917 #line 2683 "parser.yy"
     8903#line 2681 "parser.yy"
    89188904    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    89198905    break;
     
    89228908
    89238909/* Line 1806 of yacc.c  */
     8910#line 2691 "parser.yy"
     8911    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     8912    break;
     8913
     8914  case 708:
     8915
     8916/* Line 1806 of yacc.c  */
    89248917#line 2693 "parser.yy"
     8918    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
     8919    break;
     8920
     8921  case 709:
     8922
     8923/* Line 1806 of yacc.c  */
     8924#line 2695 "parser.yy"
    89258925    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    89268926    break;
    89278927
    8928   case 708:
    8929 
    8930 /* Line 1806 of yacc.c  */
    8931 #line 2695 "parser.yy"
     8928  case 710:
     8929
     8930/* Line 1806 of yacc.c  */
     8931#line 2697 "parser.yy"
    89328932    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    89338933    break;
    89348934
    8935   case 709:
    8936 
    8937 /* Line 1806 of yacc.c  */
    8938 #line 2697 "parser.yy"
     8935  case 711:
     8936
     8937/* Line 1806 of yacc.c  */
     8938#line 2699 "parser.yy"
    89398939    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    89408940    break;
    89418941
    8942   case 710:
    8943 
    8944 /* Line 1806 of yacc.c  */
    8945 #line 2699 "parser.yy"
     8942  case 712:
     8943
     8944/* Line 1806 of yacc.c  */
     8945#line 2701 "parser.yy"
    89468946    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    89478947    break;
    89488948
    8949   case 711:
    8950 
    8951 /* Line 1806 of yacc.c  */
    8952 #line 2701 "parser.yy"
     8949  case 713:
     8950
     8951/* Line 1806 of yacc.c  */
     8952#line 2708 "parser.yy"
     8953    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     8954    break;
     8955
     8956  case 714:
     8957
     8958/* Line 1806 of yacc.c  */
     8959#line 2710 "parser.yy"
     8960    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
     8961    break;
     8962
     8963  case 715:
     8964
     8965/* Line 1806 of yacc.c  */
     8966#line 2712 "parser.yy"
     8967    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     8968    break;
     8969
     8970  case 716:
     8971
     8972/* Line 1806 of yacc.c  */
     8973#line 2714 "parser.yy"
     8974    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }
     8975    break;
     8976
     8977  case 717:
     8978
     8979/* Line 1806 of yacc.c  */
     8980#line 2716 "parser.yy"
     8981    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
     8982    break;
     8983
     8984  case 718:
     8985
     8986/* Line 1806 of yacc.c  */
     8987#line 2718 "parser.yy"
     8988    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     8989    break;
     8990
     8991  case 719:
     8992
     8993/* Line 1806 of yacc.c  */
     8994#line 2720 "parser.yy"
     8995    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
     8996    break;
     8997
     8998  case 720:
     8999
     9000/* Line 1806 of yacc.c  */
     9001#line 2722 "parser.yy"
     9002    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     9003    break;
     9004
     9005  case 721:
     9006
     9007/* Line 1806 of yacc.c  */
     9008#line 2724 "parser.yy"
     9009    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }
     9010    break;
     9011
     9012  case 722:
     9013
     9014/* Line 1806 of yacc.c  */
     9015#line 2726 "parser.yy"
     9016    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
     9017    break;
     9018
     9019  case 723:
     9020
     9021/* Line 1806 of yacc.c  */
     9022#line 2731 "parser.yy"
     9023    { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }
     9024    break;
     9025
     9026  case 724:
     9027
     9028/* Line 1806 of yacc.c  */
     9029#line 2733 "parser.yy"
     9030    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }
     9031    break;
     9032
     9033  case 725:
     9034
     9035/* Line 1806 of yacc.c  */
     9036#line 2738 "parser.yy"
     9037    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), true ); }
     9038    break;
     9039
     9040  case 726:
     9041
     9042/* Line 1806 of yacc.c  */
     9043#line 2740 "parser.yy"
     9044    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl)->addQualifiers( (yyvsp[(3) - (7)].decl) ), true ); }
     9045    break;
     9046
     9047  case 728:
     9048
     9049/* Line 1806 of yacc.c  */
     9050#line 2767 "parser.yy"
     9051    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
     9052    break;
     9053
     9054  case 732:
     9055
     9056/* Line 1806 of yacc.c  */
     9057#line 2778 "parser.yy"
    89539058    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    89549059    break;
    89559060
    8956   case 712:
    8957 
    8958 /* Line 1806 of yacc.c  */
    8959 #line 2703 "parser.yy"
     9061  case 733:
     9062
     9063/* Line 1806 of yacc.c  */
     9064#line 2780 "parser.yy"
    89609065    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    89619066    break;
    89629067
    8963   case 713:
    8964 
    8965 /* Line 1806 of yacc.c  */
    8966 #line 2710 "parser.yy"
     9068  case 734:
     9069
     9070/* Line 1806 of yacc.c  */
     9071#line 2782 "parser.yy"
     9072    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     9073    break;
     9074
     9075  case 735:
     9076
     9077/* Line 1806 of yacc.c  */
     9078#line 2784 "parser.yy"
     9079    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
     9080    break;
     9081
     9082  case 736:
     9083
     9084/* Line 1806 of yacc.c  */
     9085#line 2786 "parser.yy"
     9086    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
     9087    break;
     9088
     9089  case 737:
     9090
     9091/* Line 1806 of yacc.c  */
     9092#line 2788 "parser.yy"
     9093    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
     9094    break;
     9095
     9096  case 738:
     9097
     9098/* Line 1806 of yacc.c  */
     9099#line 2795 "parser.yy"
    89679100    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    89689101    break;
    89699102
    8970   case 714:
    8971 
    8972 /* Line 1806 of yacc.c  */
    8973 #line 2712 "parser.yy"
     9103  case 739:
     9104
     9105/* Line 1806 of yacc.c  */
     9106#line 2797 "parser.yy"
     9107    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     9108    break;
     9109
     9110  case 740:
     9111
     9112/* Line 1806 of yacc.c  */
     9113#line 2799 "parser.yy"
    89749114    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    89759115    break;
    89769116
    8977   case 715:
    8978 
    8979 /* Line 1806 of yacc.c  */
    8980 #line 2714 "parser.yy"
     9117  case 741:
     9118
     9119/* Line 1806 of yacc.c  */
     9120#line 2801 "parser.yy"
     9121    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     9122    break;
     9123
     9124  case 742:
     9125
     9126/* Line 1806 of yacc.c  */
     9127#line 2803 "parser.yy"
    89819128    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    89829129    break;
    89839130
    8984   case 716:
    8985 
    8986 /* Line 1806 of yacc.c  */
    8987 #line 2716 "parser.yy"
    8988     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }
    8989     break;
    8990 
    8991   case 717:
    8992 
    8993 /* Line 1806 of yacc.c  */
    8994 #line 2718 "parser.yy"
     9131  case 743:
     9132
     9133/* Line 1806 of yacc.c  */
     9134#line 2805 "parser.yy"
    89959135    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    89969136    break;
    89979137
    8998   case 718:
    8999 
    9000 /* Line 1806 of yacc.c  */
    9001 #line 2720 "parser.yy"
    9002     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    9003     break;
    9004 
    9005   case 719:
    9006 
    9007 /* Line 1806 of yacc.c  */
    9008 #line 2722 "parser.yy"
    9009     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    9010     break;
    9011 
    9012   case 720:
    9013 
    9014 /* Line 1806 of yacc.c  */
    9015 #line 2724 "parser.yy"
    9016     { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    9017     break;
    9018 
    9019   case 721:
    9020 
    9021 /* Line 1806 of yacc.c  */
    9022 #line 2726 "parser.yy"
    9023     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }
    9024     break;
    9025 
    9026   case 722:
    9027 
    9028 /* Line 1806 of yacc.c  */
    9029 #line 2728 "parser.yy"
    9030     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    9031     break;
    9032 
    9033   case 723:
    9034 
    9035 /* Line 1806 of yacc.c  */
    9036 #line 2733 "parser.yy"
    9037     { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }
    9038     break;
    9039 
    9040   case 724:
    9041 
    9042 /* Line 1806 of yacc.c  */
    9043 #line 2735 "parser.yy"
    9044     { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }
    9045     break;
    9046 
    9047   case 725:
    9048 
    9049 /* Line 1806 of yacc.c  */
    9050 #line 2740 "parser.yy"
    9051     { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), true ); }
    9052     break;
    9053 
    9054   case 726:
    9055 
    9056 /* Line 1806 of yacc.c  */
    9057 #line 2742 "parser.yy"
    9058     { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl)->addQualifiers( (yyvsp[(3) - (7)].decl) ), true ); }
    9059     break;
    9060 
    9061   case 728:
    9062 
    9063 /* Line 1806 of yacc.c  */
    9064 #line 2769 "parser.yy"
    9065     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    9066     break;
    9067 
    9068   case 732:
    9069 
    9070 /* Line 1806 of yacc.c  */
    9071 #line 2780 "parser.yy"
    9072     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    9073     break;
    9074 
    9075   case 733:
    9076 
    9077 /* Line 1806 of yacc.c  */
    9078 #line 2782 "parser.yy"
    9079     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    9080     break;
    9081 
    9082   case 734:
    9083 
    9084 /* Line 1806 of yacc.c  */
    9085 #line 2784 "parser.yy"
    9086     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    9087     break;
    9088 
    9089   case 735:
    9090 
    9091 /* Line 1806 of yacc.c  */
    9092 #line 2786 "parser.yy"
    9093     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    9094     break;
    9095 
    9096   case 736:
    9097 
    9098 /* Line 1806 of yacc.c  */
    9099 #line 2788 "parser.yy"
    9100     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    9101     break;
    9102 
    9103   case 737:
    9104 
    9105 /* Line 1806 of yacc.c  */
    9106 #line 2790 "parser.yy"
    9107     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    9108     break;
    9109 
    9110   case 738:
    9111 
    9112 /* Line 1806 of yacc.c  */
    9113 #line 2797 "parser.yy"
    9114     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    9115     break;
    9116 
    9117   case 739:
    9118 
    9119 /* Line 1806 of yacc.c  */
    9120 #line 2799 "parser.yy"
    9121     { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    9122     break;
    9123 
    9124   case 740:
    9125 
    9126 /* Line 1806 of yacc.c  */
    9127 #line 2801 "parser.yy"
    9128     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    9129     break;
    9130 
    9131   case 741:
    9132 
    9133 /* Line 1806 of yacc.c  */
    9134 #line 2803 "parser.yy"
    9135     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    9136     break;
    9137 
    9138   case 742:
    9139 
    9140 /* Line 1806 of yacc.c  */
    9141 #line 2805 "parser.yy"
    9142     { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    9143     break;
    9144 
    9145   case 743:
    9146 
    9147 /* Line 1806 of yacc.c  */
    9148 #line 2807 "parser.yy"
    9149     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    9150     break;
    9151 
    91529138  case 744:
    91539139
    91549140/* Line 1806 of yacc.c  */
    9155 #line 2812 "parser.yy"
     9141#line 2810 "parser.yy"
    91569142    { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); }
    91579143    break;
     
    91609146
    91619147/* Line 1806 of yacc.c  */
     9148#line 2815 "parser.yy"
     9149    { (yyval.decl) = DeclarationNode::newFunction( 0, DeclarationNode::newTuple( 0 ), (yyvsp[(4) - (5)].decl), 0 ); }
     9150    break;
     9151
     9152  case 746:
     9153
     9154/* Line 1806 of yacc.c  */
    91629155#line 2817 "parser.yy"
    9163     { (yyval.decl) = DeclarationNode::newFunction( 0, DeclarationNode::newTuple( 0 ), (yyvsp[(4) - (5)].decl), 0 ); }
    9164     break;
    9165 
    9166   case 746:
     9156    { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), 0 ); }
     9157    break;
     9158
     9159  case 747:
    91679160
    91689161/* Line 1806 of yacc.c  */
     
    91719164    break;
    91729165
    9173   case 747:
    9174 
    9175 /* Line 1806 of yacc.c  */
    9176 #line 2821 "parser.yy"
    9177     { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), 0 ); }
    9178     break;
    9179 
    91809166  case 750:
    91819167
    91829168/* Line 1806 of yacc.c  */
     9169#line 2843 "parser.yy"
     9170    { (yyval.en) = 0; }
     9171    break;
     9172
     9173  case 751:
     9174
     9175/* Line 1806 of yacc.c  */
    91839176#line 2845 "parser.yy"
    9184     { (yyval.en) = 0; }
    9185     break;
    9186 
    9187   case 751:
    9188 
    9189 /* Line 1806 of yacc.c  */
    9190 #line 2847 "parser.yy"
    91919177    { (yyval.en) = (yyvsp[(2) - (2)].en); }
    91929178    break;
     
    91959181
    91969182/* Line 1806 of yacc.c  */
    9197 #line 9198 "Parser/parser.cc"
     9183#line 9184 "Parser/parser.cc"
    91989184      default: break;
    91999185    }
     
    94269412
    94279413/* Line 2067 of yacc.c  */
    9428 #line 2850 "parser.yy"
     9414#line 2848 "parser.yy"
    94299415
    94309416// ----end of grammar----
  • src/Parser/parser.yy

    r12bc63a rfc4a0fa  
    377377                { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); }
    378378        | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector
    379                 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); }
    380379        | postfix_expression ARROW no_attr_identifier
    381380                { $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); }
    382381        | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector
    383                         { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
    384382        | postfix_expression ICR
    385383                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, $1 ) ); }
  • src/ResolvExpr/Alternative.cc

    r12bc63a rfc4a0fa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Alternative.cc --
     7// Alternative.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    1212// Last Modified On : Sat May 16 23:54:23 2015
    1313// Update Count     : 2
    14 //
     14// 
    1515
    1616#include "Alternative.h"
     
    5454                        expr->print( os, indent );
    5555                        os << "(types:" << std::endl;
    56                         os << std::string( indent+4, ' ' );
    57                         expr->get_result()->print( os, indent + 4 );
    58                         os << std::endl << ")" << std::endl;
     56                        printAll( expr->get_results(), os, indent + 4 );
     57                        os << ")" << std::endl;
    5958                } else {
    6059                        os << "Null expression!" << std::endl;
  • src/ResolvExpr/AlternativeFinder.cc

    r12bc63a rfc4a0fa  
    3838#include "SynTree/TypeSubstitution.h"
    3939#include "SymTab/Validate.h"
    40 #include "Tuples/Tuples.h"
     40#include "Tuples/TupleAssignment.h"
     41#include "Tuples/NameMatcher.h"
    4142#include "Common/utility.h"
    4243#include "InitTweak/InitTweak.h"
     
    6364        }
    6465
    65         Cost sumCost( const AltList &in ) {
    66                 Cost total;
    67                 for ( AltList::const_iterator i = in.begin(); i != in.end(); ++i ) {
    68                         total += i->cost;
    69                 }
    70                 return total;
    71         }
    72 
    7366        namespace {
    7467                void printAlts( const AltList &list, std::ostream &os, int indent = 0 ) {
     
    8376                                out.push_back( i->expr->clone() );
    8477                        }
     78                }
     79
     80                Cost sumCost( const AltList &in ) {
     81                        Cost total;
     82                        for ( AltList::const_iterator i = in.begin(); i != in.end(); ++i ) {
     83                                total += i->cost;
     84                        }
     85                        return total;
    8586                }
    8687
     
    100101                                PruneStruct current( candidate );
    101102                                std::string mangleName;
    102                                 {
    103                                         Type * newType = candidate->expr->get_result()->clone();
     103                                for ( std::list< Type* >::const_iterator retType = candidate->expr->get_results().begin(); retType != candidate->expr->get_results().end(); ++retType ) {
     104                                        Type *newType = (*retType)->clone();
    104105                                        candidate->env.apply( newType );
    105                                         mangleName = SymTab::Mangler::mangle( newType );
     106                                        mangleName += SymTab::Mangler::mangle( newType );
    106107                                        delete newType;
    107108                                }
     
    132133                                if ( ! target->second.isAmbiguous ) {
    133134                                        Alternative &alt = *target->second.candidate;
    134                                         alt.env.applyFree( alt.expr->get_result() );
     135                                        for ( std::list< Type* >::iterator result = alt.expr->get_results().begin(); result != alt.expr->get_results().end(); ++result ) {
     136                                                alt.env.applyFree( *result );
     137                                        }
    135138                                        *out++ = alt;
    136139                                }
    137140                        }
     141
     142                }
     143
     144                template< typename InputIterator, typename OutputIterator >
     145                void findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) {
     146                        AltList alternatives;
     147
     148                        // select the alternatives that have the minimum parameter cost
     149                        Cost minCost = Cost::infinity;
     150                        for ( AltList::iterator i = begin; i != end; ++i ) {
     151                                if ( i->cost < minCost ) {
     152                                        minCost = i->cost;
     153                                        i->cost = i->cvtCost;
     154                                        alternatives.clear();
     155                                        alternatives.push_back( *i );
     156                                } else if ( i->cost == minCost ) {
     157                                        i->cost = i->cvtCost;
     158                                        alternatives.push_back( *i );
     159                                }
     160                        }
     161                        std::copy( alternatives.begin(), alternatives.end(), out );
    138162                }
    139163
     
    146170
    147171                void renameTypes( Expression *expr ) {
    148                         expr->get_result()->accept( global_renamer );
     172                        for ( std::list< Type* >::iterator i = expr->get_results().begin(); i != expr->get_results().end(); ++i ) {
     173                                (*i)->accept( global_renamer );
     174                        }
    149175                }
    150176        }
     
    178204                for ( AltList::iterator i = alternatives.begin(); i != alternatives.end(); ++i ) {
    179205                        if ( adjust ) {
    180                                 adjustExprType( i->expr->get_result(), i->env, indexer );
     206                                adjustExprTypeList( i->expr->get_results().begin(), i->expr->get_results().end(), i->env, indexer );
    181207                        }
    182208                }
     
    215241
    216242        template< typename StructOrUnionType >
    217         void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
    218 
    219                 // // member must be either a tuple expression or a name expr
    220                 // if ( NameExpr * nameExpr = dynamic_cast< NameExpr * >( memberExpr->get_member() ) ) {
    221                 //  addAggMembers( structInst, agg->expr, agg->cost, nameExpr->get_name() );
    222                 // } else {
    223                 //  TupleExpr * tupleExpr = safe_dynamic_cast< TupleExpr * >( memberExpr->get_member() );
    224                 //  // xxx - ...
    225                 //  assert( false );
    226                 // }
    227                 // if ( TupleExpr * tupleExpr = dynamic_cast< TupleExpr * >( memberExpr->get_member() ) ) {
    228 
    229                 // }
    230                 NameExpr * nameExpr = safe_dynamic_cast< NameExpr * >( member );
    231                 const std::string & name = nameExpr->get_name();
     243        void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string &name ) {
    232244                std::list< Declaration* > members;
    233245                aggInst->lookup( name, members );
     
    247259
    248260        Cost computeConversionCost( Alternative &alt, const SymTab::Indexer &indexer ) {
    249                 ApplicationExpr *appExpr = safe_dynamic_cast< ApplicationExpr* >( alt.expr );
    250                 PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
    251                 FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
     261                ApplicationExpr *appExpr = dynamic_cast< ApplicationExpr* >( alt.expr );
     262                assert( appExpr );
     263                PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() );
     264                assert( pointer );
     265                FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
     266                assert( function );
    252267
    253268                Cost convCost( 0, 0, 0 );
     
    255270                std::list< DeclarationWithType* >::iterator formal = formals.begin();
    256271                std::list< Expression* >& actuals = appExpr->get_args();
    257 
    258                 std::list< Type * > formalTypes;
    259                 std::list< Type * >::iterator formalType = formalTypes.end();
    260 
    261272                for ( std::list< Expression* >::iterator actualExpr = actuals.begin(); actualExpr != actuals.end(); ++actualExpr ) {
    262 
    263273                        PRINT(
    264274                                std::cerr << "actual expression:" << std::endl;
    265275                                (*actualExpr)->print( std::cerr, 8 );
    266276                                std::cerr << "--- results are" << std::endl;
    267                                 (*actualExpr)->get_result()->print( std::cerr, 8 );
     277                                printAll( (*actualExpr)->get_results(), std::cerr, 8 );
    268278                        )
    269279                        std::list< DeclarationWithType* >::iterator startFormal = formal;
    270280                        Cost actualCost;
    271                         std::list< Type * > flatActualTypes;
    272                         flatten( (*actualExpr)->get_result(), back_inserter( flatActualTypes ) );
    273                         for ( std::list< Type* >::iterator actualType = flatActualTypes.begin(); actualType != flatActualTypes.end(); ++actualType ) {
    274 
    275 
    276                                 // tuple handling code
    277                                 if ( formalType == formalTypes.end() ) {
    278                                         // the type of the formal parameter may be a tuple type. To make this easier to work with,
    279                                         // flatten the tuple type and traverse the resulting list of types, incrementing the formal
    280                                         // iterator once its types have been extracted. Once a particular formal parameter's type has
    281                                         // been exhausted load the next formal parameter's type.
    282                                         if ( formal == formals.end() ) {
    283                                                 if ( function->get_isVarArgs() ) {
    284                                                         convCost += Cost( 1, 0, 0 );
    285                                                         break;
    286                                                 } else {
    287                                                         return Cost::infinity;
    288                                                 }
     281                        for ( std::list< Type* >::iterator actual = (*actualExpr)->get_results().begin(); actual != (*actualExpr)->get_results().end(); ++actual ) {
     282                                if ( formal == formals.end() ) {
     283                                        if ( function->get_isVarArgs() ) {
     284                                                convCost += Cost( 1, 0, 0 );
     285                                                break;
     286                                        } else {
     287                                                return Cost::infinity;
    289288                                        }
    290                                         formalTypes.clear();
    291                                         flatten( (*formal)->get_type(), back_inserter( formalTypes ) );
    292                                         formalType = formalTypes.begin();
    293                                         ++formal;
    294289                                }
    295 
    296290                                PRINT(
    297291                                        std::cerr << std::endl << "converting ";
    298                                         (*actualType)->print( std::cerr, 8 );
     292                                        (*actual)->print( std::cerr, 8 );
    299293                                        std::cerr << std::endl << " to ";
    300294                                        (*formal)->get_type()->print( std::cerr, 8 );
    301295                                )
    302                                 Cost newCost = conversionCost( *actualType, *formalType, indexer, alt.env );
     296                                Cost newCost = conversionCost( *actual, (*formal)->get_type(), indexer, alt.env );
    303297                                PRINT(
    304298                                        std::cerr << std::endl << "cost is" << newCost << std::endl;
     
    311305                                actualCost += newCost;
    312306
    313                                 convCost += Cost( 0, polyCost( *formalType, alt.env, indexer ) + polyCost( *actualType, alt.env, indexer ), 0 );
    314 
    315                                 formalType++;
     307                                convCost += Cost( 0, polyCost( (*formal)->get_type(), alt.env, indexer ) + polyCost( *actual, alt.env, indexer ), 0 );
     308
     309                                formal++;
    316310                        }
    317311                        if ( actualCost != Cost( 0, 0, 0 ) ) {
     
    379373                resultEnv.extractOpenVars( openVars );
    380374
     375                /*
     376                  Tuples::NameMatcher matcher( formals );
     377                  try {
     378                  matcher.match( actuals );
     379                  } catch ( Tuples::NoMatch &e ) {
     380                  std::cerr << "Alternative doesn't match: " << e.message << std::endl;
     381                  }
     382                */
    381383                std::list< DeclarationWithType* >::iterator formal = formals.begin();
    382 
    383                 std::list< Type * > formalTypes;
    384                 std::list< Type * >::iterator formalType = formalTypes.end();
    385 
    386384                for ( AltList::const_iterator actualExpr = actuals.begin(); actualExpr != actuals.end(); ++actualExpr ) {
    387                         std::list< Type * > flatActualTypes;
    388                         flatten( actualExpr->expr->get_result(), back_inserter( flatActualTypes ) );
    389                         for ( std::list< Type* >::iterator actualType = flatActualTypes.begin(); actualType != flatActualTypes.end(); ++actualType, ++formalType ) {
    390                                 if ( formalType == formalTypes.end() ) {
    391                                         // the type of the formal parameter may be a tuple type. To make this easier to work with,
    392                                         // flatten the tuple type and traverse the resulting list of types, incrementing the formal
    393                                         // iterator once its types have been extracted. Once a particular formal parameter's type has
    394                                         // been exhausted load the next formal parameter's type.
    395                                         if ( formal == formals.end() ) {
    396                                                 return isVarArgs;
    397                                         }
    398                                         formalTypes.clear();
    399                                         flatten( (*formal)->get_type(), back_inserter( formalTypes ) );
    400                                         formalType = formalTypes.begin();
    401                                         ++formal;
     385                        for ( std::list< Type* >::iterator actual = actualExpr->expr->get_results().begin(); actual != actualExpr->expr->get_results().end(); ++actual ) {
     386                                if ( formal == formals.end() ) {
     387                                        return isVarArgs;
    402388                                }
    403389                                PRINT(
    404390                                        std::cerr << "formal type is ";
    405                                         (*formalType)->print( std::cerr );
     391                                        (*formal)->get_type()->print( std::cerr );
    406392                                        std::cerr << std::endl << "actual type is ";
    407                                         (*actualType)->print( std::cerr );
     393                                        (*actual)->print( std::cerr );
    408394                                        std::cerr << std::endl;
    409395                                )
    410                                 if ( ! unify( *formalType, *actualType, resultEnv, resultNeed, resultHave, openVars, indexer ) ) {
     396                                if ( ! unify( (*formal)->get_type(), *actual, resultEnv, resultNeed, resultHave, openVars, indexer ) ) {
    411397                                        return false;
    412398                                }
    413                         }
    414                 }
    415 
    416                 // xxx - a tuple type was not completely matched
    417                 // partially handle the tuple with default arguments??
    418                 if ( formalType != formalTypes.end() ) return false;
    419 
     399                                formal++;
     400                        }
     401                }
    420402                // Handling of default values
    421403                while ( formal != formals.end() ) {
     
    518500                                //if ( newNeedParents[ curDecl->get_uniqueId() ][ candDecl->get_uniqueId() ]++ > recursionParentLimit ) continue;
    519501                                Expression *varExpr = new VariableExpr( candDecl );
    520                                 delete varExpr->get_result();
    521                                 varExpr->set_result( adjType->clone() );
     502                                deleteAll( varExpr->get_results() );
     503                                varExpr->get_results().clear();
     504                                varExpr->get_results().push_front( adjType->clone() );
    522505                                PRINT(
    523506                                        std::cerr << "satisfying assertion " << curDecl->get_uniqueId() << " ";
     
    591574                                PointerType pt( Type::Qualifiers(), v.clone() );
    592575                                UntypedExpr *vexpr = untypedExpr->clone();
    593                                 vexpr->set_result( pt.clone() );
     576                                vexpr->get_results().push_front( pt.clone() );
    594577                                alternatives.push_back( Alternative( vexpr, env, Cost()) );
    595578                                return;
     
    604587                combos( argAlternatives.begin(), argAlternatives.end(), back_inserter( possibilities ) );
    605588
    606                 // take care of possible tuple assignments
    607                 // if not tuple assignment, assignment is taken care of as a normal function call
    608                 Tuples::handleTupleAssignment( *this, untypedExpr, possibilities );
     589                Tuples::TupleAssignSpotter tassign( this );
     590                if ( tassign.isTupleAssignment( untypedExpr, possibilities ) ) {
     591                        // take care of possible tuple assignments, or discard expression
     592                        return;
     593                } // else ...
    609594
    610595                AltList candidates;
     
    619604                                // check if the type is pointer to function
    620605                                PointerType *pointer;
    621                                 if ( ( pointer = dynamic_cast< PointerType* >( func->expr->get_result() ) ) ) {
     606                                if ( func->expr->get_results().size() == 1 && ( pointer = dynamic_cast< PointerType* >( func->expr->get_results().front() ) ) ) {
    622607                                        if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) {
    623608                                                for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) {
     
    655640                                                // check if the type is pointer to function
    656641                                                PointerType *pointer;
    657                                                 if ( ( pointer = dynamic_cast< PointerType* >( funcOp->expr->get_result() ) ) ) {
     642                                                if ( funcOp->expr->get_results().size() == 1
     643                                                        && ( pointer = dynamic_cast< PointerType* >( funcOp->expr->get_results().front() ) ) ) {
    658644                                                        if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) {
    659645                                                                for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) {
     
    679665
    680666                        PRINT(
    681                                 ApplicationExpr *appExpr = safe_dynamic_cast< ApplicationExpr* >( withFunc->expr );
    682                                 PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
    683                                 FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
     667                                ApplicationExpr *appExpr = dynamic_cast< ApplicationExpr* >( withFunc->expr );
     668                                assert( appExpr );
     669                                PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() );
     670                                assert( pointer );
     671                                FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
     672                                assert( function );
    684673                                std::cerr << "Case +++++++++++++" << std::endl;
    685674                                std::cerr << "formals are:" << std::endl;
     
    703692
    704693        bool isLvalue( Expression *expr ) {
    705                 // xxx - recurse into tuples?
    706                 return expr->has_result() && expr->get_result()->get_isLvalue();
     694                for ( std::list< Type* >::const_iterator i = expr->get_results().begin(); i != expr->get_results().end(); ++i ) {
     695                        if ( !(*i)->get_isLvalue() ) return false;
     696                } // for
     697                return true;
    707698        }
    708699
     
    718709
    719710        void AlternativeFinder::visit( CastExpr *castExpr ) {
    720                 Type *& toType = castExpr->get_result();
    721                 toType = resolveTypeof( toType, indexer );
    722                 SymTab::validateType( toType, &indexer );
    723                 adjustExprType( toType, env, indexer );
     711                for ( std::list< Type* >::iterator i = castExpr->get_results().begin(); i != castExpr->get_results().end(); ++i ) {
     712                        *i = resolveTypeof( *i, indexer );
     713                        SymTab::validateType( *i, &indexer );
     714                        adjustExprType( *i, env, indexer );
     715                } // for
    724716
    725717                AlternativeFinder finder( indexer, env );
     
    735727                        // that are cast directly.  The candidate is invalid if it has fewer results than there are types to cast
    736728                        // to.
    737                         int discardedValues = (*i).expr->get_result()->size() - castExpr->get_result()->size();
     729                        int discardedValues = (*i).expr->get_results().size() - castExpr->get_results().size();
    738730                        if ( discardedValues < 0 ) continue;
    739                         // xxx - may need to go into tuple types and extract relavent types and use unifyList
     731                        std::list< Type* >::iterator candidate_end = (*i).expr->get_results().begin();
     732                        std::advance( candidate_end, castExpr->get_results().size() );
    740733                        // unification run for side-effects
    741                         unify( castExpr->get_result(), (*i).expr->get_result(), i->env, needAssertions, haveAssertions, openVars, indexer );
    742                         Cost thisCost = castCost( (*i).expr->get_result(), castExpr->get_result(), indexer, i->env );
     734                        unifyList( castExpr->get_results().begin(), castExpr->get_results().end(),
     735                                           (*i).expr->get_results().begin(), candidate_end,
     736                                   i->env, needAssertions, haveAssertions, openVars, indexer );
     737                        Cost thisCost = castCostList( (*i).expr->get_results().begin(), candidate_end,
     738                                                                                  castExpr->get_results().begin(), castExpr->get_results().end(),
     739                                                                                  indexer, i->env );
    743740                        if ( thisCost != Cost::infinity ) {
    744741                                // count one safe conversion for each value that is thrown away
     
    763760
    764761                for ( AltList::const_iterator agg = funcFinder.alternatives.begin(); agg != funcFinder.alternatives.end(); ++agg ) {
    765                         if ( StructInstType *structInst = dynamic_cast< StructInstType* >( agg->expr->get_result() ) ) {
    766                                 addAggMembers( structInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
    767                         } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( agg->expr->get_result() ) ) {
    768                                 addAggMembers( unionInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
     762                        if ( agg->expr->get_results().size() == 1 ) {
     763                                if ( StructInstType *structInst = dynamic_cast< StructInstType* >( agg->expr->get_results().front() ) ) {
     764                                        addAggMembers( structInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
     765                                } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( agg->expr->get_results().front() ) ) {
     766                                        addAggMembers( unionInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
     767                                } // if
    769768                        } // if
    770769                } // for
     
    792791                        renameTypes( alternatives.back().expr );
    793792                        if ( StructInstType *structInst = dynamic_cast< StructInstType* >( (*i)->get_type() ) ) {
    794                                 NameExpr nameExpr( "" );
    795                                 addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr );
     793                                addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), env, "" );
    796794                        } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( (*i)->get_type() ) ) {
    797                                 NameExpr nameExpr( "" );
    798                                 addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr );
     795                                addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), env, "" );
    799796                        } // if
    800797                } // for
     
    897894                        alternatives.push_back( Alternative( new AttrExpr( new VariableExpr( funcDecl ), argType->clone() ), env, Cost::zero ) );
    898895                        for ( std::list< DeclarationWithType* >::iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) {
    899                                 alternatives.back().expr->set_result( (*i)->get_type()->clone() );
     896                                alternatives.back().expr->get_results().push_back( (*i)->get_type()->clone() );
    900897                        } // for
    901898                } // if
     
    920917                                                        finder.find( attrExpr->get_expr() );
    921918                                                        for ( AltList::iterator choice = finder.alternatives.begin(); choice != finder.alternatives.end(); ++choice ) {
    922                                                                 if ( choice->expr->get_result()->size() == 1 ) {
    923                                                                         resolveAttr(*i, function, choice->expr->get_result(), choice->env );
     919                                                                if ( choice->expr->get_results().size() == 1 ) {
     920                                                                        resolveAttr(*i, function, choice->expr->get_results().front(), choice->env );
    924921                                                                } // fi
    925922                                                        } // for
     
    963960                                        AssertionSet needAssertions, haveAssertions;
    964961                                        Alternative newAlt( 0, third->env, first->cost + second->cost + third->cost );
    965                                         Type* commonType;
    966                                         if ( unify( second->expr->get_result(), third->expr->get_result(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
     962                                        std::list< Type* > commonTypes;
     963                                        if ( unifyList( second->expr->get_results().begin(), second->expr->get_results().end(), third->expr->get_results().begin(), third->expr->get_results().end(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonTypes ) ) {
    967964                                                ConditionalExpr *newExpr = new ConditionalExpr( first->expr->clone(), second->expr->clone(), third->expr->clone() );
    968                                                 newExpr->set_result( commonType ? commonType : second->expr->get_result()->clone() );
     965                                                std::list< Type* >::const_iterator original = second->expr->get_results().begin();
     966                                                std::list< Type* >::const_iterator commonType = commonTypes.begin();
     967                                                for ( ; original != second->expr->get_results().end() && commonType != commonTypes.end(); ++original, ++commonType ) {
     968                                                        if ( *commonType ) {
     969                                                                newExpr->get_results().push_back( *commonType );
     970                                                        } else {
     971                                                                newExpr->get_results().push_back( (*original)->clone() );
     972                                                        } // if
     973                                                } // for
    969974                                                newAlt.expr = newExpr;
    970975                                                inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( alternatives ) );
     
    994999                        TupleExpr *newExpr = new TupleExpr;
    9951000                        makeExprList( *i, newExpr->get_exprs() );
    996                         TupleType *tupleType = new TupleType( Type::Qualifiers(true, true, true, true, true, true) );
    997                         Type::Qualifiers &qualifiers = tupleType->get_qualifiers();
    998                         for ( Expression * resultExpr : newExpr->get_exprs() ) {
    999                                 Type * type = resultExpr->get_result()->clone();
    1000                                 tupleType->get_types().push_back( type );
    1001                                 qualifiers &= type->get_qualifiers();
     1001                        for ( std::list< Expression* >::const_iterator resultExpr = newExpr->get_exprs().begin(); resultExpr != newExpr->get_exprs().end(); ++resultExpr ) {
     1002                                for ( std::list< Type* >::const_iterator resultType = (*resultExpr)->get_results().begin(); resultType != (*resultExpr)->get_results().end(); ++resultType ) {
     1003                                        newExpr->get_results().push_back( (*resultType)->clone() );
     1004                                } // for
    10021005                        } // for
    1003                         newExpr->set_result( tupleType );
    10041006
    10051007                        TypeEnvironment compositeEnv;
     
    10221024                }
    10231025        }
    1024 
    1025         void AlternativeFinder::visit( TupleIndexExpr *tupleExpr ) {
    1026                 alternatives.push_back( Alternative( tupleExpr->clone(), env, Cost::zero ) );
    1027         }
    1028 
    1029         void AlternativeFinder::visit( TupleAssignExpr *tupleAssignExpr ) {
    1030                 alternatives.push_back( Alternative( tupleAssignExpr->clone(), env, Cost::zero ) );
    1031         }
    10321026} // namespace ResolvExpr
    10331027
  • src/ResolvExpr/AlternativeFinder.h

    r12bc63a rfc4a0fa  
    6767                virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr );
    6868                virtual void visit( ConstructorExpr * ctorExpr );
    69                 virtual void visit( TupleIndexExpr *tupleExpr );
    70                 virtual void visit( TupleAssignExpr *tupleExpr );
    71                 /// Runs a new alternative finder on each element in [begin, end)
    72                 /// and writes each alternative finder to out.
     69          public:  // xxx - temporary hack - should make Tuples::TupleAssignment a friend
    7370                template< typename InputIterator, typename OutputIterator >
    7471                void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );
    7572
     73          private:
    7674                /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member
    77                 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
     75                template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string &name );
    7876                /// Adds alternatives for offsetof expressions, given the base type and name of the member
    7977                template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name );
     
    9189
    9290        Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env );
    93 
    94         template< typename InputIterator, typename OutputIterator >
    95         void findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) {
    96                 AltList alternatives;
    97 
    98                 // select the alternatives that have the minimum parameter cost
    99                 Cost minCost = Cost::infinity;
    100                 for ( InputIterator i = begin; i != end; ++i ) {
    101                         if ( i->cost < minCost ) {
    102                                 minCost = i->cost;
    103                                 i->cost = i->cvtCost;
    104                                 alternatives.clear();
    105                                 alternatives.push_back( *i );
    106                         } else if ( i->cost == minCost ) {
    107                                 i->cost = i->cvtCost;
    108                                 alternatives.push_back( *i );
    109                         }
    110                 }
    111                 std::copy( alternatives.begin(), alternatives.end(), out );
    112         }
    113 
    114         Cost sumCost( const AltList &in );
    11591} // namespace ResolvExpr
    11692
  • src/ResolvExpr/AlternativePrinter.cc

    r12bc63a rfc4a0fa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // AlternativePrinter.cc --
     7// AlternativePrinter.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    3333                for ( AltList::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
    3434                        os << "Alternative " << count++ << " ==============" << std::endl;
    35                         i->expr->get_result()->print( os );
     35                        printAll( i->expr->get_results(), os );
    3636                        //    i->print( os );
    3737                        os << std::endl;
  • src/ResolvExpr/ConversionCost.cc

    r12bc63a rfc4a0fa  
    236236                        std::list< Type* >::const_iterator srcIt = tupleType->get_types().begin();
    237237                        std::list< Type* >::const_iterator destIt = destAsTuple->get_types().begin();
    238                         while ( srcIt != tupleType->get_types().end() && destIt != destAsTuple->get_types().end() ) {
     238                        while ( srcIt != tupleType->get_types().end() ) {
    239239                                Cost newCost = conversionCost( *srcIt++, *destIt++, indexer, env );
    240240                                if ( newCost == Cost::infinity ) {
  • src/ResolvExpr/ResolveTypeof.cc

    r12bc63a rfc4a0fa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ResolveTypeof.cc --
     7// ResolveTypeof.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    5858                if ( typeofType->get_expr() ) {
    5959                        Expression *newExpr = resolveInVoidContext( typeofType->get_expr(), indexer );
    60                         assert( newExpr->has_result() && ! newExpr->get_result()->isVoid() );
    61                         Type *newType = newExpr->get_result();
     60                        assert( newExpr->get_results().size() > 0 );
     61                        Type *newType;
     62                        if ( newExpr->get_results().size() > 1 ) {
     63                                TupleType *tupleType = new TupleType( Type::Qualifiers() );
     64                                cloneAll( newExpr->get_results(), tupleType->get_types() );
     65                                newType = tupleType;
     66                        } else {
     67                                newType = newExpr->get_results().front()->clone();
     68                        } // if
    6269                        delete typeofType;
    6370                        return newType;
  • src/ResolvExpr/Resolver.cc

    r12bc63a rfc4a0fa  
    1919#include "RenameVars.h"
    2020#include "ResolveTypeof.h"
    21 #include "typeops.h"
    2221#include "SynTree/Statement.h"
    2322#include "SynTree/Type.h"
     
    6867          void resolveSingleAggrInit( Declaration *, InitIterator &, InitIterator & );
    6968          void fallbackInit( ConstructorInit * ctorInit );
    70                 Type * functionReturn;
     69                std::list< Type * > functionReturn;
    7170                Type *initContext;
    7271                Type *switchType;
     
    156155                        const TypeEnvironment *newEnv = 0;
    157156                        for ( AltList::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
    158                                 if ( i->expr->get_result()->size() == 1 && isIntegralType( i->expr->get_result() ) ) {
     157                                if ( i->expr->get_results().size() == 1 && isIntegralType( i->expr->get_results().front() ) ) {
    159158                                        if ( newExpr ) {
    160159                                                throw SemanticError( "Too many interpretations for case control expression", untyped );
     
    233232                Type *new_type = resolveTypeof( functionDecl->get_type(), *this );
    234233                functionDecl->set_type( new_type );
    235                 ValueGuard< Type * > oldFunctionReturn( functionReturn );
    236                 functionReturn = ResolvExpr::extractResultType( functionDecl->get_functionType() );
     234                std::list< Type * > oldFunctionReturn = functionReturn;
     235                functionReturn.clear();
     236                for ( std::list< DeclarationWithType * >::const_iterator i = functionDecl->get_functionType()->get_returnVals().begin(); i != functionDecl->get_functionType()->get_returnVals().end(); ++i ) {
     237                        functionReturn.push_back( (*i)->get_type() );
     238                } // for
    237239                SymTab::Indexer::visit( functionDecl );
     240                functionReturn = oldFunctionReturn;
    238241        }
    239242
     
    333336        void Resolver::visit( ReturnStmt *returnStmt ) {
    334337                if ( returnStmt->get_expr() ) {
    335                         CastExpr *castExpr = new CastExpr( returnStmt->get_expr(), functionReturn->clone() );
     338                        CastExpr *castExpr = new CastExpr( returnStmt->get_expr() );
     339                        cloneAll( functionReturn, castExpr->get_results() );
    336340                        Expression *newExpr = findSingleExpression( castExpr, *this );
    337341                        delete castExpr;
     
    378382                                if ( isCharType( at->get_base() ) ) {
    379383                                        // check if the resolved type is char *
    380                                         if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result() ) ) {
     384                                        if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_results().front() ) ) {
    381385                                                if ( isCharType( pt->get_base() ) ) {
    382386                                                        // strip cast if we're initializing a char[] with a char *, e.g.  char x[] = "hello";
  • src/ResolvExpr/Unify.cc

    r12bc63a rfc4a0fa  
    588588        }
    589589
    590         // xxx - compute once and store in the FunctionType?
    591         Type * extractResultType( FunctionType * function ) {
    592                 if ( function->get_returnVals().size() == 0 ) {
    593                         return new VoidType( Type::Qualifiers() );
    594                 } else if ( function->get_returnVals().size() == 1 ) {
    595                         return function->get_returnVals().front()->get_type()->clone();
    596                 } else {
    597                         TupleType * tupleType = new TupleType( Type::Qualifiers() );
    598                         for ( DeclarationWithType * decl : function->get_returnVals() ) {
    599                                 tupleType->get_types().push_back( decl->get_type()->clone() );
    600                         } // for
    601                         return tupleType;
    602                 }
    603         }
    604 
    605590} // namespace ResolvExpr
    606591
  • src/ResolvExpr/typeops.h

    r12bc63a rfc4a0fa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // typeops.h --
     7// typeops.h -- 
    88//
    99// Author           : Richard C. Bilson
     
    3030                typedef typename InputIterator::value_type SetType;
    3131                typedef typename std::list< typename SetType::value_type > ListType;
    32 
     32 
    3333                if ( begin == end )     {
    3434                        *out++ = ListType();
    3535                        return;
    3636                } // if
    37 
     37 
    3838                InputIterator current = begin;
    3939                begin++;
     
    4141                std::list< ListType > recursiveResult;
    4242                combos( begin, end, back_inserter( recursiveResult ) );
    43 
     43 
    4444                for ( typename std::list< ListType >::const_iterator i = recursiveResult.begin(); i != recursiveResult.end(); ++i ) {
    4545                        for ( typename ListType::const_iterator j = current->begin(); j != current->end(); ++j ) {
     
    5252                } // for
    5353        }
    54 
     54 
    5555        // in AdjustExprType.cc
    5656        /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function
     
    144144        }
    145145
    146         /// creates the type represented by the list of returnVals in a FunctionType. The caller owns the return value.
    147         Type * extractResultType( FunctionType * functionType );
    148 
    149146        // in CommonType.cc
    150147        Type *commonType( Type *type1, Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars );
     
    155152        // in Occurs.cc
    156153        bool occurs( Type *type, std::string varName, const TypeEnvironment &env );
    157 
    158         // flatten tuple type into list of types
    159         template< typename OutputIterator >
    160         void flatten( Type * type, OutputIterator out ) {
    161                 if ( TupleType * tupleType = dynamic_cast< TupleType * >( type ) ) {
    162                         for ( Type * t : tupleType->get_types() ) {
    163                                 flatten( t, out );
    164                         }
    165                 } else {
    166                         *out++ = type;
    167                 }
    168         }
    169154} // namespace ResolvExpr
    170155
  • src/SymTab/Autogen.cc

    r12bc63a rfc4a0fa  
    116116                // This happens before function pointer type conversion, so need to do it manually here
    117117                VariableExpr * assignVarExpr = new VariableExpr( assignDecl );
    118                 Type * assignVarExprType = assignVarExpr->get_result();
     118                Type *& assignVarExprType = assignVarExpr->get_results().front();
    119119                assignVarExprType = new PointerType( Type::Qualifiers(), assignVarExprType );
    120                 assignVarExpr->set_result( assignVarExprType );
    121120                ApplicationExpr * assignExpr = new ApplicationExpr( assignVarExpr );
    122121                assignExpr->get_args().push_back( new VariableExpr( dstParam ) );
  • src/SymTab/Indexer.cc

    r12bc63a rfc4a0fa  
    4040
    4141namespace SymTab {
    42         template< typename TreeType, typename VisitorType >
    43         inline void acceptNewScope( TreeType *tree, VisitorType &visitor ) {
     42        template< typename Container, typename VisitorType >
     43        inline void acceptAllNewScope( Container &container, VisitorType &visitor ) {
    4444                visitor.enterScope();
    45                 maybeAccept( tree, visitor );
     45                acceptAll( container, visitor );
    4646                visitor.leaveScope();
    4747        }
     
    337337
    338338        void Indexer::visit( ApplicationExpr *applicationExpr ) {
    339                 acceptNewScope( applicationExpr->get_result(), *this );
     339                acceptAllNewScope( applicationExpr->get_results(), *this );
    340340                maybeAccept( applicationExpr->get_function(), *this );
    341341                acceptAll( applicationExpr->get_args(), *this );
     
    343343
    344344        void Indexer::visit( UntypedExpr *untypedExpr ) {
    345                 acceptNewScope( untypedExpr->get_result(), *this );
     345                acceptAllNewScope( untypedExpr->get_results(), *this );
    346346                acceptAll( untypedExpr->get_args(), *this );
    347347        }
    348348
    349349        void Indexer::visit( NameExpr *nameExpr ) {
    350                 acceptNewScope( nameExpr->get_result(), *this );
     350                acceptAllNewScope( nameExpr->get_results(), *this );
    351351        }
    352352
    353353        void Indexer::visit( AddressExpr *addressExpr ) {
    354                 acceptNewScope( addressExpr->get_result(), *this );
     354                acceptAllNewScope( addressExpr->get_results(), *this );
    355355                maybeAccept( addressExpr->get_arg(), *this );
    356356        }
    357357
    358358        void Indexer::visit( LabelAddressExpr *labAddressExpr ) {
    359                 acceptNewScope( labAddressExpr->get_result(), *this );
     359                acceptAllNewScope( labAddressExpr->get_results(), *this );
    360360                maybeAccept( labAddressExpr->get_arg(), *this );
    361361        }
    362362
    363363        void Indexer::visit( CastExpr *castExpr ) {
    364                 acceptNewScope( castExpr->get_result(), *this );
     364                acceptAllNewScope( castExpr->get_results(), *this );
    365365                maybeAccept( castExpr->get_arg(), *this );
    366366        }
    367367
    368368        void Indexer::visit( UntypedMemberExpr *memberExpr ) {
    369                 acceptNewScope( memberExpr->get_result(), *this );
     369                acceptAllNewScope( memberExpr->get_results(), *this );
    370370                maybeAccept( memberExpr->get_aggregate(), *this );
    371371        }
    372372
    373373        void Indexer::visit( MemberExpr *memberExpr ) {
    374                 acceptNewScope( memberExpr->get_result(), *this );
     374                acceptAllNewScope( memberExpr->get_results(), *this );
    375375                maybeAccept( memberExpr->get_aggregate(), *this );
    376376        }
    377377
    378378        void Indexer::visit( VariableExpr *variableExpr ) {
    379                 acceptNewScope( variableExpr->get_result(), *this );
     379                acceptAllNewScope( variableExpr->get_results(), *this );
    380380        }
    381381
    382382        void Indexer::visit( ConstantExpr *constantExpr ) {
    383                 acceptNewScope( constantExpr->get_result(), *this );
     383                acceptAllNewScope( constantExpr->get_results(), *this );
    384384                maybeAccept( constantExpr->get_constant(), *this );
    385385        }
    386386
    387387        void Indexer::visit( SizeofExpr *sizeofExpr ) {
    388                 acceptNewScope( sizeofExpr->get_result(), *this );
     388                acceptAllNewScope( sizeofExpr->get_results(), *this );
    389389                if ( sizeofExpr->get_isType() ) {
    390390                        maybeAccept( sizeofExpr->get_type(), *this );
     
    395395
    396396        void Indexer::visit( AlignofExpr *alignofExpr ) {
    397                 acceptNewScope( alignofExpr->get_result(), *this );
     397                acceptAllNewScope( alignofExpr->get_results(), *this );
    398398                if ( alignofExpr->get_isType() ) {
    399399                        maybeAccept( alignofExpr->get_type(), *this );
     
    404404
    405405        void Indexer::visit( UntypedOffsetofExpr *offsetofExpr ) {
    406                 acceptNewScope( offsetofExpr->get_result(), *this );
     406                acceptAllNewScope( offsetofExpr->get_results(), *this );
    407407                maybeAccept( offsetofExpr->get_type(), *this );
    408408        }
    409409
    410410        void Indexer::visit( OffsetofExpr *offsetofExpr ) {
    411                 acceptNewScope( offsetofExpr->get_result(), *this );
     411                acceptAllNewScope( offsetofExpr->get_results(), *this );
    412412                maybeAccept( offsetofExpr->get_type(), *this );
    413413                maybeAccept( offsetofExpr->get_member(), *this );
     
    415415
    416416        void Indexer::visit( OffsetPackExpr *offsetPackExpr ) {
    417                 acceptNewScope( offsetPackExpr->get_result(), *this );
     417                acceptAllNewScope( offsetPackExpr->get_results(), *this );
    418418                maybeAccept( offsetPackExpr->get_type(), *this );
    419419        }
    420420
    421421        void Indexer::visit( AttrExpr *attrExpr ) {
    422                 acceptNewScope( attrExpr->get_result(), *this );
     422                acceptAllNewScope( attrExpr->get_results(), *this );
    423423                if ( attrExpr->get_isType() ) {
    424424                        maybeAccept( attrExpr->get_type(), *this );
     
    429429
    430430        void Indexer::visit( LogicalExpr *logicalExpr ) {
    431                 acceptNewScope( logicalExpr->get_result(), *this );
     431                acceptAllNewScope( logicalExpr->get_results(), *this );
    432432                maybeAccept( logicalExpr->get_arg1(), *this );
    433433                maybeAccept( logicalExpr->get_arg2(), *this );
     
    435435
    436436        void Indexer::visit( ConditionalExpr *conditionalExpr ) {
    437                 acceptNewScope( conditionalExpr->get_result(), *this );
     437                acceptAllNewScope( conditionalExpr->get_results(), *this );
    438438                maybeAccept( conditionalExpr->get_arg1(), *this );
    439439                maybeAccept( conditionalExpr->get_arg2(), *this );
     
    442442
    443443        void Indexer::visit( CommaExpr *commaExpr ) {
    444                 acceptNewScope( commaExpr->get_result(), *this );
     444                acceptAllNewScope( commaExpr->get_results(), *this );
    445445                maybeAccept( commaExpr->get_arg1(), *this );
    446446                maybeAccept( commaExpr->get_arg2(), *this );
     
    448448
    449449        void Indexer::visit( TupleExpr *tupleExpr ) {
    450                 acceptNewScope( tupleExpr->get_result(), *this );
     450                acceptAllNewScope( tupleExpr->get_results(), *this );
    451451                acceptAll( tupleExpr->get_exprs(), *this );
    452452        }
    453453
    454         void Indexer::visit( TupleAssignExpr *tupleExpr ) {
    455                 acceptNewScope( tupleExpr->get_result(), *this );
    456                 enterScope();
    457                 acceptAll( tupleExpr->get_tempDecls(), *this );
    458                 acceptAll( tupleExpr->get_assigns(), *this );
    459                 leaveScope();
     454        void Indexer::visit( SolvedTupleExpr *tupleExpr ) {
     455                acceptAllNewScope( tupleExpr->get_results(), *this );
     456                acceptAll( tupleExpr->get_exprs(), *this );
    460457        }
    461458
    462459        void Indexer::visit( TypeExpr *typeExpr ) {
    463                 acceptNewScope( typeExpr->get_result(), *this );
     460                acceptAllNewScope( typeExpr->get_results(), *this );
    464461                maybeAccept( typeExpr->get_type(), *this );
    465462        }
     
    472469
    473470        void Indexer::visit( UntypedValofExpr *valofExpr ) {
    474                 acceptNewScope( valofExpr->get_result(), *this );
     471                acceptAllNewScope( valofExpr->get_results(), *this );
    475472                maybeAccept( valofExpr->get_body(), *this );
    476473        }
  • src/SymTab/Indexer.h

    r12bc63a rfc4a0fa  
    6464                virtual void visit( ConditionalExpr *conditionalExpr );
    6565                virtual void visit( CommaExpr *commaExpr );
     66                virtual void visit( TupleExpr *tupleExpr );
     67                virtual void visit( SolvedTupleExpr *tupleExpr );
    6668                virtual void visit( TypeExpr *typeExpr );
    6769                virtual void visit( AsmExpr *asmExpr );
    6870                virtual void visit( UntypedValofExpr *valofExpr );
    69                 virtual void visit( TupleExpr *tupleExpr );
    70                 virtual void visit( TupleAssignExpr *tupleExpr );
    7171
    7272                virtual void visit( TraitInstType *contextInst );
  • src/SynTree/AddressExpr.cc

    r12bc63a rfc4a0fa  
    1919
    2020AddressExpr::AddressExpr( Expression *arg, Expression *_aname ) : Expression( _aname ), arg( arg ) {
    21         if ( arg->has_result() ) {
    22                 set_result( new PointerType( Type::Qualifiers(), arg->get_result()->clone() ) );
    23         }
     21        for ( std::list< Type* >::const_iterator i = arg->get_results().begin(); i != arg->get_results().end(); ++i ) {
     22                get_results().push_back( new PointerType( Type::Qualifiers(), (*i)->clone() ) );
     23        } // for
    2424}
    2525
     
    3535        if ( arg ) {
    3636                os << std::string( indent+2, ' ' );
    37                 arg->print( os, indent+2 );
     37    arg->print( os, indent+2 );
    3838        } // if
    3939}
  • src/SynTree/ApplicationExpr.cc

    r12bc63a rfc4a0fa  
    2121#include "TypeSubstitution.h"
    2222#include "Common/utility.h"
    23 #include "ResolvExpr/typeops.h"
     23
    2424
    2525ParamEntry::ParamEntry( const ParamEntry &other ) :
     
    4343
    4444ApplicationExpr::ApplicationExpr( Expression *funcExpr ) : function( funcExpr ) {
    45         PointerType *pointer = safe_dynamic_cast< PointerType* >( funcExpr->get_result() );
    46         FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
     45        PointerType *pointer = dynamic_cast< PointerType* >( funcExpr->get_results().front() );
     46        assert( pointer );
     47        FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
     48        assert( function );
    4749
    48         set_result( ResolvExpr::extractResultType( function ) );
    49 
    50         assert( has_result() );
     50        for ( std::list< DeclarationWithType* >::const_iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) {
     51                get_results().push_back( (*i)->get_type()->clone() );
     52        } // for
    5153}
    5254
  • src/SynTree/CommaExpr.cc

    r12bc63a rfc4a0fa  
    2323        // to false on all result types. Actually doing this causes some strange things
    2424        // to happen in later passes (particularly, Specialize, Lvalue, and Box). This needs to be looked into.
    25         set_result( maybeClone( arg2->get_result() ) );
    26         // get_type->set_isLvalue( false );
     25        cloneAll( arg2->get_results(), get_results() );
     26        // for ( Type *& type : get_results() ) {
     27        //      type->set_isLvalue( false );
     28        // }
    2729}
    2830
  • src/SynTree/Expression.cc

    r12bc63a rfc4a0fa  
    3131
    3232
    33 Expression::Expression( Expression *_aname ) : result( 0 ), env( 0 ), argName( _aname ) {}
    34 
    35 Expression::Expression( const Expression &other ) : result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ), extension( other.extension ) {
     33Expression::Expression( Expression *_aname ) : env( 0 ), argName( _aname ) {}
     34
     35Expression::Expression( const Expression &other ) : env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ), extension( other.extension ) {
     36        cloneAll( other.results, results );
    3637}
    3738
     
    3940        delete env;
    4041        delete argName; // xxx -- there's a problem in cloning ConstantExpr I still don't know how to fix
    41         delete result;
     42        deleteAll( results );
     43}
     44
     45void Expression::add_result( Type *t ) {
     46        if ( TupleType *tuple = dynamic_cast< TupleType* >( t ) ) {
     47                std::copy( tuple->get_types().begin(), tuple->get_types().end(), back_inserter( results ) );
     48        } else {
     49                results.push_back(t);
     50        } // if
    4251}
    4352
     
    5968
    6069ConstantExpr::ConstantExpr( Constant _c, Expression *_aname ) : Expression( _aname ), constant( _c ) {
    61         set_result( constant.get_type()->clone() );
     70        add_result( constant.get_type()->clone() );
    6271}
    6372
     
    7685        assert( var );
    7786        assert( var->get_type() );
    78         Type * type = var->get_type()->clone();
    79         type->set_isLvalue( true );
    80         set_result( type );
     87        add_result( var->get_type()->clone() );
     88        for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) {
     89                (*i)->set_isLvalue( true );
     90        } // for
    8191}
    8292
     
    100110SizeofExpr::SizeofExpr( Expression *expr_, Expression *_aname ) :
    101111                Expression( _aname ), expr(expr_), type(0), isType(false) {
    102         set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     112        add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    103113}
    104114
    105115SizeofExpr::SizeofExpr( Type *type_, Expression *_aname ) :
    106116                Expression( _aname ), expr(0), type(type_), isType(true) {
    107         set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     117        add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    108118}
    109119
     
    131141AlignofExpr::AlignofExpr( Expression *expr_, Expression *_aname ) :
    132142                Expression( _aname ), expr(expr_), type(0), isType(false) {
    133         set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     143        add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    134144}
    135145
    136146AlignofExpr::AlignofExpr( Type *type_, Expression *_aname ) :
    137147                Expression( _aname ), expr(0), type(type_), isType(true) {
    138         set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     148        add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    139149}
    140150
     
    162172UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type_, const std::string &member_, Expression *_aname ) :
    163173                Expression( _aname ), type(type_), member(member_) {
    164         set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     174        add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    165175}
    166176
     
    187197OffsetofExpr::OffsetofExpr( Type *type_, DeclarationWithType *member_, Expression *_aname ) :
    188198                Expression( _aname ), type(type_), member(member_) {
    189         set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     199        add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    190200}
    191201
     
    219229
    220230OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) {
    221         set_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );
     231        add_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );
    222232}
    223233
     
    274284
    275285CastExpr::CastExpr( Expression *arg_, Type *toType, Expression *_aname ) : Expression( _aname ), arg(arg_) {
    276         set_result(toType);
     286        add_result(toType);
    277287}
    278288
    279289CastExpr::CastExpr( Expression *arg_, Expression *_aname ) : Expression( _aname ), arg(arg_) {
    280         set_result( new VoidType( Type::Qualifiers() ) );
    281290}
    282291
     
    294303        arg->print(os, indent+2);
    295304        os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl;
    296         os << std::string( indent+2, ' ' );
    297         if ( result->isVoid() ) {
    298                 os << "nothing";
     305        if ( results.empty() ) {
     306                os << std::string( indent+2, ' ' ) << "nothing" << std::endl;
    299307        } else {
    300                 result->print( os, indent+2 );
     308                printAll(results, os, indent+2);
    301309        } // if
    302         os << std::endl;
    303         Expression::print( os, indent );
    304 }
    305 
    306 UntypedMemberExpr::UntypedMemberExpr( Expression * _member, Expression *_aggregate, Expression *_aname ) :
     310        Expression::print( os, indent );
     311}
     312
     313UntypedMemberExpr::UntypedMemberExpr( std::string _member, Expression *_aggregate, Expression *_aname ) :
    307314                Expression( _aname ), member(_member), aggregate(_aggregate) {}
    308315
    309316UntypedMemberExpr::UntypedMemberExpr( const UntypedMemberExpr &other ) :
    310                 Expression( other ), member( maybeClone( other.member ) ), aggregate( maybeClone( other.aggregate ) ) {
     317                Expression( other ), member( other.member ), aggregate( maybeClone( other.aggregate ) ) {
    311318}
    312319
    313320UntypedMemberExpr::~UntypedMemberExpr() {
    314321        delete aggregate;
    315         delete member;
    316322}
    317323
    318324void UntypedMemberExpr::print( std::ostream &os, int indent ) const {
    319         os << "Untyped Member Expression, with field: " << std::endl;
    320         get_member()->print(os, indent+4);
    321         os << std::string( indent+2, ' ' );
     325        os << "Untyped Member Expression, with field: " << get_member();
    322326
    323327        Expression *agg = get_aggregate();
    324         os << "from aggregate: " << std::endl;
     328        os << ", from aggregate: ";
    325329        if (agg != 0) {
    326                 os << std::string( indent + 4, ' ' );
    327                 agg->print(os, indent + 4);
     330                os << std::string( indent + 2, ' ' );
     331                agg->print(os, indent + 2);
    328332        }
    329333        os << std::string( indent+2, ' ' );
     
    334338MemberExpr::MemberExpr( DeclarationWithType *_member, Expression *_aggregate, Expression *_aname ) :
    335339                Expression( _aname ), member(_member), aggregate(_aggregate) {
    336         set_result( member->get_type()->clone() );
    337         get_result()->set_isLvalue( true );
     340        add_result( member->get_type()->clone() );
     341        for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) {
     342                (*i)->set_isLvalue( true );
     343        } // for
    338344}
    339345
     
    366372}
    367373
    368 UntypedExpr::UntypedExpr( Expression *_function, const std::list<Expression *> &_args, Expression *_aname ) :
    369                 Expression( _aname ), function(_function), args(_args) {}
     374
     375UntypedExpr::UntypedExpr( Expression *_function, Expression *_aname ) : Expression( _aname ), function( _function ) {}
    370376
    371377UntypedExpr::UntypedExpr( const UntypedExpr &other ) :
     
    373379        cloneAll( other.args, args );
    374380}
     381
     382UntypedExpr::UntypedExpr( Expression *_function, std::list<Expression *> &_args, Expression *_aname ) :
     383                Expression( _aname ), function(_function), args(_args) {}
    375384
    376385UntypedExpr::~UntypedExpr() {
     
    410419LogicalExpr::LogicalExpr( Expression *arg1_, Expression *arg2_, bool andp, Expression *_aname ) :
    411420                Expression( _aname ), arg1(arg1_), arg2(arg2_), isAnd(andp) {
    412         set_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
     421        add_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
    413422}
    414423
     
    468477ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) {
    469478        assert( callExpr );
    470         assert( callExpr->has_result() );
    471         set_result( callExpr->get_result()->clone() );
     479        cloneAll( callExpr->get_results(), results );
    472480}
    473481
     
    502510        Expression * arg = InitTweak::getCallArg( callExpr, 0 );
    503511        assert( arg );
    504         set_result( maybeClone( arg->get_result() ) );
     512        cloneAll( arg->get_results(), results );
    505513}
    506514
     
    522530
    523531CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : type( type ), initializer( initializer ) {
    524         set_result( type->clone() );
     532        add_result( type->clone() );
    525533}
    526534
     
    557565}
    558566
    559 StmtExpr::StmtExpr( CompoundStmt *statements ) : statements( statements ) {
    560         assert( statements );
    561         std::list< Statement * > & body = statements->get_kids();
    562         if ( ! body.empty() ) {
    563                 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) {
    564                         set_result( maybeClone( exprStmt->get_expr()->get_result() ) );
    565                 }
    566         }
    567 }
    568 StmtExpr::StmtExpr( const StmtExpr &other ) : statements( other.statements->clone() ) {}
    569 StmtExpr::~StmtExpr() {
    570         delete statements;
    571 }
    572 void StmtExpr::print( std::ostream &os, int indent ) const {
    573         os << std::string( indent, ' ' ) << "Statement Expression: " << std::endl;
    574         statements->print( os, indent+2 );
    575 }
    576 
    577567std::ostream & operator<<( std::ostream & out, const Expression * expr ) {
    578568        expr->print( out );
  • src/SynTree/Expression.h

    r12bc63a rfc4a0fa  
    3232        virtual ~Expression();
    3333
    34         Type *& get_result() { return result; }
    35         void set_result( Type *newValue ) { result = newValue; }
    36         bool has_result() const { return result != nullptr; }
     34        std::list<Type *>& get_results() { return results; }
     35        void add_result( Type *t );
    3736
    3837        TypeSubstitution *get_env() const { return env; }
     
    4847        virtual void print( std::ostream &os, int indent = 0 ) const;
    4948  protected:
    50         Type * result;
     49        std::list<Type *> results;
    5150        TypeSubstitution *env;
    5251        Expression* argName; // if expression is used as an argument, it can be "designated" by this name
     
    9998class UntypedExpr : public Expression {
    10099  public:
    101         UntypedExpr( Expression *function, const std::list<Expression *> &args = std::list< Expression * >(), Expression *_aname = nullptr );
     100        UntypedExpr( Expression *function, Expression *_aname = nullptr );
    102101        UntypedExpr( const UntypedExpr &other );
     102        UntypedExpr( Expression *function, std::list<Expression *> &args, Expression *_aname = nullptr );
    103103        virtual ~UntypedExpr();
    104104
     
    200200class UntypedMemberExpr : public Expression {
    201201  public:
    202         UntypedMemberExpr( Expression *member, Expression *aggregate, Expression *_aname = nullptr );
     202        UntypedMemberExpr( std::string member, Expression *aggregate, Expression *_aname = nullptr );
    203203        UntypedMemberExpr( const UntypedMemberExpr &other );
    204204        virtual ~UntypedMemberExpr();
    205205
    206         Expression * get_member() const { return member; }
    207         void set_member( Expression * newValue ) { member = newValue; }
     206        std::string get_member() const { return member; }
     207        void set_member( const std::string &newValue ) { member = newValue; }
    208208        Expression *get_aggregate() const { return aggregate; }
    209209        void set_aggregate( Expression *newValue ) { aggregate = newValue; }
     
    214214        virtual void print( std::ostream &os, int indent = 0 ) const;
    215215  private:
    216         Expression *member;
     216        std::string member;
    217217        Expression *aggregate;
    218218};
     
    483483};
    484484
     485/// TupleExpr represents a tuple expression ( [a, b, c] )
     486class TupleExpr : public Expression {
     487  public:
     488        TupleExpr( Expression *_aname = nullptr );
     489        TupleExpr( const TupleExpr &other );
     490        virtual ~TupleExpr();
     491
     492        void set_exprs( std::list<Expression*> newValue ) { exprs = newValue; }
     493        std::list<Expression*>& get_exprs() { return exprs; }
     494
     495        virtual TupleExpr *clone() const { return new TupleExpr( *this ); }
     496        virtual void accept( Visitor &v ) { v.visit( this ); }
     497        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     498        virtual void print( std::ostream &os, int indent = 0 ) const;
     499  private:
     500        std::list<Expression*> exprs;
     501};
     502
     503/// SolvedTupleExpr represents a TupleExpr whose components have been type-resolved. It is effectively a shell for the code generator to work on
     504class SolvedTupleExpr : public Expression {
     505  public:
     506        SolvedTupleExpr( Expression *_aname = nullptr ) : Expression( _aname ) {}
     507        SolvedTupleExpr( std::list<Expression *> &, Expression *_aname = nullptr );
     508        SolvedTupleExpr( const SolvedTupleExpr &other );
     509        virtual ~SolvedTupleExpr() {}
     510
     511        std::list<Expression*> &get_exprs() { return exprs; }
     512
     513        virtual SolvedTupleExpr *clone() const { return new SolvedTupleExpr( *this ); }
     514        virtual void accept( Visitor &v ) { v.visit( this ); }
     515        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     516        virtual void print( std::ostream &os, int indent = 0 ) const;
     517  private:
     518        std::list<Expression*> exprs;
     519};
     520
    485521/// TypeExpr represents a type used in an expression (e.g. as a type generator parameter)
    486522class TypeExpr : public Expression {
     
    582618        CompoundLiteralExpr( Type * type, Initializer * initializer );
    583619        CompoundLiteralExpr( const CompoundLiteralExpr &other );
    584         virtual ~CompoundLiteralExpr();
     620        ~CompoundLiteralExpr();
    585621
    586622        Type * get_type() const { return type; }
     
    634670  private:
    635671        Expression *low, *high;
    636 };
    637 
    638 /// TupleExpr represents a tuple expression ( [a, b, c] )
    639 class TupleExpr : public Expression {
    640   public:
    641         TupleExpr( Expression *_aname = nullptr );
    642         TupleExpr( const TupleExpr &other );
    643         virtual ~TupleExpr();
    644 
    645         void set_exprs( std::list<Expression*> newValue ) { exprs = newValue; }
    646         std::list<Expression*>& get_exprs() { return exprs; }
    647 
    648         virtual TupleExpr *clone() const { return new TupleExpr( *this ); }
    649         virtual void accept( Visitor &v ) { v.visit( this ); }
    650         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    651         virtual void print( std::ostream &os, int indent = 0 ) const;
    652   private:
    653         std::list<Expression*> exprs;
    654 };
    655 
    656 /// TupleIndexExpr represents an element selection operation on a tuple value, e.g. t.3 after processing by the expression analyzer
    657 class TupleIndexExpr : public Expression {
    658   public:
    659         TupleIndexExpr( Expression * tuple, unsigned int index );
    660         TupleIndexExpr( const TupleIndexExpr &other );
    661         virtual ~TupleIndexExpr();
    662 
    663         Expression * get_tuple() const { return tuple; }
    664         int get_index() const { return index; }
    665         TupleIndexExpr * set_tuple( Expression *newValue ) { tuple = newValue; return this; }
    666         TupleIndexExpr * set_index( unsigned int newValue ) { index = newValue; return this; }
    667 
    668         virtual TupleIndexExpr *clone() const { return new TupleIndexExpr( *this ); }
    669         virtual void accept( Visitor &v ) { v.visit( this ); }
    670         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    671         virtual void print( std::ostream &os, int indent = 0 ) const;
    672   private:
    673         Expression * tuple;
    674         unsigned int index;
    675 };
    676 
    677 /// MemberTupleExpr represents a tuple member selection operation on a struct type, e.g. s.[a, b, c] after processing by the expression analyzer
    678 class MemberTupleExpr : public Expression {
    679   public:
    680         MemberTupleExpr( Expression * member, Expression * aggregate, Expression * _aname = nullptr );
    681         MemberTupleExpr( const MemberTupleExpr &other );
    682         virtual ~MemberTupleExpr();
    683 
    684         Expression * get_member() const { return member; }
    685         Expression * get_aggregate() const { return aggregate; }
    686         MemberTupleExpr * set_member( Expression *newValue ) { member = newValue; return this; }
    687         MemberTupleExpr * set_aggregate( Expression *newValue ) { aggregate = newValue; return this; }
    688 
    689         virtual MemberTupleExpr *clone() const { return new MemberTupleExpr( *this ); }
    690         virtual void accept( Visitor &v ) { v.visit( this ); }
    691         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    692         virtual void print( std::ostream &os, int indent = 0 ) const;
    693   private:
    694         Expression * member;
    695         Expression * aggregate;
    696 };
    697 
    698 /// TupleAssignExpr represents a multiple assignment operation, where both sides of the assignment have tuple type, e.g. [a, b, c] = [d, e, f];, or a mass assignment operation, where the left hand side has tuple type and the right hand side does not, e.g. [a, b, c] = 5.0;
    699 class TupleAssignExpr : public Expression {
    700   public:
    701         TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname = nullptr );
    702         TupleAssignExpr( const TupleAssignExpr &other );
    703         virtual ~TupleAssignExpr();
    704 
    705         std::list< Expression * > & get_assigns() { return assigns; }
    706         std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; }
    707 
    708         virtual TupleAssignExpr *clone() const { return new TupleAssignExpr( *this ); }
    709         virtual void accept( Visitor &v ) { v.visit( this ); }
    710         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    711         virtual void print( std::ostream &os, int indent = 0 ) const;
    712   private:
    713         std::list< Expression * > assigns; // assignment expressions that use tempDecls
    714         std::list< ObjectDecl * > tempDecls; // temporaries for address of lhs exprs
    715 };
    716 
    717 /// StmtExpr represents a GCC 'statement expression', e.g. ({ int x = 5; x; })
    718 class StmtExpr : public Expression {
    719 public:
    720         StmtExpr( CompoundStmt *statements );
    721         StmtExpr( const StmtExpr & other );
    722         virtual ~StmtExpr();
    723 
    724         CompoundStmt * get_statements() const { return statements; }
    725         StmtExpr * set_statements( CompoundStmt * newValue ) { statements = newValue; return this; }
    726 
    727         virtual StmtExpr *clone() const { return new StmtExpr( *this ); }
    728         virtual void accept( Visitor &v ) { v.visit( this ); }
    729         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    730         virtual void print( std::ostream &os, int indent = 0 ) const;
    731 private:
    732         CompoundStmt * statements;
    733672};
    734673
  • src/SynTree/Mutator.cc

    r12bc63a rfc4a0fa  
    178178
    179179Expression *Mutator::mutate( ApplicationExpr *applicationExpr ) {
    180         applicationExpr->set_result( maybeMutate( applicationExpr->get_result(), *this ) );
     180        mutateAll( applicationExpr->get_results(), *this );
    181181        applicationExpr->set_function( maybeMutate( applicationExpr->get_function(), *this ) );
    182182        mutateAll( applicationExpr->get_args(), *this );
     
    185185
    186186Expression *Mutator::mutate( UntypedExpr *untypedExpr ) {
    187         untypedExpr->set_result( maybeMutate( untypedExpr->get_result(), *this ) );
     187        mutateAll( untypedExpr->get_results(), *this );
    188188        mutateAll( untypedExpr->get_args(), *this );
    189189        return untypedExpr;
     
    191191
    192192Expression *Mutator::mutate( NameExpr *nameExpr ) {
    193         nameExpr->set_result( maybeMutate( nameExpr->get_result(), *this ) );
     193        mutateAll( nameExpr->get_results(), *this );
    194194        return nameExpr;
    195195}
    196196
    197197Expression *Mutator::mutate( AddressExpr *addressExpr ) {
    198         addressExpr->set_result( maybeMutate( addressExpr->get_result(), *this ) );
     198        mutateAll( addressExpr->get_results(), *this );
    199199        addressExpr->set_arg( maybeMutate( addressExpr->get_arg(), *this ) );
    200200        return addressExpr;
     
    202202
    203203Expression *Mutator::mutate( LabelAddressExpr *labelAddressExpr ) {
    204         labelAddressExpr->set_result( maybeMutate( labelAddressExpr->get_result(), *this ) );
     204        mutateAll( labelAddressExpr->get_results(), *this );
    205205        labelAddressExpr->set_arg( maybeMutate( labelAddressExpr->get_arg(), *this ) );
    206206        return labelAddressExpr;
     
    208208
    209209Expression *Mutator::mutate( CastExpr *castExpr ) {
    210         castExpr->set_result( maybeMutate( castExpr->get_result(), *this ) );
     210        mutateAll( castExpr->get_results(), *this );
    211211        castExpr->set_arg( maybeMutate( castExpr->get_arg(), *this ) );
    212212        return castExpr;
     
    214214
    215215Expression *Mutator::mutate( UntypedMemberExpr *memberExpr ) {
    216         memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) );
    217         memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) );
    218         memberExpr->set_member( maybeMutate( memberExpr->get_member(), *this ) );
    219         return memberExpr;
    220 }
    221 
    222 Expression *Mutator::mutate( MemberExpr *memberExpr ) {
    223         memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) );
     216        mutateAll( memberExpr->get_results(), *this );
    224217        memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) );
    225218        return memberExpr;
    226219}
    227220
     221Expression *Mutator::mutate( MemberExpr *memberExpr ) {
     222        mutateAll( memberExpr->get_results(), *this );
     223        memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) );
     224        return memberExpr;
     225}
     226
    228227Expression *Mutator::mutate( VariableExpr *variableExpr ) {
    229         variableExpr->set_result( maybeMutate( variableExpr->get_result(), *this ) );
     228        mutateAll( variableExpr->get_results(), *this );
    230229        return variableExpr;
    231230}
    232231
    233232Expression *Mutator::mutate( ConstantExpr *constantExpr ) {
    234         constantExpr->set_result( maybeMutate( constantExpr->get_result(), *this ) );
     233        mutateAll( constantExpr->get_results(), *this );
    235234//  maybeMutate( constantExpr->get_constant(), *this )
    236235        return constantExpr;
     
    238237
    239238Expression *Mutator::mutate( SizeofExpr *sizeofExpr ) {
    240         sizeofExpr->set_result( maybeMutate( sizeofExpr->get_result(), *this ) );
     239        mutateAll( sizeofExpr->get_results(), *this );
    241240        if ( sizeofExpr->get_isType() ) {
    242241                sizeofExpr->set_type( maybeMutate( sizeofExpr->get_type(), *this ) );
     
    248247
    249248Expression *Mutator::mutate( AlignofExpr *alignofExpr ) {
    250         alignofExpr->set_result( maybeMutate( alignofExpr->get_result(), *this ) );
     249        mutateAll( alignofExpr->get_results(), *this );
    251250        if ( alignofExpr->get_isType() ) {
    252251                alignofExpr->set_type( maybeMutate( alignofExpr->get_type(), *this ) );
     
    258257
    259258Expression *Mutator::mutate( UntypedOffsetofExpr *offsetofExpr ) {
    260         offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ) );
     259        mutateAll( offsetofExpr->get_results(), *this );
    261260        offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) );
    262261        return offsetofExpr;
     
    264263
    265264Expression *Mutator::mutate( OffsetofExpr *offsetofExpr ) {
    266         offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ) );
     265        mutateAll( offsetofExpr->get_results(), *this );
    267266        offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) );
    268267        offsetofExpr->set_member( maybeMutate( offsetofExpr->get_member(), *this ) );
     
    271270
    272271Expression *Mutator::mutate( OffsetPackExpr *offsetPackExpr ) {
    273         offsetPackExpr->set_result( maybeMutate( offsetPackExpr->get_result(), *this ) );
     272        mutateAll( offsetPackExpr->get_results(), *this );
    274273        offsetPackExpr->set_type( maybeMutate( offsetPackExpr->get_type(), *this ) );
    275274        return offsetPackExpr;
     
    277276
    278277Expression *Mutator::mutate( AttrExpr *attrExpr ) {
    279         attrExpr->set_result( maybeMutate( attrExpr->get_result(), *this ) );
     278        mutateAll( attrExpr->get_results(), *this );
    280279        if ( attrExpr->get_isType() ) {
    281280                attrExpr->set_type( maybeMutate( attrExpr->get_type(), *this ) );
     
    287286
    288287Expression *Mutator::mutate( LogicalExpr *logicalExpr ) {
    289         logicalExpr->set_result( maybeMutate( logicalExpr->get_result(), *this ) );
     288        mutateAll( logicalExpr->get_results(), *this );
    290289        logicalExpr->set_arg1( maybeMutate( logicalExpr->get_arg1(), *this ) );
    291290        logicalExpr->set_arg2( maybeMutate( logicalExpr->get_arg2(), *this ) );
     
    294293
    295294Expression *Mutator::mutate( ConditionalExpr *conditionalExpr ) {
    296         conditionalExpr->set_result( maybeMutate( conditionalExpr->get_result(), *this ) );
     295        mutateAll( conditionalExpr->get_results(), *this );
    297296        conditionalExpr->set_arg1( maybeMutate( conditionalExpr->get_arg1(), *this ) );
    298297        conditionalExpr->set_arg2( maybeMutate( conditionalExpr->get_arg2(), *this ) );
     
    302301
    303302Expression *Mutator::mutate( CommaExpr *commaExpr ) {
    304         commaExpr->set_result( maybeMutate( commaExpr->get_result(), *this ) );
     303        mutateAll( commaExpr->get_results(), *this );
    305304        commaExpr->set_arg1( maybeMutate( commaExpr->get_arg1(), *this ) );
    306305        commaExpr->set_arg2( maybeMutate( commaExpr->get_arg2(), *this ) );
     
    308307}
    309308
     309Expression *Mutator::mutate( TupleExpr *tupleExpr ) {
     310        mutateAll( tupleExpr->get_results(), *this );
     311        mutateAll( tupleExpr->get_exprs(), *this );
     312        return tupleExpr;
     313}
     314
     315Expression *Mutator::mutate( SolvedTupleExpr *tupleExpr ) {
     316        mutateAll( tupleExpr->get_results(), *this );
     317        mutateAll( tupleExpr->get_exprs(), *this );
     318        return tupleExpr;
     319}
     320
    310321Expression *Mutator::mutate( TypeExpr *typeExpr ) {
    311         typeExpr->set_result( maybeMutate( typeExpr->get_result(), *this ) );
     322        mutateAll( typeExpr->get_results(), *this );
    312323        typeExpr->set_type( maybeMutate( typeExpr->get_type(), *this ) );
    313324        return typeExpr;
     
    329340
    330341Expression* Mutator::mutate( ConstructorExpr *ctorExpr ) {
    331         ctorExpr->set_result( maybeMutate( ctorExpr->get_result(), *this ) );
     342        mutateAll( ctorExpr->get_results(), *this );
    332343        ctorExpr->set_callExpr( maybeMutate( ctorExpr->get_callExpr(), *this ) );
    333344        return ctorExpr;
     
    335346
    336347Expression *Mutator::mutate( CompoundLiteralExpr *compLitExpr ) {
    337         compLitExpr->set_result( maybeMutate( compLitExpr->get_result(), *this ) );
     348        mutateAll( compLitExpr->get_results(), *this );
    338349        compLitExpr->set_type( maybeMutate( compLitExpr->get_type(), *this ) );
    339350        compLitExpr->set_initializer( maybeMutate( compLitExpr->get_initializer(), *this ) );
     
    342353
    343354Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) {
    344         valofExpr->set_result( maybeMutate( valofExpr->get_result(), *this ) );
     355        mutateAll( valofExpr->get_results(), *this );
    345356        return valofExpr;
    346357}
     
    350361        rangeExpr->set_high( maybeMutate( rangeExpr->get_high(), *this ) );
    351362        return rangeExpr;
    352 }
    353 
    354 Expression *Mutator::mutate( TupleExpr *tupleExpr ) {
    355         tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
    356         mutateAll( tupleExpr->get_exprs(), *this );
    357         return tupleExpr;
    358 }
    359 
    360 Expression *Mutator::mutate( TupleIndexExpr *tupleExpr ) {
    361         tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
    362         tupleExpr->set_tuple( maybeMutate( tupleExpr->get_tuple(), *this ) );
    363         return tupleExpr;
    364 }
    365 
    366 Expression *Mutator::mutate( MemberTupleExpr *tupleExpr ) {
    367         tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
    368         tupleExpr->set_member( maybeMutate( tupleExpr->get_member(), *this ) );
    369         tupleExpr->set_aggregate( maybeMutate( tupleExpr->get_aggregate(), *this ) );
    370         return tupleExpr;
    371 }
    372 
    373 Expression *Mutator::mutate( TupleAssignExpr *assignExpr ) {
    374         assignExpr->set_result( maybeMutate( assignExpr->get_result(), *this ) );
    375         mutateAll( assignExpr->get_tempDecls(), *this );
    376         mutateAll( assignExpr->get_assigns(), *this );
    377         return assignExpr;
    378 }
    379 
    380 Expression *Mutator::mutate( StmtExpr *stmtExpr ) {
    381         stmtExpr->set_result( maybeMutate( stmtExpr->get_result(), *this ) );
    382         stmtExpr->set_statements( maybeMutate( stmtExpr->get_statements(), *this ) );
    383         return stmtExpr;
    384363}
    385364
  • src/SynTree/Mutator.h

    r12bc63a rfc4a0fa  
    7171        virtual Expression* mutate( ConditionalExpr *conditionalExpr );
    7272        virtual Expression* mutate( CommaExpr *commaExpr );
     73        virtual Expression* mutate( TupleExpr *tupleExpr );
     74        virtual Expression* mutate( SolvedTupleExpr *tupleExpr );
    7375        virtual Expression* mutate( TypeExpr *typeExpr );
    7476        virtual Expression* mutate( AsmExpr *asmExpr );
     
    7880        virtual Expression* mutate( UntypedValofExpr *valofExpr );
    7981        virtual Expression* mutate( RangeExpr *rangeExpr );
    80         virtual Expression* mutate( TupleExpr *tupleExpr );
    81         virtual Expression* mutate( TupleIndexExpr *tupleExpr );
    82         virtual Expression* mutate( MemberTupleExpr *tupleExpr );
    83         virtual Expression* mutate( TupleAssignExpr *assignExpr );
    84         virtual Expression* mutate( StmtExpr * stmtExpr );
    8582
    8683        virtual Type* mutate( VoidType *basicType );
  • src/SynTree/ReferenceToType.cc

    r12bc63a rfc4a0fa  
    5656        }
    5757} // namespace
    58 
    59 StructInstType::StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct ) : Parent( tq, baseStruct->get_name() ), baseStruct( baseStruct ) {}
    6058
    6159std::string StructInstType::typeString() const { return "struct"; }
  • src/SynTree/SynTree.h

    r12bc63a rfc4a0fa  
    7676class ConditionalExpr;
    7777class CommaExpr;
     78class TupleExpr;
     79class SolvedTupleExpr;
    7880class TypeExpr;
    7981class AsmExpr;
     
    8385class UntypedValofExpr;
    8486class RangeExpr;
    85 class TupleExpr;
    86 class TupleIndexExpr;
    87 class MemberTupleExpr;
    88 class TupleAssignExpr;
    89 class StmtExpr;
    9087
    9188class Type;
  • src/SynTree/TupleExpr.cc

    r12bc63a rfc4a0fa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TupleExpr.cc --
     7// TupleExpr.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    1616#include "Expression.h"
    1717#include "Common/utility.h"
    18 #include "Type.h"
    19 #include "Declaration.h"
    2018
    2119TupleExpr::TupleExpr( Expression *_aname ) : Expression( _aname ) {
     
    3129
    3230void TupleExpr::print( std::ostream &os, int indent ) const {
    33         os << "Tuple:" << std::endl;
     31        os << std::string( indent, ' ' ) << "Tuple:" << std::endl;
    3432        printAll( exprs, os, indent+2 );
    3533        Expression::print( os, indent );
    3634}
    3735
    38 TupleIndexExpr::TupleIndexExpr( Expression * tuple, unsigned int index ) {
    39         TupleType * type = safe_dynamic_cast< TupleType * >( tuple->get_result() );
    40         assert( type->size() >= index );
    41         set_result( *std::next( type->get_types().begin(), index ) );
     36SolvedTupleExpr::SolvedTupleExpr( std::list<Expression *> &_exprs, Expression *_aname ) : Expression( _aname ) {
     37        std::copy(_exprs.begin(), _exprs.end(), back_inserter(exprs));
    4238}
    4339
    44 TupleIndexExpr::TupleIndexExpr( const TupleIndexExpr &other ) : Expression( other ), tuple( other.tuple->clone() ), index( other.index ) {
     40SolvedTupleExpr::SolvedTupleExpr( const SolvedTupleExpr &other ) : Expression( other ) {
     41        cloneAll( other.exprs, exprs );
    4542}
    4643
    47 TupleIndexExpr::~TupleIndexExpr() {
    48         delete tuple;
    49 }
    50 
    51 void TupleIndexExpr::print( std::ostream &os, int indent ) const {
    52         os << "Tuple Index Expression, with tuple:" << std::endl;
    53         tuple->print( os, indent+2 );
    54         os << std::string( indent+2, ' ' ) << "with index: " << index << std::endl;
     44void SolvedTupleExpr::print( std::ostream &os, int indent ) const {
     45        os << std::string( indent, ' ' ) << "Solved Tuple:" << std::endl;
     46        printAll( exprs, os, indent+2 );
    5547        Expression::print( os, indent );
    5648}
    57 
    58 MemberTupleExpr::MemberTupleExpr( Expression * member, Expression * aggregate, Expression * _aname ) : Expression( _aname ) {
    59         set_result( maybeClone( member->get_result() ) ); // xxx - ???
    60 }
    61 
    62 MemberTupleExpr::MemberTupleExpr( const MemberTupleExpr &other ) : Expression( other ), member( other.member->clone() ), aggregate( other.aggregate->clone() ) {
    63 }
    64 
    65 MemberTupleExpr::~MemberTupleExpr() {
    66         delete member;
    67         delete aggregate;
    68 }
    69 
    70 void MemberTupleExpr::print( std::ostream &os, int indent ) const {
    71         os << "Member Tuple Expression, with aggregate:" << std::endl;
    72         aggregate->print( os, indent+2 );
    73         os << std::string( indent+2, ' ' ) << "with member: " << std::endl;
    74         member->print( os, indent+2 );
    75         Expression::print( os, indent );
    76 }
    77 
    78 
    79 TupleAssignExpr::TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname ) : Expression( _aname ), assigns( assigns ), tempDecls( tempDecls ) {
    80         TupleType * type = new TupleType( Type::Qualifiers() );
    81         for ( Expression * expr : assigns ) {
    82                 assert( expr->has_result() );
    83                 type->get_types().push_back( expr->get_result()->clone() );
    84         }
    85         set_result( type );
    86 }
    87 
    88 TupleAssignExpr::TupleAssignExpr( const TupleAssignExpr &other ) : Expression( other ), tempDecls( other.tempDecls ) /* temporary */ {
    89         cloneAll( other.assigns, assigns );
    90         // xxx - clone needs to go into assigns and replace tempDecls
    91 }
    92 
    93 TupleAssignExpr::~TupleAssignExpr() {
    94         deleteAll( assigns );
    95         // deleteAll( tempDecls );
    96 }
    97 
    98 void TupleAssignExpr::print( std::ostream &os, int indent ) const {
    99         os << std::string( indent, ' ' ) << "Tuple Assignment Expression, with temporaries:" << std::endl;
    100         printAll( tempDecls, os, indent+4 );
    101         os << std::string( indent+2, ' ' ) << "with assignments: " << std::endl;
    102         printAll( assigns, os, indent+4 );
    103         Expression::print( os, indent );
    104 }
    105 
    106 
    10749
    10850// Local Variables: //
  • src/SynTree/TupleType.cc

    r12bc63a rfc4a0fa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TupleType.cc --
     7// TupleType.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    1717#include "Common/utility.h"
    1818
    19 TupleType::TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types ) : Type( tq ), types( types ) {
     19TupleType::TupleType( const Type::Qualifiers &tq ) : Type( tq ) {
    2020}
    2121
  • src/SynTree/Type.h

    r12bc63a rfc4a0fa  
    2727                Qualifiers( bool isConst, bool isVolatile, bool isRestrict, bool isLvalue, bool isAtomic, bool isAttribute ): isConst( isConst ), isVolatile( isVolatile ), isRestrict( isRestrict ), isLvalue( isLvalue ), isAtomic( isAtomic ), isAttribute( isAttribute ) {}
    2828
    29                 Qualifiers &operator&=( const Qualifiers &other );
    3029                Qualifiers &operator+=( const Qualifiers &other );
    3130                Qualifiers &operator-=( const Qualifiers &other );
     
    6665        std::list<TypeDecl*>& get_forall() { return forall; }
    6766
    68         /// How many elemental types are represented by this type
    69         virtual unsigned size() const { return 1; };
    70         virtual bool isVoid() const { return size() == 0; }
    71 
    7267        virtual Type *clone() const = 0;
    7368        virtual void accept( Visitor &v ) = 0;
     
    8277  public:
    8378        VoidType( const Type::Qualifiers &tq );
    84 
    85         virtual unsigned size() const { return 0; };
    8679
    8780        virtual VoidType *clone() const { return new VoidType( *this ); }
     
    241234  public:
    242235        StructInstType( const Type::Qualifiers &tq, const std::string &name ) : Parent( tq, name ), baseStruct( 0 ) {}
    243         StructInstType( const Type::Qualifiers &tq, StructDecl * baseStruct );
    244236        StructInstType( const StructInstType &other ) : Parent( other ), baseStruct( other.baseStruct ) {}
    245237
     
    356348class TupleType : public Type {
    357349  public:
    358         TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types = std::list< Type * >() );
     350        TupleType( const Type::Qualifiers &tq );
    359351        TupleType( const TupleType& );
    360352        virtual ~TupleType();
    361353
    362         typedef std::list<Type*> value_type;
    363         typedef value_type::iterator iterator;
    364 
    365354        std::list<Type*>& get_types() { return types; }
    366         virtual unsigned size() const { return types.size(); };
    367 
    368         iterator begin() { return types.begin(); }
    369         iterator end() { return types.end(); }
    370355
    371356        virtual TupleType *clone() const { return new TupleType( *this ); }
     
    433418};
    434419
    435 inline Type::Qualifiers &Type::Qualifiers::operator&=( const Type::Qualifiers &other ) {
    436         isConst &= other.isConst;
    437         isVolatile &= other.isVolatile;
    438         isRestrict &= other.isRestrict;
    439         isLvalue &= other.isLvalue;
    440         isAtomic &= other.isAtomic;
    441         return *this;
    442 }
    443 
    444420inline Type::Qualifiers &Type::Qualifiers::operator+=( const Type::Qualifiers &other ) {
    445421        isConst |= other.isConst;
  • src/SynTree/Visitor.cc

    r12bc63a rfc4a0fa  
    150150
    151151void Visitor::visit( ApplicationExpr *applicationExpr ) {
    152         maybeAccept( applicationExpr->get_result(), *this );
     152        acceptAll( applicationExpr->get_results(), *this );
    153153        maybeAccept( applicationExpr->get_function(), *this );
    154154        acceptAll( applicationExpr->get_args(), *this );
     
    156156
    157157void Visitor::visit( UntypedExpr *untypedExpr ) {
    158         maybeAccept( untypedExpr->get_result(), *this );
     158        acceptAll( untypedExpr->get_results(), *this );
    159159        acceptAll( untypedExpr->get_args(), *this );
    160160}
    161161
    162162void Visitor::visit( NameExpr *nameExpr ) {
    163         maybeAccept( nameExpr->get_result(), *this );
     163        acceptAll( nameExpr->get_results(), *this );
    164164}
    165165
    166166void Visitor::visit( AddressExpr *addressExpr ) {
    167         maybeAccept( addressExpr->get_result(), *this );
     167        acceptAll( addressExpr->get_results(), *this );
    168168        maybeAccept( addressExpr->get_arg(), *this );
    169169}
    170170
    171171void Visitor::visit( LabelAddressExpr *labAddressExpr ) {
    172         maybeAccept( labAddressExpr->get_result(), *this );
     172        acceptAll( labAddressExpr->get_results(), *this );
    173173        maybeAccept( labAddressExpr->get_arg(), *this );
    174174}
    175175
    176176void Visitor::visit( CastExpr *castExpr ) {
    177         maybeAccept( castExpr->get_result(), *this );
     177        acceptAll( castExpr->get_results(), *this );
    178178        maybeAccept( castExpr->get_arg(), *this );
    179179}
    180180
    181181void Visitor::visit( UntypedMemberExpr *memberExpr ) {
    182         maybeAccept( memberExpr->get_result(), *this );
     182        acceptAll( memberExpr->get_results(), *this );
    183183        maybeAccept( memberExpr->get_aggregate(), *this );
    184         maybeAccept( memberExpr->get_member(), *this );
    185184}
    186185
    187186void Visitor::visit( MemberExpr *memberExpr ) {
    188         maybeAccept( memberExpr->get_result(), *this );
     187        acceptAll( memberExpr->get_results(), *this );
    189188        maybeAccept( memberExpr->get_aggregate(), *this );
    190189}
    191190
    192191void Visitor::visit( VariableExpr *variableExpr ) {
    193         maybeAccept( variableExpr->get_result(), *this );
     192        acceptAll( variableExpr->get_results(), *this );
    194193}
    195194
    196195void Visitor::visit( ConstantExpr *constantExpr ) {
    197         maybeAccept( constantExpr->get_result(), *this );
     196        acceptAll( constantExpr->get_results(), *this );
    198197        maybeAccept( constantExpr->get_constant(), *this );
    199198}
    200199
    201200void Visitor::visit( SizeofExpr *sizeofExpr ) {
    202         maybeAccept( sizeofExpr->get_result(), *this );
     201        acceptAll( sizeofExpr->get_results(), *this );
    203202        if ( sizeofExpr->get_isType() ) {
    204203                maybeAccept( sizeofExpr->get_type(), *this );
     
    209208
    210209void Visitor::visit( AlignofExpr *alignofExpr ) {
    211         maybeAccept( alignofExpr->get_result(), *this );
     210        acceptAll( alignofExpr->get_results(), *this );
    212211        if ( alignofExpr->get_isType() ) {
    213212                maybeAccept( alignofExpr->get_type(), *this );
     
    218217
    219218void Visitor::visit( UntypedOffsetofExpr *offsetofExpr ) {
    220         maybeAccept( offsetofExpr->get_result(), *this );
     219        acceptAll( offsetofExpr->get_results(), *this );
    221220        maybeAccept( offsetofExpr->get_type(), *this );
    222221}
    223222
    224223void Visitor::visit( OffsetofExpr *offsetofExpr ) {
    225         maybeAccept( offsetofExpr->get_result(), *this );
     224        acceptAll( offsetofExpr->get_results(), *this );
    226225        maybeAccept( offsetofExpr->get_type(), *this );
    227226        maybeAccept( offsetofExpr->get_member(), *this );
     
    229228
    230229void Visitor::visit( OffsetPackExpr *offsetPackExpr ) {
    231         maybeAccept( offsetPackExpr->get_result(), *this );
     230        acceptAll( offsetPackExpr->get_results(), *this );
    232231        maybeAccept( offsetPackExpr->get_type(), *this );
    233232}
    234233
    235234void Visitor::visit( AttrExpr *attrExpr ) {
    236         maybeAccept( attrExpr->get_result(), *this );
     235        acceptAll( attrExpr->get_results(), *this );
    237236        if ( attrExpr->get_isType() ) {
    238237                maybeAccept( attrExpr->get_type(), *this );
     
    243242
    244243void Visitor::visit( LogicalExpr *logicalExpr ) {
    245         maybeAccept( logicalExpr->get_result(), *this );
     244        acceptAll( logicalExpr->get_results(), *this );
    246245        maybeAccept( logicalExpr->get_arg1(), *this );
    247246        maybeAccept( logicalExpr->get_arg2(), *this );
     
    249248
    250249void Visitor::visit( ConditionalExpr *conditionalExpr ) {
    251         maybeAccept( conditionalExpr->get_result(), *this );
     250        acceptAll( conditionalExpr->get_results(), *this );
    252251        maybeAccept( conditionalExpr->get_arg1(), *this );
    253252        maybeAccept( conditionalExpr->get_arg2(), *this );
     
    256255
    257256void Visitor::visit( CommaExpr *commaExpr ) {
    258         maybeAccept( commaExpr->get_result(), *this );
     257        acceptAll( commaExpr->get_results(), *this );
    259258        maybeAccept( commaExpr->get_arg1(), *this );
    260259        maybeAccept( commaExpr->get_arg2(), *this );
    261260}
    262261
     262void Visitor::visit( TupleExpr *tupleExpr ) {
     263        acceptAll( tupleExpr->get_results(), *this );
     264        acceptAll( tupleExpr->get_exprs(), *this );
     265}
     266
     267void Visitor::visit( SolvedTupleExpr *tupleExpr ) {
     268        acceptAll( tupleExpr->get_results(), *this );
     269        acceptAll( tupleExpr->get_exprs(), *this );
     270}
     271
    263272void Visitor::visit( TypeExpr *typeExpr ) {
    264         maybeAccept( typeExpr->get_result(), *this );
     273        acceptAll( typeExpr->get_results(), *this );
    265274        maybeAccept( typeExpr->get_type(), *this );
    266275}
     
    279288
    280289void Visitor::visit( ConstructorExpr * ctorExpr ) {
    281         maybeAccept( ctorExpr->get_result(), *this );
     290        acceptAll( ctorExpr->get_results(), *this );
    282291        maybeAccept( ctorExpr->get_callExpr(), *this );
    283292}
    284293
    285294void Visitor::visit( CompoundLiteralExpr *compLitExpr ) {
    286         maybeAccept( compLitExpr->get_result(), *this );
     295        acceptAll( compLitExpr->get_results(), *this );
    287296        maybeAccept( compLitExpr->get_type(), *this );
    288297        maybeAccept( compLitExpr->get_initializer(), *this );
     
    290299
    291300void Visitor::visit( UntypedValofExpr *valofExpr ) {
    292         maybeAccept( valofExpr->get_result(), *this );
     301        acceptAll( valofExpr->get_results(), *this );
    293302        maybeAccept( valofExpr->get_body(), *this );
    294303}
     
    297306        maybeAccept( rangeExpr->get_low(), *this );
    298307        maybeAccept( rangeExpr->get_high(), *this );
    299 }
    300 
    301 void Visitor::visit( TupleExpr *tupleExpr ) {
    302         maybeAccept( tupleExpr->get_result(), *this );
    303         acceptAll( tupleExpr->get_exprs(), *this );
    304 }
    305 
    306 void Visitor::visit( TupleIndexExpr *tupleExpr ) {
    307         maybeAccept( tupleExpr->get_result(), *this );
    308         maybeAccept( tupleExpr->get_tuple(), *this );
    309 }
    310 
    311 void Visitor::visit( MemberTupleExpr *tupleExpr ) {
    312         maybeAccept( tupleExpr->get_result(), *this );
    313         maybeAccept( tupleExpr->get_member(), *this );
    314         maybeAccept( tupleExpr->get_aggregate(), *this );
    315 }
    316 
    317 void Visitor::visit( TupleAssignExpr *assignExpr ) {
    318         maybeAccept( assignExpr->get_result(), *this );
    319         acceptAll( assignExpr->get_tempDecls(), *this );
    320         acceptAll( assignExpr->get_assigns(), *this );
    321 }
    322 
    323 void Visitor::visit( StmtExpr *stmtExpr ) {
    324         maybeAccept( stmtExpr->get_result(), *this );
    325         maybeAccept( stmtExpr->get_statements(), *this );
    326308}
    327309
  • src/SynTree/Visitor.h

    r12bc63a rfc4a0fa  
    7171        virtual void visit( ConditionalExpr *conditionalExpr );
    7272        virtual void visit( CommaExpr *commaExpr );
     73        virtual void visit( TupleExpr *tupleExpr );
     74        virtual void visit( SolvedTupleExpr *tupleExpr );
    7375        virtual void visit( TypeExpr *typeExpr );
    7476        virtual void visit( AsmExpr *asmExpr );
     
    7880        virtual void visit( UntypedValofExpr *valofExpr );
    7981        virtual void visit( RangeExpr *rangeExpr );
    80         virtual void visit( TupleExpr *tupleExpr );
    81         virtual void visit( TupleIndexExpr *tupleExpr );
    82         virtual void visit( MemberTupleExpr *tupleExpr );
    83         virtual void visit( TupleAssignExpr *assignExpr );
    84         virtual void visit( StmtExpr * stmtExpr );
    8582
    8683        virtual void visit( VoidType *basicType );
  • src/Tuples/TupleAssignment.cc

    r12bc63a rfc4a0fa  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TupleAssignment.cc --
     7// TupleAssignment.cc -- 
    88//
    99// Author           : Rodolfo G. Esteves
     
    1818#include "ResolvExpr/typeops.h"
    1919#include "SynTree/Expression.h"
    20 #include "SynTree/Initializer.h"
    21 #include "Tuples.h"
     20#include "TupleAssignment.h"
    2221#include "Common/SemanticError.h"
    2322
     
    2827#include <cassert>
    2928#include <set>
    30 #include <unordered_set>
    3129
    3230namespace Tuples {
    33         class TupleAssignSpotter {
    34           public:
    35                 // dispatcher for Tuple (multiple and mass) assignment operations
    36                 TupleAssignSpotter( ResolvExpr::AlternativeFinder & );
    37                 void spot( UntypedExpr * expr, std::list<ResolvExpr::AltList> &possibilities );
    38 
    39           private:
    40                 void match();
    41                 // records for assignment generation
    42                 struct Options {
    43                         void print( std::ostream & );
    44                         int size() const { return options.size(); }
    45                         bool empty() const { return options.empty(); }
    46                         typedef std::list< ResolvExpr::AltList >::iterator iterator;
    47                         iterator begin() { return options.begin(); }
    48                         iterator end() { return options.end(); }
    49 
    50                         std::list< ResolvExpr::AltList > options;
    51                 };
    52 
    53                 struct Matcher {
    54                   public:
    55                         Matcher( TupleAssignSpotter &spotter, Expression *_lhs, Expression *_rhs );
    56                         virtual ~Matcher() {}
    57                         virtual void match( std::list< Expression * > &out ) = 0;
    58                         std::list< Expression * > lhs, rhs;
    59                         TupleAssignSpotter &spotter;
    60                         std::list< ObjectDecl * > tmpDecls;
    61                 };
    62 
    63                 struct MassAssignMatcher : public Matcher {
    64                   public:
    65                         MassAssignMatcher( TupleAssignSpotter &spotter, Expression *lhs, Expression *rhs ) : Matcher( spotter, lhs, rhs ) {
    66                                 this->rhs.push_back( rhs );
     31        TupleAssignSpotter::TupleAssignSpotter( ResolvExpr::AlternativeFinder *f = 0 )
     32                : currentFinder(f), matcher(0), hasMatched( false ) {}
     33
     34        bool TupleAssignSpotter::pointsToTuple( Expression *expr ) {
     35                // also check for function returning tuple of reference types
     36                if (AddressExpr *addr = dynamic_cast<AddressExpr *>(expr) )
     37                        if ( isTuple(addr->get_arg() ) )
     38                                return true;
     39                return false;
     40        }
     41
     42        bool TupleAssignSpotter::isTupleVar( DeclarationWithType *decl ) {
     43                if ( dynamic_cast<TupleType *>(decl->get_type()) )
     44                        return true;
     45                return false;
     46        }
     47
     48        bool TupleAssignSpotter::isTuple( Expression *expr, bool isRight ) {
     49                // true if `expr' is an expression returning a tuple: tuple, tuple variable or MRV function
     50                if ( ! expr ) return false;
     51
     52                if ( dynamic_cast<TupleExpr *>(expr) )
     53                        return true;
     54                else if ( VariableExpr *var = dynamic_cast<VariableExpr *>(expr) ) {
     55                        if ( isTupleVar(var->get_var()) )
     56                                return true;
     57                }
     58
     59                return false;
     60        }
     61
     62        bool TupleAssignSpotter::match() {
     63                assert ( matcher != 0 );
     64
     65                std::list< Expression * > new_assigns;
     66                if ( ! matcher->match(new_assigns) )
     67                        return false;
     68
     69                if ( new_assigns.empty() ) return false;
     70                /*return */matcher->solve( new_assigns );
     71                if ( dynamic_cast<TupleAssignSpotter::MultipleAssignMatcher *>( matcher ) ) {
     72                        // now resolve new assignments
     73                        std::list< Expression * > solved_assigns;
     74                        ResolvExpr::AltList solved_alts;
     75                        assert( currentFinder != 0 );
     76
     77                        ResolvExpr::AltList current;
     78                        for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i ) {
     79                                //try {
     80                                ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() );
     81                                finder.findWithAdjustment(*i);
     82                                // prune expressions that don't coincide with
     83                                ResolvExpr::AltList alts = finder.get_alternatives();
     84                                assert( alts.size() == 1 );
     85                                assert(alts.front().expr != 0 );
     86                                current.push_back( finder.get_alternatives().front() );
     87                                solved_assigns.push_back( alts.front().expr->clone() );
     88                                //solved_assigns.back()->print(std::cerr);
     89                                /*} catch( ... ) {
     90                                  continue; // no reasonable alternative found
     91                                  }*/
    6792                        }
    68                         virtual void match( std::list< Expression * > &out );
    69                 };
    70 
    71                 struct MultipleAssignMatcher : public Matcher {
    72                   public:
    73                         MultipleAssignMatcher( TupleAssignSpotter &spot, Expression *lhs, Expression *rhs );
    74                         virtual void match( std::list< Expression * > &out );
    75                 };
    76 
    77                 ResolvExpr::AlternativeFinder &currentFinder;
    78                 // Expression *rhs, *lhs;
    79                 Matcher *matcher = nullptr;
    80                 Options options;
    81         };
    82 
    83         bool isTupleVar( DeclarationWithType *decl ) {
    84                 return dynamic_cast< TupleType * >( decl->get_type() );
    85         }
    86 
    87         /// true if expr is an expression of tuple type, i.e. a tuple expression, tuple variable, or MRV (multiple-return-value) function
    88         bool isTuple( Expression *expr ) {
    89                 if ( ! expr ) return false;
    90                 assert( expr->has_result() );
    91                 // xxx - used to include cast to varExpr and call to isTupleVar, but this doesn't seem like it should be necessary
    92                 return dynamic_cast<TupleExpr *>(expr) || expr->get_result()->size() > 1;
    93         }
    94 
    95         bool pointsToTuple( Expression *expr ) {
    96                 // also check for function returning tuple of reference types
    97                 if ( AddressExpr *addr = dynamic_cast< AddressExpr * >( expr) ) {
    98                         return isTuple( addr->get_arg() );
    99                 }
    100                 return false;
    101         }
    102 
    103         bool isTupleExpr( Expression *expr ) {
    104                 assert( expr->has_result() );
    105                 return expr->get_result()->size() > 1;
    106         }
    107 
    108         void handleTupleAssignment( ResolvExpr::AlternativeFinder & currentFinder, UntypedExpr * expr, std::list<ResolvExpr::AltList> &possibilities ) {
    109                 TupleAssignSpotter spotter( currentFinder );
    110                 spotter.spot( expr, possibilities );
    111         }
    112 
    113         TupleAssignSpotter::TupleAssignSpotter( ResolvExpr::AlternativeFinder &f )
    114                 : currentFinder(f) {}
    115 
    116         void TupleAssignSpotter::spot( UntypedExpr * expr, std::list<ResolvExpr::AltList> &possibilities ) {
     93                        options.add_option( current );
     94
     95                        return true;
     96                } else { // mass assignment
     97                        //if ( new_assigns.empty() ) return false;
     98                        std::list< Expression * > solved_assigns;
     99                        ResolvExpr::AltList solved_alts;
     100                        assert( currentFinder != 0 );
     101
     102                        ResolvExpr::AltList current;
     103                        if ( optMass.empty() ) {
     104                                for ( std::list< Expression * >::size_type i = 0; i != new_assigns.size(); ++i )
     105                                        optMass.push_back( ResolvExpr::AltList() );
     106                        }
     107                        int cnt = 0;
     108                        for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i, cnt++ ) {
     109
     110                                ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() );
     111                                finder.findWithAdjustment(*i);
     112                                ResolvExpr::AltList alts = finder.get_alternatives();
     113                                assert( alts.size() == 1 );
     114                                assert(alts.front().expr != 0 );
     115                                current.push_back( finder.get_alternatives().front() );
     116                                optMass[cnt].push_back( finder.get_alternatives().front() );
     117                                solved_assigns.push_back( alts.front().expr->clone() );
     118                        }
     119
     120                        return true;
     121                }
     122
     123                return false;
     124        }
     125
     126        bool TupleAssignSpotter::isMVR( Expression *expr ) {
     127                if ( expr->get_results().size() > 1 ) {
     128                        // MVR processing
     129                        return true;
     130                }
     131                return false;
     132        }
     133
     134        bool TupleAssignSpotter::isTupleAssignment( UntypedExpr * expr, std::list<ResolvExpr::AltList> &possibilities ) {
    117135                if (  NameExpr *assgnop = dynamic_cast< NameExpr * >(expr->get_function()) ) {
     136
    118137                        if ( assgnop->get_name() == std::string("?=?") ) {
     138
    119139                                for ( std::list<ResolvExpr::AltList>::iterator ali = possibilities.begin(); ali != possibilities.end(); ++ali ) {
    120140                                        assert( ali->size() == 2 );
    121                                         ResolvExpr::Alternative op1 = ali->front(), op2 = ali->back();
    122 
    123                                         MultipleAssignMatcher multiMatcher( *this, op1.expr, op2.expr );
    124                                         MassAssignMatcher massMatcher( *this, op1.expr, op2.expr );
     141                                        ResolvExpr::AltList::iterator opit = ali->begin();
     142                                        ResolvExpr::Alternative op1 = *opit, op2 = *(++opit);
     143
    125144                                        if ( pointsToTuple(op1.expr) ) { // also handles tuple vars
    126                                                 if ( isTuple( op2.expr ) ) {
    127                                                         matcher = &multiMatcher;
    128                                                 } else {
     145                                                if ( isTuple( op2.expr, true ) )
     146                                                        matcher = new MultipleAssignMatcher(op1.expr, op2.expr);
     147                                                else if ( isMVR( op2.expr ) ) {
     148                                                        // handle MVR differently
     149                                                } else
    129150                                                        // mass assignment
    130                                                         matcher = &massMatcher;
     151                                                        matcher = new MassAssignMatcher(op1.expr, op2.expr);
     152
     153                                                std::list< ResolvExpr::AltList > options;
     154                                                if ( match() )
     155                                                        /*
     156                                                          if ( hasMatched ) {
     157                                                          // throw SemanticError("Ambiguous tuple assignment");
     158                                                          } else {*/
     159                                                        // Matched for the first time
     160                                                        hasMatched = true;
     161                                                /*} */
     162                                        } /* else if ( isTuple( op2 ) )
     163                                                 throw SemanticError("Inapplicable tuple assignment.");
     164                                          */
     165                                }
     166
     167                                if ( hasMatched ) {
     168                                        if ( dynamic_cast<TupleAssignSpotter::MultipleAssignMatcher *>( matcher ) ) {
     169                                                //options.print( std::cerr );
     170                                                std::list< ResolvExpr::AltList >best = options.get_best();
     171                                                if ( best.size() == 1 ) {
     172                                                        std::list<Expression *> solved_assigns;
     173                                                        for ( ResolvExpr::AltList::iterator i = best.front().begin(); i != best.front().end(); ++i ) {
     174                                                                solved_assigns.push_back( i->expr );
     175                                                        }
     176                                                        /* assigning cost zero? */
     177                                                        currentFinder->get_alternatives().push_front( ResolvExpr::Alternative(new SolvedTupleExpr(solved_assigns/*, SolvedTupleExpr::MULTIPLE*/), currentFinder->get_environ(), ResolvExpr::Cost() ) );
    131178                                                }
    132                                                 match();
    133                                         } else if ( isTuple( op2.expr ) ) {
    134                                                 throw SemanticError("Cannot assign a tuple value into a non-tuple lvalue.", expr);
     179                                        } else {
     180                                                assert( ! optMass.empty() );
     181                                                ResolvExpr::AltList winners;
     182                                                for ( std::vector< ResolvExpr::AltList >::iterator i = optMass.begin(); i != optMass.end(); ++i )
     183                                                        findMinCostAlt( i->begin(), i->end(), back_inserter(winners) );
     184
     185                                                std::list< Expression *> solved_assigns;
     186                                                for ( ResolvExpr::AltList::iterator i = winners.begin(); i != winners.end(); ++i )
     187                                                        solved_assigns.push_back( i->expr );
     188                                                currentFinder->get_alternatives().push_front( ResolvExpr::Alternative(new SolvedTupleExpr(solved_assigns/*, SolvedTupleExpr::MASS*/), currentFinder->get_environ(), ResolvExpr::Cost() ) );
    135189                                        }
    136190                                }
    137191                        }
    138192                }
    139         }
    140 
    141         void TupleAssignSpotter::match() {
    142                 assert ( matcher != 0 );
    143 
    144                 std::list< Expression * > new_assigns;
    145                 matcher->match( new_assigns );
    146 
    147                 if ( new_assigns.empty() ) return;
    148                 ResolvExpr::AltList current;
    149                 // now resolve new assignments
    150                 for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i ) {
    151                         ResolvExpr::AlternativeFinder finder( currentFinder.get_indexer(), currentFinder.get_environ() );
    152                         finder.findWithAdjustment(*i);
    153                         // prune expressions that don't coincide with
    154                         ResolvExpr::AltList alts = finder.get_alternatives();
    155                         assert( alts.size() == 1 );
    156                         assert( alts.front().expr != 0 );
    157                         current.push_back( alts.front() );
    158                 }
    159 
    160                 // extract expressions from the assignment alternatives to produce a list of assignments that
    161                 // together form a single alternative
    162                 std::list< Expression *> solved_assigns;
    163                 for ( ResolvExpr::Alternative & alt : current ) {
    164                         solved_assigns.push_back( alt.expr->clone() );
    165                 }
    166                 // xxx - need to do this??
    167                 // TypeEnvironment compositeEnv;
    168                 // simpleCombineEnvironments( i->begin(), i->end(), compositeEnv );
    169                 currentFinder.get_alternatives().push_front( ResolvExpr::Alternative(new TupleAssignExpr(solved_assigns, matcher->tmpDecls), currentFinder.get_environ(), ResolvExpr::sumCost( current ) ) );
    170         }
    171 
    172         TupleAssignSpotter::Matcher::Matcher( TupleAssignSpotter &spotter, Expression *lhs, Expression *rhs ) : spotter(spotter) {
    173                 // xxx - shouldn't need to be &<tuple-expr>, just &<lvalue-tuple-type>
    174                 if (AddressExpr *addr = dynamic_cast<AddressExpr *>(lhs) )
     193                return hasMatched;
     194        }
     195
     196        void TupleAssignSpotter::Matcher::init( Expression *_lhs, Expression *_rhs ) {
     197                lhs.clear();
     198                if (AddressExpr *addr = dynamic_cast<AddressExpr *>(_lhs) )
    175199                        if ( TupleExpr *tuple = dynamic_cast<TupleExpr *>(addr->get_arg()) )
    176                                 std::copy( tuple->get_exprs().begin(), tuple->get_exprs().end(), back_inserter(this->lhs) );
    177         }
    178 
    179         TupleAssignSpotter::MultipleAssignMatcher::MultipleAssignMatcher( TupleAssignSpotter &spotter, Expression *lhs, Expression *rhs ) : Matcher( spotter, lhs, rhs ) {
    180 
    181                 if ( TupleExpr *tuple = dynamic_cast<TupleExpr *>(rhs) )
    182                         std::copy( tuple->get_exprs().begin(), tuple->get_exprs().end(), back_inserter(this->rhs) );
    183         }
    184 
    185         UntypedExpr * createAssgn( ObjectDecl *left, ObjectDecl *right ) {
    186                 assert( left && right );
    187                 std::list< Expression * > args;
    188                 args.push_back( new AddressExpr( new UntypedExpr( new NameExpr("*?"), std::list< Expression * >{ new VariableExpr( left ) } ) ) );
    189                 args.push_back( new VariableExpr( right ) );
    190                 return new UntypedExpr( new NameExpr( "?=?" ), args );
    191         }
    192 
    193         ObjectDecl * newObject( UniqueName & namer, Expression * expr ) {
    194                 assert( expr->has_result() && ! expr->get_result()->isVoid() );
    195                 return new ObjectDecl( namer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) );
    196         }
    197 
    198         void TupleAssignSpotter::MassAssignMatcher::match( std::list< Expression * > &out ) {
    199                 static UniqueName lhsNamer( "__massassign_L" );
    200                 static UniqueName rhsNamer( "__massassign_R" );
    201                 assert ( ! lhs.empty() && rhs.size() == 1);
    202 
    203                 ObjectDecl * rtmp = newObject( rhsNamer, rhs.front() );
    204                 for ( Expression * l : lhs ) {
    205                         ObjectDecl * ltmp = newObject( lhsNamer, new AddressExpr( l ) );
    206                         out.push_back( createAssgn( ltmp, rtmp ) );
    207                         tmpDecls.push_back( ltmp );
    208                 }
    209                 tmpDecls.push_back( rtmp );
    210         }
    211 
    212         void TupleAssignSpotter::MultipleAssignMatcher::match( std::list< Expression * > &out ) {
    213                 static UniqueName lhsNamer( "__multassign_L" );
    214                 static UniqueName rhsNamer( "__multassign_R" );
    215                 // xxx - need more complicated matching?
     200                                std::copy( tuple->get_exprs().begin(), tuple->get_exprs().end(), back_inserter(lhs) );
     201
     202                rhs.clear();
     203        }
     204
     205        TupleAssignSpotter::Matcher::Matcher( /*TupleAssignSpotter &spot,*/ Expression *_lhs, Expression *_rhs ) /*: own_spotter(spot) */{
     206                init(_lhs,_rhs);
     207        }
     208
     209        TupleAssignSpotter::MultipleAssignMatcher::MultipleAssignMatcher( Expression *_lhs, Expression *_rhs )/* : own_spotter(spot) */{
     210                init(_lhs,_rhs);
     211
     212                if ( TupleExpr *tuple = dynamic_cast<TupleExpr *>(_rhs) )
     213                        std::copy( tuple->get_exprs().begin(), tuple->get_exprs().end(), back_inserter(rhs) );
     214        }
     215
     216        UntypedExpr *TupleAssignSpotter::Matcher::createAssgn( Expression *left, Expression *right ) {
     217                if ( left && right ) {
     218                        std::list< Expression * > args;
     219                        args.push_back(new AddressExpr(left->clone()));  args.push_back(right->clone());
     220                        return new UntypedExpr(new NameExpr("?=?"), args);
     221                } else
     222                        throw 0; // xxx - diagnose the problem
     223        }
     224
     225        bool TupleAssignSpotter::MassAssignMatcher::match( std::list< Expression * > &out ) {
     226                if ( lhs.empty() || (rhs.size() != 1) ) return false;
     227
     228                for ( std::list< Expression * >::iterator l = lhs.begin(); l != lhs.end(); l++ ) {
     229                        std::list< Expression * > args;
     230                        args.push_back( new AddressExpr(*l) );
     231                        args.push_back( rhs.front() );
     232                        out.push_back( new UntypedExpr(new NameExpr("?=?"), args) );
     233                }
     234
     235                return true;
     236        }
     237
     238        bool TupleAssignSpotter::MassAssignMatcher::solve( std::list< Expression * > &assigns ) {
     239                /*
     240                  std::list< Expression * > solved_assigns;
     241                  ResolvExpr::AltList solved_alts;
     242                  assert( currentFinder != 0 );
     243
     244                  ResolvExpr::AltList current;
     245                  if ( optMass.empty() ) {
     246                  for ( std::list< Expression * >::size_type i = 0; i != new_assigns.size(); ++i )
     247                  optMass.push_back( ResolvExpr::AltList() );
     248                  }
     249                  int cnt = 0;
     250                  for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i, cnt++ ) {
     251
     252                  ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() );
     253                  finder.findWithAdjustment(*i);
     254                  ResolvExpr::AltList alts = finder.get_alternatives();
     255                  assert( alts.size() == 1 );
     256                  assert(alts.front().expr != 0 );
     257                  current.push_back( finder.get_alternatives().front() );
     258                  optMass[cnt].push_back( finder.get_alternatives().front() );
     259                  solved_assigns.push_back( alts.front().expr->clone() );
     260                  }
     261                */
     262                return true;
     263        }
     264
     265        bool TupleAssignSpotter::MultipleAssignMatcher::match( std::list< Expression * > &out ) {
     266                // need more complicated matching
    216267                if ( lhs.size() == rhs.size() ) {
    217                         std::list< ObjectDecl * > ltmp;
    218                         std::list< ObjectDecl * > rtmp;
    219                         std::transform( lhs.begin(), lhs.end(), back_inserter( ltmp ), []( Expression * expr ){
    220                                 return newObject( lhsNamer, new AddressExpr( expr ) );
    221                         });
    222                         std::transform( rhs.begin(), rhs.end(), back_inserter( rtmp ), []( Expression * expr ){
    223                                 return newObject( rhsNamer, expr );
    224                         });
    225                         zipWith( ltmp.begin(), ltmp.end(), rtmp.begin(), rtmp.end(), back_inserter(out), createAssgn );
    226                         tmpDecls.splice( tmpDecls.end(), ltmp );
    227                         tmpDecls.splice( tmpDecls.end(), rtmp );
    228                 }
     268                        zipWith( lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), back_inserter(out), TupleAssignSpotter::Matcher::createAssgn );
     269                        return true;
     270                } //else
     271                //std::cerr << "The length of (left, right) is: (" << lhs.size() << "," << rhs.size() << ")" << std::endl;*/
     272                return false;
     273        }
     274
     275        bool TupleAssignSpotter::MultipleAssignMatcher::solve( std::list< Expression * > &assigns ) {
     276                /*
     277                  std::list< Expression * > solved_assigns;
     278                  ResolvExpr::AltList solved_alts;
     279                  assert( currentFinder != 0 );
     280
     281                  ResolvExpr::AltList current;
     282                  for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i ) {
     283                  //try {
     284                  ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() );
     285                  finder.findWithAdjustment(*i);
     286                  // prune expressions that don't coincide with
     287                  ResolvExpr::AltList alts = finder.get_alternatives();
     288                  assert( alts.size() == 1 );
     289                  assert(alts.front().expr != 0 );
     290                  current.push_back( finder.get_alternatives().front() );
     291                  solved_assigns.push_back( alts.front().expr->clone() );
     292                  //solved_assigns.back()->print(std::cerr);
     293                  //} catch( ... ) {
     294                  //continue; // no reasonable alternative found
     295                  //}
     296                  }
     297                  options.add_option( current );
     298                */
     299
     300                return true;
     301        }
     302
     303        void TupleAssignSpotter::Options::add_option( ResolvExpr::AltList &opt ) {
     304                using namespace std;
     305
     306                options.push_back( opt );
     307                /*
     308                  vector< Cost > costs;
     309                  costs.reserve( opt.size() );
     310                  transform( opt.begin(), opt.end(), back_inserter(costs), ptr_fun(extract_cost) );
     311                */
     312                // transpose matrix
     313                if ( costMatrix.empty() )
     314                        for ( unsigned int i = 0; i< opt.size(); ++i)
     315                                costMatrix.push_back( vector<ResolvExpr::Cost>() );
     316
     317                int cnt = 0;
     318                for ( ResolvExpr::AltList::iterator i = opt.begin(); i != opt.end(); ++i, cnt++ )
     319                        costMatrix[cnt].push_back( i->cost );
     320
     321                return;
     322        }
     323
     324        std::list< ResolvExpr::AltList > TupleAssignSpotter::Options::get_best() {
     325                using namespace std;
     326                using namespace ResolvExpr;
     327                list< ResolvExpr::AltList > ret;
     328                list< multiset<int> > solns;
     329                for ( vector< vector<Cost> >::iterator i = costMatrix.begin(); i != costMatrix.end(); ++i ) {
     330                        list<int> current;
     331                        findMinCost( i->begin(), i->end(), back_inserter(current) );
     332                        solns.push_back( multiset<int>(current.begin(), current.end()) );
     333                }
     334                // need to combine
     335                multiset<int> result;
     336                lift_intersection( solns.begin(), solns.end(), inserter( result, result.begin() ) );
     337                if ( result.size() != 1 )
     338                        throw SemanticError("Ambiguous tuple expression");
     339                ret.push_back(get_option( *(result.begin() )));
     340                return ret;
    229341        }
    230342
    231343        void TupleAssignSpotter::Options::print( std::ostream &ostr ) {
    232                 for ( ResolvExpr::AltList & l : options ) {
    233                         for ( ResolvExpr::Alternative & alt : l ) {
    234                                 alt.print( ostr );
    235                                 ostr << " ";
    236                         }
     344                using namespace std;
     345
     346                for ( vector< vector < ResolvExpr::Cost > >::iterator i = costMatrix.begin(); i != costMatrix.end(); ++i ) {
     347                        for ( vector < ResolvExpr::Cost >::iterator j = i->begin(); j != i->end(); ++j )
     348                                ostr << *j << " " ;
    237349                        ostr << std::endl;
    238350                } // for
     351                return;
     352        }
     353
     354        ResolvExpr::Cost extract_cost( ResolvExpr::Alternative &alt ) {
     355                return alt.cost;
     356        }
     357
     358        template< typename InputIterator, typename OutputIterator >
     359        void TupleAssignSpotter::Options::findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) {
     360                using namespace ResolvExpr;
     361                std::list<int> alternatives;
     362
     363                // select the alternatives that have the minimum parameter cost
     364                Cost minCost = Cost::infinity;
     365                unsigned int index = 0;
     366                for ( InputIterator i = begin; i != end; ++i, index++ ) {
     367                        if ( *i < minCost ) {
     368                                minCost = *i;
     369                                alternatives.clear();
     370                                alternatives.push_back( index );
     371                        } else if ( *i == minCost ) {
     372                                alternatives.push_back( index );
     373                        }
     374                }
     375                std::copy( alternatives.begin(), alternatives.end(), out );
     376        }
     377
     378        template< class InputIterator, class OutputIterator >
     379        void TupleAssignSpotter::Options::lift_intersection( InputIterator begin, InputIterator end, OutputIterator out ) {
     380                if ( begin == end ) return;
     381                InputIterator test = begin;
     382
     383                if (++test == end)
     384                        { copy(begin->begin(), begin->end(), out); return; }
     385
     386
     387                std::multiset<int> cur; // InputIterator::value_type::value_type
     388                copy( begin->begin(), begin->end(), inserter( cur, cur.begin() ) );
     389
     390                while ( test != end ) {
     391                        std::multiset<int> temp;
     392                        set_intersection( cur.begin(), cur.end(), test->begin(), test->end(), inserter(temp,temp.begin()) );
     393                        cur.clear();
     394                        copy( temp.begin(), temp.end(), inserter(cur,cur.begin()));
     395                        ++test;
     396                }
     397
     398                copy( cur.begin(), cur.end(), out );
     399                return;
     400        }
     401
     402        ResolvExpr::AltList TupleAssignSpotter::Options::get_option( std::list< ResolvExpr::AltList >::size_type index ) {
     403                if ( index >= options.size() )
     404                        throw 0; // XXX
     405                std::list< ResolvExpr::AltList >::iterator it = options.begin();
     406                for ( std::list< ResolvExpr::AltList >::size_type i = 0; i < index; ++i, ++it );
     407                return *it;
    239408        }
    240409} // namespace Tuples
  • src/Tuples/module.mk

    r12bc63a rfc4a0fa  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk --
     8## module.mk -- 
    99##
    1010## Author           : Richard C. Bilson
     
    1616
    1717SRC +=  Tuples/TupleAssignment.cc \
    18         Tuples/TupleExpansion.cc
     18        Tuples/NameMatcher.cc
  • src/main.cc

    r12bc63a rfc4a0fa  
    4242#include "Common/UnimplementedError.h"
    4343#include "../config.h"
    44 #include "Tuples/Tuples.h"
    4544
    4645using namespace std;
     
    266265                OPTPRINT( "convertLvalue" )
    267266                GenPoly::convertLvalue( translationUnit );
    268                 OPTPRINT( "expandTuples" ); // xxx - is this the right place for this?
    269                 Tuples::expandTuples( translationUnit );
    270267
    271268                if ( bboxp ) {
Note: See TracChangeset for help on using the changeset viewer.