source: trunk/orbital/generated/gun-parser.cpp @ 1434

Last change on this file since 1434 was 1434, checked in by sam, 11 years ago

orbital: enhance the language with [] contexts.

  • Property svn:keywords set to Id
File size: 28.7 KB
Line 
1/* A Bison parser, made by GNU Bison 2.4.2.  */
2
3/* Skeleton implementation 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// Take the name prefix into account.
34#define yylex   orbitallex
35
36/* First part of user declarations.  */
37
38/* Line 310 of lalr1.cc  */
39#line 1 "gun-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
56using namespace lol;
57
58#include "../gun.h"
59
60#include <string>
61
62
63/* Line 310 of lalr1.cc  */
64#line 65 "generated/gun-parser.cpp"
65
66
67#include "gun-parser.h"
68
69/* User implementation prologue.  */
70
71/* Line 316 of lalr1.cc  */
72#line 66 "gun-parser.y"
73
74#include "../gun-compiler.h"
75
76#undef yylex
77#define yylex gc.m_lexer->lex
78
79
80/* Line 316 of lalr1.cc  */
81#line 82 "generated/gun-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/* Suppress unused-variable warnings by "using" E.  */
96#define YYUSE(e) ((void) (e))
97
98/* Enable debugging if requested.  */
99#if YYDEBUG
100
101/* A pseudo ostream that takes yydebug_ into account.  */
102# define YYCDEBUG if (yydebug_) (*yycdebug_)
103
104# define YY_SYMBOL_PRINT(Title, Type, Value, Location)  \
105do {                                                    \
106  if (yydebug_)                                         \
107    {                                                   \
108      *yycdebug_ << Title << ' ';                       \
109      yy_symbol_print_ ((Type), (Value), (Location));   \
110      *yycdebug_ << std::endl;                          \
111    }                                                   \
112} while (false)
113
114# define YY_REDUCE_PRINT(Rule)          \
115do {                                    \
116  if (yydebug_)                         \
117    yy_reduce_print_ (Rule);            \
118} while (false)
119
120# define YY_STACK_PRINT()               \
121do {                                    \
122  if (yydebug_)                         \
123    yystack_print_ ();                  \
124} while (false)
125
126#else /* !YYDEBUG */
127
128# define YYCDEBUG if (false) std::cerr
129# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
130# define YY_REDUCE_PRINT(Rule)
131# define YY_STACK_PRINT()
132
133#endif /* !YYDEBUG */
134
135#define yyerrok         (yyerrstatus_ = 0)
136#define yyclearin       (yychar = yyempty_)
137
138#define YYACCEPT        goto yyacceptlab
139#define YYABORT         goto yyabortlab
140#define YYERROR         goto yyerrorlab
141#define YYRECOVERING()  (!!yyerrstatus_)
142
143
144namespace orbital {
145
146/* Line 379 of lalr1.cc  */
147#line 148 "generated/gun-parser.cpp"
148#if YYERROR_VERBOSE
149
150  /* Return YYSTR after stripping away unnecessary quotes and
151     backslashes, so that it's suitable for yyerror.  The heuristic is
152     that double-quoting is unnecessary unless the string contains an
153     apostrophe, a comma, or backslash (other than backslash-backslash).
154     YYSTR is taken from yytname.  */
155  std::string
156  GunParser::yytnamerr_ (const char *yystr)
157  {
158    if (*yystr == '"')
159      {
160        std::string yyr = "";
161        char const *yyp = yystr;
162
163        for (;;)
164          switch (*++yyp)
165            {
166            case '\'':
167            case ',':
168              goto do_not_strip_quotes;
169
170            case '\\':
171              if (*++yyp != '\\')
172                goto do_not_strip_quotes;
173              /* Fall through.  */
174            default:
175              yyr += *yyp;
176              break;
177
178            case '"':
179              return yyr;
180            }
181      do_not_strip_quotes: ;
182      }
183
184    return yystr;
185  }
186
187#endif
188
189  /// Build a parser object.
190  GunParser::GunParser (class GunCompiler& gc_yyarg)
191    :
192#if YYDEBUG
193      yydebug_ (false),
194      yycdebug_ (&std::cerr),
195#endif
196      gc (gc_yyarg)
197  {
198  }
199
200  GunParser::~GunParser ()
201  {
202  }
203
204#if YYDEBUG
205  /*--------------------------------.
206  | Print this symbol on YYOUTPUT.  |
207  `--------------------------------*/
208
209  inline void
210  GunParser::yy_symbol_value_print_ (int yytype,
211                           const semantic_type* yyvaluep, const location_type* yylocationp)
212  {
213    YYUSE (yylocationp);
214    YYUSE (yyvaluep);
215    switch (yytype)
216      {
217         default:
218          break;
219      }
220  }
221
222
223  void
224  GunParser::yy_symbol_print_ (int yytype,
225                           const semantic_type* yyvaluep, const location_type* yylocationp)
226  {
227    *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
228               << ' ' << yytname_[yytype] << " ("
229               << *yylocationp << ": ";
230    yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
231    *yycdebug_ << ')';
232  }
233#endif
234
235  void
236  GunParser::yydestruct_ (const char* yymsg,
237                           int yytype, semantic_type* yyvaluep, location_type* yylocationp)
238  {
239    YYUSE (yylocationp);
240    YYUSE (yymsg);
241    YYUSE (yyvaluep);
242
243    YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
244
245    switch (yytype)
246      {
247 
248        default:
249          break;
250      }
251  }
252
253  void
254  GunParser::yypop_ (unsigned int n)
255  {
256    yystate_stack_.pop (n);
257    yysemantic_stack_.pop (n);
258    yylocation_stack_.pop (n);
259  }
260
261#if YYDEBUG
262  std::ostream&
263  GunParser::debug_stream () const
264  {
265    return *yycdebug_;
266  }
267
268  void
269  GunParser::set_debug_stream (std::ostream& o)
270  {
271    yycdebug_ = &o;
272  }
273
274
275  GunParser::debug_level_type
276  GunParser::debug_level () const
277  {
278    return yydebug_;
279  }
280
281  void
282  GunParser::set_debug_level (debug_level_type l)
283  {
284    yydebug_ = l;
285  }
286#endif
287
288  int
289  GunParser::parse ()
290  {
291    /// Lookahead and lookahead in internal form.
292    int yychar = yyempty_;
293    int yytoken = 0;
294
295    /* State.  */
296    int yyn;
297    int yylen = 0;
298    int yystate = 0;
299
300    /* Error handling.  */
301    int yynerrs_ = 0;
302    int yyerrstatus_ = 0;
303
304    /// Semantic value of the lookahead.
305    semantic_type yylval;
306    /// Location of the lookahead.
307    location_type yylloc;
308    /// The locations where the error started and ended.
309    location_type yyerror_range[2];
310
311    /// $$.
312    semantic_type yyval;
313    /// @$.
314    location_type yyloc;
315
316    int yyresult;
317
318    YYCDEBUG << "Starting parse" << std::endl;
319
320
321    /* Initialize the stacks.  The initial state will be pushed in
322       yynewstate, since the latter expects the semantical and the
323       location values to have been already stored, initialize these
324       stacks with a primary value.  */
325    yystate_stack_ = state_stack_type (0);
326    yysemantic_stack_ = semantic_stack_type (0);
327    yylocation_stack_ = location_stack_type (0);
328    yysemantic_stack_.push (yylval);
329    yylocation_stack_.push (yylloc);
330
331    /* New state.  */
332  yynewstate:
333    yystate_stack_.push (yystate);
334    YYCDEBUG << "Entering state " << yystate << std::endl;
335
336    /* Accept?  */
337    if (yystate == yyfinal_)
338      goto yyacceptlab;
339
340    goto yybackup;
341
342    /* Backup.  */
343  yybackup:
344
345    /* Try to take a decision without lookahead.  */
346    yyn = yypact_[yystate];
347    if (yyn == yypact_ninf_)
348      goto yydefault;
349
350    /* Read a lookahead token.  */
351    if (yychar == yyempty_)
352      {
353        YYCDEBUG << "Reading a token: ";
354        yychar = yylex (&yylval, &yylloc);
355      }
356
357
358    /* Convert token to internal form.  */
359    if (yychar <= yyeof_)
360      {
361        yychar = yytoken = yyeof_;
362        YYCDEBUG << "Now at end of input." << std::endl;
363      }
364    else
365      {
366        yytoken = yytranslate_ (yychar);
367        YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
368      }
369
370    /* If the proper action on seeing token YYTOKEN is to reduce or to
371       detect an error, take that action.  */
372    yyn += yytoken;
373    if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
374      goto yydefault;
375
376    /* Reduce or error.  */
377    yyn = yytable_[yyn];
378    if (yyn <= 0)
379      {
380        if (yyn == 0 || yyn == yytable_ninf_)
381        goto yyerrlab;
382        yyn = -yyn;
383        goto yyreduce;
384      }
385
386    /* Shift the lookahead token.  */
387    YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
388
389    /* Discard the token being shifted.  */
390    yychar = yyempty_;
391
392    yysemantic_stack_.push (yylval);
393    yylocation_stack_.push (yylloc);
394
395    /* Count tokens shifted since error; after three, turn off error
396       status.  */
397    if (yyerrstatus_)
398      --yyerrstatus_;
399
400    yystate = yyn;
401    goto yynewstate;
402
403  /*-----------------------------------------------------------.
404  | yydefault -- do the default action for the current state.  |
405  `-----------------------------------------------------------*/
406  yydefault:
407    yyn = yydefact_[yystate];
408    if (yyn == 0)
409      goto yyerrlab;
410    goto yyreduce;
411
412  /*-----------------------------.
413  | yyreduce -- Do a reduction.  |
414  `-----------------------------*/
415  yyreduce:
416    yylen = yyr2_[yyn];
417    /* If YYLEN is nonzero, implement the default value of the action:
418       `$$ = $1'.  Otherwise, use the top of the stack.
419
420       Otherwise, the following line sets YYVAL to garbage.
421       This behavior is undocumented and Bison
422       users should not rely upon it.  */
423    if (yylen)
424      yyval = yysemantic_stack_[yylen - 1];
425    else
426      yyval = yysemantic_stack_[0];
427
428    {
429      slice<location_type, location_stack_type> slice (yylocation_stack_, yylen);
430      YYLLOC_DEFAULT (yyloc, slice, yylen);
431    }
432    YY_REDUCE_PRINT (yyn);
433    switch (yyn)
434      {
435          case 5:
436
437/* Line 677 of lalr1.cc  */
438#line 85 "gun-parser.y"
439    { gc.m_gun.m_angle = gc.m_gun.AimActor(); }
440    break;
441
442  case 6:
443
444/* Line 677 of lalr1.cc  */
445#line 86 "gun-parser.y"
446    { gc.m_gun.PreAimActor((yysemantic_stack_[(2) - (2)].args).f0); }
447    break;
448
449  case 7:
450
451/* Line 677 of lalr1.cc  */
452#line 87 "gun-parser.y"
453    { gc.m_gun.m_pre_aim = (yysemantic_stack_[(2) - (2)].args).f0; }
454    break;
455
456  case 8:
457
458/* Line 677 of lalr1.cc  */
459#line 88 "gun-parser.y"
460    { gc.m_gun.m_angle = (yysemantic_stack_[(2) - (2)].args).f0; }
461    break;
462
463  case 9:
464
465/* Line 677 of lalr1.cc  */
466#line 89 "gun-parser.y"
467    { gc.m_gun.m_round_duration = (yysemantic_stack_[(2) - (2)].args).f0; }
468    break;
469
470  case 10:
471
472/* Line 677 of lalr1.cc  */
473#line 90 "gun-parser.y"
474    { gc.m_gun.m_angle_offset = (yysemantic_stack_[(2) - (2)].args).f0; }
475    break;
476
477  case 11:
478
479/* Line 677 of lalr1.cc  */
480#line 91 "gun-parser.y"
481    { gc.m_gun.m_radius = (yysemantic_stack_[(2) - (2)].args).f0; }
482    break;
483
484  case 12:
485
486/* Line 677 of lalr1.cc  */
487#line 92 "gun-parser.y"
488    { gc.m_gun.m_shoot_speed = (yysemantic_stack_[(2) - (2)].args).f0; }
489    break;
490
491  case 13:
492
493/* Line 677 of lalr1.cc  */
494#line 93 "gun-parser.y"
495    { /* FIXME: 1st modifier */ }
496    break;
497
498  case 14:
499
500/* Line 677 of lalr1.cc  */
501#line 94 "gun-parser.y"
502    { /* FIXME: 2nd modifier */ }
503    break;
504
505  case 15:
506
507/* Line 677 of lalr1.cc  */
508#line 95 "gun-parser.y"
509    { for (int i = 0; i < (int)(yysemantic_stack_[(2) - (2)].args).f0; i++) gc.m_gun.Shoot(1);
510                      gc.m_gun.m_shoot_type = 1;
511                      gc.m_gun.m_round_timer = gc.m_gun.m_round_duration; }
512    break;
513
514  case 16:
515
516/* Line 677 of lalr1.cc  */
517#line 98 "gun-parser.y"
518    { for (int i = 0; i < (int)(yysemantic_stack_[(2) - (2)].args).f0; i++) gc.m_gun.Shoot(0);
519                      gc.m_gun.m_shoot_type = 0;
520                      gc.m_gun.m_round_timer = gc.m_gun.m_round_duration; }
521    break;
522
523  case 17:
524
525/* Line 677 of lalr1.cc  */
526#line 101 "gun-parser.y"
527    { gc.m_gun.Shoot(1); gc.m_gun.m_nbshoots = (int)(yysemantic_stack_[(2) - (2)].args).f0 - 1;
528                      gc.m_gun.m_shoot_type = 1;
529                      gc.m_gun.m_round_timer = gc.m_gun.m_round_duration; }
530    break;
531
532  case 18:
533
534/* Line 677 of lalr1.cc  */
535#line 104 "gun-parser.y"
536    { gc.m_gun.Shoot(0); gc.m_gun.m_nbshoots = (int)(yysemantic_stack_[(2) - (2)].args).f0 - 1;
537                      gc.m_gun.m_shoot_type = 0;
538                      gc.m_gun.m_round_timer = gc.m_gun.m_round_duration; }
539    break;
540
541  case 19:
542
543/* Line 677 of lalr1.cc  */
544#line 107 "gun-parser.y"
545    { gc.m_gun.m_round_timer = gc.m_gun.m_round_duration * (yysemantic_stack_[(2) - (2)].args).f0;
546                      /* FIXME: modifiers */ }
547    break;
548
549  case 20:
550
551/* Line 677 of lalr1.cc  */
552#line 109 "gun-parser.y"
553    { /* FIXME: loops */ }
554    break;
555
556  case 21:
557
558/* Line 677 of lalr1.cc  */
559#line 112 "gun-parser.y"
560    { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); }
561    break;
562
563  case 22:
564
565/* Line 677 of lalr1.cc  */
566#line 113 "gun-parser.y"
567    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(3) - (3)].fval); }
568    break;
569
570  case 23:
571
572/* Line 677 of lalr1.cc  */
573#line 114 "gun-parser.y"
574    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(3) - (3)].fval); }
575    break;
576
577  case 24:
578
579/* Line 677 of lalr1.cc  */
580#line 117 "gun-parser.y"
581    { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); }
582    break;
583
584  case 25:
585
586/* Line 677 of lalr1.cc  */
587#line 118 "gun-parser.y"
588    { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); }
589    break;
590
591
592
593/* Line 677 of lalr1.cc  */
594#line 595 "generated/gun-parser.cpp"
595        default:
596          break;
597      }
598    YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
599
600    yypop_ (yylen);
601    yylen = 0;
602    YY_STACK_PRINT ();
603
604    yysemantic_stack_.push (yyval);
605    yylocation_stack_.push (yyloc);
606
607    /* Shift the result of the reduction.  */
608    yyn = yyr1_[yyn];
609    yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
610    if (0 <= yystate && yystate <= yylast_
611        && yycheck_[yystate] == yystate_stack_[0])
612      yystate = yytable_[yystate];
613    else
614      yystate = yydefgoto_[yyn - yyntokens_];
615    goto yynewstate;
616
617  /*------------------------------------.
618  | yyerrlab -- here on detecting error |
619  `------------------------------------*/
620  yyerrlab:
621    /* If not already recovering from an error, report this error.  */
622    if (!yyerrstatus_)
623      {
624        ++yynerrs_;
625        error (yylloc, yysyntax_error_ (yystate, yytoken));
626      }
627
628    yyerror_range[0] = yylloc;
629    if (yyerrstatus_ == 3)
630      {
631        /* If just tried and failed to reuse lookahead token after an
632         error, discard it.  */
633
634        if (yychar <= yyeof_)
635          {
636          /* Return failure if at end of input.  */
637          if (yychar == yyeof_)
638            YYABORT;
639          }
640        else
641          {
642            yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
643            yychar = yyempty_;
644          }
645      }
646
647    /* Else will try to reuse lookahead token after shifting the error
648       token.  */
649    goto yyerrlab1;
650
651
652  /*---------------------------------------------------.
653  | yyerrorlab -- error raised explicitly by YYERROR.  |
654  `---------------------------------------------------*/
655  yyerrorlab:
656
657    /* Pacify compilers like GCC when the user code never invokes
658       YYERROR and the label yyerrorlab therefore never appears in user
659       code.  */
660    if (false)
661      goto yyerrorlab;
662
663    yyerror_range[0] = yylocation_stack_[yylen - 1];
664    /* Do not reclaim the symbols of the rule which action triggered
665       this YYERROR.  */
666    yypop_ (yylen);
667    yylen = 0;
668    yystate = yystate_stack_[0];
669    goto yyerrlab1;
670
671  /*-------------------------------------------------------------.
672  | yyerrlab1 -- common code for both syntax error and YYERROR.  |
673  `-------------------------------------------------------------*/
674  yyerrlab1:
675    yyerrstatus_ = 3;   /* Each real token shifted decrements this.  */
676
677    for (;;)
678      {
679        yyn = yypact_[yystate];
680        if (yyn != yypact_ninf_)
681        {
682          yyn += yyterror_;
683          if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
684            {
685              yyn = yytable_[yyn];
686              if (0 < yyn)
687                break;
688            }
689        }
690
691        /* Pop the current state because it cannot handle the error token.  */
692        if (yystate_stack_.height () == 1)
693        YYABORT;
694
695        yyerror_range[0] = yylocation_stack_[0];
696        yydestruct_ ("Error: popping",
697                     yystos_[yystate],
698                     &yysemantic_stack_[0], &yylocation_stack_[0]);
699        yypop_ ();
700        yystate = yystate_stack_[0];
701        YY_STACK_PRINT ();
702      }
703
704    yyerror_range[1] = yylloc;
705    // Using YYLLOC is tempting, but would change the location of
706    // the lookahead.  YYLOC is available though.
707    YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
708    yysemantic_stack_.push (yylval);
709    yylocation_stack_.push (yyloc);
710
711    /* Shift the error token.  */
712    YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
713                     &yysemantic_stack_[0], &yylocation_stack_[0]);
714
715    yystate = yyn;
716    goto yynewstate;
717
718    /* Accept.  */
719  yyacceptlab:
720    yyresult = 0;
721    goto yyreturn;
722
723    /* Abort.  */
724  yyabortlab:
725    yyresult = 1;
726    goto yyreturn;
727
728  yyreturn:
729    if (yychar != yyempty_)
730      yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
731
732    /* Do not reclaim the symbols of the rule which action triggered
733       this YYABORT or YYACCEPT.  */
734    yypop_ (yylen);
735    while (yystate_stack_.height () != 1)
736      {
737        yydestruct_ ("Cleanup: popping",
738                   yystos_[yystate_stack_[0]],
739                   &yysemantic_stack_[0],
740                   &yylocation_stack_[0]);
741        yypop_ ();
742      }
743
744    return yyresult;
745  }
746
747  // Generate an error message.
748  std::string
749  GunParser::yysyntax_error_ (int yystate, int tok)
750  {
751    std::string res;
752    YYUSE (yystate);
753#if YYERROR_VERBOSE
754    int yyn = yypact_[yystate];
755    if (yypact_ninf_ < yyn && yyn <= yylast_)
756      {
757        /* Start YYX at -YYN if negative to avoid negative indexes in
758           YYCHECK.  */
759        int yyxbegin = yyn < 0 ? -yyn : 0;
760
761        /* Stay within bounds of both yycheck and yytname.  */
762        int yychecklim = yylast_ - yyn + 1;
763        int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
764        int count = 0;
765        for (int x = yyxbegin; x < yyxend; ++x)
766          if (yycheck_[x + yyn] == x && x != yyterror_)
767            ++count;
768
769        // FIXME: This method of building the message is not compatible
770        // with internationalization.  It should work like yacc.c does it.
771        // That is, first build a string that looks like this:
772        // "syntax error, unexpected %s or %s or %s"
773        // Then, invoke YY_ on this string.
774        // Finally, use the string as a format to output
775        // yytname_[tok], etc.
776        // Until this gets fixed, this message appears in English only.
777        res = "syntax error, unexpected ";
778        res += yytnamerr_ (yytname_[tok]);
779        if (count < 5)
780          {
781            count = 0;
782            for (int x = yyxbegin; x < yyxend; ++x)
783              if (yycheck_[x + yyn] == x && x != yyterror_)
784                {
785                  res += (!count++) ? ", expecting " : " or ";
786                  res += yytnamerr_ (yytname_[x]);
787                }
788          }
789      }
790    else
791#endif
792      res = YY_("syntax error");
793    return res;
794  }
795
796
797  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
798     STATE-NUM.  */
799  const signed char GunParser::yypact_ninf_ = -23;
800  const signed char
801  GunParser::yypact_[] =
802  {
803        -1,   -23,    19,    19,    19,    19,    19,    19,    19,    19,
804      19,    19,    19,    19,    19,    19,   -23,    18,     1,   -23,
805     -23,    19,   -23,   -23,   -23,   -23,   -23,   -23,   -23,   -23,
806       0,    11,   -23,   -23,   -23,   -23,   -23,   -23,   -23,   -23,
807     -23,    -1,   -23,    19,    19,   -23,   -23,   -23
808  };
809
810  /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
811     doesn't specify something else to do.  Zero means the default is an
812     error.  */
813  const unsigned char
814  GunParser::yydefact_[] =
815  {
816         0,     5,     0,     0,     0,     0,     0,     0,     0,     0,
817       0,     0,     0,     0,     0,     0,    20,     0,     0,     3,
818      24,     0,     6,    21,     7,     8,     9,    10,    11,    12,
819       0,     0,    13,    14,    15,    16,    17,    18,    19,     1,
820       2,     0,    25,     0,     0,     4,    22,    23
821  };
822
823  /* YYPGOTO[NTERM-NUM].  */
824  const signed char
825  GunParser::yypgoto_[] =
826  {
827       -23,   -23,   -23,   -22,    22,   -23,    29,   -21
828  };
829
830  /* YYDEFGOTO[NTERM-NUM].  */
831  const signed char
832  GunParser::yydefgoto_[] =
833  {
834        -1,    17,    18,    19,    30,    31,    32,    23
835  };
836
837  /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
838     positive, shift that token.  If negative, reduce the rule which
839     number is the opposite.  If zero, do what YYDEFACT says.  */
840  const signed char GunParser::yytable_ninf_ = -1;
841  const unsigned char
842  GunParser::yytable_[] =
843  {
844        42,    40,     1,     2,     3,     4,     5,     6,     7,     8,
845       9,    10,    11,    12,    13,    14,    15,    16,    39,    45,
846      43,    41,    46,    47,    22,    24,    25,    26,    27,    28,
847      29,    44,     0,    34,    35,    36,    37,    38,    20,    33,
848      21
849  };
850
851  /* YYCHECK.  */
852  const signed char
853  GunParser::yycheck_[] =
854  {
855        21,     0,     3,     4,     5,     6,     7,     8,     9,    10,
856      11,    12,    13,    14,    15,    16,    17,    18,     0,    41,
857      20,    20,    43,    44,     2,     3,     4,     5,     6,     7,
858       8,    20,    -1,    11,    12,    13,    14,    15,    19,    10,
859      21
860  };
861
862  /* STOS_[STATE-NUM] -- The (internal number of the) accessing
863     symbol of state STATE-NUM.  */
864  const unsigned char
865  GunParser::yystos_[] =
866  {
867         0,     3,     4,     5,     6,     7,     8,     9,    10,    11,
868      12,    13,    14,    15,    16,    17,    18,    23,    24,    25,
869      19,    21,    26,    29,    26,    26,    26,    26,    26,    26,
870      26,    27,    28,    28,    26,    26,    26,    26,    26,     0,
871       0,    20,    29,    20,    20,    25,    29,    29
872  };
873
874#if YYDEBUG
875  /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
876     to YYLEX-NUM.  */
877  const unsigned short int
878  GunParser::yytoken_number_[] =
879  {
880         0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
881     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
882      44,    45
883  };
884#endif
885
886  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
887  const unsigned char
888  GunParser::yyr1_[] =
889  {
890         0,    22,    23,    24,    24,    25,    25,    25,    25,    25,
891      25,    25,    25,    25,    25,    25,    25,    25,    25,    25,
892      25,    26,    27,    28,    29,    29
893  };
894
895  /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
896  const unsigned char
897  GunParser::yyr2_[] =
898  {
899         0,     2,     2,     1,     3,     1,     2,     2,     2,     2,
900       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
901       1,     1,     3,     3,     1,     2
902  };
903
904#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
905  /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
906     First, the terminals, then, starting at \a yyntokens_, nonterminals.  */
907  const char*
908  const GunParser::yytname_[] =
909  {
910    "T_END", "error", "$undefined", "T_AI", "T_PAI", "T_CA", "T_SA",
911  "T_TIM", "T_SO", "T_RD", "T_SPD", "T_MODA", "T_MODB", "T_FFB", "T_FFP",
912  "T_FB", "T_FP", "T_SK", "T_LOOP", "NUMBER", "','", "'-'", "$accept",
913  "gun_description", "gun_command_list", "gun_command", "args1", "args2",
914  "args3", "number", 0
915  };
916#endif
917
918#if YYDEBUG
919  /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
920  const GunParser::rhs_number_type
921  GunParser::yyrhs_[] =
922  {
923        23,     0,    -1,    24,     0,    -1,    25,    -1,    24,    20,
924      25,    -1,     3,    -1,     4,    26,    -1,     5,    26,    -1,
925       6,    26,    -1,     7,    26,    -1,     8,    26,    -1,     9,
926      26,    -1,    10,    26,    -1,    11,    28,    -1,    12,    28,
927      -1,    13,    26,    -1,    14,    26,    -1,    15,    26,    -1,
928      16,    26,    -1,    17,    26,    -1,    18,    -1,    29,    -1,
929      26,    20,    29,    -1,    27,    20,    29,    -1,    19,    -1,
930      21,    29,    -1
931  };
932
933  /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
934     YYRHS.  */
935  const unsigned char
936  GunParser::yyprhs_[] =
937  {
938         0,     0,     3,     6,     8,    12,    14,    17,    20,    23,
939      26,    29,    32,    35,    38,    41,    44,    47,    50,    53,
940      56,    58,    60,    64,    68,    70
941  };
942
943  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
944  const unsigned char
945  GunParser::yyrline_[] =
946  {
947         0,    76,    76,    80,    81,    85,    86,    87,    88,    89,
948      90,    91,    92,    93,    94,    95,    98,   101,   104,   107,
949     109,   112,   113,   114,   117,   118
950  };
951
952  // Print the state stack on the debug stream.
953  void
954  GunParser::yystack_print_ ()
955  {
956    *yycdebug_ << "Stack now";
957    for (state_stack_type::const_iterator i = yystate_stack_.begin ();
958         i != yystate_stack_.end (); ++i)
959      *yycdebug_ << ' ' << *i;
960    *yycdebug_ << std::endl;
961  }
962
963  // Report on the debug stream that the rule \a yyrule is going to be reduced.
964  void
965  GunParser::yy_reduce_print_ (int yyrule)
966  {
967    unsigned int yylno = yyrline_[yyrule];
968    int yynrhs = yyr2_[yyrule];
969    /* Print the symbols being reduced, and their result.  */
970    *yycdebug_ << "Reducing stack by rule " << yyrule - 1
971               << " (line " << yylno << "):" << std::endl;
972    /* The symbols being reduced.  */
973    for (int yyi = 0; yyi < yynrhs; yyi++)
974      YY_SYMBOL_PRINT ("   $" << yyi + 1 << " =",
975                       yyrhs_[yyprhs_[yyrule] + yyi],
976                       &(yysemantic_stack_[(yynrhs) - (yyi + 1)]),
977                       &(yylocation_stack_[(yynrhs) - (yyi + 1)]));
978  }
979#endif // YYDEBUG
980
981  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
982  GunParser::token_number_type
983  GunParser::yytranslate_ (int t)
984  {
985    static
986    const token_number_type
987    translate_table[] =
988    {
989           0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
990       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
991       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
992       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
993       2,     2,     2,     2,    20,    21,     2,     2,     2,     2,
994       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
995       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
996       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
997       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
998       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
999       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1000       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1001       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1002       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1003       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1004       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1005       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1006       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1007       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1008       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1009       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1010       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1011       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1012       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1013       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
1014       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
1015       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
1016      15,    16,    17,    18,    19
1017    };
1018    if ((unsigned int) t <= yyuser_token_number_max_)
1019      return translate_table[t];
1020    else
1021      return yyundef_token_;
1022  }
1023
1024  const int GunParser::yyeof_ = 0;
1025  const int GunParser::yylast_ = 40;
1026  const int GunParser::yynnts_ = 8;
1027  const int GunParser::yyempty_ = -2;
1028  const int GunParser::yyfinal_ = 39;
1029  const int GunParser::yyterror_ = 1;
1030  const int GunParser::yyerrcode_ = 256;
1031  const int GunParser::yyntokens_ = 22;
1032
1033  const unsigned int GunParser::yyuser_token_number_max_ = 274;
1034  const GunParser::token_number_type GunParser::yyundef_token_ = 2;
1035
1036
1037} // orbital
1038
1039/* Line 1053 of lalr1.cc  */
1040#line 1041 "generated/gun-parser.cpp"
1041
1042
1043/* Line 1055 of lalr1.cc  */
1044#line 121 "gun-parser.y"
1045
1046
1047void orbital::GunParser::error(const GunParser::location_type& l,
1048                               const std::string& m)
1049{
1050    gc.Error(l, m);
1051}
1052
1053
Note: See TracBrowser for help on using the repository browser.