Changeset 9236060 for src/Parser


Ignore:
Timestamp:
Aug 14, 2017, 2:03:39 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
74b007ba
Parents:
fd344aa (diff), 54cd58b0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into references

Location:
src/Parser
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rfd344aa r9236060  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:27:00 2017
    13 // Update Count     : 1019
     12// Last Modified On : Fri Jul 14 16:55:00 2017
     13// Update Count     : 1020
    1414//
    1515
     
    253253        newnode->type->aggregate.fields = fields;
    254254        newnode->type->aggregate.body = body;
     255        newnode->type->aggregate.tagged = false;
     256        newnode->type->aggregate.parent = nullptr;
    255257        return newnode;
    256258} // DeclarationNode::newAggregate
     
    273275        return newnode;
    274276} // DeclarationNode::newEnumConstant
     277
     278DeclarationNode * DeclarationNode::newTreeStruct( Aggregate kind, const string * name, const string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body ) {
     279        assert( name );
     280        DeclarationNode * newnode = new DeclarationNode;
     281        newnode->type = new TypeData( TypeData::Aggregate );
     282        newnode->type->aggregate.kind = kind;
     283        newnode->type->aggregate.name = name;
     284        newnode->type->aggregate.actuals = actuals;
     285        newnode->type->aggregate.fields = fields;
     286        newnode->type->aggregate.body = body;
     287        newnode->type->aggregate.tagged = true;
     288        newnode->type->aggregate.parent = parent;
     289        return newnode;
     290} // DeclarationNode::newTreeStruct
    275291
    276292DeclarationNode * DeclarationNode::newName( string * name ) {
  • src/Parser/ExpressionNode.cc

    rfd344aa r9236060  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:17:07 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 21:08:15 2017
    13 // Update Count     : 542
    14 //
    15 
    16 #include <cassert>
    17 #include <cctype>
    18 #include <climits>
    19 #include <cstdio>
    20 #include <algorithm>
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Aug  2 11:12:00 2017
     13// Update Count     : 568
     14//
     15
     16#include <climits>                                                                              // access INT_MAX, UINT_MAX, LONG_MAX, ULONG_MAX, LLONG_MAX
    2117#include <sstream>
    2218
     
    2622#include "SynTree/Expression.h"
    2723#include "SynTree/Declaration.h"
    28 #include "Common/UnimplementedError.h"
    2924#include "parserutility.h"
    30 #include "Common/utility.h"
    3125
    3226using namespace std;
     
    4640// type.
    4741
    48 Type::Qualifiers emptyQualifiers;                               // no qualifiers on constants
     42extern const Type::Qualifiers noQualifiers;             // no qualifiers on constants
    4943
    5044static inline bool checkU( char c ) { return c == 'u' || c == 'U'; }
     
    5549static inline bool checkX( char c ) { return c == 'x' || c == 'X'; }
    5650
    57 Expression *build_constantInteger( const std::string & str ) {
     51Expression * build_constantInteger( const std::string & str ) {
    5852        static const BasicType::Kind kind[2][3] = {
    5953                { BasicType::SignedInt, BasicType::LongSignedInt, BasicType::LongLongSignedInt },
     
    6256        bool dec = true, Unsigned = false;                                      // decimal, unsigned constant
    6357        int size;                                                                                       // 0 => int, 1 => long, 2 => long long
    64         unsigned long long int v;                                                               // converted integral value
     58        unsigned long long int v;                                                       // converted integral value
    6559        size_t last = str.length() - 1;                                         // last character of constant
    66 
     60        Expression * ret;
     61
     62        // special constants
     63        if ( str == "0" ) {
     64                ret = new ConstantExpr( Constant( (Type *)new ZeroType( noQualifiers ), str, (unsigned long long int)0 ) );
     65                goto CLEANUP;
     66        } // if
     67        if ( str == "1" ) {
     68                ret = new ConstantExpr( Constant( (Type *)new OneType( noQualifiers ), str, (unsigned long long int)1 ) );
     69                goto CLEANUP;
     70        } // if
     71       
    6772        if ( str[0] == '0' ) {                                                          // octal/hex constant ?
    6873                dec = false;
     
    118123        } // if
    119124
    120         Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[Unsigned][size] ), str, v ) );
     125        ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) );
     126  CLEANUP:
    121127        delete &str;                                                                            // created by lex
    122128        return ret;
    123129} // build_constantInteger
    124130
    125 Expression *build_constantFloat( const std::string & str ) {
     131Expression * build_constantFloat( const std::string & str ) {
    126132        static const BasicType::Kind kind[2][3] = {
    127133                { BasicType::Float, BasicType::Double, BasicType::LongDouble },
     
    153159        } // if
    154160
    155         Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[complx][size] ), str, v ) );
     161        Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) );
    156162        delete &str;                                                                            // created by lex
    157163        return ret;
    158164} // build_constantFloat
    159165
    160 Expression *build_constantChar( const std::string & str ) {
    161         Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) );
     166Expression * build_constantChar( const std::string & str ) {
     167        Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) );
    162168        delete &str;                                                                            // created by lex
    163169        return ret;
    164170} // build_constantChar
    165171
    166 ConstantExpr *build_constantStr( const std::string & str ) {
     172ConstantExpr * build_constantStr( const std::string & str ) {
    167173        // string should probably be a primitive type
    168         ArrayType *at = new ArrayType( emptyQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ),
    169                                                                    new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ),  // +1 for '\0' and -2 for '"'
     174        ArrayType * at = new ArrayType( noQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ),
     175                                                                   new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ), // +1 for '\0' and -2 for '"'
    170176                                                                   false, false );
    171         // constant 0 is ignored for pure string value
    172         ConstantExpr * ret = new ConstantExpr( Constant( at, str, (unsigned long long int)0 ) );
     177        ConstantExpr * ret = new ConstantExpr( Constant( at, str, (unsigned long long int)0 ) ); // constant 0 is ignored for pure string value
    173178        delete &str;                                                                            // created by lex
    174179        return ret;
    175180} // build_constantStr
    176 
    177 Expression *build_constantZeroOne( const std::string & str ) {
    178         Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( emptyQualifiers ) : (Type*)new OneType( emptyQualifiers ), str,
    179                                                                                                    str == "0" ? (unsigned long long int)0 : (unsigned long long int)1 ) );
    180         delete &str;                                                                            // created by lex
    181         return ret;
    182 } // build_constantChar
    183181
    184182Expression * build_field_name_FLOATINGconstant( const std::string & str ) {
     
    209207} // build_field_name_fraction_constants
    210208
    211 
    212 
    213209Expression * build_field_name_REALFRACTIONconstant( const std::string & str ) {
    214210        if ( str.find_first_not_of( "0123456789", 1 ) != string::npos ) throw SemanticError( "invalid tuple index " + str );
     
    225221} // build_field_name_REALDECIMALconstant
    226222
    227 NameExpr * build_varref( const string *name ) {
    228         NameExpr *expr = new NameExpr( *name, nullptr );
     223NameExpr * build_varref( const string * name ) {
     224        NameExpr * expr = new NameExpr( *name, nullptr );
    229225        delete name;
    230226        return expr;
    231 }
    232 
    233 static const char *OperName[] = {
     227} // build_varref
     228
     229
     230static const char * OperName[] = {                                              // must harmonize with OperKinds
    234231        // diadic
    235         "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?*?", "?/?", "?%?", "||", "&&",
     232        "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?\\?", "?*?", "?/?", "?%?", "||", "&&",
    236233        "?|?", "?&?", "?^?", "Cast", "?<<?", "?>>?", "?<?", "?>?", "?<=?", "?>=?", "?==?", "?!=?",
    237         "?=?", "?@=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",
     234        "?=?", "?@=?", "?\\=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",
    238235        "?[?]", "...",
    239236        // monadic
    240237        "+?", "-?", "AddressOf", "*?", "!?", "~?", "++?", "?++", "--?", "?--", "&&"
    241 };
    242 
    243 Expression *build_cast( DeclarationNode *decl_node, ExpressionNode *expr_node ) {
    244         Type *targetType = maybeMoveBuildType( decl_node );
     238}; // OperName
     239
     240Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node ) {
     241        Type * targetType = maybeMoveBuildType( decl_node );
    245242        if ( dynamic_cast< VoidType * >( targetType ) ) {
    246243                delete targetType;
     
    249246                return new CastExpr( maybeMoveBuild< Expression >(expr_node), targetType );
    250247        } // if
    251 }
    252 
    253 Expression *build_fieldSel( ExpressionNode *expr_node, Expression *member ) {
    254         UntypedMemberExpr *ret = new UntypedMemberExpr( member, maybeMoveBuild< Expression >(expr_node) );
    255         return ret;
    256 }
    257 
    258 Expression *build_pfieldSel( ExpressionNode *expr_node, Expression *member ) {
    259         UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
     248} // build_cast
     249
     250Expression * build_virtual_cast( DeclarationNode * decl_node, ExpressionNode * expr_node ) {
     251        Type * targetType = maybeMoveBuildType( decl_node );
     252        Expression * castArg = maybeMoveBuild< Expression >( expr_node );
     253        return new VirtualCastExpr( castArg, targetType );
     254} // build_virtual_cast
     255
     256Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member ) {
     257        UntypedMemberExpr * ret = new UntypedMemberExpr( member, maybeMoveBuild< Expression >(expr_node) );
     258        return ret;
     259} // build_fieldSel
     260
     261Expression * build_pfieldSel( ExpressionNode * expr_node, Expression * member ) {
     262        UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) );
    260263        deref->location = expr_node->location;
    261264        deref->get_args().push_back( maybeMoveBuild< Expression >(expr_node) );
    262         UntypedMemberExpr *ret = new UntypedMemberExpr( member, deref );
    263         return ret;
    264 }
    265 
    266 Expression *build_addressOf( ExpressionNode *expr_node ) {
     265        UntypedMemberExpr * ret = new UntypedMemberExpr( member, deref );
     266        return ret;
     267} // build_pfieldSel
     268
     269Expression * build_addressOf( ExpressionNode * expr_node ) {
    267270                return new AddressExpr( maybeMoveBuild< Expression >(expr_node) );
    268 }
    269 Expression *build_sizeOfexpr( ExpressionNode *expr_node ) {
     271} // build_addressOf
     272
     273Expression * build_sizeOfexpr( ExpressionNode * expr_node ) {
    270274        return new SizeofExpr( maybeMoveBuild< Expression >(expr_node) );
    271 }
    272 Expression *build_sizeOftype( DeclarationNode *decl_node ) {
     275} // build_sizeOfexpr
     276
     277Expression * build_sizeOftype( DeclarationNode * decl_node ) {
    273278        return new SizeofExpr( maybeMoveBuildType( decl_node ) );
    274 }
    275 Expression *build_alignOfexpr( ExpressionNode *expr_node ) {
     279} // build_sizeOftype
     280
     281Expression * build_alignOfexpr( ExpressionNode * expr_node ) {
    276282        return new AlignofExpr( maybeMoveBuild< Expression >(expr_node) );
    277 }
    278 Expression *build_alignOftype( DeclarationNode *decl_node ) {
     283} // build_alignOfexpr
     284
     285Expression * build_alignOftype( DeclarationNode * decl_node ) {
    279286        return new AlignofExpr( maybeMoveBuildType( decl_node) );
    280 }
    281 Expression *build_offsetOf( DeclarationNode *decl_node, NameExpr *member ) {
     287} // build_alignOftype
     288
     289Expression * build_offsetOf( DeclarationNode * decl_node, NameExpr * member ) {
    282290        Expression * ret = new UntypedOffsetofExpr( maybeMoveBuildType( decl_node ), member->get_name() );
    283291        delete member;
    284292        return ret;
    285 }
    286 
    287 Expression *build_and_or( ExpressionNode *expr_node1, ExpressionNode *expr_node2, bool kind ) {
     293} // build_offsetOf
     294
     295Expression * build_and_or( ExpressionNode * expr_node1, ExpressionNode * expr_node2, bool kind ) {
    288296        return new LogicalExpr( notZeroExpr( maybeMoveBuild< Expression >(expr_node1) ), notZeroExpr( maybeMoveBuild< Expression >(expr_node2) ), kind );
    289 }
    290 
    291 Expression *build_unary_val( OperKinds op, ExpressionNode *expr_node ) {
     297} // build_and_or
     298
     299Expression * build_unary_val( OperKinds op, ExpressionNode * expr_node ) {
    292300        std::list< Expression * > args;
    293301        args.push_back( maybeMoveBuild< Expression >(expr_node) );
    294302        return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
    295 }
    296 Expression *build_unary_ptr( OperKinds op, ExpressionNode *expr_node ) {
     303} // build_unary_val
     304
     305Expression * build_unary_ptr( OperKinds op, ExpressionNode * expr_node ) {
    297306        std::list< Expression * > args;
    298307        args.push_back(  maybeMoveBuild< Expression >(expr_node) ); // xxx
    299308        return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
    300 }
    301 Expression *build_binary_val( OperKinds op, ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) {
     309} // build_unary_ptr
     310
     311Expression * build_binary_val( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 ) {
    302312        std::list< Expression * > args;
    303313        args.push_back( maybeMoveBuild< Expression >(expr_node1) );
    304314        args.push_back( maybeMoveBuild< Expression >(expr_node2) );
    305315        return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
    306 }
    307 Expression *build_binary_ptr( OperKinds op, ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) {
     316} // build_binary_val
     317
     318Expression * build_binary_ptr( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 ) {
    308319        std::list< Expression * > args;
    309320        args.push_back( maybeMoveBuild< Expression >(expr_node1) );
    310321        args.push_back( maybeMoveBuild< Expression >(expr_node2) );
    311322        return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args );
    312 }
    313 
    314 Expression *build_cond( ExpressionNode *expr_node1, ExpressionNode *expr_node2, ExpressionNode *expr_node3 ) {
     323} // build_binary_ptr
     324
     325Expression * build_cond( ExpressionNode * expr_node1, ExpressionNode * expr_node2, ExpressionNode * expr_node3 ) {
    315326        return new ConditionalExpr( notZeroExpr( maybeMoveBuild< Expression >(expr_node1) ), maybeMoveBuild< Expression >(expr_node2), maybeMoveBuild< Expression >(expr_node3) );
    316 }
    317 
    318 Expression *build_comma( ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) {
     327} // build_cond
     328
     329Expression * build_comma( ExpressionNode * expr_node1, ExpressionNode * expr_node2 ) {
    319330        return new CommaExpr( maybeMoveBuild< Expression >(expr_node1), maybeMoveBuild< Expression >(expr_node2) );
    320 }
    321 
    322 Expression *build_attrexpr( NameExpr *var, ExpressionNode * expr_node ) {
     331} // build_comma
     332
     333Expression * build_attrexpr( NameExpr * var, ExpressionNode * expr_node ) {
    323334        return new AttrExpr( var, maybeMoveBuild< Expression >(expr_node) );
    324 }
    325 Expression *build_attrtype( NameExpr *var, DeclarationNode * decl_node ) {
     335} // build_attrexpr
     336
     337Expression * build_attrtype( NameExpr * var, DeclarationNode * decl_node ) {
    326338        return new AttrExpr( var, maybeMoveBuildType( decl_node ) );
    327 }
    328 
    329 Expression *build_tuple( ExpressionNode * expr_node ) {
     339} // build_attrtype
     340
     341Expression * build_tuple( ExpressionNode * expr_node ) {
    330342        std::list< Expression * > exprs;
    331343        buildMoveList( expr_node, exprs );
    332344        return new UntypedTupleExpr( exprs );;
    333 }
    334 
    335 Expression *build_func( ExpressionNode * function, ExpressionNode * expr_node ) {
     345} // build_tuple
     346
     347Expression * build_func( ExpressionNode * function, ExpressionNode * expr_node ) {
    336348        std::list< Expression * > args;
    337349        buildMoveList( expr_node, args );
    338350        return new UntypedExpr( maybeMoveBuild< Expression >(function), args, nullptr );
    339 }
    340 
    341 Expression *build_range( ExpressionNode * low, ExpressionNode *high ) {
     351} // build_func
     352
     353Expression * build_range( ExpressionNode * low, ExpressionNode * high ) {
    342354        return new RangeExpr( maybeMoveBuild< Expression >( low ), maybeMoveBuild< Expression >( high ) );
    343 }
    344 
    345 Expression *build_asmexpr( ExpressionNode *inout, ConstantExpr *constraint, ExpressionNode *operand ) {
     355} // build_range
     356
     357Expression * build_asmexpr( ExpressionNode * inout, ConstantExpr * constraint, ExpressionNode * operand ) {
    346358        return new AsmExpr( maybeMoveBuild< Expression >( inout ), constraint, maybeMoveBuild< Expression >(operand) );
    347 }
    348 
    349 Expression *build_valexpr( StatementNode *s ) {
     359} // build_asmexpr
     360
     361Expression * build_valexpr( StatementNode * s ) {
    350362        return new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(s) ) );
    351 }
    352 Expression *build_typevalue( DeclarationNode *decl ) {
     363} // build_valexpr
     364
     365Expression * build_typevalue( DeclarationNode * decl ) {
    353366        return new TypeExpr( maybeMoveBuildType( decl ) );
    354 }
    355 
    356 Expression *build_compoundLiteral( DeclarationNode *decl_node, InitializerNode *kids ) {
     367} // build_typevalue
     368
     369Expression * build_compoundLiteral( DeclarationNode * decl_node, InitializerNode * kids ) {
    357370        Declaration * newDecl = maybeBuild< Declaration >(decl_node); // compound literal type
    358371        if ( DeclarationWithType * newDeclWithType = dynamic_cast< DeclarationWithType * >( newDecl ) ) { // non-sue compound-literal type
     
    380393                assert( false );
    381394        } // if
    382 }
     395} // build_compoundLiteral
    383396
    384397// Local Variables: //
  • src/Parser/InitializerNode.cc

    rfd344aa r9236060  
    1010// Created On       : Sat May 16 13:20:24 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Oct  1 23:09:51 2016
    13 // Update Count     : 21
     12// Last Modified On : Fri Jul 28 23:27:20 2017
     13// Update Count     : 26
    1414//
    1515
     
    2222#include "SynTree/Initializer.h"
    2323
    24 InitializerNode::InitializerNode( ExpressionNode *_expr, bool aggrp, ExpressionNode *des )
    25                 : expr( _expr ), aggregate( aggrp ), designator( des ), kids( 0 ), maybeConstructed( true ) {
     24InitializerNode::InitializerNode( ExpressionNode * _expr, bool aggrp, ExpressionNode * des )
     25                : expr( _expr ), aggregate( aggrp ), designator( des ), kids( nullptr ), maybeConstructed( true ) {
    2626        if ( aggrp )
    2727                kids = dynamic_cast< InitializerNode * >( get_next() );
    2828
    29         if ( kids != 0 )
    30                 set_last( 0 );
    31 }
     29        if ( kids )
     30                set_last( nullptr );
     31} // InitializerNode::InitializerNode
    3232
    33 InitializerNode::InitializerNode( InitializerNode *init, bool aggrp, ExpressionNode *des )
    34                 : expr( 0 ), aggregate( aggrp ), designator( des ), kids( 0 ), maybeConstructed( true ) {
    35         if ( init != 0 )
     33InitializerNode::InitializerNode( InitializerNode * init, bool aggrp, ExpressionNode * des )
     34                : expr( nullptr ), aggregate( aggrp ), designator( des ), kids( nullptr ), maybeConstructed( true ) {
     35        if ( init )
    3636                set_last( init );
    3737
     
    3939                kids = dynamic_cast< InitializerNode * >( get_next() );
    4040
    41         if ( kids != 0 )
    42                 set_next( 0 );
    43 }
     41        if ( kids )
     42                set_next( nullptr );
     43} // InitializerNode::InitializerNode
    4444
    4545InitializerNode::~InitializerNode() {
     
    4747        delete designator;
    4848        delete kids;
    49 }
     49} // InitializerNode::~InitializerNode
    5050
    5151void InitializerNode::print( std::ostream &os, int indent ) const {
    5252        os << std::string( indent, ' ' ) << "Initializer expression" << std::endl;
    53 }
     53} // InitializerNode::print
    5454
    5555void InitializerNode::printOneLine( std::ostream &os ) const {
    5656        if ( ! aggregate ) {
    57                 if ( designator != 0 ) {
     57                if ( designator ) {
    5858                        os << "designated by: (";
    5959                        ExpressionNode *curdes = designator;
    60                         while ( curdes != 0) {
     60                        while ( curdes != nullptr) {
    6161                                curdes->printOneLine(os);
    6262                                curdes = (ExpressionNode *)(curdes->get_next());
     
    6565                        os << ")";
    6666                } // if
    67                 if ( expr ) expr->printOneLine(os);
     67                if ( expr ) expr->printOneLine( os );
    6868        } else {  // It's an aggregate
    6969                os << "[--";
    70                 if ( next_init() != 0 )
    71                         next_init()->printOneLine(os);
     70                if ( next_init() != nullptr )
     71                        next_init()->printOneLine( os );
    7272                if (aggregate) os << "--]";
    7373        } // if
     
    7676        if ( (moreInit = dynamic_cast< InitializerNode * >( get_next() ) ) ) {
    7777                moreInit->printOneLine( os );
    78         }
    79 }
     78        } // if
     79} // InitializerNode::printOneLine
    8080
    81 Initializer *InitializerNode::build() const {
     81Initializer * InitializerNode::build() const {
    8282        if ( aggregate ) {
    8383                // steal designators from children
     
    9393                return new ListInit( initlist, designlist, maybeConstructed );
    9494        } else {
    95                 if ( get_expression() != 0) {
     95                if ( get_expression() ) {
    9696                        return new SingleInit( maybeBuild< Expression >( get_expression() ), maybeConstructed );
    97                 }
     97                } // if
    9898        } // if
    99         return 0;
    100 }
     99        return nullptr;
     100} // InitializerNode::build
    101101
    102102// Local Variables: //
  • src/Parser/LinkageSpec.h

    rfd344aa r9236060  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:24:28 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jul  7 11:03:00 2017
    13 // Update Count     : 13
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Jul 22 09:32:16 2017
     13// Update Count     : 14
    1414//
    1515
    16 #ifndef LINKAGESPEC_H
    17 #define LINKAGESPEC_H
     16#pragma once
    1817
    1918#include <string>
     
    7877};
    7978
    80 #endif // LINKAGESPEC_H
    81 
    8279// Local Variables: //
    8380// tab-width: 4 //
  • src/Parser/ParseNode.h

    rfd344aa r9236060  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:28:16 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Jun 12 13:00:00 2017
    13 // Update Count     : 779
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Jul 27 12:08:08 2017
     13// Update Count     : 788
    1414//
    1515
    16 #ifndef PARSENODE_H
    17 #define PARSENODE_H
     16#pragma once
    1817
    1918#include <string>
     
    141140};
    142141
     142// Must harmonize with OperName.
    143143enum class OperKinds {
    144144        // diadic
    145         SizeOf, AlignOf, OffsetOf, Plus, Minus, Mul, Div, Mod, Or, And,
     145        SizeOf, AlignOf, OffsetOf, Plus, Minus, Exp, Mul, Div, Mod, Or, And,
    146146        BitOr, BitAnd, Xor, Cast, LShift, RShift, LThan, GThan, LEThan, GEThan, Eq, Neq,
    147         Assign, AtAssn, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn,
     147        Assign, AtAssn, ExpAssn, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn,
    148148        Index, Range,
    149149        // monadic
     
    159159Expression * build_constantFloat( const std::string &str );
    160160Expression * build_constantChar( const std::string &str );
    161 Expression * build_constantZeroOne( const std::string &str );
    162161ConstantExpr * build_constantStr( const std::string &str );
    163162Expression * build_field_name_FLOATINGconstant( const std::string & str );
     
    170169
    171170Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node );
     171Expression * build_virtual_cast( DeclarationNode * decl_node, ExpressionNode * expr_node );
    172172Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member );
    173173Expression * build_pfieldSel( ExpressionNode * expr_node, Expression * member );
     
    248248        static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement
    249249
     250        // Perhaps this would best fold into newAggragate.
     251        static DeclarationNode * newTreeStruct( Aggregate kind, const std::string * name, const std::string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body );
     252
    250253        DeclarationNode();
    251254        ~DeclarationNode();
     
    332335
    333336        static UniqueName anonymous;
     337
     338        // Temp to test TreeStruct
     339        const std::string * parent_name;
    334340}; // DeclarationNode
    335341
     
    443449std::ostream & operator<<( std::ostream & out, const ParseNode * node );
    444450
    445 #endif // PARSENODE_H
    446 
    447451// Local Variables: //
    448452// tab-width: 4 //
  • src/Parser/ParserTypes.h

    rfd344aa r9236060  
    1010// Created On       : Sat Sep 22 08:58:10 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 22:10:17 2017
    13 // Update Count     : 349
     12// Last Modified On : Sat Jul 22 09:33:28 2017
     13// Update Count     : 350
    1414//
    1515
    16 #ifndef PARSER_HH
    17 #define PARSER_HH
     16#pragma once
    1817
    1918int yylex();
     
    4241}; // Token
    4342
    44 #endif // PARSER_HH
    45 
    4643// Local Variables: //
    4744// tab-width: 4 //
  • src/Parser/TypeData.cc

    rfd344aa r9236060  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:28:00 2017
    13 // Update Count     : 564
     12// Last Modified On : Wed Aug  9 13:50:00 2017
     13// Update Count     : 567
    1414//
    1515
     
    6464                aggregate.fields = nullptr;
    6565                aggregate.body = false;
     66                aggregate.tagged = false;
     67                aggregate.parent = nullptr;
    6668                break;
    6769          case AggregateInst:
     
    123125                delete aggregate.actuals;
    124126                delete aggregate.fields;
     127                delete aggregate.parent;
    125128                // delete aggregate;
    126129                break;
     
    195198                newtype->aggregate.kind = aggregate.kind;
    196199                newtype->aggregate.body = aggregate.body;
     200                newtype->aggregate.tagged = aggregate.tagged;
     201                newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr;
    197202                break;
    198203          case AggregateInst:
     
    454459          case TypeData::Builtin:
    455460                if(td->builtintype == DeclarationNode::Zero) {
    456                         return new ZeroType( emptyQualifiers );
     461                        return new ZeroType( noQualifiers );
    457462                }
    458463                else if(td->builtintype == DeclarationNode::One) {
    459                         return new OneType( emptyQualifiers );
     464                        return new OneType( noQualifiers );
    460465                }
    461466                else {
     
    635640        switch ( td->aggregate.kind ) {
    636641          case DeclarationNode::Struct:
     642                if ( td->aggregate.tagged ) {
     643                        at = new StructDecl( *td->aggregate.name, td->aggregate.parent, attributes, linkage );
     644                        buildForall( td->aggregate.params, at->get_parameters() );
     645                        break;
     646                }
    637647          case DeclarationNode::Coroutine:
    638648          case DeclarationNode::Monitor:
     
    754764} // buildAggInst
    755765
    756 NamedTypeDecl * buildSymbolic( const TypeData * td, const string & name, Type::StorageClasses scs ) {
     766NamedTypeDecl * buildSymbolic( const TypeData * td, const string & name, Type::StorageClasses scs, LinkageSpec::Spec linkage ) {
    757767        assert( td->kind == TypeData::Symbolic );
    758768        NamedTypeDecl * ret;
    759769        assert( td->base );
    760770        if ( td->symbolic.isTypedef ) {
    761                 ret = new TypedefDecl( name, scs, typebuild( td->base ) );
     771                ret = new TypedefDecl( name, scs, typebuild( td->base ), linkage );
    762772        } else {
    763773                ret = new TypeDecl( name, scs, typebuild( td->base ), TypeDecl::Any );
     
    823833                return buildEnum( td, attributes );
    824834        } else if ( td->kind == TypeData::Symbolic ) {
    825                 return buildSymbolic( td, name, scs );
     835                return buildSymbolic( td, name, scs, linkage );
    826836        } else {
    827837                return (new ObjectDecl( name, scs, linkage, bitfieldWidth, typebuild( td ), init, attributes ))->set_asmName( asmName );
  • src/Parser/TypeData.h

    rfd344aa r9236060  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 15:18:36 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jun 28 15:29:00 2017
    13 // Update Count     : 186
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Jul 22 09:32:47 2017
     13// Update Count     : 188
    1414//
    1515
    16 #ifndef TYPEDATA_H
    17 #define TYPEDATA_H
     16#pragma once
    1817
    1918#include "ParseNode.h"
     
    3130                DeclarationNode * fields;
    3231                bool body;
     32
     33                bool tagged;
     34                const std::string * parent;
    3335        };
    3436
     
    114116void buildKRFunction( const TypeData::Function_t & function );
    115117
    116 #endif // TYPEDATA_H
    117 
    118118// Local Variables: //
    119119// tab-width: 4 //
  • src/Parser/TypedefTable.h

    rfd344aa r9236060  
    1010// Created On       : Sat May 16 15:24:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 21:56:34 2017
    13 // Update Count     : 33
     12// Last Modified On : Sat Jul 22 09:33:14 2017
     13// Update Count     : 34
    1414//
    1515
    16 #ifndef TYPEDEFTABLE_H
    17 #define TYPEDEFTABLE_H
     16#pragma once
    1817
    1918#include <map>
     
    9190};
    9291
    93 #endif // TYPEDEFTABLE_H
    94 
    9592// Local Variables: //
    9693// tab-width: 4 //
  • src/Parser/lex.ll

    rfd344aa r9236060  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Wed Jul 12 18:04:44 2017
    13  * Update Count     : 535
     12 * Last Modified On : Thu Jul 27 21:46:06 2017
     13 * Update Count     : 550
    1414 */
    1515
    1616%option yylineno
     17%option noyywrap
    1718%option nounput
    1819
     
    125126op_unary {op_unary_only}|{op_unary_binary}|{op_unary_pre_post}
    126127
    127 op_binary_only "/"|"%"|"^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"&="|"|="|"^="|"<<="|">>="
     128op_binary_only "/"|"%"|"\\"|"^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"\\="|"&="|"|="|"^="|"<<="|">>="
    128129op_binary_over {op_unary_binary}|{op_binary_only}
    129130                                // op_binary_not_over "?"|"->"|"."|"&&"|"||"|"@="
     
    136137
    137138%%
    138                                    /* line directives */
     139                                /* line directives */
    139140^{h_white}*"#"{h_white}*[0-9]+{h_white}*["][^"\n]+["].*"\n" {
    140141        /* " stop highlighting */
     
    232233int                             { KEYWORD_RETURN(INT); }
    233234__int128                { KEYWORD_RETURN(INT); }                                // GCC
     235__int128_t              { KEYWORD_RETURN(INT); }                                // GCC
    234236__label__               { KEYWORD_RETURN(LABEL); }                              // GCC
    235237long                    { KEYWORD_RETURN(LONG); }
     
    265267__typeof                { KEYWORD_RETURN(TYPEOF); }                             // GCC
    266268__typeof__              { KEYWORD_RETURN(TYPEOF); }                             // GCC
     269__uint128_t             { KEYWORD_RETURN(INT); }                                // GCC
    267270union                   { KEYWORD_RETURN(UNION); }
    268271unsigned                { KEYWORD_RETURN(UNSIGNED); }
    269272__builtin_va_list { KEYWORD_RETURN(VALIST); }                   // GCC
     273virtual                 { KEYWORD_RETURN(VIRTUAL); }                    // CFA
    270274void                    { KEYWORD_RETURN(VOID); }
    271275volatile                { KEYWORD_RETURN(VOLATILE); }
     
    284288
    285289                                /* numeric constants */
    286 "0"                             { NUMERIC_RETURN(ZERO); }                               // CFA
    287 "1"                             { NUMERIC_RETURN(ONE); }                                // CFA
    288290{decimal_constant} { NUMERIC_RETURN(INTEGERconstant); }
    289291{octal_constant} { NUMERIC_RETURN(INTEGERconstant); }
     
    336338"-"                             { ASCIIOP_RETURN(); }
    337339"*"                             { ASCIIOP_RETURN(); }
     340"\\"                    { ASCIIOP_RETURN(); }                                   // CFA, exponentiation
    338341"/"                             { ASCIIOP_RETURN(); }
    339342"%"                             { ASCIIOP_RETURN(); }
     
    360363"+="                    { NAMEDOP_RETURN(PLUSassign); }
    361364"-="                    { NAMEDOP_RETURN(MINUSassign); }
     365"\\="                   { NAMEDOP_RETURN(EXPassign); }                  // CFA, exponentiation
    362366"*="                    { NAMEDOP_RETURN(MULTassign); }
    363367"/="                    { NAMEDOP_RETURN(DIVassign); }
     
    414418
    415419                                /* unknown characters */
    416 .                       { printf("unknown character(s):\"%s\" on line %d\n", yytext, yylineno); }
     420.                               { printf("unknown character(s):\"%s\" on line %d\n", yytext, yylineno); }
    417421
    418422%%
  • src/Parser/parser.yy

    rfd344aa r9236060  
    99// Author           : Peter A. Buhr
    1010// Created On       : Sat Sep  1 20:22:55 2001
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 12 18:23:36 2017
    13 // Update Count     : 2426
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Aug  4 13:33:00 2017
     13// Update Count     : 2475
    1414//
    1515
     
    118118%token RESTRICT                                                                                 // C99
    119119%token ATOMIC                                                                                   // C11
    120 %token FORALL MUTEX                                                             // CFA
    121 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED ZERO_T ONE_T
     120%token FORALL MUTEX VIRTUAL                                             // CFA
     121%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
     122%token BOOL COMPLEX IMAGINARY                                                   // C99
     123%token ZERO_T ONE_T                                                                             // CFA
    122124%token VALIST                                                                                   // GCC
    123 %token BOOL COMPLEX IMAGINARY                                                   // C99
    124125%token TYPEOF LABEL                                                                             // GCC
    125126%token ENUM STRUCT UNION
     
    141142// converted into the tuple index (.)(1). e.g., 3.x
    142143%token<tok>     REALDECIMALconstant     REALFRACTIONconstant    FLOATINGconstant
    143 %token<tok> ZERO                                ONE                                             // CFA
    144144
    145145// multi-character operators
     
    151151%token ELLIPSIS                                                                                 // ...
    152152
    153 %token MULTassign       DIVassign       MODassign                               // *=   /=      %=/
     153%token EXPassign        MULTassign      DIVassign       MODassign       // \=   *=      /=      %=
    154154%token PLUSassign       MINUSassign                                                     // +=   -=
    155155%token LSassign         RSassign                                                        // <<=  >>=
     
    158158%token ATassign                                                                                 // @=
    159159
    160 %type<tok> identifier  no_attr_identifier  zero_one
     160%type<tok> identifier  no_attr_identifier
    161161%type<tok> identifier_or_type_name  no_attr_identifier_or_type_name  attr_name
    162162%type<constant> string_literal
     
    168168%type<op> ptrref_operator                               unary_operator                          assignment_operator
    169169%type<en> primary_expression                    postfix_expression                      unary_expression
    170 %type<en> cast_expression                               multiplicative_expression       additive_expression                     shift_expression
    171 %type<en> relational_expression                 equality_expression                     AND_expression                          exclusive_OR_expression
    172 %type<en> inclusive_OR_expression               logical_AND_expression          logical_OR_expression           conditional_expression
    173 %type<en> constant_expression                   assignment_expression           assignment_expression_opt
     170%type<en> cast_expression                               exponential_expression          multiplicative_expression       additive_expression
     171%type<en> shift_expression                              relational_expression           equality_expression
     172%type<en> AND_expression                                exclusive_OR_expression         inclusive_OR_expression
     173%type<en> logical_AND_expression                logical_OR_expression
     174%type<en> conditional_expression                constant_expression                     assignment_expression           assignment_expression_opt
    174175%type<en> comma_expression                              comma_expression_opt
    175 %type<en> argument_expression_list              argument_expression                     assignment_opt
     176%type<en> argument_expression_list              argument_expression                     default_initialize_opt
    176177%type<fctl> for_control_expression
    177178%type<en> subrange
     
    181182%type<en> asm_clobbers_list_opt
    182183%type<flag> asm_volatile_opt
     184%type<en> handler_predicate_opt
    183185
    184186// statements
     
    358360        ;
    359361
    360 zero_one:                                                                                               // CFA
    361         ZERO
    362         | ONE
    363         ;
    364 
    365362string_literal:
    366363        string_literal_list                                                     { $$ = build_constantStr( *$1 ); }
     
    382379        IDENTIFIER                                                                                      // typedef name cannot be used as a variable name
    383380                { $$ = new ExpressionNode( build_varref( $1 ) ); }
    384         | zero_one
    385                 { $$ = new ExpressionNode( build_constantZeroOne( *$1 ) ); }
    386381        | tuple
    387382        | '(' comma_expression ')'
     
    483478                        $$ = new ExpressionNode( build_field_name_fraction_constants( build_varref( $1 ), $2 ) );
    484479                }
    485         | zero_one fraction_constants
    486                 {
    487                         $$ = new ExpressionNode( build_field_name_fraction_constants( build_constantZeroOne( *$1 ), $2 ) );
    488                 }
    489480        ;
    490481
     
    537528        | ALIGNOF unary_expression                                                      // GCC, variable alignment
    538529                { $$ = new ExpressionNode( build_alignOfexpr( $2 ) ); }
    539         | ALIGNOF '(' type_no_function ')'                              // GCC, type alignment
     530        | ALIGNOF '(' type_no_function ')'                                      // GCC, type alignment
    540531                { $$ = new ExpressionNode( build_alignOftype( $3 ) ); }
    541532        | OFFSETOF '(' type_no_function ',' no_attr_identifier ')'
     
    569560        | '(' type_no_function ')' cast_expression
    570561                { $$ = new ExpressionNode( build_cast( $2, $4 ) ); }
     562                // VIRTUAL cannot be opt because of look ahead issues
     563        | '(' VIRTUAL ')' cast_expression
     564                { $$ = new ExpressionNode( build_virtual_cast( nullptr, $4 ) ); }
     565        | '(' VIRTUAL type_no_function ')' cast_expression
     566                { $$ = new ExpressionNode( build_virtual_cast( $3, $5 ) ); }
    571567//      | '(' type_no_function ')' tuple
    572568//              { $$ = new ExpressionNode( build_cast( $2, $4 ) ); }
    573569        ;
    574570
     571exponential_expression:
     572        cast_expression
     573        | exponential_expression '\\' cast_expression
     574                { $$ = new ExpressionNode( build_binary_val( OperKinds::Exp, $1, $3 ) ); }
     575        ;
     576
    575577multiplicative_expression:
    576         cast_expression
    577         | multiplicative_expression '*' cast_expression
     578        exponential_expression
     579        | multiplicative_expression '*' exponential_expression
    578580                { $$ = new ExpressionNode( build_binary_val( OperKinds::Mul, $1, $3 ) ); }
    579         | multiplicative_expression '/' cast_expression
     581        | multiplicative_expression '/' exponential_expression
    580582                { $$ = new ExpressionNode( build_binary_val( OperKinds::Div, $1, $3 ) ); }
    581         | multiplicative_expression '%' cast_expression
     583        | multiplicative_expression '%' exponential_expression
    582584                { $$ = new ExpressionNode( build_binary_val( OperKinds::Mod, $1, $3 ) ); }
    583585        ;
     
    678680        '='                                                                                     { $$ = OperKinds::Assign; }
    679681        | ATassign                                                                      { $$ = OperKinds::AtAssn; }
     682        | EXPassign                                                                     { $$ = OperKinds::ExpAssn; }
    680683        | MULTassign                                                            { $$ = OperKinds::MulAssn; }
    681684        | DIVassign                                                                     { $$ = OperKinds::DivAssn; }
     
    939942
    940943with_statement:
    941         WITH identifier_list compound_statement
     944        WITH '(' tuple_expression_list ')' compound_statement
    942945                { $$ = (StatementNode *)0; }                                    // FIX ME
    943946        ;
     
    966969
    967970handler_clause:
    968         // TEMPORARY, TEST EXCEPTIONS
    969         handler_key '(' push push INTEGERconstant pop ')' compound_statement pop
    970                 { $$ = new StatementNode( build_catch( $1, nullptr, new ExpressionNode( build_constantInteger( *$5 ) ), $8 ) ); }
    971         | handler_clause handler_key '(' push push INTEGERconstant pop ')' compound_statement pop
    972                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); }
    973 
    974         | handler_key '(' push push exception_declaration pop ')' compound_statement pop
    975                 { $$ = new StatementNode( build_catch( $1, $5, nullptr, $8 ) ); }
    976         | handler_clause handler_key '(' push push exception_declaration pop ')' compound_statement pop
    977                 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $9 ) ) ); }
     971        handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
     972                { $$ = new StatementNode( build_catch( $1, $5, $7, $9 ) ); }
     973        | handler_clause handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop
     974                { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, $8, $10 ) ) ); }
     975        ;
     976
     977handler_predicate_opt:
     978        //empty
     979                { $$ = nullptr; }
     980        | ';' conditional_expression
     981                { $$ = $2; }
    978982        ;
    979983
     
    15001504        | IMAGINARY                                                                                     // C99
    15011505                { $$ = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
    1502         | VALIST                                                                                        // GCC, __builtin_va_list
    1503                 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
    15041506        | ZERO_T
    15051507                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); }
    15061508        | ONE_T
    15071509                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::One ); }
     1510        | VALIST                                                                                        // GCC, __builtin_va_list
     1511                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
    15081512        ;
    15091513
     
    18431847cfa_parameter_declaration:                                                              // CFA, new & old style parameter declaration
    18441848        parameter_declaration
    1845         | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name assignment_opt
     1849        | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initialize_opt
    18461850                { $$ = $1->addName( $2 ); }
    1847         | cfa_abstract_tuple identifier_or_type_name assignment_opt
     1851        | cfa_abstract_tuple identifier_or_type_name default_initialize_opt
    18481852                // To obtain LR(1), these rules must be duplicated here (see cfa_abstract_declarator).
    18491853                { $$ = $1->addName( $2 ); }
    1850         | type_qualifier_list cfa_abstract_tuple identifier_or_type_name assignment_opt
     1854        | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initialize_opt
    18511855                { $$ = $2->addName( $3 )->addQualifiers( $1 ); }
    18521856        | cfa_function_specifier
     
    18651869parameter_declaration:
    18661870                // No SUE declaration in parameter list.
    1867         declaration_specifier_nobody identifier_parameter_declarator assignment_opt
     1871        declaration_specifier_nobody identifier_parameter_declarator default_initialize_opt
    18681872                {
    18691873                        typedefTable.addToEnclosingScope( TypedefTable::ID );
    18701874                        $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr );
    18711875                }
    1872         | declaration_specifier_nobody type_parameter_redeclarator assignment_opt
     1876        | declaration_specifier_nobody type_parameter_redeclarator default_initialize_opt
    18731877                {
    18741878                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    18781882
    18791883abstract_parameter_declaration:
    1880         declaration_specifier_nobody assignment_opt
     1884        declaration_specifier_nobody default_initialize_opt
    18811885                { $$ = $1->addInitializer( $2 ? new InitializerNode( $2 ) : nullptr ); }
    1882         | declaration_specifier_nobody abstract_parameter_declarator assignment_opt
     1886        | declaration_specifier_nobody abstract_parameter_declarator default_initialize_opt
    18831887                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    18841888        ;
     
    19241928        | '=' initializer
    19251929                { $$ = $2; }
     1930        | '=' VOID
     1931                { $$ = nullptr; }
    19261932        | ATassign initializer
    19271933                { $$ = $2->set_maybeConstructed( false ); }
     
    22202226        // empty
    22212227                { $$ = (StatementNode *)0; }                                    // FIX ME
    2222         | WITH identifier_list
     2228        | WITH '(' tuple_expression_list ')'
    22232229                { $$ = (StatementNode *)0; }                                    // FIX ME
    22242230        ;
     
    30433049        ;
    30443050
    3045 assignment_opt:
     3051default_initialize_opt:
    30463052        // empty
    30473053                { $$ = nullptr; }
  • src/Parser/parserutility.cc

    rfd344aa r9236060  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 15:30:39 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 22:11:32 2017
    13 // Update Count     : 7
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tus Jul 18 10:12:00 2017
     13// Update Count     : 8
    1414//
    1515
     
    2626        UntypedExpr *comparison = new UntypedExpr( new NameExpr( "?!=?" ) );
    2727        comparison->get_args().push_back( orig );
    28         comparison->get_args().push_back( new ConstantExpr( Constant( new ZeroType( emptyQualifiers ), "0", (unsigned long long int)0 ) ) );
     28        comparison->get_args().push_back( new ConstantExpr( Constant( new ZeroType( noQualifiers ), "0", (unsigned long long int)0 ) ) );
    2929        return new CastExpr( comparison, new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
    3030}
  • src/Parser/parserutility.h

    rfd344aa r9236060  
    1010// Created On       : Sat May 16 15:31:46 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 22:11:40 2017
    13 // Update Count     : 3
     12// Last Modified On : Sat Jul 22 09:32:58 2017
     13// Update Count     : 4
    1414//
    1515
    16 #ifndef PARSEUTILITY_H
    17 #define PARSEUTILITY_H
     16#pragma once
    1817
    1918#include "SynTree/SynTree.h"
    2019
    2120Expression *notZeroExpr( Expression *orig );
    22 
    23 #endif // PARSEUTILITY_H
    2421
    2522// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.