CommandParser.h
1 /*
2  * PFPSim: Library for the Programmable Forwarding Plane Simulation Framework
3  *
4  * Copyright (C) 2016 Concordia Univ., Montreal
5  * Samar Abdi
6  * Umair Aftab
7  * Gordon Bailey
8  * Faras Dewal
9  * Shafigh Parsazad
10  * Eric Tremblay
11  *
12  * Copyright (C) 2016 Ericsson
13  * Bochra Boughzala
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28  * 02110-1301, USA.
29  */
30 
31 // Generated by Bisonc++ V4.09.02 on Sun, 03 Apr 2016 08:35:18 -0400
32 
33 #ifndef CORE_CP_COMMANDPARSER_H_
34 #define CORE_CP_COMMANDPARSER_H_
35 #include <string>
36 #include "Commands.h"
37 
38 #ifndef pfp_cpCommandParserBase_h_included
39 #include "NAMESPACE_HACK_BEGIN"
40 // $insert baseclass
41 #include "CommandParserbase.h"
42 #include "NAMESPACE_HACK_END"
43 #endif
44 
45 // $insert scanner.h
46 #include "CommandScanner.h"
47 
48 #include "NAMESPACE_HACK_BEGIN" // NOLINT(build/include)
49 // $insert namespace-open
50 namespace pfp_cp {
51 
52 #undef CommandParser
53 class CommandParser: public CommandParserBase {
54  // $insert scannerobject
55  CommandScanner d_scanner;
56 
57  public:
58  CommandParser();
59 
60  std::shared_ptr<Command> parse_line(std::string & s);
61 
62  private:
63  void returnCommand(Command *cmd);
64  std::shared_ptr<Command> returned_command;
65 
66  int parse();
67  void error(char const *msg); // called on (syntax) errors
68  int lex(); // returns the next token from the
69  // lexical scanner.
70  void print(); // use, e.g., d_token, d_loc
71 
72 // support functions for parse():
73  void executeAction(int ruleNr);
74  void errorRecovery();
75  int lookup(bool recovery);
76  void nextToken();
77  void print__();
78  void exceptionHandler__(std::exception const &exc);
79 };
80 
81 // $insert namespace-close
82 }; // namespace pfp_cp
83 #include "NAMESPACE_HACK_END" // NOLINT(build/include)
84 
85 #endif // CORE_CP_COMMANDPARSER_H_
Definition: CommandParser.h:50