1 | /* A Bison parser, made by GNU Bison 2.5. */ |
---|
2 | |
---|
3 | /* Skeleton implementation 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 | // Take the name prefix into account. |
---|
34 | #define yylex orbitallex |
---|
35 | |
---|
36 | /* First part of user declarations. */ |
---|
37 | |
---|
38 | /* Line 293 of lalr1.cc */ |
---|
39 | #line 1 "mesh-parser.y" |
---|
40 | |
---|
41 | // |
---|
42 | // Orbital |
---|
43 | // |
---|
44 | // Copyright: (c) 2009-2012 Cédric Lecacheur <jordx@free.fr> |
---|
45 | // (c) 2009-2012 Benjamin Huet <huet.benjamin@gmail.com> |
---|
46 | // (c) 2012 Sam Hocevar <sam@hocevar.net> |
---|
47 | // |
---|
48 | |
---|
49 | #if defined HAVE_CONFIG_H |
---|
50 | # include "config.h" |
---|
51 | #endif |
---|
52 | |
---|
53 | #include "core.h" |
---|
54 | #include "loldebug.h" |
---|
55 | |
---|
56 | using namespace lol; |
---|
57 | |
---|
58 | #include "../mesh.h" |
---|
59 | |
---|
60 | #include <string> |
---|
61 | |
---|
62 | |
---|
63 | /* Line 293 of lalr1.cc */ |
---|
64 | #line 65 "generated/mesh-parser.cpp" |
---|
65 | |
---|
66 | |
---|
67 | #include "mesh-parser.h" |
---|
68 | |
---|
69 | /* User implementation prologue. */ |
---|
70 | |
---|
71 | /* Line 299 of lalr1.cc */ |
---|
72 | #line 64 "mesh-parser.y" |
---|
73 | |
---|
74 | #include "../mesh-compiler.h" |
---|
75 | |
---|
76 | #undef yylex |
---|
77 | #define yylex mc.m_lexer->lex |
---|
78 | |
---|
79 | |
---|
80 | /* Line 299 of lalr1.cc */ |
---|
81 | #line 82 "generated/mesh-parser.cpp" |
---|
82 | |
---|
83 | #ifndef YY_ |
---|
84 | # if defined YYENABLE_NLS && YYENABLE_NLS |
---|
85 | # if ENABLE_NLS |
---|
86 | # include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */ |
---|
87 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
---|
88 | # endif |
---|
89 | # endif |
---|
90 | # ifndef YY_ |
---|
91 | # define YY_(msgid) msgid |
---|
92 | # endif |
---|
93 | #endif |
---|
94 | |
---|
95 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
---|
96 | If N is 0, then set CURRENT to the empty location which ends |
---|
97 | the previous symbol: RHS[0] (always defined). */ |
---|
98 | |
---|
99 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) |
---|
100 | #ifndef YYLLOC_DEFAULT |
---|
101 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
---|
102 | do \ |
---|
103 | if (N) \ |
---|
104 | { \ |
---|
105 | (Current).begin = YYRHSLOC (Rhs, 1).begin; \ |
---|
106 | (Current).end = YYRHSLOC (Rhs, N).end; \ |
---|
107 | } \ |
---|
108 | else \ |
---|
109 | { \ |
---|
110 | (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \ |
---|
111 | } \ |
---|
112 | while (false) |
---|
113 | #endif |
---|
114 | |
---|
115 | /* Suppress unused-variable warnings by "using" E. */ |
---|
116 | #define YYUSE(e) ((void) (e)) |
---|
117 | |
---|
118 | /* Enable debugging if requested. */ |
---|
119 | #if YYDEBUG |
---|
120 | |
---|
121 | /* A pseudo ostream that takes yydebug_ into account. */ |
---|
122 | # define YYCDEBUG if (yydebug_) (*yycdebug_) |
---|
123 | |
---|
124 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ |
---|
125 | do { \ |
---|
126 | if (yydebug_) \ |
---|
127 | { \ |
---|
128 | *yycdebug_ << Title << ' '; \ |
---|
129 | yy_symbol_print_ ((Type), (Value), (Location)); \ |
---|
130 | *yycdebug_ << std::endl; \ |
---|
131 | } \ |
---|
132 | } while (false) |
---|
133 | |
---|
134 | # define YY_REDUCE_PRINT(Rule) \ |
---|
135 | do { \ |
---|
136 | if (yydebug_) \ |
---|
137 | yy_reduce_print_ (Rule); \ |
---|
138 | } while (false) |
---|
139 | |
---|
140 | # define YY_STACK_PRINT() \ |
---|
141 | do { \ |
---|
142 | if (yydebug_) \ |
---|
143 | yystack_print_ (); \ |
---|
144 | } while (false) |
---|
145 | |
---|
146 | #else /* !YYDEBUG */ |
---|
147 | |
---|
148 | # define YYCDEBUG if (false) std::cerr |
---|
149 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) |
---|
150 | # define YY_REDUCE_PRINT(Rule) |
---|
151 | # define YY_STACK_PRINT() |
---|
152 | |
---|
153 | #endif /* !YYDEBUG */ |
---|
154 | |
---|
155 | #define yyerrok (yyerrstatus_ = 0) |
---|
156 | #define yyclearin (yychar = yyempty_) |
---|
157 | |
---|
158 | #define YYACCEPT goto yyacceptlab |
---|
159 | #define YYABORT goto yyabortlab |
---|
160 | #define YYERROR goto yyerrorlab |
---|
161 | #define YYRECOVERING() (!!yyerrstatus_) |
---|
162 | |
---|
163 | |
---|
164 | namespace orbital { |
---|
165 | |
---|
166 | /* Line 382 of lalr1.cc */ |
---|
167 | #line 168 "generated/mesh-parser.cpp" |
---|
168 | |
---|
169 | /* Return YYSTR after stripping away unnecessary quotes and |
---|
170 | backslashes, so that it's suitable for yyerror. The heuristic is |
---|
171 | that double-quoting is unnecessary unless the string contains an |
---|
172 | apostrophe, a comma, or backslash (other than backslash-backslash). |
---|
173 | YYSTR is taken from yytname. */ |
---|
174 | std::string |
---|
175 | MeshParser::yytnamerr_ (const char *yystr) |
---|
176 | { |
---|
177 | if (*yystr == '"') |
---|
178 | { |
---|
179 | std::string yyr = ""; |
---|
180 | char const *yyp = yystr; |
---|
181 | |
---|
182 | for (;;) |
---|
183 | switch (*++yyp) |
---|
184 | { |
---|
185 | case '\'': |
---|
186 | case ',': |
---|
187 | goto do_not_strip_quotes; |
---|
188 | |
---|
189 | case '\\': |
---|
190 | if (*++yyp != '\\') |
---|
191 | goto do_not_strip_quotes; |
---|
192 | /* Fall through. */ |
---|
193 | default: |
---|
194 | yyr += *yyp; |
---|
195 | break; |
---|
196 | |
---|
197 | case '"': |
---|
198 | return yyr; |
---|
199 | } |
---|
200 | do_not_strip_quotes: ; |
---|
201 | } |
---|
202 | |
---|
203 | return yystr; |
---|
204 | } |
---|
205 | |
---|
206 | |
---|
207 | /// Build a parser object. |
---|
208 | MeshParser::MeshParser (class MeshCompiler& mc_yyarg) |
---|
209 | : |
---|
210 | #if YYDEBUG |
---|
211 | yydebug_ (false), |
---|
212 | yycdebug_ (&std::cerr), |
---|
213 | #endif |
---|
214 | mc (mc_yyarg) |
---|
215 | { |
---|
216 | } |
---|
217 | |
---|
218 | MeshParser::~MeshParser () |
---|
219 | { |
---|
220 | } |
---|
221 | |
---|
222 | #if YYDEBUG |
---|
223 | /*--------------------------------. |
---|
224 | | Print this symbol on YYOUTPUT. | |
---|
225 | `--------------------------------*/ |
---|
226 | |
---|
227 | inline void |
---|
228 | MeshParser::yy_symbol_value_print_ (int yytype, |
---|
229 | const semantic_type* yyvaluep, const location_type* yylocationp) |
---|
230 | { |
---|
231 | YYUSE (yylocationp); |
---|
232 | YYUSE (yyvaluep); |
---|
233 | switch (yytype) |
---|
234 | { |
---|
235 | default: |
---|
236 | break; |
---|
237 | } |
---|
238 | } |
---|
239 | |
---|
240 | |
---|
241 | void |
---|
242 | MeshParser::yy_symbol_print_ (int yytype, |
---|
243 | const semantic_type* yyvaluep, const location_type* yylocationp) |
---|
244 | { |
---|
245 | *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm") |
---|
246 | << ' ' << yytname_[yytype] << " (" |
---|
247 | << *yylocationp << ": "; |
---|
248 | yy_symbol_value_print_ (yytype, yyvaluep, yylocationp); |
---|
249 | *yycdebug_ << ')'; |
---|
250 | } |
---|
251 | #endif |
---|
252 | |
---|
253 | void |
---|
254 | MeshParser::yydestruct_ (const char* yymsg, |
---|
255 | int yytype, semantic_type* yyvaluep, location_type* yylocationp) |
---|
256 | { |
---|
257 | YYUSE (yylocationp); |
---|
258 | YYUSE (yymsg); |
---|
259 | YYUSE (yyvaluep); |
---|
260 | |
---|
261 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); |
---|
262 | |
---|
263 | switch (yytype) |
---|
264 | { |
---|
265 | |
---|
266 | default: |
---|
267 | break; |
---|
268 | } |
---|
269 | } |
---|
270 | |
---|
271 | void |
---|
272 | MeshParser::yypop_ (unsigned int n) |
---|
273 | { |
---|
274 | yystate_stack_.pop (n); |
---|
275 | yysemantic_stack_.pop (n); |
---|
276 | yylocation_stack_.pop (n); |
---|
277 | } |
---|
278 | |
---|
279 | #if YYDEBUG |
---|
280 | std::ostream& |
---|
281 | MeshParser::debug_stream () const |
---|
282 | { |
---|
283 | return *yycdebug_; |
---|
284 | } |
---|
285 | |
---|
286 | void |
---|
287 | MeshParser::set_debug_stream (std::ostream& o) |
---|
288 | { |
---|
289 | yycdebug_ = &o; |
---|
290 | } |
---|
291 | |
---|
292 | |
---|
293 | MeshParser::debug_level_type |
---|
294 | MeshParser::debug_level () const |
---|
295 | { |
---|
296 | return yydebug_; |
---|
297 | } |
---|
298 | |
---|
299 | void |
---|
300 | MeshParser::set_debug_level (debug_level_type l) |
---|
301 | { |
---|
302 | yydebug_ = l; |
---|
303 | } |
---|
304 | #endif |
---|
305 | |
---|
306 | inline bool |
---|
307 | MeshParser::yy_pact_value_is_default_ (int yyvalue) |
---|
308 | { |
---|
309 | return yyvalue == yypact_ninf_; |
---|
310 | } |
---|
311 | |
---|
312 | inline bool |
---|
313 | MeshParser::yy_table_value_is_error_ (int yyvalue) |
---|
314 | { |
---|
315 | return yyvalue == yytable_ninf_; |
---|
316 | } |
---|
317 | |
---|
318 | int |
---|
319 | MeshParser::parse () |
---|
320 | { |
---|
321 | /// Lookahead and lookahead in internal form. |
---|
322 | int yychar = yyempty_; |
---|
323 | int yytoken = 0; |
---|
324 | |
---|
325 | /* State. */ |
---|
326 | int yyn; |
---|
327 | int yylen = 0; |
---|
328 | int yystate = 0; |
---|
329 | |
---|
330 | /* Error handling. */ |
---|
331 | int yynerrs_ = 0; |
---|
332 | int yyerrstatus_ = 0; |
---|
333 | |
---|
334 | /// Semantic value of the lookahead. |
---|
335 | semantic_type yylval; |
---|
336 | /// Location of the lookahead. |
---|
337 | location_type yylloc; |
---|
338 | /// The locations where the error started and ended. |
---|
339 | location_type yyerror_range[3]; |
---|
340 | |
---|
341 | /// $$. |
---|
342 | semantic_type yyval; |
---|
343 | /// @$. |
---|
344 | location_type yyloc; |
---|
345 | |
---|
346 | int yyresult; |
---|
347 | |
---|
348 | YYCDEBUG << "Starting parse" << std::endl; |
---|
349 | |
---|
350 | |
---|
351 | /* Initialize the stacks. The initial state will be pushed in |
---|
352 | yynewstate, since the latter expects the semantical and the |
---|
353 | location values to have been already stored, initialize these |
---|
354 | stacks with a primary value. */ |
---|
355 | yystate_stack_ = state_stack_type (0); |
---|
356 | yysemantic_stack_ = semantic_stack_type (0); |
---|
357 | yylocation_stack_ = location_stack_type (0); |
---|
358 | yysemantic_stack_.push (yylval); |
---|
359 | yylocation_stack_.push (yylloc); |
---|
360 | |
---|
361 | /* New state. */ |
---|
362 | yynewstate: |
---|
363 | yystate_stack_.push (yystate); |
---|
364 | YYCDEBUG << "Entering state " << yystate << std::endl; |
---|
365 | |
---|
366 | /* Accept? */ |
---|
367 | if (yystate == yyfinal_) |
---|
368 | goto yyacceptlab; |
---|
369 | |
---|
370 | goto yybackup; |
---|
371 | |
---|
372 | /* Backup. */ |
---|
373 | yybackup: |
---|
374 | |
---|
375 | /* Try to take a decision without lookahead. */ |
---|
376 | yyn = yypact_[yystate]; |
---|
377 | if (yy_pact_value_is_default_ (yyn)) |
---|
378 | goto yydefault; |
---|
379 | |
---|
380 | /* Read a lookahead token. */ |
---|
381 | if (yychar == yyempty_) |
---|
382 | { |
---|
383 | YYCDEBUG << "Reading a token: "; |
---|
384 | yychar = yylex (&yylval, &yylloc); |
---|
385 | } |
---|
386 | |
---|
387 | |
---|
388 | /* Convert token to internal form. */ |
---|
389 | if (yychar <= yyeof_) |
---|
390 | { |
---|
391 | yychar = yytoken = yyeof_; |
---|
392 | YYCDEBUG << "Now at end of input." << std::endl; |
---|
393 | } |
---|
394 | else |
---|
395 | { |
---|
396 | yytoken = yytranslate_ (yychar); |
---|
397 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); |
---|
398 | } |
---|
399 | |
---|
400 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
---|
401 | detect an error, take that action. */ |
---|
402 | yyn += yytoken; |
---|
403 | if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken) |
---|
404 | goto yydefault; |
---|
405 | |
---|
406 | /* Reduce or error. */ |
---|
407 | yyn = yytable_[yyn]; |
---|
408 | if (yyn <= 0) |
---|
409 | { |
---|
410 | if (yy_table_value_is_error_ (yyn)) |
---|
411 | goto yyerrlab; |
---|
412 | yyn = -yyn; |
---|
413 | goto yyreduce; |
---|
414 | } |
---|
415 | |
---|
416 | /* Shift the lookahead token. */ |
---|
417 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
---|
418 | |
---|
419 | /* Discard the token being shifted. */ |
---|
420 | yychar = yyempty_; |
---|
421 | |
---|
422 | yysemantic_stack_.push (yylval); |
---|
423 | yylocation_stack_.push (yylloc); |
---|
424 | |
---|
425 | /* Count tokens shifted since error; after three, turn off error |
---|
426 | status. */ |
---|
427 | if (yyerrstatus_) |
---|
428 | --yyerrstatus_; |
---|
429 | |
---|
430 | yystate = yyn; |
---|
431 | goto yynewstate; |
---|
432 | |
---|
433 | /*-----------------------------------------------------------. |
---|
434 | | yydefault -- do the default action for the current state. | |
---|
435 | `-----------------------------------------------------------*/ |
---|
436 | yydefault: |
---|
437 | yyn = yydefact_[yystate]; |
---|
438 | if (yyn == 0) |
---|
439 | goto yyerrlab; |
---|
440 | goto yyreduce; |
---|
441 | |
---|
442 | /*-----------------------------. |
---|
443 | | yyreduce -- Do a reduction. | |
---|
444 | `-----------------------------*/ |
---|
445 | yyreduce: |
---|
446 | yylen = yyr2_[yyn]; |
---|
447 | /* If YYLEN is nonzero, implement the default value of the action: |
---|
448 | `$$ = $1'. Otherwise, use the top of the stack. |
---|
449 | |
---|
450 | Otherwise, the following line sets YYVAL to garbage. |
---|
451 | This behavior is undocumented and Bison |
---|
452 | users should not rely upon it. */ |
---|
453 | if (yylen) |
---|
454 | yyval = yysemantic_stack_[yylen - 1]; |
---|
455 | else |
---|
456 | yyval = yysemantic_stack_[0]; |
---|
457 | |
---|
458 | { |
---|
459 | slice<location_type, location_stack_type> slice (yylocation_stack_, yylen); |
---|
460 | YYLLOC_DEFAULT (yyloc, slice, yylen); |
---|
461 | } |
---|
462 | YY_REDUCE_PRINT (yyn); |
---|
463 | switch (yyn) |
---|
464 | { |
---|
465 | case 9: |
---|
466 | |
---|
467 | /* Line 690 of lalr1.cc */ |
---|
468 | #line 90 "mesh-parser.y" |
---|
469 | { mc.m_mesh.Flush(); } |
---|
470 | break; |
---|
471 | |
---|
472 | case 10: |
---|
473 | |
---|
474 | /* Line 690 of lalr1.cc */ |
---|
475 | #line 91 "mesh-parser.y" |
---|
476 | { mc.m_mesh.MeshConvert(); } |
---|
477 | break; |
---|
478 | |
---|
479 | case 11: |
---|
480 | |
---|
481 | /* Line 690 of lalr1.cc */ |
---|
482 | #line 92 "mesh-parser.y" |
---|
483 | { /* TODO */ } |
---|
484 | break; |
---|
485 | |
---|
486 | case 12: |
---|
487 | |
---|
488 | /* Line 690 of lalr1.cc */ |
---|
489 | #line 96 "mesh-parser.y" |
---|
490 | { mc.m_mesh.SetCurColor(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } |
---|
491 | break; |
---|
492 | |
---|
493 | case 13: |
---|
494 | |
---|
495 | /* Line 690 of lalr1.cc */ |
---|
496 | #line 97 "mesh-parser.y" |
---|
497 | { uint16_t x = (uint16_t)(yysemantic_stack_[(2) - (2)].u32val); |
---|
498 | vec4 v(x >> 12, (x >> 8) & 0xf, (x >> 4) & 0xf, x & 0xf); |
---|
499 | mc.m_mesh.SetCurColor(vec4(v) * (1. / 15)); } |
---|
500 | break; |
---|
501 | |
---|
502 | case 14: |
---|
503 | |
---|
504 | /* Line 690 of lalr1.cc */ |
---|
505 | #line 100 "mesh-parser.y" |
---|
506 | { mc.m_mesh.SetCurColor2(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } |
---|
507 | break; |
---|
508 | |
---|
509 | case 15: |
---|
510 | |
---|
511 | /* Line 690 of lalr1.cc */ |
---|
512 | #line 101 "mesh-parser.y" |
---|
513 | { uint16_t x = (uint16_t)(yysemantic_stack_[(2) - (2)].u32val); |
---|
514 | vec4 v(x >> 12, (x >> 8) & 0xf, (x >> 4) & 0xf, x & 0xf); |
---|
515 | mc.m_mesh.SetCurColor(vec4(v) * (1. / 15)); } |
---|
516 | break; |
---|
517 | |
---|
518 | case 16: |
---|
519 | |
---|
520 | /* Line 690 of lalr1.cc */ |
---|
521 | #line 107 "mesh-parser.y" |
---|
522 | { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); } |
---|
523 | break; |
---|
524 | |
---|
525 | case 17: |
---|
526 | |
---|
527 | /* Line 690 of lalr1.cc */ |
---|
528 | #line 108 "mesh-parser.y" |
---|
529 | { mc.m_mesh.Translate(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); } |
---|
530 | break; |
---|
531 | |
---|
532 | case 18: |
---|
533 | |
---|
534 | /* Line 690 of lalr1.cc */ |
---|
535 | #line 109 "mesh-parser.y" |
---|
536 | { mc.m_mesh.Translate(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); } |
---|
537 | break; |
---|
538 | |
---|
539 | case 19: |
---|
540 | |
---|
541 | /* Line 690 of lalr1.cc */ |
---|
542 | #line 110 "mesh-parser.y" |
---|
543 | { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } |
---|
544 | break; |
---|
545 | |
---|
546 | case 20: |
---|
547 | |
---|
548 | /* Line 690 of lalr1.cc */ |
---|
549 | #line 111 "mesh-parser.y" |
---|
550 | { mc.m_mesh.RotateX((yysemantic_stack_[(2) - (2)].args).f0); } |
---|
551 | break; |
---|
552 | |
---|
553 | case 21: |
---|
554 | |
---|
555 | /* Line 690 of lalr1.cc */ |
---|
556 | #line 112 "mesh-parser.y" |
---|
557 | { mc.m_mesh.RotateY((yysemantic_stack_[(2) - (2)].args).f0); } |
---|
558 | break; |
---|
559 | |
---|
560 | case 22: |
---|
561 | |
---|
562 | /* Line 690 of lalr1.cc */ |
---|
563 | #line 113 "mesh-parser.y" |
---|
564 | { mc.m_mesh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0); } |
---|
565 | break; |
---|
566 | |
---|
567 | case 23: |
---|
568 | |
---|
569 | /* Line 690 of lalr1.cc */ |
---|
570 | #line 114 "mesh-parser.y" |
---|
571 | { mc.m_mesh.TaperX((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } |
---|
572 | break; |
---|
573 | |
---|
574 | case 24: |
---|
575 | |
---|
576 | /* Line 690 of lalr1.cc */ |
---|
577 | #line 115 "mesh-parser.y" |
---|
578 | { mc.m_mesh.TaperY((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } |
---|
579 | break; |
---|
580 | |
---|
581 | case 25: |
---|
582 | |
---|
583 | /* Line 690 of lalr1.cc */ |
---|
584 | #line 116 "mesh-parser.y" |
---|
585 | { mc.m_mesh.TaperZ((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } |
---|
586 | break; |
---|
587 | |
---|
588 | case 26: |
---|
589 | |
---|
590 | /* Line 690 of lalr1.cc */ |
---|
591 | #line 117 "mesh-parser.y" |
---|
592 | { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); } |
---|
593 | break; |
---|
594 | |
---|
595 | case 27: |
---|
596 | |
---|
597 | /* Line 690 of lalr1.cc */ |
---|
598 | #line 118 "mesh-parser.y" |
---|
599 | { mc.m_mesh.Scale(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); } |
---|
600 | break; |
---|
601 | |
---|
602 | case 28: |
---|
603 | |
---|
604 | /* Line 690 of lalr1.cc */ |
---|
605 | #line 119 "mesh-parser.y" |
---|
606 | { mc.m_mesh.Scale(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); } |
---|
607 | break; |
---|
608 | |
---|
609 | case 29: |
---|
610 | |
---|
611 | /* Line 690 of lalr1.cc */ |
---|
612 | #line 120 "mesh-parser.y" |
---|
613 | { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } |
---|
614 | break; |
---|
615 | |
---|
616 | case 30: |
---|
617 | |
---|
618 | /* Line 690 of lalr1.cc */ |
---|
619 | #line 121 "mesh-parser.y" |
---|
620 | { mc.m_mesh.MirrorX(); } |
---|
621 | break; |
---|
622 | |
---|
623 | case 31: |
---|
624 | |
---|
625 | /* Line 690 of lalr1.cc */ |
---|
626 | #line 122 "mesh-parser.y" |
---|
627 | { mc.m_mesh.MirrorY(); } |
---|
628 | break; |
---|
629 | |
---|
630 | case 32: |
---|
631 | |
---|
632 | /* Line 690 of lalr1.cc */ |
---|
633 | #line 123 "mesh-parser.y" |
---|
634 | { mc.m_mesh.MirrorZ(); } |
---|
635 | break; |
---|
636 | |
---|
637 | case 33: |
---|
638 | |
---|
639 | /* Line 690 of lalr1.cc */ |
---|
640 | #line 127 "mesh-parser.y" |
---|
641 | { mc.m_mesh.AppendCylinder((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, |
---|
642 | (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3, |
---|
643 | (int)(yysemantic_stack_[(2) - (2)].args).f4, (int)(yysemantic_stack_[(2) - (2)].args).f5); } |
---|
644 | break; |
---|
645 | |
---|
646 | case 34: |
---|
647 | |
---|
648 | /* Line 690 of lalr1.cc */ |
---|
649 | #line 130 "mesh-parser.y" |
---|
650 | { mc.m_mesh.AppendBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } |
---|
651 | break; |
---|
652 | |
---|
653 | case 35: |
---|
654 | |
---|
655 | /* Line 690 of lalr1.cc */ |
---|
656 | #line 131 "mesh-parser.y" |
---|
657 | { mc.m_mesh.AppendSmoothChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, |
---|
658 | (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); } |
---|
659 | break; |
---|
660 | |
---|
661 | case 36: |
---|
662 | |
---|
663 | /* Line 690 of lalr1.cc */ |
---|
664 | #line 133 "mesh-parser.y" |
---|
665 | { mc.m_mesh.AppendFlatChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, |
---|
666 | (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); } |
---|
667 | break; |
---|
668 | |
---|
669 | case 37: |
---|
670 | |
---|
671 | /* Line 690 of lalr1.cc */ |
---|
672 | #line 135 "mesh-parser.y" |
---|
673 | { mc.m_mesh.AppendSphere((yysemantic_stack_[(2) - (2)].args).f0, |
---|
674 | vec3((yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } |
---|
675 | break; |
---|
676 | |
---|
677 | case 38: |
---|
678 | |
---|
679 | /* Line 690 of lalr1.cc */ |
---|
680 | #line 137 "mesh-parser.y" |
---|
681 | { mc.m_mesh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, |
---|
682 | (int)(yysemantic_stack_[(2) - (2)].args).f3, (int)(yysemantic_stack_[(2) - (2)].args).f4); } |
---|
683 | break; |
---|
684 | |
---|
685 | case 39: |
---|
686 | |
---|
687 | /* Line 690 of lalr1.cc */ |
---|
688 | #line 139 "mesh-parser.y" |
---|
689 | { mc.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, |
---|
690 | (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3); } |
---|
691 | break; |
---|
692 | |
---|
693 | case 40: |
---|
694 | |
---|
695 | /* Line 690 of lalr1.cc */ |
---|
696 | #line 141 "mesh-parser.y" |
---|
697 | { mc.m_mesh.AppendDisc((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (int)(yysemantic_stack_[(2) - (2)].args).f2); } |
---|
698 | break; |
---|
699 | |
---|
700 | case 41: |
---|
701 | |
---|
702 | /* Line 690 of lalr1.cc */ |
---|
703 | #line 142 "mesh-parser.y" |
---|
704 | { mc.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } |
---|
705 | break; |
---|
706 | |
---|
707 | case 42: |
---|
708 | |
---|
709 | /* Line 690 of lalr1.cc */ |
---|
710 | #line 143 "mesh-parser.y" |
---|
711 | { mc.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } |
---|
712 | break; |
---|
713 | |
---|
714 | case 43: |
---|
715 | |
---|
716 | /* Line 690 of lalr1.cc */ |
---|
717 | #line 144 "mesh-parser.y" |
---|
718 | { mc.m_mesh.AppendCog((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3, |
---|
719 | (yysemantic_stack_[(2) - (2)].args).f4, (yysemantic_stack_[(2) - (2)].args).f5, (yysemantic_stack_[(2) - (2)].args).f6, (int)(yysemantic_stack_[(2) - (2)].args).f7); } |
---|
720 | break; |
---|
721 | |
---|
722 | case 44: |
---|
723 | |
---|
724 | /* Line 690 of lalr1.cc */ |
---|
725 | #line 148 "mesh-parser.y" |
---|
726 | { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); } |
---|
727 | break; |
---|
728 | |
---|
729 | case 45: |
---|
730 | |
---|
731 | /* Line 690 of lalr1.cc */ |
---|
732 | #line 149 "mesh-parser.y" |
---|
733 | { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(3) - (3)].fval); } |
---|
734 | break; |
---|
735 | |
---|
736 | case 46: |
---|
737 | |
---|
738 | /* Line 690 of lalr1.cc */ |
---|
739 | #line 150 "mesh-parser.y" |
---|
740 | { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(3) - (3)].fval); } |
---|
741 | break; |
---|
742 | |
---|
743 | case 47: |
---|
744 | |
---|
745 | /* Line 690 of lalr1.cc */ |
---|
746 | #line 151 "mesh-parser.y" |
---|
747 | { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f3 = (yysemantic_stack_[(3) - (3)].fval); } |
---|
748 | break; |
---|
749 | |
---|
750 | case 48: |
---|
751 | |
---|
752 | /* Line 690 of lalr1.cc */ |
---|
753 | #line 152 "mesh-parser.y" |
---|
754 | { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f4 = (yysemantic_stack_[(3) - (3)].fval); } |
---|
755 | break; |
---|
756 | |
---|
757 | case 49: |
---|
758 | |
---|
759 | /* Line 690 of lalr1.cc */ |
---|
760 | #line 153 "mesh-parser.y" |
---|
761 | { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f5 = (yysemantic_stack_[(3) - (3)].fval); } |
---|
762 | break; |
---|
763 | |
---|
764 | case 50: |
---|
765 | |
---|
766 | /* Line 690 of lalr1.cc */ |
---|
767 | #line 154 "mesh-parser.y" |
---|
768 | { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f6 = (yysemantic_stack_[(3) - (3)].fval); } |
---|
769 | break; |
---|
770 | |
---|
771 | case 51: |
---|
772 | |
---|
773 | /* Line 690 of lalr1.cc */ |
---|
774 | #line 155 "mesh-parser.y" |
---|
775 | { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f7 = (yysemantic_stack_[(3) - (3)].fval); } |
---|
776 | break; |
---|
777 | |
---|
778 | case 52: |
---|
779 | |
---|
780 | /* Line 690 of lalr1.cc */ |
---|
781 | #line 158 "mesh-parser.y" |
---|
782 | { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); } |
---|
783 | break; |
---|
784 | |
---|
785 | case 53: |
---|
786 | |
---|
787 | /* Line 690 of lalr1.cc */ |
---|
788 | #line 159 "mesh-parser.y" |
---|
789 | { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); } |
---|
790 | break; |
---|
791 | |
---|
792 | |
---|
793 | |
---|
794 | /* Line 690 of lalr1.cc */ |
---|
795 | #line 796 "generated/mesh-parser.cpp" |
---|
796 | default: |
---|
797 | break; |
---|
798 | } |
---|
799 | /* User semantic actions sometimes alter yychar, and that requires |
---|
800 | that yytoken be updated with the new translation. We take the |
---|
801 | approach of translating immediately before every use of yytoken. |
---|
802 | One alternative is translating here after every semantic action, |
---|
803 | but that translation would be missed if the semantic action |
---|
804 | invokes YYABORT, YYACCEPT, or YYERROR immediately after altering |
---|
805 | yychar. In the case of YYABORT or YYACCEPT, an incorrect |
---|
806 | destructor might then be invoked immediately. In the case of |
---|
807 | YYERROR, subsequent parser actions might lead to an incorrect |
---|
808 | destructor call or verbose syntax error message before the |
---|
809 | lookahead is translated. */ |
---|
810 | YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc); |
---|
811 | |
---|
812 | yypop_ (yylen); |
---|
813 | yylen = 0; |
---|
814 | YY_STACK_PRINT (); |
---|
815 | |
---|
816 | yysemantic_stack_.push (yyval); |
---|
817 | yylocation_stack_.push (yyloc); |
---|
818 | |
---|
819 | /* Shift the result of the reduction. */ |
---|
820 | yyn = yyr1_[yyn]; |
---|
821 | yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0]; |
---|
822 | if (0 <= yystate && yystate <= yylast_ |
---|
823 | && yycheck_[yystate] == yystate_stack_[0]) |
---|
824 | yystate = yytable_[yystate]; |
---|
825 | else |
---|
826 | yystate = yydefgoto_[yyn - yyntokens_]; |
---|
827 | goto yynewstate; |
---|
828 | |
---|
829 | /*------------------------------------. |
---|
830 | | yyerrlab -- here on detecting error | |
---|
831 | `------------------------------------*/ |
---|
832 | yyerrlab: |
---|
833 | /* Make sure we have latest lookahead translation. See comments at |
---|
834 | user semantic actions for why this is necessary. */ |
---|
835 | yytoken = yytranslate_ (yychar); |
---|
836 | |
---|
837 | /* If not already recovering from an error, report this error. */ |
---|
838 | if (!yyerrstatus_) |
---|
839 | { |
---|
840 | ++yynerrs_; |
---|
841 | if (yychar == yyempty_) |
---|
842 | yytoken = yyempty_; |
---|
843 | error (yylloc, yysyntax_error_ (yystate, yytoken)); |
---|
844 | } |
---|
845 | |
---|
846 | yyerror_range[1] = yylloc; |
---|
847 | if (yyerrstatus_ == 3) |
---|
848 | { |
---|
849 | /* If just tried and failed to reuse lookahead token after an |
---|
850 | error, discard it. */ |
---|
851 | |
---|
852 | if (yychar <= yyeof_) |
---|
853 | { |
---|
854 | /* Return failure if at end of input. */ |
---|
855 | if (yychar == yyeof_) |
---|
856 | YYABORT; |
---|
857 | } |
---|
858 | else |
---|
859 | { |
---|
860 | yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc); |
---|
861 | yychar = yyempty_; |
---|
862 | } |
---|
863 | } |
---|
864 | |
---|
865 | /* Else will try to reuse lookahead token after shifting the error |
---|
866 | token. */ |
---|
867 | goto yyerrlab1; |
---|
868 | |
---|
869 | |
---|
870 | /*---------------------------------------------------. |
---|
871 | | yyerrorlab -- error raised explicitly by YYERROR. | |
---|
872 | `---------------------------------------------------*/ |
---|
873 | yyerrorlab: |
---|
874 | |
---|
875 | /* Pacify compilers like GCC when the user code never invokes |
---|
876 | YYERROR and the label yyerrorlab therefore never appears in user |
---|
877 | code. */ |
---|
878 | if (false) |
---|
879 | goto yyerrorlab; |
---|
880 | |
---|
881 | yyerror_range[1] = yylocation_stack_[yylen - 1]; |
---|
882 | /* Do not reclaim the symbols of the rule which action triggered |
---|
883 | this YYERROR. */ |
---|
884 | yypop_ (yylen); |
---|
885 | yylen = 0; |
---|
886 | yystate = yystate_stack_[0]; |
---|
887 | goto yyerrlab1; |
---|
888 | |
---|
889 | /*-------------------------------------------------------------. |
---|
890 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
---|
891 | `-------------------------------------------------------------*/ |
---|
892 | yyerrlab1: |
---|
893 | yyerrstatus_ = 3; /* Each real token shifted decrements this. */ |
---|
894 | |
---|
895 | for (;;) |
---|
896 | { |
---|
897 | yyn = yypact_[yystate]; |
---|
898 | if (!yy_pact_value_is_default_ (yyn)) |
---|
899 | { |
---|
900 | yyn += yyterror_; |
---|
901 | if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_) |
---|
902 | { |
---|
903 | yyn = yytable_[yyn]; |
---|
904 | if (0 < yyn) |
---|
905 | break; |
---|
906 | } |
---|
907 | } |
---|
908 | |
---|
909 | /* Pop the current state because it cannot handle the error token. */ |
---|
910 | if (yystate_stack_.height () == 1) |
---|
911 | YYABORT; |
---|
912 | |
---|
913 | yyerror_range[1] = yylocation_stack_[0]; |
---|
914 | yydestruct_ ("Error: popping", |
---|
915 | yystos_[yystate], |
---|
916 | &yysemantic_stack_[0], &yylocation_stack_[0]); |
---|
917 | yypop_ (); |
---|
918 | yystate = yystate_stack_[0]; |
---|
919 | YY_STACK_PRINT (); |
---|
920 | } |
---|
921 | |
---|
922 | yyerror_range[2] = yylloc; |
---|
923 | // Using YYLLOC is tempting, but would change the location of |
---|
924 | // the lookahead. YYLOC is available though. |
---|
925 | YYLLOC_DEFAULT (yyloc, yyerror_range, 2); |
---|
926 | yysemantic_stack_.push (yylval); |
---|
927 | yylocation_stack_.push (yyloc); |
---|
928 | |
---|
929 | /* Shift the error token. */ |
---|
930 | YY_SYMBOL_PRINT ("Shifting", yystos_[yyn], |
---|
931 | &yysemantic_stack_[0], &yylocation_stack_[0]); |
---|
932 | |
---|
933 | yystate = yyn; |
---|
934 | goto yynewstate; |
---|
935 | |
---|
936 | /* Accept. */ |
---|
937 | yyacceptlab: |
---|
938 | yyresult = 0; |
---|
939 | goto yyreturn; |
---|
940 | |
---|
941 | /* Abort. */ |
---|
942 | yyabortlab: |
---|
943 | yyresult = 1; |
---|
944 | goto yyreturn; |
---|
945 | |
---|
946 | yyreturn: |
---|
947 | if (yychar != yyempty_) |
---|
948 | { |
---|
949 | /* Make sure we have latest lookahead translation. See comments |
---|
950 | at user semantic actions for why this is necessary. */ |
---|
951 | yytoken = yytranslate_ (yychar); |
---|
952 | yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, |
---|
953 | &yylloc); |
---|
954 | } |
---|
955 | |
---|
956 | /* Do not reclaim the symbols of the rule which action triggered |
---|
957 | this YYABORT or YYACCEPT. */ |
---|
958 | yypop_ (yylen); |
---|
959 | while (yystate_stack_.height () != 1) |
---|
960 | { |
---|
961 | yydestruct_ ("Cleanup: popping", |
---|
962 | yystos_[yystate_stack_[0]], |
---|
963 | &yysemantic_stack_[0], |
---|
964 | &yylocation_stack_[0]); |
---|
965 | yypop_ (); |
---|
966 | } |
---|
967 | |
---|
968 | return yyresult; |
---|
969 | } |
---|
970 | |
---|
971 | // Generate an error message. |
---|
972 | std::string |
---|
973 | MeshParser::yysyntax_error_ (int yystate, int yytoken) |
---|
974 | { |
---|
975 | std::string yyres; |
---|
976 | // Number of reported tokens (one for the "unexpected", one per |
---|
977 | // "expected"). |
---|
978 | size_t yycount = 0; |
---|
979 | // Its maximum. |
---|
980 | enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; |
---|
981 | // Arguments of yyformat. |
---|
982 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; |
---|
983 | |
---|
984 | /* There are many possibilities here to consider: |
---|
985 | - If this state is a consistent state with a default action, then |
---|
986 | the only way this function was invoked is if the default action |
---|
987 | is an error action. In that case, don't check for expected |
---|
988 | tokens because there are none. |
---|
989 | - The only way there can be no lookahead present (in yytoken) is |
---|
990 | if this state is a consistent state with a default action. |
---|
991 | Thus, detecting the absence of a lookahead is sufficient to |
---|
992 | determine that there is no unexpected or expected token to |
---|
993 | report. In that case, just report a simple "syntax error". |
---|
994 | - Don't assume there isn't a lookahead just because this state is |
---|
995 | a consistent state with a default action. There might have |
---|
996 | been a previous inconsistent state, consistent state with a |
---|
997 | non-default action, or user semantic action that manipulated |
---|
998 | yychar. |
---|
999 | - Of course, the expected token list depends on states to have |
---|
1000 | correct lookahead information, and it depends on the parser not |
---|
1001 | to perform extra reductions after fetching a lookahead from the |
---|
1002 | scanner and before detecting a syntax error. Thus, state |
---|
1003 | merging (from LALR or IELR) and default reductions corrupt the |
---|
1004 | expected token list. However, the list is correct for |
---|
1005 | canonical LR with one exception: it will still contain any |
---|
1006 | token that will not be accepted due to an error action in a |
---|
1007 | later state. |
---|
1008 | */ |
---|
1009 | if (yytoken != yyempty_) |
---|
1010 | { |
---|
1011 | yyarg[yycount++] = yytname_[yytoken]; |
---|
1012 | int yyn = yypact_[yystate]; |
---|
1013 | if (!yy_pact_value_is_default_ (yyn)) |
---|
1014 | { |
---|
1015 | /* Start YYX at -YYN if negative to avoid negative indexes in |
---|
1016 | YYCHECK. In other words, skip the first -YYN actions for |
---|
1017 | this state because they are default actions. */ |
---|
1018 | int yyxbegin = yyn < 0 ? -yyn : 0; |
---|
1019 | /* Stay within bounds of both yycheck and yytname. */ |
---|
1020 | int yychecklim = yylast_ - yyn + 1; |
---|
1021 | int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_; |
---|
1022 | for (int yyx = yyxbegin; yyx < yyxend; ++yyx) |
---|
1023 | if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_ |
---|
1024 | && !yy_table_value_is_error_ (yytable_[yyx + yyn])) |
---|
1025 | { |
---|
1026 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
---|
1027 | { |
---|
1028 | yycount = 1; |
---|
1029 | break; |
---|
1030 | } |
---|
1031 | else |
---|
1032 | yyarg[yycount++] = yytname_[yyx]; |
---|
1033 | } |
---|
1034 | } |
---|
1035 | } |
---|
1036 | |
---|
1037 | char const* yyformat = 0; |
---|
1038 | switch (yycount) |
---|
1039 | { |
---|
1040 | #define YYCASE_(N, S) \ |
---|
1041 | case N: \ |
---|
1042 | yyformat = S; \ |
---|
1043 | break |
---|
1044 | YYCASE_(0, YY_("syntax error")); |
---|
1045 | YYCASE_(1, YY_("syntax error, unexpected %s")); |
---|
1046 | YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); |
---|
1047 | YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); |
---|
1048 | YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); |
---|
1049 | YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); |
---|
1050 | #undef YYCASE_ |
---|
1051 | } |
---|
1052 | |
---|
1053 | // Argument number. |
---|
1054 | size_t yyi = 0; |
---|
1055 | for (char const* yyp = yyformat; *yyp; ++yyp) |
---|
1056 | if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount) |
---|
1057 | { |
---|
1058 | yyres += yytnamerr_ (yyarg[yyi++]); |
---|
1059 | ++yyp; |
---|
1060 | } |
---|
1061 | else |
---|
1062 | yyres += *yyp; |
---|
1063 | return yyres; |
---|
1064 | } |
---|
1065 | |
---|
1066 | |
---|
1067 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
---|
1068 | STATE-NUM. */ |
---|
1069 | const signed char MeshParser::yypact_ninf_ = -44; |
---|
1070 | const signed char |
---|
1071 | MeshParser::yypact_[] = |
---|
1072 | { |
---|
1073 | -1, -44, -44, -44, 14, 45, 16, 16, 16, 16, |
---|
1074 | -44, 16, 16, 16, 16, -44, 16, 16, 16, 16, |
---|
1075 | -44, 16, 16, 16, 16, 16, 16, 16, 16, 16, |
---|
1076 | 16, 16, 16, 16, 40, 1, -44, -44, -44, -44, |
---|
1077 | -44, -44, -44, 16, 10, 23, 26, -44, -44, -44, |
---|
1078 | -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, |
---|
1079 | -44, -44, -44, -44, -44, 28, 36, -44, -44, -44, |
---|
1080 | -44, -44, -44, -44, -44, -44, -44, 38, 47, -44, |
---|
1081 | -44, -44, -1, -44, 16, 16, 16, 16, 16, 16, |
---|
1082 | 16, -44, -44, -44, -44, -44, -44, -44, -44 |
---|
1083 | }; |
---|
1084 | |
---|
1085 | /* YYDEFACT[S] -- default reduction number in state S. Performed when |
---|
1086 | YYTABLE doesn't specify something else to do. Zero means the |
---|
1087 | default is an error. */ |
---|
1088 | const unsigned char |
---|
1089 | MeshParser::yydefact_[] = |
---|
1090 | { |
---|
1091 | 0, 9, 10, 11, 0, 0, 0, 0, 0, 0, |
---|
1092 | 30, 0, 0, 0, 0, 31, 0, 0, 0, 0, |
---|
1093 | 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
---|
1094 | 0, 0, 0, 0, 0, 0, 3, 5, 6, 7, |
---|
1095 | 8, 52, 13, 0, 0, 0, 0, 12, 44, 15, |
---|
1096 | 14, 16, 20, 23, 26, 17, 21, 24, 27, 18, |
---|
1097 | 22, 25, 28, 19, 29, 0, 0, 33, 34, 35, |
---|
1098 | 36, 37, 38, 39, 40, 41, 42, 0, 0, 43, |
---|
1099 | 1, 2, 0, 53, 0, 0, 0, 0, 0, 0, |
---|
1100 | 0, 4, 45, 46, 47, 48, 49, 50, 51 |
---|
1101 | }; |
---|
1102 | |
---|
1103 | /* YYPGOTO[NTERM-NUM]. */ |
---|
1104 | const signed char |
---|
1105 | MeshParser::yypgoto_[] = |
---|
1106 | { |
---|
1107 | -44, -44, -44, -13, -44, -44, -44, -44, 61, 6, |
---|
1108 | 41, 31, 51, 50, -44, -44, -43 |
---|
1109 | }; |
---|
1110 | |
---|
1111 | /* YYDEFGOTO[NTERM-NUM]. */ |
---|
1112 | const signed char |
---|
1113 | MeshParser::yydefgoto_[] = |
---|
1114 | { |
---|
1115 | -1, 34, 35, 36, 37, 38, 39, 40, 44, 45, |
---|
1116 | 46, 65, 66, 67, 78, 79, 48 |
---|
1117 | }; |
---|
1118 | |
---|
1119 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
---|
1120 | positive, shift that token. If negative, reduce the rule which |
---|
1121 | number is the opposite. If YYTABLE_NINF_, syntax error. */ |
---|
1122 | const signed char MeshParser::yytable_ninf_ = -1; |
---|
1123 | const unsigned char |
---|
1124 | MeshParser::yytable_[] = |
---|
1125 | { |
---|
1126 | 83, 81, 1, 2, 3, 4, 5, 6, 7, 8, |
---|
1127 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, |
---|
1128 | 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, |
---|
1129 | 29, 30, 31, 32, 33, 47, 50, 75, 76, 82, |
---|
1130 | 80, 92, 93, 94, 95, 96, 97, 98, 84, 53, |
---|
1131 | 41, 42, 41, 43, 57, 43, 69, 70, 71, 61, |
---|
1132 | 73, 85, 63, 64, 86, 68, 87, 51, 52, 91, |
---|
1133 | 54, 74, 55, 56, 88, 58, 89, 59, 60, 72, |
---|
1134 | 62, 41, 49, 77, 43, 90 |
---|
1135 | }; |
---|
1136 | |
---|
1137 | /* YYCHECK. */ |
---|
1138 | const unsigned char |
---|
1139 | MeshParser::yycheck_[] = |
---|
1140 | { |
---|
1141 | 43, 0, 3, 4, 5, 6, 7, 8, 9, 10, |
---|
1142 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, |
---|
1143 | 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, |
---|
1144 | 31, 32, 33, 34, 35, 4, 5, 31, 32, 38, |
---|
1145 | 0, 84, 85, 86, 87, 88, 89, 90, 38, 8, |
---|
1146 | 36, 37, 36, 39, 13, 39, 25, 26, 27, 18, |
---|
1147 | 29, 38, 21, 22, 38, 24, 38, 6, 7, 82, |
---|
1148 | 9, 30, 11, 12, 38, 14, 38, 16, 17, 28, |
---|
1149 | 19, 36, 37, 33, 39, 38 |
---|
1150 | }; |
---|
1151 | |
---|
1152 | /* STOS_[STATE-NUM] -- The (internal number of the) accessing |
---|
1153 | symbol of state STATE-NUM. */ |
---|
1154 | const unsigned char |
---|
1155 | MeshParser::yystos_[] = |
---|
1156 | { |
---|
1157 | 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, |
---|
1158 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, |
---|
1159 | 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, |
---|
1160 | 32, 33, 34, 35, 41, 42, 43, 44, 45, 46, |
---|
1161 | 47, 36, 37, 39, 48, 49, 50, 51, 56, 37, |
---|
1162 | 51, 48, 48, 50, 48, 48, 48, 50, 48, 48, |
---|
1163 | 48, 50, 48, 50, 50, 51, 52, 53, 50, 51, |
---|
1164 | 51, 51, 52, 51, 50, 49, 49, 53, 54, 55, |
---|
1165 | 0, 0, 38, 56, 38, 38, 38, 38, 38, 38, |
---|
1166 | 38, 43, 56, 56, 56, 56, 56, 56, 56 |
---|
1167 | }; |
---|
1168 | |
---|
1169 | #if YYDEBUG |
---|
1170 | /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding |
---|
1171 | to YYLEX-NUM. */ |
---|
1172 | const unsigned short int |
---|
1173 | MeshParser::yytoken_number_[] = |
---|
1174 | { |
---|
1175 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
---|
1176 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
---|
1177 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
---|
1178 | 285, 286, 287, 288, 289, 290, 291, 292, 44, 45 |
---|
1179 | }; |
---|
1180 | #endif |
---|
1181 | |
---|
1182 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
---|
1183 | const unsigned char |
---|
1184 | MeshParser::yyr1_[] = |
---|
1185 | { |
---|
1186 | 0, 40, 41, 42, 42, 43, 43, 43, 43, 44, |
---|
1187 | 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, |
---|
1188 | 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, |
---|
1189 | 46, 46, 46, 47, 47, 47, 47, 47, 47, 47, |
---|
1190 | 47, 47, 47, 47, 48, 49, 50, 51, 52, 53, |
---|
1191 | 54, 55, 56, 56 |
---|
1192 | }; |
---|
1193 | |
---|
1194 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
---|
1195 | const unsigned char |
---|
1196 | MeshParser::yyr2_[] = |
---|
1197 | { |
---|
1198 | 0, 2, 2, 1, 3, 1, 1, 1, 1, 1, |
---|
1199 | 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1200 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1201 | 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, |
---|
1202 | 2, 2, 2, 2, 1, 3, 3, 3, 3, 3, |
---|
1203 | 3, 3, 1, 2 |
---|
1204 | }; |
---|
1205 | |
---|
1206 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
---|
1207 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
---|
1208 | First, the terminals, then, starting at \a yyntokens_, nonterminals. */ |
---|
1209 | const char* |
---|
1210 | const MeshParser::yytname_[] = |
---|
1211 | { |
---|
1212 | "T_END", "error", "$undefined", "T_FLUSH", "T_INITRB", "T_FREERB", |
---|
1213 | "T_COLOR", "T_BGCOLOR", "T_TRANSLATEX", "T_ROTATEX", "T_TAPERX", |
---|
1214 | "T_SCALEX", "T_MIRRORX", "T_TRANSLATEY", "T_ROTATEY", "T_TAPERY", |
---|
1215 | "T_SCALEY", "T_MIRRORY", "T_TRANSLATEZ", "T_ROTATEZ", "T_TAPERZ", |
---|
1216 | "T_SCALEZ", "T_MIRRORZ", "T_TRANSLATE", "T_SCALE", "T_CYLINDER", "T_BOX", |
---|
1217 | "T_SMOOTHCHAMFBOX", "T_FLATCHAMFBOX", "T_SPHERE", "T_STAR", |
---|
1218 | "T_EXPANDEDSTAR", "T_DISC", "T_TRIANGLE", "T_QUAD", "T_COG", "NUMBER", |
---|
1219 | "COLOR", "','", "'-'", "$accept", "mesh_description", |
---|
1220 | "mesh_command_list", "mesh_command", "rb_command", "color_command", |
---|
1221 | "transform_command", "primitive_command", "args1", "args2", "args3", |
---|
1222 | "args4", "args5", "args6", "args7", "args8", "number", 0 |
---|
1223 | }; |
---|
1224 | #endif |
---|
1225 | |
---|
1226 | #if YYDEBUG |
---|
1227 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
---|
1228 | const MeshParser::rhs_number_type |
---|
1229 | MeshParser::yyrhs_[] = |
---|
1230 | { |
---|
1231 | 41, 0, -1, 42, 0, -1, 43, -1, 42, 38, |
---|
1232 | 43, -1, 44, -1, 45, -1, 46, -1, 47, -1, |
---|
1233 | 3, -1, 4, -1, 5, -1, 6, 51, -1, 6, |
---|
1234 | 37, -1, 7, 51, -1, 7, 37, -1, 8, 48, |
---|
1235 | -1, 13, 48, -1, 18, 48, -1, 23, 50, -1, |
---|
1236 | 9, 48, -1, 14, 48, -1, 19, 48, -1, 10, |
---|
1237 | 50, -1, 15, 50, -1, 20, 50, -1, 11, 48, |
---|
1238 | -1, 16, 48, -1, 21, 48, -1, 24, 50, -1, |
---|
1239 | 12, -1, 17, -1, 22, -1, 25, 53, -1, 26, |
---|
1240 | 50, -1, 27, 51, -1, 28, 51, -1, 29, 51, |
---|
1241 | -1, 30, 52, -1, 31, 51, -1, 32, 50, -1, |
---|
1242 | 33, 49, -1, 34, 49, -1, 35, 55, -1, 56, |
---|
1243 | -1, 48, 38, 56, -1, 49, 38, 56, -1, 50, |
---|
1244 | 38, 56, -1, 51, 38, 56, -1, 52, 38, 56, |
---|
1245 | -1, 53, 38, 56, -1, 54, 38, 56, -1, 36, |
---|
1246 | -1, 39, 56, -1 |
---|
1247 | }; |
---|
1248 | |
---|
1249 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
---|
1250 | YYRHS. */ |
---|
1251 | const unsigned char |
---|
1252 | MeshParser::yyprhs_[] = |
---|
1253 | { |
---|
1254 | 0, 0, 3, 6, 8, 12, 14, 16, 18, 20, |
---|
1255 | 22, 24, 26, 29, 32, 35, 38, 41, 44, 47, |
---|
1256 | 50, 53, 56, 59, 62, 65, 68, 71, 74, 77, |
---|
1257 | 80, 82, 84, 86, 89, 92, 95, 98, 101, 104, |
---|
1258 | 107, 110, 113, 116, 119, 121, 125, 129, 133, 137, |
---|
1259 | 141, 145, 149, 151 |
---|
1260 | }; |
---|
1261 | |
---|
1262 | /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ |
---|
1263 | const unsigned char |
---|
1264 | MeshParser::yyrline_[] = |
---|
1265 | { |
---|
1266 | 0, 74, 74, 78, 79, 83, 84, 85, 86, 90, |
---|
1267 | 91, 92, 96, 97, 100, 101, 107, 108, 109, 110, |
---|
1268 | 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, |
---|
1269 | 121, 122, 123, 127, 130, 131, 133, 135, 137, 139, |
---|
1270 | 141, 142, 143, 144, 148, 149, 150, 151, 152, 153, |
---|
1271 | 154, 155, 158, 159 |
---|
1272 | }; |
---|
1273 | |
---|
1274 | // Print the state stack on the debug stream. |
---|
1275 | void |
---|
1276 | MeshParser::yystack_print_ () |
---|
1277 | { |
---|
1278 | *yycdebug_ << "Stack now"; |
---|
1279 | for (state_stack_type::const_iterator i = yystate_stack_.begin (); |
---|
1280 | i != yystate_stack_.end (); ++i) |
---|
1281 | *yycdebug_ << ' ' << *i; |
---|
1282 | *yycdebug_ << std::endl; |
---|
1283 | } |
---|
1284 | |
---|
1285 | // Report on the debug stream that the rule \a yyrule is going to be reduced. |
---|
1286 | void |
---|
1287 | MeshParser::yy_reduce_print_ (int yyrule) |
---|
1288 | { |
---|
1289 | unsigned int yylno = yyrline_[yyrule]; |
---|
1290 | int yynrhs = yyr2_[yyrule]; |
---|
1291 | /* Print the symbols being reduced, and their result. */ |
---|
1292 | *yycdebug_ << "Reducing stack by rule " << yyrule - 1 |
---|
1293 | << " (line " << yylno << "):" << std::endl; |
---|
1294 | /* The symbols being reduced. */ |
---|
1295 | for (int yyi = 0; yyi < yynrhs; yyi++) |
---|
1296 | YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", |
---|
1297 | yyrhs_[yyprhs_[yyrule] + yyi], |
---|
1298 | &(yysemantic_stack_[(yynrhs) - (yyi + 1)]), |
---|
1299 | &(yylocation_stack_[(yynrhs) - (yyi + 1)])); |
---|
1300 | } |
---|
1301 | #endif // YYDEBUG |
---|
1302 | |
---|
1303 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
---|
1304 | MeshParser::token_number_type |
---|
1305 | MeshParser::yytranslate_ (int t) |
---|
1306 | { |
---|
1307 | static |
---|
1308 | const token_number_type |
---|
1309 | translate_table[] = |
---|
1310 | { |
---|
1311 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1312 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1313 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1314 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1315 | 2, 2, 2, 2, 38, 39, 2, 2, 2, 2, |
---|
1316 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1317 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1318 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1319 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1320 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1321 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1322 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1323 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1324 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1325 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1326 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1327 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1328 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1329 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1330 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1331 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1332 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1333 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1334 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1335 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
1336 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
---|
1337 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
---|
1338 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
---|
1339 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
---|
1340 | 35, 36, 37 |
---|
1341 | }; |
---|
1342 | if ((unsigned int) t <= yyuser_token_number_max_) |
---|
1343 | return translate_table[t]; |
---|
1344 | else |
---|
1345 | return yyundef_token_; |
---|
1346 | } |
---|
1347 | |
---|
1348 | const int MeshParser::yyeof_ = 0; |
---|
1349 | const int MeshParser::yylast_ = 85; |
---|
1350 | const int MeshParser::yynnts_ = 17; |
---|
1351 | const int MeshParser::yyempty_ = -2; |
---|
1352 | const int MeshParser::yyfinal_ = 80; |
---|
1353 | const int MeshParser::yyterror_ = 1; |
---|
1354 | const int MeshParser::yyerrcode_ = 256; |
---|
1355 | const int MeshParser::yyntokens_ = 40; |
---|
1356 | |
---|
1357 | const unsigned int MeshParser::yyuser_token_number_max_ = 292; |
---|
1358 | const MeshParser::token_number_type MeshParser::yyundef_token_ = 2; |
---|
1359 | |
---|
1360 | |
---|
1361 | } // orbital |
---|
1362 | |
---|
1363 | /* Line 1136 of lalr1.cc */ |
---|
1364 | #line 1365 "generated/mesh-parser.cpp" |
---|
1365 | |
---|
1366 | |
---|
1367 | /* Line 1138 of lalr1.cc */ |
---|
1368 | #line 162 "mesh-parser.y" |
---|
1369 | |
---|
1370 | |
---|
1371 | void orbital::MeshParser::error(const MeshParser::location_type& l, |
---|
1372 | const std::string& m) |
---|
1373 | { |
---|
1374 | mc.Error(l, m); |
---|
1375 | } |
---|
1376 | |
---|
1377 | |
---|