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 c8ffe20b was 51b73452, checked in by Peter A. Buhr <pabuhr@…>, 11 years ago |
|
initial commit
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * This file is part of the Cforall project
|
|---|
| 3 | *
|
|---|
| 4 | * $Id: Parser.cc,v 1.6 2002/11/15 20:07:18 rcbilson Exp $
|
|---|
| 5 | *
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include "Parser.h"
|
|---|
| 9 | #include "TypedefTable.h"
|
|---|
| 10 | #include "lex.h"
|
|---|
| 11 | #include "cfa.tab.h"
|
|---|
| 12 |
|
|---|
| 13 | /* global variables in cfa.y */
|
|---|
| 14 | extern int yyparse(void);
|
|---|
| 15 |
|
|---|
| 16 | extern int yydebug;
|
|---|
| 17 | extern LinkageSpec::Type linkage;
|
|---|
| 18 |
|
|---|
| 19 | extern TypedefTable typedefTable;
|
|---|
| 20 | extern DeclarationNode *theTree;
|
|---|
| 21 | /* end of globals */
|
|---|
| 22 |
|
|---|
| 23 | Parser *Parser::theParser = 0;
|
|---|
| 24 |
|
|---|
| 25 | Parser::Parser(): parseTree( 0 ), parseStatus( 1 ) {}
|
|---|
| 26 |
|
|---|
| 27 | Parser::~Parser()
|
|---|
| 28 | {
|
|---|
| 29 | delete parseTree;
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | /* static class method */
|
|---|
| 33 | Parser &
|
|---|
| 34 | Parser::get_parser()
|
|---|
| 35 | {
|
|---|
| 36 | if( theParser == 0 ) {
|
|---|
| 37 | theParser = new Parser;
|
|---|
| 38 | }
|
|---|
| 39 | return *theParser;
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | void
|
|---|
| 43 | Parser::parse( FILE *input )
|
|---|
| 44 | {
|
|---|
| 45 | extern FILE *yyin;
|
|---|
| 46 | yyin = input;
|
|---|
| 47 | extern int yylineno;
|
|---|
| 48 | yylineno = 1;
|
|---|
| 49 | typedefTable.enterScope();
|
|---|
| 50 | parseStatus = yyparse();
|
|---|
| 51 | parseTree = theTree;
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | void
|
|---|
| 55 | Parser::set_debug( bool debug )
|
|---|
| 56 | {
|
|---|
| 57 | yydebug = debug;
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | void
|
|---|
| 61 | Parser::set_linkage( LinkageSpec::Type linkage )
|
|---|
| 62 | {
|
|---|
| 63 | ::linkage = linkage;
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 | void
|
|---|
| 68 | Parser::freeTree()
|
|---|
| 69 | {
|
|---|
| 70 | delete parseTree;
|
|---|
| 71 | parseTree = 0;
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.