Changeset 136ccd7 for src/Parser


Ignore:
Timestamp:
Nov 3, 2017, 3:01:31 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
Children:
4ee36bf0
Parents:
4ee1efb (diff), 760ba67 (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 cleanup-dtors

Location:
src/Parser
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r4ee1efb r136ccd7  
    10311031
    10321032        if ( variable.tyClass != NoTypeClass ) {
    1033                 static const TypeDecl::Kind kindMap[] = { TypeDecl::Any, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype };
    1034                 assertf( sizeof(kindMap)/sizeof(kindMap[0] == NoTypeClass-1), "DeclarationNode::build: kindMap is out of sync." );
     1033                // otype is internally converted to dtype + otype parameters
     1034                static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype };
     1035                assertf( sizeof(kindMap)/sizeof(kindMap[0]) == NoTypeClass, "DeclarationNode::build: kindMap is out of sync." );
    10351036                assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." );
    1036                 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.initializer ? variable.initializer->buildType() : nullptr );
     1037                TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == Otype, variable.initializer ? variable.initializer->buildType() : nullptr );
    10371038                buildList( variable.assertions, ret->get_assertions() );
    10381039                return ret;
  • src/Parser/TypeData.cc

    r4ee1efb r136ccd7  
    406406void buildForall( const DeclarationNode * firstNode, ForallList &outputList ) {
    407407        buildList( firstNode, outputList );
    408         for ( typename ForallList::iterator i = outputList.begin(); i != outputList.end(); ++i ) {
     408        auto n = firstNode;
     409        for ( typename ForallList::iterator i = outputList.begin(); i != outputList.end(); ++i, n = (DeclarationNode*)n->get_next() ) {
    409410                TypeDecl * td = static_cast<TypeDecl *>(*i);
    410                 if ( td->get_kind() == TypeDecl::Any ) {
     411                if ( n->variable.tyClass == DeclarationNode::Otype ) {
    411412                        // add assertion parameters to `type' tyvars in reverse order
    412413                        // add dtor:  void ^?{}(T *)
     
    798799                ret = new TypedefDecl( name, scs, typebuild( td->base ), linkage );
    799800        } else {
    800                 ret = new TypeDecl( name, scs, typebuild( td->base ), TypeDecl::Any );
     801                ret = new TypeDecl( name, scs, typebuild( td->base ), TypeDecl::Dtype, true );
    801802        } // if
    802803        buildList( td->symbolic.params, ret->get_parameters() );
  • src/Parser/lex.ll

    r4ee1efb r136ccd7  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Sat Sep 23 17:29:28 2017
    13  * Update Count     : 632
     12 * Last Modified On : Wed Oct 25 13:53:56 2017
     13 * Update Count     : 634
    1414 */
    1515
     
    233233__extension__   { KEYWORD_RETURN(EXTENSION); }                  // GCC
    234234extern                  { KEYWORD_RETURN(EXTERN); }
    235 fallthrough             { KEYWORD_RETURN(FALLTHRU); }                   // CFA
    236235fallthru                { KEYWORD_RETURN(FALLTHRU); }                   // CFA
     236fallthrough             { KEYWORD_RETURN(FALLTHROUGH); }                // CFA
    237237finally                 { KEYWORD_RETURN(FINALLY); }                    // CFA
    238238float                   { KEYWORD_RETURN(FLOAT); }
  • src/Parser/parser.yy

    r4ee1efb r136ccd7  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Oct 16 11:07:29 2017
    13 // Update Count     : 2892
     12// Last Modified On : Wed Oct 25 12:28:54 2017
     13// Update Count     : 2893
    1414//
    1515
     
    180180%token ATTRIBUTE EXTENSION                                                              // GCC
    181181%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
    182 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH WHEN WAITFOR // CFA
     182%token CHOOSE DISABLE ENABLE FALLTHRU FALLTHROUGH TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH WHEN WAITFOR // CFA
    183183%token ASM                                                                                              // C99, extension ISO/IEC 9899:1999 Section J.5.10(1)
    184184%token ALIGNAS ALIGNOF GENERIC STATICASSERT                             // C11
     
    362362%precedence ELSE        // token precedence for start of else clause in IF/WAITFOR statement
    363363
    364 %locations
     364%locations                      // support location tracking for error messages
    365365
    366366%start translation_unit                                                                 // parse-tree root
     
    458458                { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); }
    459459        | type_name '.' no_attr_identifier                                      // CFA, nested type
    460                 { $$ = nullptr; }                                                               // FIX ME
     460                { throw SemanticError("Qualified names are currently unimplemented."); $$ = nullptr; }                                                          // FIX ME
    461461        | type_name '.' '[' push field_list pop ']'                     // CFA, nested type / tuple field selector
    462                 { $$ = nullptr; }                                                               // FIX ME
     462                { throw SemanticError("Qualified names are currently unimplemented."); $$ = nullptr; }                                                          // FIX ME
    463463        ;
    464464
     
    974974        ;
    975975
     976fall_through_name:                                                                              // CFA
     977        FALLTHRU
     978        | FALLTHROUGH
     979        ;
     980
    976981fall_through:                                                                                   // CFA
    977         FALLTHRU
     982        fall_through_name
    978983                { $$ = nullptr; }
    979         | FALLTHRU ';'
     984        | fall_through_name ';'
    980985                { $$ = nullptr; }
    981986        ;
     
    24862491        | TYPEDEFname
    24872492        | TYPEGENname
     2493        | FALLTHROUGH
     2494                { $$ = Token{ new string( "fallthrough" ), { nullptr, -1 } }; }
    24882495        | CONST
    24892496                { $$ = Token{ new string( "__const__" ), { nullptr, -1 } }; }
     
    27512758//
    27522759//              typedef int foo;
    2753 //              forall( otype T ) foo( T );
     2760//              forall( otype T ) struct foo;
    27542761//              int f( int foo ); // redefine typedef name in new scope
    27552762//
Note: See TracChangeset for help on using the changeset viewer.