Changeset 2d019af for src/Parser


Ignore:
Timestamp:
Mar 12, 2021, 11:14:29 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
41ca6fa, e867b44
Parents:
6083392
Message:

parser global pragmas, fixes #241

Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r6083392 r2d019af  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jan 11 20:58:07 2021
    13 // Update Count     : 1137
     12// Last Modified On : Fri Mar 12 18:35:37 2021
     13// Update Count     : 1141
    1414//
    1515
     
    424424        newnode->attributes.push_back( new Attribute( *name, exprs ) );
    425425        delete name;
     426        return newnode;
     427}
     428
     429DeclarationNode * DeclarationNode::newDirectiveStmt( StatementNode * stmt ) {
     430        DeclarationNode * newnode = new DeclarationNode;
     431        newnode->directiveStmt = stmt;
    426432        return newnode;
    427433}
     
    10721078                return new AsmDecl( strict_dynamic_cast<AsmStmt *>( asmStmt->build() ) );
    10731079        } // if
     1080        if ( directiveStmt ) {
     1081                return new DirectiveDecl( strict_dynamic_cast<DirectiveStmt *>( directiveStmt->build() ) );
     1082        } // if
    10741083
    10751084        if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) {
  • src/Parser/ParseNode.h

    r6083392 r2d019af  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jan  3 18:23:01 2021
    13 // Update Count     : 896
     12// Last Modified On : Fri Mar 12 15:19:04 2021
     13// Update Count     : 897
    1414//
    1515
     
    249249        static DeclarationNode * newTypeof( ExpressionNode * expr, bool basetypeof = false );
    250250        static DeclarationNode * newAttribute( const std::string *, ExpressionNode * expr = nullptr ); // gcc attributes
     251        static DeclarationNode * newDirectiveStmt( StatementNode * stmt ); // gcc external directive statement
    251252        static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement
    252253        static DeclarationNode * newStaticAssert( ExpressionNode * condition, Expression * message );
     
    345346        std::string error;
    346347        StatementNode * asmStmt = nullptr;
     348        StatementNode * directiveStmt = nullptr;
    347349
    348350        static UniqueName anonymous;
  • src/Parser/parser.yy

    r6083392 r2d019af  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 17 09:03:07 2021
    13 // Update Count     : 4722
     12// Last Modified On : Fri Mar 12 15:21:02 2021
     13// Update Count     : 4728
    1414//
    1515
     
    26392639
    26402640external_definition:
    2641         declaration
     2641        DIRECTIVE
     2642                { $$ = DeclarationNode::newDirectiveStmt( new StatementNode( build_directive( $1 ) ) ); }
     2643        | declaration
    26422644        | external_function_definition
    26432645        | EXTENSION external_definition                                         // GCC, multiple __extension__ allowed, meaning unknown
Note: See TracChangeset for help on using the changeset viewer.