1 | /* A Bison parser, made by GNU Bison 2.4.2. */ |
---|
2 | |
---|
3 | /* Skeleton interface for Bison LALR(1) parsers in C++ |
---|
4 | |
---|
5 | Copyright (C) 2002-2010 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 | |
---|
44 | |
---|
45 | namespace orbital { |
---|
46 | |
---|
47 | /* Line 34 of lalr1.cc */ |
---|
48 | #line 49 "generated/gun-parser.h" |
---|
49 | class position; |
---|
50 | class location; |
---|
51 | |
---|
52 | } // orbital |
---|
53 | |
---|
54 | /* Line 34 of lalr1.cc */ |
---|
55 | #line 56 "generated/gun-parser.h" |
---|
56 | |
---|
57 | #include "location.hh" |
---|
58 | |
---|
59 | /* Enabling traces. */ |
---|
60 | #ifndef YYDEBUG |
---|
61 | # define YYDEBUG 1 |
---|
62 | #endif |
---|
63 | |
---|
64 | /* Enabling verbose error messages. */ |
---|
65 | #ifdef YYERROR_VERBOSE |
---|
66 | # undef YYERROR_VERBOSE |
---|
67 | # define YYERROR_VERBOSE 1 |
---|
68 | #else |
---|
69 | # define YYERROR_VERBOSE 1 |
---|
70 | #endif |
---|
71 | |
---|
72 | /* Enabling the token table. */ |
---|
73 | #ifndef YYTOKEN_TABLE |
---|
74 | # define YYTOKEN_TABLE 0 |
---|
75 | #endif |
---|
76 | |
---|
77 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
---|
78 | If N is 0, then set CURRENT to the empty location which ends |
---|
79 | the previous symbol: RHS[0] (always defined). */ |
---|
80 | |
---|
81 | #ifndef YYLLOC_DEFAULT |
---|
82 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
---|
83 | do { \ |
---|
84 | if (N) \ |
---|
85 | { \ |
---|
86 | (Current).begin = (Rhs)[1].begin; \ |
---|
87 | (Current).end = (Rhs)[N].end; \ |
---|
88 | } \ |
---|
89 | else \ |
---|
90 | { \ |
---|
91 | (Current).begin = (Current).end = (Rhs)[0].end; \ |
---|
92 | } \ |
---|
93 | } while (false) |
---|
94 | #endif |
---|
95 | |
---|
96 | |
---|
97 | namespace orbital { |
---|
98 | |
---|
99 | /* Line 34 of lalr1.cc */ |
---|
100 | #line 101 "generated/gun-parser.h" |
---|
101 | |
---|
102 | /// A Bison parser. |
---|
103 | class GunParser |
---|
104 | { |
---|
105 | public: |
---|
106 | /// Symbol semantic values. |
---|
107 | #ifndef YYSTYPE |
---|
108 | union semantic_type |
---|
109 | { |
---|
110 | |
---|
111 | /* Line 34 of lalr1.cc */ |
---|
112 | #line 35 "gun-parser.y" |
---|
113 | |
---|
114 | float fval; |
---|
115 | struct { float f0, f1, f2, f3, f4, f5, f6, f7; } args; |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | /* Line 34 of lalr1.cc */ |
---|
120 | #line 121 "generated/gun-parser.h" |
---|
121 | }; |
---|
122 | #else |
---|
123 | typedef YYSTYPE semantic_type; |
---|
124 | #endif |
---|
125 | /// Symbol locations. |
---|
126 | typedef location location_type; |
---|
127 | /// Tokens. |
---|
128 | struct token |
---|
129 | { |
---|
130 | /* Tokens. */ |
---|
131 | enum yytokentype { |
---|
132 | T_END = 0, |
---|
133 | T_AI = 258, |
---|
134 | T_PAI = 259, |
---|
135 | T_CA = 260, |
---|
136 | T_SA = 261, |
---|
137 | T_TIM = 262, |
---|
138 | T_SO = 263, |
---|
139 | T_RD = 264, |
---|
140 | T_SPD = 265, |
---|
141 | T_MODA = 266, |
---|
142 | T_MODB = 267, |
---|
143 | T_FFB = 268, |
---|
144 | T_FFP = 269, |
---|
145 | T_FB = 270, |
---|
146 | T_FP = 271, |
---|
147 | T_SK = 272, |
---|
148 | T_LOOP = 273, |
---|
149 | NUMBER = 274 |
---|
150 | }; |
---|
151 | |
---|
152 | }; |
---|
153 | /// Token type. |
---|
154 | typedef token::yytokentype token_type; |
---|
155 | |
---|
156 | /// Build a parser object. |
---|
157 | GunParser (class GunCompiler& gc_yyarg); |
---|
158 | virtual ~GunParser (); |
---|
159 | |
---|
160 | /// Parse. |
---|
161 | /// \returns 0 iff parsing succeeded. |
---|
162 | virtual int parse (); |
---|
163 | |
---|
164 | #if YYDEBUG |
---|
165 | /// The current debugging stream. |
---|
166 | std::ostream& debug_stream () const; |
---|
167 | /// Set the current debugging stream. |
---|
168 | void set_debug_stream (std::ostream &); |
---|
169 | |
---|
170 | /// Type for debugging levels. |
---|
171 | typedef int debug_level_type; |
---|
172 | /// The current debugging level. |
---|
173 | debug_level_type debug_level () const; |
---|
174 | /// Set the current debugging level. |
---|
175 | void set_debug_level (debug_level_type l); |
---|
176 | #endif |
---|
177 | |
---|
178 | private: |
---|
179 | /// Report a syntax error. |
---|
180 | /// \param loc where the syntax error is found. |
---|
181 | /// \param msg a description of the syntax error. |
---|
182 | virtual void error (const location_type& loc, const std::string& msg); |
---|
183 | |
---|
184 | /// Generate an error message. |
---|
185 | /// \param state the state where the error occurred. |
---|
186 | /// \param tok the lookahead token. |
---|
187 | virtual std::string yysyntax_error_ (int yystate, int tok); |
---|
188 | |
---|
189 | #if YYDEBUG |
---|
190 | /// \brief Report a symbol value on the debug stream. |
---|
191 | /// \param yytype The token type. |
---|
192 | /// \param yyvaluep Its semantic value. |
---|
193 | /// \param yylocationp Its location. |
---|
194 | virtual void yy_symbol_value_print_ (int yytype, |
---|
195 | const semantic_type* yyvaluep, |
---|
196 | const location_type* yylocationp); |
---|
197 | /// \brief Report a symbol on the debug stream. |
---|
198 | /// \param yytype The token type. |
---|
199 | /// \param yyvaluep Its semantic value. |
---|
200 | /// \param yylocationp Its location. |
---|
201 | virtual void yy_symbol_print_ (int yytype, |
---|
202 | const semantic_type* yyvaluep, |
---|
203 | const location_type* yylocationp); |
---|
204 | #endif |
---|
205 | |
---|
206 | |
---|
207 | /// State numbers. |
---|
208 | typedef int state_type; |
---|
209 | /// State stack type. |
---|
210 | typedef stack<state_type> state_stack_type; |
---|
211 | /// Semantic value stack type. |
---|
212 | typedef stack<semantic_type> semantic_stack_type; |
---|
213 | /// location stack type. |
---|
214 | typedef stack<location_type> location_stack_type; |
---|
215 | |
---|
216 | /// The state stack. |
---|
217 | state_stack_type yystate_stack_; |
---|
218 | /// The semantic value stack. |
---|
219 | semantic_stack_type yysemantic_stack_; |
---|
220 | /// The location stack. |
---|
221 | location_stack_type yylocation_stack_; |
---|
222 | |
---|
223 | /// Internal symbol numbers. |
---|
224 | typedef unsigned char token_number_type; |
---|
225 | /* Tables. */ |
---|
226 | /// For a state, the index in \a yytable_ of its portion. |
---|
227 | static const signed char yypact_[]; |
---|
228 | static const signed char yypact_ninf_; |
---|
229 | |
---|
230 | /// For a state, default rule to reduce. |
---|
231 | /// Unless\a yytable_ specifies something else to do. |
---|
232 | /// Zero means the default is an error. |
---|
233 | static const unsigned char yydefact_[]; |
---|
234 | |
---|
235 | static const signed char yypgoto_[]; |
---|
236 | static const signed char yydefgoto_[]; |
---|
237 | |
---|
238 | /// What to do in a state. |
---|
239 | /// \a yytable_[yypact_[s]]: what to do in state \a s. |
---|
240 | /// - if positive, shift that token. |
---|
241 | /// - if negative, reduce the rule which number is the opposite. |
---|
242 | /// - if zero, do what YYDEFACT says. |
---|
243 | static const unsigned char yytable_[]; |
---|
244 | static const signed char yytable_ninf_; |
---|
245 | |
---|
246 | static const signed char yycheck_[]; |
---|
247 | |
---|
248 | /// For a state, its accessing symbol. |
---|
249 | static const unsigned char yystos_[]; |
---|
250 | |
---|
251 | /// For a rule, its LHS. |
---|
252 | static const unsigned char yyr1_[]; |
---|
253 | /// For a rule, its RHS length. |
---|
254 | static const unsigned char yyr2_[]; |
---|
255 | |
---|
256 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
---|
257 | /// For a symbol, its name in clear. |
---|
258 | static const char* const yytname_[]; |
---|
259 | #endif |
---|
260 | |
---|
261 | #if YYERROR_VERBOSE |
---|
262 | /// Convert the symbol name \a n to a form suitable for a diagnostic. |
---|
263 | virtual std::string yytnamerr_ (const char *n); |
---|
264 | #endif |
---|
265 | |
---|
266 | #if YYDEBUG |
---|
267 | /// A type to store symbol numbers and -1. |
---|
268 | typedef signed char rhs_number_type; |
---|
269 | /// A `-1'-separated list of the rules' RHS. |
---|
270 | static const rhs_number_type yyrhs_[]; |
---|
271 | /// For each rule, the index of the first RHS symbol in \a yyrhs_. |
---|
272 | static const unsigned char yyprhs_[]; |
---|
273 | /// For each rule, its source line number. |
---|
274 | static const unsigned char yyrline_[]; |
---|
275 | /// For each scanner token number, its symbol number. |
---|
276 | static const unsigned short int yytoken_number_[]; |
---|
277 | /// Report on the debug stream that the rule \a r is going to be reduced. |
---|
278 | virtual void yy_reduce_print_ (int r); |
---|
279 | /// Print the state stack on the debug stream. |
---|
280 | virtual void yystack_print_ (); |
---|
281 | |
---|
282 | /* Debugging. */ |
---|
283 | int yydebug_; |
---|
284 | std::ostream* yycdebug_; |
---|
285 | #endif |
---|
286 | |
---|
287 | /// Convert a scanner token number \a t to a symbol number. |
---|
288 | token_number_type yytranslate_ (int t); |
---|
289 | |
---|
290 | /// \brief Reclaim the memory associated to a symbol. |
---|
291 | /// \param yymsg Why this token is reclaimed. |
---|
292 | /// \param yytype The symbol type. |
---|
293 | /// \param yyvaluep Its semantic value. |
---|
294 | /// \param yylocationp Its location. |
---|
295 | inline void yydestruct_ (const char* yymsg, |
---|
296 | int yytype, |
---|
297 | semantic_type* yyvaluep, |
---|
298 | location_type* yylocationp); |
---|
299 | |
---|
300 | /// Pop \a n symbols the three stacks. |
---|
301 | inline void yypop_ (unsigned int n = 1); |
---|
302 | |
---|
303 | /* Constants. */ |
---|
304 | static const int yyeof_; |
---|
305 | /* LAST_ -- Last index in TABLE_. */ |
---|
306 | static const int yylast_; |
---|
307 | static const int yynnts_; |
---|
308 | static const int yyempty_; |
---|
309 | static const int yyfinal_; |
---|
310 | static const int yyterror_; |
---|
311 | static const int yyerrcode_; |
---|
312 | static const int yyntokens_; |
---|
313 | static const unsigned int yyuser_token_number_max_; |
---|
314 | static const token_number_type yyundef_token_; |
---|
315 | |
---|
316 | /* User arguments. */ |
---|
317 | class GunCompiler& gc; |
---|
318 | }; |
---|
319 | |
---|
320 | } // orbital |
---|
321 | |
---|
322 | /* Line 34 of lalr1.cc */ |
---|
323 | #line 324 "generated/gun-parser.h" |
---|
324 | |
---|
325 | |
---|
326 | |
---|
327 | #endif /* ! defined PARSER_HEADER_H */ |
---|