1 /*
2  * CCdlParserDriver.hh
3  *
4  * Copyright 2014-2018 D. Mitch Bailey  cvc at shuharisystem dot com
5  *
6  * This file is part of cvc.
7  *
8  * cvc is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * cvc is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with cvc.  If not, see <http://www.gnu.org/licenses/>.
20  *
21  * You can download cvc from https://github.com/d-m-bailey/cvc.git
22  */
23 
24 #ifndef CCdlParserDriver_HH
25 
26 #define CCdlParserDriver_HH
27 
28 #include "Cvc.hh"
29 #include "location.hh"
30 
31 #include "CCircuit.hh"
32 
33 namespace yy {
34 	typedef location location_type;
35 	class CCdlParser;
36 }
37 
38 // Conducting the whole scanning and parsing of Cdl File.
39 class CCdlParserDriver
40 {
41 public:
42 	CCdlParserDriver ();
43 	virtual ~CCdlParserDriver ();
44 
45 	int result;
46 
47 	// Handling the scanner.
48 	void scan_begin ();
49 	void scan_end ();
50 	bool trace_scanning;
51 
52 	// Run the parser on file F.
53 	// Return 0 on success.
54 	int parse (const string& theCdlFileName, CCircuitPtrList& theCircuitPtrList, bool theCvcSOI);
55 
56 	// The name of the file being parsed.
57 	// Used later to pass the file name to the location tracker.
58 	string filename;
59 
60 	// Whether parser traces should be generated.
61 	bool trace_parsing;
62 
63 
64 	// Error handling.
65 	void error (const yy::location_type& theLocation, const string& theMessage);
66 	void error (const string& theMessage);
67 };
68 
69 #include "cdlParser.hh"
70 
71 // Tell Flex the lexer's prototype ...
72 # define YY_DECL \
73  yy::CCdlParser::token_type yylex (yy::CCdlParser::semantic_type *yylval, yy::CCdlParser::location_type *yylloc, CCdlParserDriver& driver, CCircuitPtrList& cdlCircuitList, bool theCvcSOI)
74 YY_DECL;
75 
76 
77 #endif // ! CCdlParserDriver_HH
78