Changeset 93bbbc4 for src/Parser


Ignore:
Timestamp:
Jul 14, 2021, 6:35:37 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
e7a63e3
Parents:
b16e15e
Message:

update parser for vtable declarations

Location:
src/Parser
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rb16e15e r93bbbc4  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 23 08:44:08 2021
    13 // Update Count     : 1149
     12// Last Modified On : Wed Jul 14 17:36:57 2021
     13// Update Count     : 1154
    1414//
    1515
     
    385385        newnode->type = new TypeData( basetypeof ? TypeData::Basetypeof : TypeData::Typeof );
    386386        newnode->type->typeexpr = expr;
     387        return newnode;
     388}
     389
     390DeclarationNode * DeclarationNode::newVtableType( DeclarationNode * decl ) {
     391        DeclarationNode * newnode = new DeclarationNode;
     392        newnode->type = new TypeData( TypeData::Vtable );
     393        newnode->setBase( decl->type );
    387394        return newnode;
    388395}
  • src/Parser/ParseNode.h

    rb16e15e r93bbbc4  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 15:19:04 2021
    13 // Update Count     : 897
     12// Last Modified On : Wed Jul 14 17:28:53 2021
     13// Update Count     : 900
    1414//
    1515
     
    249249        static DeclarationNode * newTuple( DeclarationNode * members );
    250250        static DeclarationNode * newTypeof( ExpressionNode * expr, bool basetypeof = false );
     251        static DeclarationNode * newVtableType( DeclarationNode * expr );
    251252        static DeclarationNode * newAttribute( const std::string *, ExpressionNode * expr = nullptr ); // gcc attributes
    252253        static DeclarationNode * newDirectiveStmt( StatementNode * stmt ); // gcc external directive statement
  • src/Parser/TypeData.cc

    rb16e15e r93bbbc4  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Dec 16 07:56:46 2019
    13 // Update Count     : 662
     12// Last Modified On : Wed Jul 14 17:46:47 2021
     13// Update Count     : 671
    1414//
    1515
     
    100100                typeexpr = nullptr;
    101101                break;
     102          case Vtable:
     103                break;
    102104          case Builtin:
    103105                // builtin = new Builtin_t;
     
    170172                // delete typeexpr->expr;
    171173                delete typeexpr;
     174                break;
     175          case Vtable:
    172176                break;
    173177          case Builtin:
     
    249253          case Basetypeof:
    250254                newtype->typeexpr = maybeClone( typeexpr );
     255                break;
     256          case Vtable:
    251257                break;
    252258          case Builtin:
     
    467473          case Basetypeof:
    468474          case Builtin:
     475          case Vtable:
    469476                assertf(false, "Tried to get leaf name from kind without a name: %d", kind);
    470477                break;
     
    546553          case TypeData::Basetypeof:
    547554                return buildTypeof( td );
     555          case TypeData::Vtable:
     556                return buildVtable( td );
    548557          case TypeData::Builtin:
    549558                switch ( td->builtintype ) {
     
    950959
    951960
     961VTableType * buildVtable( const TypeData * td ) {
     962        assert( td->base );
     963        return new VTableType{ buildQualifiers( td ), typebuild( td->base ) };
     964} // buildVtable
     965
     966
    952967Declaration * buildDecl( const TypeData * td, const string &name, Type::StorageClasses scs, Expression * bitfieldWidth, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec linkage, Expression *asmName, Initializer * init, std::list< Attribute * > attributes ) {
    953968        if ( td->kind == TypeData::Function ) {
  • src/Parser/TypeData.h

    rb16e15e r93bbbc4  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Mar 27 09:05:35 2021
    13 // Update Count     : 200
     12// Last Modified On : Wed Jul 14 17:44:05 2021
     13// Update Count     : 202
    1414//
    1515
     
    2727struct TypeData {
    2828        enum Kind { Basic, Pointer, Reference, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
    29                                 SymbolicInst, Tuple, Typeof, Basetypeof, Builtin, GlobalScope, Qualified, Unknown };
     29                                SymbolicInst, Tuple, Typeof, Basetypeof, Vtable, Builtin, GlobalScope, Qualified, Unknown };
    3030
    3131        struct Aggregate_t {
     
    128128TupleType * buildTuple( const TypeData * );
    129129TypeofType * buildTypeof( const TypeData * );
     130VTableType * buildVtable( const TypeData * );
    130131Declaration * buildDecl( const TypeData *, const std::string &, Type::StorageClasses, Expression *, Type::FuncSpecifiers funcSpec, LinkageSpec::Spec, Expression * asmName,
    131132                                                 Initializer * init = nullptr, std::list< class Attribute * > attributes = std::list< class Attribute * >() );
  • src/Parser/parser.yy

    rb16e15e r93bbbc4  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jun 29 09:12:47 2021
    13 // Update Count     : 5027
     12// Last Modified On : Wed Jul 14 17:27:54 2021
     13// Update Count     : 5030
    1414//
    1515
     
    19231923
    19241924vtable:
    1925         VTABLE '(' type_list ')' default_opt
    1926                 { SemanticError( yylloc, "vtable is currently unimplemented." ); $$ = nullptr; }
     1925        VTABLE '(' typedef_name ')' default_opt
     1926                { $$ = DeclarationNode::newVtableType( $3 ); }
     1927                // { SemanticError( yylloc, "vtable is currently unimplemented." ); $$ = nullptr; }
    19271928        ;
    19281929
Note: See TracChangeset for help on using the changeset viewer.