ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change
on this file since c3a4385 was
56c3935,
checked in by Peter A. Buhr <pabuhr@…>, 9 years ago
|
redo automake third attempt
|
-
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 |
---|
[56c3935] | 12 | // Last Modified On : Sun May 31 23:45:19 2015 |
---|
| 13 | // Update Count : 4 |
---|
[b87a5ed] | 14 | // |
---|
[51b7345] | 15 | |
---|
| 16 | #include "Parser.h" |
---|
| 17 | #include "TypedefTable.h" |
---|
| 18 | #include "lex.h" |
---|
[56c3935] | 19 | #include "parser.h" |
---|
[51b7345] | 20 | |
---|
[b87a5ed] | 21 | // global variables in cfa.y |
---|
[51b7345] | 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; |
---|
[51b7345] | 34 | } |
---|
| 35 | |
---|
[b87a5ed] | 36 | Parser &Parser::get_parser() { |
---|
| 37 | if ( theParser == 0 ) { |
---|
| 38 | theParser = new Parser; |
---|
| 39 | } // if |
---|
| 40 | return *theParser; |
---|
[51b7345] | 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; |
---|
[51b7345] | 51 | } |
---|
| 52 | |
---|
[b87a5ed] | 53 | void Parser::set_debug( bool debug ) { |
---|
| 54 | yydebug = debug; |
---|
[51b7345] | 55 | } |
---|
| 56 | |
---|
[b87a5ed] | 57 | void Parser::set_linkage( LinkageSpec::Type linkage ) { |
---|
| 58 | ::linkage = linkage; |
---|
[51b7345] | 59 | } |
---|
| 60 | |
---|
[b87a5ed] | 61 | void Parser::freeTree() { |
---|
| 62 | delete parseTree; |
---|
| 63 | parseTree = 0; |
---|
[51b7345] | 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.