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
        with_gc
      
      
        
          | 
            Last change
 on this file since 4d3ca1d8 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
           | 
        
      
      
| Line |   | 
|---|
| 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
 | 
|---|
| 12 | // Last Modified On : Mon Mar 21 18:04:47 2016
 | 
|---|
| 13 | // Update Count     : 5
 | 
|---|
| 14 | // 
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #include "Parser.h"
 | 
|---|
| 17 | #include "lex.h"
 | 
|---|
| 18 | #include "parser.h"
 | 
|---|
| 19 | #include "TypedefTable.h"
 | 
|---|
| 20 | 
 | 
|---|
| 21 | // global variables in cfa.y
 | 
|---|
| 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 | 
 | 
|---|
| 32 | Parser::~Parser() {
 | 
|---|
| 33 |         delete parseTree;
 | 
|---|
| 34 | }
 | 
|---|
| 35 | 
 | 
|---|
| 36 | Parser &Parser::get_parser() {
 | 
|---|
| 37 |         if ( theParser == 0 ) {
 | 
|---|
| 38 |                 theParser = new Parser;
 | 
|---|
| 39 |         } // if
 | 
|---|
| 40 |         return *theParser;
 | 
|---|
| 41 | }
 | 
|---|
| 42 | 
 | 
|---|
| 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;
 | 
|---|
| 51 | }
 | 
|---|
| 52 | 
 | 
|---|
| 53 | void Parser::set_debug( bool debug ) {
 | 
|---|
| 54 |         yydebug = debug;
 | 
|---|
| 55 | }
 | 
|---|
| 56 | 
 | 
|---|
| 57 | void Parser::set_linkage( LinkageSpec::Type linkage ) {
 | 
|---|
| 58 |         ::linkage = linkage;
 | 
|---|
| 59 | }
 | 
|---|
| 60 | 
 | 
|---|
| 61 | void Parser::freeTree() {
 | 
|---|
| 62 |         delete parseTree;
 | 
|---|
| 63 |         parseTree = 0;
 | 
|---|
| 64 | }
 | 
|---|
| 65 | 
 | 
|---|
| 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.