source: src/Parser/Parser.cc @ 0853178

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 0853178 was 984dce6, checked in by Peter A. Buhr <pabuhr@…>, 9 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
22extern int yyparse(void);
23extern int yydebug;
24extern LinkageSpec::Type linkage;
25extern TypedefTable typedefTable;
26extern DeclarationNode *theTree;
27
28Parser *Parser::theParser = 0;
29
30Parser::Parser(): parseTree( 0 ), parseStatus( 1 ) {}
31
32Parser::~Parser() {
33        delete parseTree;
34}
35
36Parser &Parser::get_parser() {
37        if ( theParser == 0 ) {
38                theParser = new Parser;
39        } // if
40        return *theParser;
41}
42
43void 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
53void Parser::set_debug( bool debug ) {
54        yydebug = debug;
55}
56
57void Parser::set_linkage( LinkageSpec::Type linkage ) {
58        ::linkage = linkage;
59}
60
61void 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.