1 | /* A Bison parser, made by GNU Bison 2.5. */ |
---|
2 | |
---|
3 | /* Skeleton interface for Bison LALR(1) parsers in C++ |
---|
4 | |
---|
5 | Copyright (C) 2002-2011 Free Software Foundation, Inc. |
---|
6 | |
---|
7 | This program is free software: you can redistribute it and/or modify |
---|
8 | it under the terms of the GNU General Public License as published by |
---|
9 | the Free Software Foundation, either version 3 of the License, or |
---|
10 | (at your option) any later version. |
---|
11 | |
---|
12 | This program is distributed in the hope that it will be useful, |
---|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | GNU General Public License for more details. |
---|
16 | |
---|
17 | You should have received a copy of the GNU General Public License |
---|
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
---|
19 | |
---|
20 | /* As a special exception, you may create a larger work that contains |
---|
21 | part or all of the Bison parser skeleton and distribute that work |
---|
22 | under terms of your choice, so long as that work isn't itself a |
---|
23 | parser generator using the skeleton or a modified version thereof |
---|
24 | as a parser skeleton. Alternatively, if you modify or redistribute |
---|
25 | the parser skeleton itself, you may (at your option) remove this |
---|
26 | special exception, which will cause the skeleton and the resulting |
---|
27 | Bison output files to be licensed under the GNU General Public |
---|
28 | License without this special exception. |
---|
29 | |
---|
30 | This special exception was added by the Free Software Foundation in |
---|
31 | version 2.2 of Bison. */ |
---|
32 | |
---|
33 | /* C++ LALR(1) parser skeleton written by Akim Demaille. */ |
---|
34 | |
---|
35 | #ifndef PARSER_HEADER_H |
---|
36 | # define PARSER_HEADER_H |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | #include <string> |
---|
41 | #include <iostream> |
---|
42 | #include "stack.hh" |
---|
43 | #include "location.hh" |
---|
44 | |
---|
45 | /* Enabling traces. */ |
---|
46 | #ifndef YYDEBUG |
---|
47 | # define YYDEBUG 1 |
---|
48 | #endif |
---|
49 | |
---|
50 | /* Enabling verbose error messages. */ |
---|
51 | #ifdef YYERROR_VERBOSE |
---|
52 | # undef YYERROR_VERBOSE |
---|
53 | # define YYERROR_VERBOSE 1 |
---|
54 | #else |
---|
55 | # define YYERROR_VERBOSE 1 |
---|
56 | #endif |
---|
57 | |
---|
58 | /* Enabling the token table. */ |
---|
59 | #ifndef YYTOKEN_TABLE |
---|
60 | # define YYTOKEN_TABLE 0 |
---|
61 | #endif |
---|
62 | |
---|
63 | |
---|
64 | namespace orbital { |
---|
65 | |
---|
66 | /* Line 35 of lalr1.cc */ |
---|
67 | #line 68 "generated/gun-parser.h" |
---|
68 | |
---|
69 | /// A Bison parser. |
---|
70 | class GunParser |
---|
71 | { |
---|
72 | public: |
---|
73 | /// Symbol semantic values. |
---|
74 | #ifndef YYSTYPE |
---|
75 | union semantic_type |
---|
76 | { |
---|
77 | |
---|
78 | /* Line 35 of lalr1.cc */ |
---|
79 | #line 35 "gun-parser.y" |
---|
80 | |
---|
81 | float fval; |
---|
82 | struct { float f0, f1, f2, f3, f4, f5, f6, f7; } args; |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | /* Line 35 of lalr1.cc */ |
---|
87 | #line 88 "generated/gun-parser.h" |
---|
88 | }; |
---|
89 | #else |
---|
90 | typedef YYSTYPE semantic_type; |
---|
91 | #endif |
---|
92 | /// Symbol locations. |
---|
93 | typedef location location_type; |
---|
94 | /// Tokens. |
---|
95 | struct token |
---|
96 | { |
---|
97 | /* Tokens. */ |
---|
98 | enum yytokentype { |
---|
99 | T_END = 0, |
---|
100 | T_AI = 258, |
---|
101 | T_PAI = 259, |
---|
102 | T_CA = 260, |
---|
103 | T_SA = 261, |
---|
104 | T_TIM = 262, |
---|
105 | T_SO = 263, |
---|
106 | T_RD = 264, |
---|
107 | T_SPD = 265, |
---|
108 | T_MODA = 266, |
---|
109 | T_MODB = 267, |
---|
110 | T_FFB = 268, |
---|
111 | T_FFP = 269, |
---|
112 | T_FB = 270, |
---|
113 | T_FP = 271, |
---|
114 | T_SK = 272, |
---|
115 | T_LOOP = 273, |
---|
116 | NUMBER = 274 |
---|
117 | }; |
---|
118 | |
---|
119 | }; |
---|
120 | /// Token type. |
---|
121 | typedef token::yytokentype token_type; |
---|
122 | |
---|
123 | /// Build a parser object. |
---|
124 | GunParser (class GunCompiler& gc_yyarg); |
---|
125 | virtual ~GunParser (); |
---|
126 | |
---|
127 | /// Parse. |
---|
128 | /// \returns 0 iff parsing succeeded. |
---|
129 | virtual int parse (); |
---|
130 | |
---|
131 | #if YYDEBUG |
---|
132 | /// The current debugging stream. |
---|
133 | std::ostream& debug_stream () const; |
---|
134 | /// Set the current debugging stream. |
---|
135 | void set_debug_stream (std::ostream &); |
---|
136 | |
---|
137 | /// Type for debugging levels. |
---|
138 | typedef int debug_level_type; |
---|
139 | /// The current debugging level. |
---|
140 | debug_level_type debug_level () const; |
---|
141 | /// Set the current debugging level. |
---|
142 | void set_debug_level (debug_level_type l); |
---|
143 | #endif |
---|
144 | |
---|
145 | private: |
---|
146 | /// Report a syntax error. |
---|
147 | /// \param loc where the syntax error is found. |
---|
148 | /// \param msg a description of the syntax error. |
---|
149 | virtual void error (const location_type& loc, const std::string& msg); |
---|
150 | |
---|
151 | /// Generate an error message. |
---|
152 | /// \param state the state where the error occurred. |
---|
153 | /// \param tok the lookahead token. |
---|
154 | virtual std::string yysyntax_error_ (int yystate, int tok); |
---|
155 | |
---|
156 | #if YYDEBUG |
---|
157 | /// \brief Report a symbol value on the debug stream. |
---|
158 | /// \param yytype The token type. |
---|
159 | /// \param yyvaluep Its semantic value. |
---|
160 | /// \param yylocationp Its location. |
---|
161 | virtual void yy_symbol_value_print_ (int yytype, |
---|
162 | const semantic_type* yyvaluep, |
---|
163 | const location_type* yylocationp); |
---|
164 | /// \brief Report a symbol on the debug stream. |
---|
165 | /// \param yytype The token type. |
---|
166 | /// \param yyvaluep Its semantic value. |
---|
167 | /// \param yylocationp Its location. |
---|
168 | virtual void yy_symbol_print_ (int yytype, |
---|
169 | const semantic_type* yyvaluep, |
---|
170 | const location_type* yylocationp); |
---|
171 | #endif |
---|
172 | |
---|
173 | |
---|
174 | /// State numbers. |
---|
175 | typedef int state_type; |
---|
176 | /// State stack type. |
---|
177 | typedef stack<state_type> state_stack_type; |
---|
178 | /// Semantic value stack type. |
---|
179 | typedef stack<semantic_type> semantic_stack_type; |
---|
180 | /// location stack type. |
---|
181 | typedef stack<location_type> location_stack_type; |
---|
182 | |
---|
183 | /// The state stack. |
---|
184 | state_stack_type yystate_stack_; |
---|
185 | /// The semantic value stack. |
---|
186 | semantic_stack_type yysemantic_stack_; |
---|
187 | /// The location stack. |
---|
188 | location_stack_type yylocation_stack_; |
---|
189 | |
---|
190 | /// Whether the given \c yypact_ value indicates a defaulted state. |
---|
191 | /// \param yyvalue the value to check |
---|
192 | static bool yy_pact_value_is_default_ (int yyvalue); |
---|
193 | |
---|
194 | /// Whether the given \c yytable_ value indicates a syntax error. |
---|
195 | /// \param yyvalue the value to check |
---|
196 | static bool yy_table_value_is_error_ (int yyvalue); |
---|
197 | |
---|
198 | /// Internal symbol numbers. |
---|
199 | typedef unsigned char token_number_type; |
---|
200 | /* Tables. */ |
---|
201 | /// For a state, the index in \a yytable_ of its portion. |
---|
202 | static const signed char yypact_[]; |
---|
203 | static const signed char yypact_ninf_; |
---|
204 | |
---|
205 | /// For a state, default reduction number. |
---|
206 | /// Unless\a yytable_ specifies something else to do. |
---|
207 | /// Zero means the default is an error. |
---|
208 | static const unsigned char yydefact_[]; |
---|
209 | |
---|
210 | static const signed char yypgoto_[]; |
---|
211 | static const signed char yydefgoto_[]; |
---|
212 | |
---|
213 | /// What to do in a state. |
---|
214 | /// \a yytable_[yypact_[s]]: what to do in state \a s. |
---|
215 | /// - if positive, shift that token. |
---|
216 | /// - if negative, reduce the rule which number is the opposite. |
---|
217 | /// - if zero, do what YYDEFACT says. |
---|
218 | static const unsigned char yytable_[]; |
---|
219 | static const signed char yytable_ninf_; |
---|
220 | |
---|
221 | static const signed char yycheck_[]; |
---|
222 | |
---|
223 | /// For a state, its accessing symbol. |
---|
224 | static const unsigned char yystos_[]; |
---|
225 | |
---|
226 | /// For a rule, its LHS. |
---|
227 | static const unsigned char yyr1_[]; |
---|
228 | /// For a rule, its RHS length. |
---|
229 | static const unsigned char yyr2_[]; |
---|
230 | |
---|
231 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
---|
232 | /// For a symbol, its name in clear. |
---|
233 | static const char* const yytname_[]; |
---|
234 | #endif |
---|
235 | |
---|
236 | /// Convert the symbol name \a n to a form suitable for a diagnostic. |
---|
237 | static std::string yytnamerr_ (const char *n); |
---|
238 | |
---|
239 | #if YYDEBUG |
---|
240 | /// A type to store symbol numbers and -1. |
---|
241 | typedef signed char rhs_number_type; |
---|
242 | /// A `-1'-separated list of the rules' RHS. |
---|
243 | static const rhs_number_type yyrhs_[]; |
---|
244 | /// For each rule, the index of the first RHS symbol in \a yyrhs_. |
---|
245 | static const unsigned char yyprhs_[]; |
---|
246 | /// For each rule, its source line number. |
---|
247 | static const unsigned char yyrline_[]; |
---|
248 | /// For each scanner token number, its symbol number. |
---|
249 | static const unsigned short int yytoken_number_[]; |
---|
250 | /// Report on the debug stream that the rule \a r is going to be reduced. |
---|
251 | virtual void yy_reduce_print_ (int r); |
---|
252 | /// Print the state stack on the debug stream. |
---|
253 | virtual void yystack_print_ (); |
---|
254 | |
---|
255 | /* Debugging. */ |
---|
256 | int yydebug_; |
---|
257 | std::ostream* yycdebug_; |
---|
258 | #endif |
---|
259 | |
---|
260 | /// Convert a scanner token number \a t to a symbol number. |
---|
261 | token_number_type yytranslate_ (int t); |
---|
262 | |
---|
263 | /// \brief Reclaim the memory associated to a symbol. |
---|
264 | /// \param yymsg Why this token is reclaimed. |
---|
265 | /// \param yytype The symbol type. |
---|
266 | /// \param yyvaluep Its semantic value. |
---|
267 | /// \param yylocationp Its location. |
---|
268 | inline void yydestruct_ (const char* yymsg, |
---|
269 | int yytype, |
---|
270 | semantic_type* yyvaluep, |
---|
271 | location_type* yylocationp); |
---|
272 | |
---|
273 | /// Pop \a n symbols the three stacks. |
---|
274 | inline void yypop_ (unsigned int n = 1); |
---|
275 | |
---|
276 | /* Constants. */ |
---|
277 | static const int yyeof_; |
---|
278 | /* LAST_ -- Last index in TABLE_. */ |
---|
279 | static const int yylast_; |
---|
280 | static const int yynnts_; |
---|
281 | static const int yyempty_; |
---|
282 | static const int yyfinal_; |
---|
283 | static const int yyterror_; |
---|
284 | static const int yyerrcode_; |
---|
285 | static const int yyntokens_; |
---|
286 | static const unsigned int yyuser_token_number_max_; |
---|
287 | static const token_number_type yyundef_token_; |
---|
288 | |
---|
289 | /* User arguments. */ |
---|
290 | class GunCompiler& gc; |
---|
291 | }; |
---|
292 | |
---|
293 | } // orbital |
---|
294 | |
---|
295 | /* Line 35 of lalr1.cc */ |
---|
296 | #line 297 "generated/gun-parser.h" |
---|
297 | |
---|
298 | |
---|
299 | |
---|
300 | #endif /* ! defined PARSER_HEADER_H */ |
---|