Changeset b7d6a36 for src/Parser


Ignore:
Timestamp:
Feb 20, 2020, 4:15:51 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6a490b2
Parents:
dca5802 (diff), 2cbfe92 (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 relaxed_ready

Location:
src/Parser
Files:
1 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rdca5802 rb7d6a36  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 11 07:40:14 2019
    13 // Update Count     : 1123
     12// Last Modified On : Mon Dec 16 15:32:22 2019
     13// Update Count     : 1133
    1414//
    1515
     
    2424#include "Common/UniqueName.h"     // for UniqueName
    2525#include "Common/utility.h"        // for maybeClone, maybeBuild, CodeLocation
    26 #include "Parser/LinkageSpec.h"    // for Spec, linkageName, Cforall
    2726#include "Parser/ParseNode.h"      // for DeclarationNode, ExpressionNode
     27#include "SynTree/LinkageSpec.h"   // for Spec, linkageName, Cforall
    2828#include "SynTree/Attribute.h"     // for Attribute
    2929#include "SynTree/Declaration.h"   // for TypeDecl, ObjectDecl, Declaration
     
    4747const char * DeclarationNode::signednessNames[] = { "signed", "unsigned", "NoSignednessNames" };
    4848const char * DeclarationNode::lengthNames[] = { "short", "long", "long long", "NoLengthNames" };
    49 const char * DeclarationNode::typeClassNames[] = { "otype", "dtype", "ftype", "NoTypeClassNames" };
    5049const char * DeclarationNode::builtinTypeNames[] = { "__builtin_va_list", "__auto_type", "zero_t", "one_t", "NoBuiltinTypeNames" };
    5150
     
    5857
    5958//      variable.name = nullptr;
    60         variable.tyClass = NoTypeClass;
     59        variable.tyClass = TypeDecl::NUMBER_OF_KINDS;
    6160        variable.assertions = nullptr;
    6261        variable.initializer = nullptr;
     
    134133
    135134        if ( linkage != LinkageSpec::Cforall ) {
    136                 os << LinkageSpec::linkageName( linkage ) << " ";
     135                os << LinkageSpec::name( linkage ) << " ";
    137136        } // if
    138137
     
    312311} // DeclarationNode::newFromTypeGen
    313312
    314 DeclarationNode * DeclarationNode::newTypeParam( TypeClass tc, const string * name ) {
     313DeclarationNode * DeclarationNode::newTypeParam( TypeDecl::Kind tc, const string * name ) {
    315314        DeclarationNode * newnode = new DeclarationNode;
    316315        newnode->type = nullptr;
     
    670669
    671670DeclarationNode * DeclarationNode::addAssertions( DeclarationNode * assertions ) {
    672         if ( variable.tyClass != NoTypeClass ) {
     671        if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) {
    673672                if ( variable.assertions ) {
    674673                        variable.assertions->appendList( assertions );
     
    875874
    876875DeclarationNode * DeclarationNode::addTypeInitializer( DeclarationNode * init ) {
    877         assertf( variable.tyClass != NoTypeClass, "Called addTypeInitializer on something that isn't a type variable." );
     876        assertf( variable.tyClass != TypeDecl::NUMBER_OF_KINDS, "Called addTypeInitializer on something that isn't a type variable." );
    878877        variable.initializer = init;
    879878        return this;
     
    10741073        } // if
    10751074
    1076         if ( variable.tyClass != NoTypeClass ) {
     1075        if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) {
    10771076                // otype is internally converted to dtype + otype parameters
    10781077                static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype };
    1079                 assertf( sizeof(kindMap)/sizeof(kindMap[0]) == NoTypeClass, "DeclarationNode::build: kindMap is out of sync." );
     1078                static_assert( sizeof(kindMap)/sizeof(kindMap[0]) == TypeDecl::NUMBER_OF_KINDS, "DeclarationNode::build: kindMap is out of sync." );
    10801079                assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." );
    1081                 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == Otype, variable.initializer ? variable.initializer->buildType() : nullptr );
     1080                TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == TypeDecl::Otype, variable.initializer ? variable.initializer->buildType() : nullptr );
    10821081                buildList( variable.assertions, ret->get_assertions() );
    10831082                return ret;
  • src/Parser/ExpressionNode.cc

    rdca5802 rb7d6a36  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 10 23:01:47 2019
    13 // Update Count     : 980
     12// Last Modified On : Wed Dec 18 21:14:58 2019
     13// Update Count     : 981
    1414//
    1515
     
    265265        static const BasicType::Kind kind[2][12] = {
    266266                { BasicType::Float, BasicType::Double, BasicType::LongDouble, BasicType::uuFloat80, BasicType::uuFloat128, BasicType::uFloat16, BasicType::uFloat32, BasicType::uFloat32x, BasicType::uFloat64, BasicType::uFloat64x, BasicType::uFloat128, BasicType::uFloat128x },
    267                 { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex, (BasicType::Kind)-1, (BasicType::Kind)-1, BasicType::uFloat16Complex, BasicType::uFloat32Complex, BasicType::uFloat32xComplex, BasicType::uFloat64Complex, BasicType::uFloat64xComplex, BasicType::uFloat128Complex, BasicType::uFloat128xComplex },
     267                { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex, BasicType::NUMBER_OF_BASIC_TYPES, BasicType::NUMBER_OF_BASIC_TYPES, BasicType::uFloat16Complex, BasicType::uFloat32Complex, BasicType::uFloat32xComplex, BasicType::uFloat64Complex, BasicType::uFloat64xComplex, BasicType::uFloat128Complex, BasicType::uFloat128xComplex },
    268268        };
    269269
     
    374374
    375375Expression * build_field_name_FLOATING_DECIMALconstant( const string & str ) {
    376         if ( str[str.size()-1] != '.' ) SemanticError( yylloc, "invalid tuple index " + str );
     376        if ( str[str.size() - 1] != '.' ) SemanticError( yylloc, "invalid tuple index " + str );
    377377        Expression * ret = build_constantInteger( *new string( str.substr( 0, str.size()-1 ) ) );
    378378        delete &str;
  • src/Parser/ParseNode.h

    rdca5802 rb7d6a36  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 11 07:40:07 2019
    13 // Update Count     : 882
     12// Last Modified On : Fri Feb  7 17:56:02 2020
     13// Update Count     : 891
    1414//
    1515
     
    2828#include "Common/UniqueName.h"     // for UniqueName
    2929#include "Common/utility.h"        // for maybeClone, maybeBuild
    30 #include "Parser/LinkageSpec.h"    // for Spec
     30#include "SynTree/LinkageSpec.h"   // for Spec
    3131#include "SynTree/Declaration.h"   // for Aggregate
    3232#include "SynTree/Expression.h"    // for Expression, ConstantExpr (ptr only)
     
    218218        enum Length { Short, Long, LongLong, NoLength };
    219219        static const char * lengthNames[];
    220         enum TypeClass { Otype, Dtype, Ftype, Ttype, NoTypeClass };
    221         static const char * typeClassNames[];
    222220        enum BuiltinType { Valist, AutoType, Zero, One, NoBuiltinType };
    223221        static const char * builtinTypeNames[];
     
    241239        static DeclarationNode * newName( const std::string * );
    242240        static DeclarationNode * newFromTypeGen( const std::string *, ExpressionNode * params );
    243         static DeclarationNode * newTypeParam( TypeClass, const std::string * );
     241        static DeclarationNode * newTypeParam( TypeDecl::Kind, const std::string * );
    244242        static DeclarationNode * newTrait( const std::string * name, DeclarationNode * params, DeclarationNode * asserts );
    245243        static DeclarationNode * newTraitUse( const std::string * name, ExpressionNode * params );
     
    311309        struct Variable_t {
    312310//              const std::string * name;
    313                 DeclarationNode::TypeClass tyClass;
     311                TypeDecl::Kind tyClass;
    314312                DeclarationNode * assertions;
    315313                DeclarationNode * initializer;
     
    451449                                * out++ = result;
    452450                        } else {
    453                                 assertf(false, "buildList unknown type");
     451                                SemanticError( cur->location, "type specifier declaration in forall clause is currently unimplemented." );
    454452                        } // if
    455453                } catch( SemanticErrorException & e ) {
  • src/Parser/ParserTypes.h

    rdca5802 rb7d6a36  
    1010// Created On       : Sat Sep 22 08:58:10 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:33:28 2017
    13 // Update Count     : 350
     12// Last Modified On : Sat Feb 15 11:04:40 2020
     13// Update Count     : 351
    1414//
    1515
     
    2727// current location in the input
    2828extern int yylineno;
    29 extern char *yyfilename;
     29extern char * yyfilename;
    3030
    3131struct Location {
    32     char *file;
     32    char * file;
    3333    int line;
    3434}; // Location
    3535
    3636struct Token {
    37     std::string *str;                                                                   // must be pointer as used in union
     37    std::string * str;                                                                  // must be pointer as used in union
    3838    Location loc;
    3939
  • src/Parser/TypeData.cc

    rdca5802 rb7d6a36  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 11 07:48:33 2019
    13 // Update Count     : 659
     12// Last Modified On : Mon Dec 16 07:56:46 2019
     13// Update Count     : 662
    1414//
    1515
     
    489489        for ( typename ForallList::iterator i = outputList.begin(); i != outputList.end(); ++i, n = (DeclarationNode*)n->get_next() ) {
    490490                TypeDecl * td = static_cast<TypeDecl *>(*i);
    491                 if ( n->variable.tyClass == DeclarationNode::Otype ) {
     491                if ( n->variable.tyClass == TypeDecl::Otype ) {
    492492                        // add assertion parameters to `type' tyvars in reverse order
    493493                        // add dtor:  void ^?{}(T *)
     
    522522        switch ( td->kind ) {
    523523          case TypeData::Unknown:
    524                         // fill in implicit int
    525                         return new BasicType( buildQualifiers( td ), BasicType::SignedInt );
     524                // fill in implicit int
     525                return new BasicType( buildQualifiers( td ), BasicType::SignedInt );
    526526          case TypeData::Basic:
    527                         return buildBasicType( td );
     527                return buildBasicType( td );
    528528          case TypeData::Pointer:
    529                         return buildPointer( td );
     529                return buildPointer( td );
    530530          case TypeData::Array:
    531                         return buildArray( td );
     531                return buildArray( td );
    532532          case TypeData::Reference:
    533                         return buildReference( td );
     533                return buildReference( td );
    534534          case TypeData::Function:
    535                         return buildFunction( td );
     535                return buildFunction( td );
    536536          case TypeData::AggregateInst:
    537                         return buildAggInst( td );
     537                return buildAggInst( td );
    538538          case TypeData::EnumConstant:
    539                         // the name gets filled in later -- by SymTab::Validate
    540                         return new EnumInstType( buildQualifiers( td ), "" );
     539                // the name gets filled in later -- by SymTab::Validate
     540                return new EnumInstType( buildQualifiers( td ), "" );
    541541          case TypeData::SymbolicInst:
    542                         return buildSymbolicInst( td );
     542                return buildSymbolicInst( td );
    543543          case TypeData::Tuple:
    544                         return buildTuple( td );
     544                return buildTuple( td );
    545545          case TypeData::Typeof:
    546546          case TypeData::Basetypeof:
    547                         return buildTypeof( td );
     547                return buildTypeof( td );
    548548          case TypeData::Builtin:
    549                         if (td->builtintype == DeclarationNode::Zero) {
    550                                 return new ZeroType( noQualifiers );
    551                         }
    552                         else if (td->builtintype == DeclarationNode::One) {
    553                                 return new OneType( noQualifiers );
    554                         }
    555                         else {
    556                                 return new VarArgsType( buildQualifiers( td ) );
    557                         }
     549                switch ( td->builtintype ) {
     550                  case DeclarationNode::Zero:
     551                        return new ZeroType( noQualifiers );
     552                  case DeclarationNode::One:
     553                        return new OneType( noQualifiers );
     554                  default:
     555                        return new VarArgsType( buildQualifiers( td ) );
     556                } // switch
    558557          case TypeData::GlobalScope:
    559                         return new GlobalScopeType();
    560                 case TypeData::Qualified:
    561                         return new QualifiedType( buildQualifiers( td ), typebuild( td->qualified.parent ), typebuild( td->qualified.child ) );
     558                return new GlobalScopeType();
     559          case TypeData::Qualified:
     560                return new QualifiedType( buildQualifiers( td ), typebuild( td->qualified.parent ), typebuild( td->qualified.child ) );
    562561          case TypeData::Symbolic:
    563562          case TypeData::Enum:
    564563          case TypeData::Aggregate:
    565                         assert( false );
     564                assert( false );
    566565        } // switch
    567566
  • src/Parser/TypeData.h

    rdca5802 rb7d6a36  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 10 23:01:07 2019
    13 // Update Count     : 198
     12// Last Modified On : Fri Dec 13 23:42:35 2019
     13// Update Count     : 199
    1414//
    1515
     
    2121
    2222#include "ParseNode.h"           // for DeclarationNode, DeclarationNode::Ag...
    23 #include "Parser/LinkageSpec.h" // for Spec
     23#include "SynTree/LinkageSpec.h" // for Spec
    2424#include "SynTree/Type.h"        // for Type, ReferenceToType (ptr only)
    2525#include "SynTree/SynTree.h"     // for Visitor Nodes
  • src/Parser/TypedefTable.cc

    rdca5802 rb7d6a36  
    1010// Created On       : Sat May 16 15:20:13 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 25 15:32:35 2018
    13 // Update Count     : 258
     12// Last Modified On : Sat Feb 15 08:06:36 2020
     13// Update Count     : 259
    1414//
    1515
     
    4747} // TypedefTable::~TypedefTable
    4848
    49 bool TypedefTable::exists( const string & identifier ) {
     49bool TypedefTable::exists( const string & identifier ) const {
    5050        return kindTable.find( identifier ) != kindTable.end();
    5151} // TypedefTable::exists
    5252
    53 bool TypedefTable::existsCurr( const string & identifier ) {
     53bool TypedefTable::existsCurr( const string & identifier ) const {
    5454        return kindTable.findAt( kindTable.currentScope() - 1, identifier ) != kindTable.end();
    5555} // TypedefTable::exists
  • src/Parser/TypedefTable.h

    rdca5802 rb7d6a36  
    1010// Created On       : Sat May 16 15:24:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jul 25 15:33:55 2018
    13 // Update Count     : 114
     12// Last Modified On : Sat Feb 15 08:06:37 2020
     13// Update Count     : 117
    1414//
    1515
     
    3030        ~TypedefTable();
    3131
    32         bool exists( const std::string & identifier );
    33         bool existsCurr( const std::string & identifier );
     32        bool exists( const std::string & identifier ) const;
     33        bool existsCurr( const std::string & identifier ) const;
    3434        int isKind( const std::string & identifier ) const;
    3535        void makeTypedef( const std::string & name, int kind = TYPEDEFname );
  • src/Parser/lex.ll

    rdca5802 rb7d6a36  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Sun Aug  4 20:53:47 2019
    13  * Update Count     : 719
     12 * Last Modified On : Sat Feb 15 11:05:50 2020
     13 * Update Count     : 737
    1414 */
    1515
     
    4242#include "ParseNode.h"
    4343#include "TypedefTable.h"
     44
     45string * build_postfix_name( string * name );
    4446
    4547char *yyfilename;
     
    330332                                /* identifier */
    331333{identifier}    { IDENTIFIER_RETURN(); }
    332 "`"{identifier}"`" {                                                                    // CFA
    333         yytext[yyleng - 1] = '\0'; yytext += 1;                         // SKULLDUGGERY: remove backquotes (ok to shorten?)
     334"``"{identifier} {                                                                              // CFA
     335        yytext[yyleng] = '\0'; yytext += 2;                                     // SKULLDUGGERY: remove backquotes (ok to shorten?)
    334336        IDENTIFIER_RETURN();
    335337}
     
    432434"?"({op_unary_pre_post}|"()"|"[?]"|"{}") { IDENTIFIER_RETURN(); }
    433435"^?{}"                  { IDENTIFIER_RETURN(); }
    434 "?`"{identifier} { IDENTIFIER_RETURN(); }                               // postfix operator
     436"?`"{identifier} {                                                                              // postfix operator
     437        yylval.tok.str = new string( &yytext[2] );                      // remove ?`
     438        yylval.tok.str = build_postfix_name( yylval.tok.str ); // add prefix
     439        RETURN_LOCN( typedefTable.isKind( *yylval.tok.str ) );
     440}
    435441"?"{op_binary_over}"?"  { IDENTIFIER_RETURN(); }                // binary
    436442        /*
  • src/Parser/module.mk

    rdca5802 rb7d6a36  
    1111## Created On       : Sat May 16 15:29:09 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Wed Jun 28 21:58:29 2017
    14 ## Update Count     : 104
     13## Last Modified On : Sat Dec 14 07:34:47 2019
     14## Update Count     : 107
    1515###############################################################################
    1616
     
    1919AM_YFLAGS = -d -t -v
    2020
    21 SRC += Parser/parser.yy \
    22        Parser/lex.ll \
    23        Parser/TypedefTable.cc \
    24        Parser/ParseNode.cc \
     21SRC += \
    2522       Parser/DeclarationNode.cc \
    2623       Parser/ExpressionNode.cc \
     24       Parser/InitializerNode.cc \
     25       Parser/ParseNode.cc \
    2726       Parser/StatementNode.cc \
    28        Parser/InitializerNode.cc \
    2927       Parser/TypeData.cc \
    30        Parser/LinkageSpec.cc \
     28       Parser/TypedefTable.cc \
     29       Parser/lex.ll \
     30       Parser/parser.yy \
    3131       Parser/parserutility.cc
    3232
    33 SRCDEMANGLE += \
    34         Parser/LinkageSpec.cc
    35 
    36 
    3733MOSTLYCLEANFILES += Parser/lex.cc Parser/parser.cc Parser/parser.hh Parser/parser.output
  • src/Parser/parser.yy

    rdca5802 rb7d6a36  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 10 23:07:17 2019
    13 // Update Count     : 4400
     12// Last Modified On : Sun Feb 16 08:22:14 2020
     13// Update Count     : 4461
    1414//
    1515
     
    5555#include "TypedefTable.h"
    5656#include "TypeData.h"
    57 #include "LinkageSpec.h"
     57#include "SynTree/LinkageSpec.h"
    5858#include "Common/SemanticError.h"                                               // error_str
    5959#include "Common/utility.h"                                                             // for maybeMoveBuild, maybeBuild, CodeLo...
     
    166166} // rebindForall
    167167
    168 NameExpr * build_postfix_name( const string * name ) {
    169         NameExpr * new_name = build_varref( new string( "?`" + *name ) );
    170         delete name;
    171         return new_name;
     168string * build_postfix_name( string * name ) {
     169        *name = string("__postfix_func_") + *name;
     170        return name;
    172171} // build_postfix_name
    173172
     
    238237        DeclarationNode * decl;
    239238        AggregateDecl::Aggregate aggKey;
    240         DeclarationNode::TypeClass tclass;
     239        TypeDecl::Kind tclass;
    241240        StatementNode * sn;
    242241        WaitForStmt * wfs;
     
    323322%type<op> ptrref_operator                               unary_operator                          assignment_operator
    324323%type<en> primary_expression                    postfix_expression                      unary_expression
    325 %type<en> cast_expression                               exponential_expression          multiplicative_expression       additive_expression
     324%type<en> cast_expression_list                  cast_expression                         exponential_expression          multiplicative_expression       additive_expression
    326325%type<en> shift_expression                              relational_expression           equality_expression
    327326%type<en> AND_expression                                exclusive_OR_expression         inclusive_OR_expression
     
    579578        | '(' compound_statement ')'                                            // GCC, lambda expression
    580579                { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); }
    581         | constant '`' IDENTIFIER                                                       // CFA, postfix call
    582                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
    583         | string_literal '`' IDENTIFIER                                         // CFA, postfix call
    584                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( $1 ) ) ); }
    585         | IDENTIFIER '`' IDENTIFIER                                                     // CFA, postfix call
    586                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( build_varref( $1 ) ) ) ); }
    587         | tuple '`' IDENTIFIER                                                          // CFA, postfix call
    588                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
    589         | '(' comma_expression ')' '`' IDENTIFIER                       // CFA, postfix call
    590                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $5 ) ), $2 ) ); }
    591580        | type_name '.' identifier                                                      // CFA, nested type
    592581                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     
    642631        | postfix_expression '(' argument_expression_list ')'
    643632                { $$ = new ExpressionNode( build_func( $1, $3 ) ); }
     633        | postfix_expression '`' identifier                                     // CFA, postfix call
     634                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( build_postfix_name( $3 ) ) ), $1 ) ); }
     635        | constant '`' identifier                                                       // CFA, postfix call
     636                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( build_postfix_name( $3 ) ) ), $1 ) ); }
     637        | string_literal '`' identifier                                         // CFA, postfix call
     638                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( build_postfix_name( $3 ) ) ), new ExpressionNode( $1 ) ) ); }
    644639        | postfix_expression '.' identifier
    645640                { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); }
     
    666661        | '(' type_no_function ')' '@' '{' initializer_list_opt comma_opt '}' // CFA, explicit C compound-literal
    667662                { $$ = new ExpressionNode( build_compoundLiteral( $2, (new InitializerNode( $6, true ))->set_maybeConstructed( false ) ) ); }
    668         | '^' primary_expression '{' argument_expression_list '}' // CFA
     663        | '^' primary_expression '{' argument_expression_list '}' // CFA, destructor call
    669664                {
    670665                        Token fn;
     
    679674        | argument_expression
    680675        | argument_expression_list ',' argument_expression
    681                 { $$ = (ExpressionNode *)( $1->set_last( $3 )); }
     676                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    682677        ;
    683678
     
    691686field_name_list:                                                                                // CFA, tuple field selector
    692687        field
    693         | field_name_list ',' field                                     { $$ = (ExpressionNode *)$1->set_last( $3 ); }
     688        | field_name_list ',' field                                     { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    694689        ;
    695690
     
    960955                { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $3 ) ) ); }
    961956        | '[' push assignment_expression pop ',' tuple_expression_list ']'
    962                 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)$3->set_last( $6 ) ) ); }
     957                { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)($3->set_last( $6 ) ) )); }
    963958        ;
    964959
     
    966961        assignment_expression_opt
    967962        | tuple_expression_list ',' assignment_expression_opt
    968                 { $$ = (ExpressionNode *)$1->set_last( $3 ); }
     963                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    969964        ;
    970965
     
    11901185                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    11911186                                                OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
     1187        | '=' comma_expression                                                                  // CFA
     1188                { $$ = forCtrl( $2, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
     1189                                                OperKinds::LEThan, $2->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    11921190        | comma_expression inclexcl comma_expression            // CFA
    11931191                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
     
    11971195                { $$ = forCtrl( $3, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    11981196                                                OperKinds::LThan, $3->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
     1197        | comma_expression ';' '=' comma_expression                             // CFA
     1198                { $$ = forCtrl( $4, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
     1199                                                OperKinds::LEThan, $4->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    11991200        | comma_expression ';' comma_expression inclexcl comma_expression // CFA
    12001201                { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
     
    13011302        WAITFOR '(' cast_expression ')'
    13021303                { $$ = $3; }
    1303         | WAITFOR '(' cast_expression ',' argument_expression_list ')'
    1304                 { $$ = (ExpressionNode *)$3->set_last( $5 ); }
     1304//      | WAITFOR '(' cast_expression ',' argument_expression_list ')'
     1305//              { $$ = (ExpressionNode *)$3->set_last( $5 ); }
     1306        | WAITFOR '(' cast_expression_list ':' argument_expression_list ')'
     1307                { $$ = (ExpressionNode *)($3->set_last( $5 )); }
     1308        ;
     1309
     1310cast_expression_list:
     1311        cast_expression
     1312        | cast_expression_list ',' cast_expression
     1313                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    13051314        ;
    13061315
     
    14131422        asm_operand
    14141423        | asm_operands_list ',' asm_operand
    1415                 { $$ = (ExpressionNode *)$1->set_last( $3 ); }
     1424                { $$ = (ExpressionNode *)($1->set_last( $3 )); }
    14161425        ;
    14171426
     
    14291438                { $$ = new ExpressionNode( $1 ); }
    14301439        | asm_clobbers_list_opt ',' string_literal
    1431                 // set_last returns ParseNode *
    1432                 { $$ = (ExpressionNode *)$1->set_last( new ExpressionNode( $3 ) ); }
     1440                { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( $3 ) )); }
    14331441        ;
    14341442
     
    23532361        | initializer_list_opt ',' initializer          { $$ = (InitializerNode *)( $1->set_last( $3 ) ); }
    23542362        | initializer_list_opt ',' designation initializer
    2355                 { $$ = (InitializerNode *)( $1->set_last( $4->set_designators( $3 ) ) ); }
     2363                { $$ = (InitializerNode *)($1->set_last( $4->set_designators( $3 ) )); }
    23562364        ;
    23572365
     
    23752383        designator
    23762384        | designator_list designator
    2377                 { $$ = (ExpressionNode *)( $1->set_last( $2 ) ); }
     2385                { $$ = (ExpressionNode *)($1->set_last( $2 )); }
    23782386        //| designator_list designator                                          { $$ = new ExpressionNode( $1, $2 ); }
    23792387        ;
     
    24312439        | type_specifier identifier_parameter_declarator
    24322440        | assertion_list
    2433                 { $$ = DeclarationNode::newTypeParam( DeclarationNode::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }
     2441                { $$ = DeclarationNode::newTypeParam( TypeDecl::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }
    24342442        ;
    24352443
    24362444type_class:                                                                                             // CFA
    24372445        OTYPE
    2438                 { $$ = DeclarationNode::Otype; }
     2446                { $$ = TypeDecl::Otype; }
    24392447        | DTYPE
    2440                 { $$ = DeclarationNode::Dtype; }
     2448                { $$ = TypeDecl::Dtype; }
    24412449        | FTYPE
    2442                 { $$ = DeclarationNode::Ftype; }
     2450                { $$ = TypeDecl::Ftype; }
    24432451        | TTYPE
    2444                 { $$ = DeclarationNode::Ttype; }
     2452                { $$ = TypeDecl::Ttype; }
    24452453        ;
    24462454
     
    24722480                { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $1->build()) ); $$ = nullptr; }
    24732481        | type_list ',' type
    2474                 { $$ = (ExpressionNode *)( $1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) ) ); }
     2482                { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); }
    24752483        | type_list ',' assignment_expression
    24762484                { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $3->build()) ); $$ = nullptr; }
     
    25832591                {
    25842592                        linkageStack.push( linkage );                           // handle nested extern "C"/"Cforall"
    2585                         linkage = LinkageSpec::linkageUpdate( yylloc, linkage, $2 );
     2593                        linkage = LinkageSpec::update( yylloc, linkage, $2 );
    25862594                }
    25872595          '{' up external_definition_list_opt down '}'
Note: See TracChangeset for help on using the changeset viewer.