Ignore:
Timestamp:
Aug 16, 2016, 5:56:37 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
29917c6
Parents:
7880579
Message:

more refactoring of parser code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r7880579 r0da3e2c  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Aug 15 15:18:19 2016
    13 // Update Count     : 1891
     12// Last Modified On : Tue Aug 16 17:10:35 2016
     13// Update Count     : 1898
    1414//
    1515
     
    4343#define YYDEBUG_LEXER_TEXT (yylval)                                             // lexer loads this up each time
    4444#define YYDEBUG 1                                                                               // get the pretty debugging code to compile
    45 extern char *yytext;
    4645
    4746#undef __GNUC_MINOR__
     
    5655#include "LinkageSpec.h"
    5756
    58 DeclarationNode *theTree = 0;                                                   // the resulting parse tree
    59 LinkageSpec::Type linkage = LinkageSpec::Cforall;
     57extern DeclarationNode *parseTree;
     58extern LinkageSpec::Type linkage;
     59extern TypedefTable typedefTable;
     60
    6061std::stack< LinkageSpec::Type > linkageStack;
    61 TypedefTable typedefTable;
    6262
    6363void appendStr( std::string &to, std::string *from ) {
     
    223223%type<decl> paren_identifier paren_type
    224224
    225 %type<decl> storage_class storage_class_name storage_class_list
     225%type<decl> storage_class storage_class_list
    226226
    227227%type<decl> sue_declaration_specifier sue_type_specifier
     
    13241324
    13251325storage_class:
    1326         storage_class_name
    1327         ;
    1328 
    1329 storage_class_name:
    13301326        EXTERN
    13311327                { $$ = DeclarationNode::newStorageClass( DeclarationNode::Extern ); }
     
    19751971        | external_definition_list
    19761972                {
    1977                         if ( theTree ) {
    1978                                 theTree->appendList( $1 );
     1973                        if ( parseTree ) {
     1974                                parseTree->appendList( $1 );
    19791975                        } else {
    1980                                 theTree = $1;
     1976                                parseTree = $1;
    19811977                        }
    19821978                }
     
    21482144any_word:                                                                                               // GCC
    21492145        identifier_or_type_name {}
    2150         | storage_class_name {}
     2146        | storage_class {}
    21512147        | basic_type_name {}
    21522148        | type_qualifier {}
     
    28482844// ----end of grammar----
    28492845
     2846extern char *yytext;
     2847
    28502848void yyerror( const char * ) {
    28512849        std::cout << "Error ";
Note: See TracChangeset for help on using the changeset viewer.