ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        ctor
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        gc_noraii
        jacob/cs343-translation
        jenkins-sandbox
        memory
        new-ast
        new-ast-unique-expr
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        resolv-new
        string
        with_gc
      
      
        
          | 
            Last change
 on this file since 6b6597c was             984dce6, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago           | 
        
        
          | 
             
only implicitly generate typedef for structures if name not in use and overwrite typedef name if explicit name appears, upate parser symbol table 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            1.4 KB
           | 
        
      
      
| Rev | Line |   | 
|---|
| [b87a5ed] | 1 | //
 | 
|---|
 | 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
 | 
|---|
 | 3 | //
 | 
|---|
 | 4 | // The contents of this file are covered under the licence agreement in the
 | 
|---|
 | 5 | // file "LICENCE" distributed with Cforall.
 | 
|---|
 | 6 | //
 | 
|---|
 | 7 | // Parser.cc -- 
 | 
|---|
 | 8 | //
 | 
|---|
 | 9 | // Author           : Rodolfo G. Esteves
 | 
|---|
 | 10 | // Created On       : Sat May 16 14:54:28 2015
 | 
|---|
 | 11 | // Last Modified By : Peter A. Buhr
 | 
|---|
| [984dce6] | 12 | // Last Modified On : Mon Mar 21 18:04:47 2016
 | 
|---|
 | 13 | // Update Count     : 5
 | 
|---|
| [b87a5ed] | 14 | // 
 | 
|---|
| [51b73452] | 15 | 
 | 
|---|
 | 16 | #include "Parser.h"
 | 
|---|
 | 17 | #include "lex.h"
 | 
|---|
| [56c3935] | 18 | #include "parser.h"
 | 
|---|
| [984dce6] | 19 | #include "TypedefTable.h"
 | 
|---|
| [51b73452] | 20 | 
 | 
|---|
| [b87a5ed] | 21 | // global variables in cfa.y
 | 
|---|
| [51b73452] | 22 | extern int yyparse(void);
 | 
|---|
 | 23 | extern int yydebug;
 | 
|---|
 | 24 | extern LinkageSpec::Type linkage;
 | 
|---|
 | 25 | extern TypedefTable typedefTable;
 | 
|---|
 | 26 | extern DeclarationNode *theTree;
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 | Parser *Parser::theParser = 0;
 | 
|---|
 | 29 | 
 | 
|---|
 | 30 | Parser::Parser(): parseTree( 0 ), parseStatus( 1 ) {}
 | 
|---|
 | 31 | 
 | 
|---|
| [b87a5ed] | 32 | Parser::~Parser() {
 | 
|---|
 | 33 |         delete parseTree;
 | 
|---|
| [51b73452] | 34 | }
 | 
|---|
 | 35 | 
 | 
|---|
| [b87a5ed] | 36 | Parser &Parser::get_parser() {
 | 
|---|
 | 37 |         if ( theParser == 0 ) {
 | 
|---|
 | 38 |                 theParser = new Parser;
 | 
|---|
 | 39 |         } // if
 | 
|---|
 | 40 |         return *theParser;
 | 
|---|
| [51b73452] | 41 | }
 | 
|---|
 | 42 | 
 | 
|---|
| [b87a5ed] | 43 | void Parser::parse( FILE *input ) {
 | 
|---|
 | 44 |         extern FILE *yyin;
 | 
|---|
 | 45 |         yyin = input;
 | 
|---|
 | 46 |         extern int yylineno;
 | 
|---|
 | 47 |         yylineno = 1;
 | 
|---|
 | 48 |         typedefTable.enterScope();
 | 
|---|
 | 49 |         parseStatus = yyparse();
 | 
|---|
 | 50 |         parseTree = theTree;
 | 
|---|
| [51b73452] | 51 | }
 | 
|---|
 | 52 | 
 | 
|---|
| [b87a5ed] | 53 | void Parser::set_debug( bool debug ) {
 | 
|---|
 | 54 |         yydebug = debug;
 | 
|---|
| [51b73452] | 55 | }
 | 
|---|
 | 56 | 
 | 
|---|
| [b87a5ed] | 57 | void Parser::set_linkage( LinkageSpec::Type linkage ) {
 | 
|---|
 | 58 |         ::linkage = linkage;
 | 
|---|
| [51b73452] | 59 | }
 | 
|---|
 | 60 | 
 | 
|---|
| [b87a5ed] | 61 | void Parser::freeTree() {
 | 
|---|
 | 62 |         delete parseTree;
 | 
|---|
 | 63 |         parseTree = 0;
 | 
|---|
| [51b73452] | 64 | }
 | 
|---|
 | 65 | 
 | 
|---|
| [b87a5ed] | 66 | // Local Variables: //
 | 
|---|
 | 67 | // tab-width: 4 //
 | 
|---|
 | 68 | // mode: c++ //
 | 
|---|
 | 69 | // compile-command: "make install" //
 | 
|---|
 | 70 | // End: //
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.