g2o
bison_parser.cpp
Go to the documentation of this file.
1 
2 /* A Bison parser, made by GNU Bison 2.4.1. */
3 
4 /* Skeleton implementation for Bison LALR(1) parsers in C++
5 
6  Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software
7  Foundation, Inc.
8 
9  This program is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 
22 /* As a special exception, you may create a larger work that contains
23  part or all of the Bison parser skeleton and distribute that work
24  under terms of your choice, so long as that work isn't itself a
25  parser generator using the skeleton or a modified version thereof
26  as a parser skeleton. Alternatively, if you modify or redistribute
27  the parser skeleton itself, you may (at your option) remove this
28  special exception, which will cause the skeleton and the resulting
29  Bison output files to be licensed under the GNU General Public
30  License without this special exception.
31 
32  This special exception was added by the Free Software Foundation in
33  version 2.2 of Bison. */
34 
35 // Take the name prefix into account.
36 #define yylex SlamParserlex
37 
38 /* First part of user declarations. */
39 
40 /* Line 311 of lalr1.cc */
41 #line 1 "parser.yy"
42  /*** C/C++ Declarations ***/
43 
44 #include <stdio.h>
45 #include <string>
46 #include <vector>
47 
48 #include "commands.h"
49 
50 
51 
52 /* Line 311 of lalr1.cc */
53 #line 54 "bison_parser.cpp"
54 
55 
56 #include "bison_parser.h"
57 
58 /* User implementation prologue. */
59 
60 /* Line 317 of lalr1.cc */
61 #line 85 "parser.yy"
62 
63 
64 #include "driver.h"
65 #include "scanner.h"
66 #include "slam_context.h"
67 
68 /* this "connects" the bison parser in the driver to the flex scanner class
69  * object. it defines the yylex() function call to pull the next token from the
70  * current lexer object of the driver context. */
71 #undef yylex
72 #define yylex driver.lexer->lex
73 
74 
75 
76 /* Line 317 of lalr1.cc */
77 #line 78 "bison_parser.cpp"
78 
79 #ifndef YY_
80 # if YYENABLE_NLS
81 # if ENABLE_NLS
82 # include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
83 # define YY_(msgid) dgettext ("bison-runtime", msgid)
84 # endif
85 # endif
86 # ifndef YY_
87 # define YY_(msgid) msgid
88 # endif
89 #endif
90 
91 /* Suppress unused-variable warnings by "using" E. */
92 #define YYUSE(e) ((void) (e))
93 
94 /* Enable debugging if requested. */
95 #if YYDEBUG
96 
97 /* A pseudo ostream that takes yydebug_ into account. */
98 # define YYCDEBUG if (yydebug_) (*yycdebug_)
99 
100 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
101 do { \
102  if (yydebug_) \
103  { \
104  *yycdebug_ << Title << ' '; \
105  yy_symbol_print_ ((Type), (Value), (Location)); \
106  *yycdebug_ << std::endl; \
107  } \
108 } while (false)
109 
110 # define YY_REDUCE_PRINT(Rule) \
111 do { \
112  if (yydebug_) \
113  yy_reduce_print_ (Rule); \
114 } while (false)
115 
116 # define YY_STACK_PRINT() \
117 do { \
118  if (yydebug_) \
119  yystack_print_ (); \
120 } while (false)
121 
122 #else /* !YYDEBUG */
123 
124 # define YYCDEBUG if (false) std::cerr
125 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
126 # define YY_REDUCE_PRINT(Rule)
127 # define YY_STACK_PRINT()
128 
129 #endif /* !YYDEBUG */
130 
131 #define yyerrok (yyerrstatus_ = 0)
132 #define yyclearin (yychar = yyempty_)
133 
134 #define YYACCEPT goto yyacceptlab
135 #define YYABORT goto yyabortlab
136 #define YYERROR goto yyerrorlab
137 #define YYRECOVERING() (!!yyerrstatus_)
138 
139 
140 /* Line 380 of lalr1.cc */
141 #line 1 "[Bison:b4_percent_define_default]"
142 
143 namespace SlamParser {
144 
145 /* Line 380 of lalr1.cc */
146 #line 147 "bison_parser.cpp"
147 #if YYERROR_VERBOSE
148 
149  /* Return YYSTR after stripping away unnecessary quotes and
150  backslashes, so that it's suitable for yyerror. The heuristic is
151  that double-quoting is unnecessary unless the string contains an
152  apostrophe, a comma, or backslash (other than backslash-backslash).
153  YYSTR is taken from yytname. */
154  std::string
155  Parser::yytnamerr_ (const char *yystr)
156  {
157  if (*yystr == '"')
158  {
159  std::string yyr = "";
160  char const *yyp = yystr;
161 
162  for (;;)
163  switch (*++yyp)
164  {
165  case '\'':
166  case ',':
167  goto do_not_strip_quotes;
168 
169  case '\\':
170  if (*++yyp != '\\')
171  goto do_not_strip_quotes;
172  /* Fall through. */
173  default:
174  yyr += *yyp;
175  break;
176 
177  case '"':
178  return yyr;
179  }
180  do_not_strip_quotes: ;
181  }
182 
183  return yystr;
184  }
185 
186 #endif
187 
189  Parser::Parser (class Driver& driver_yyarg)
190  :
191 #if YYDEBUG
192  yydebug_ (false),
193  yycdebug_ (&std::cerr),
194 #endif
195  driver (driver_yyarg)
196  {
197  }
198 
200  {
201  }
202 
203 #if YYDEBUG
204  /*--------------------------------.
205  | Print this symbol on YYOUTPUT. |
206  `--------------------------------*/
207 
208  inline void
209  Parser::yy_symbol_value_print_ (int yytype,
210  const semantic_type* yyvaluep, const location_type* yylocationp)
211  {
212  YYUSE (yylocationp);
213  YYUSE (yyvaluep);
214  switch (yytype)
215  {
216  default:
217  break;
218  }
219  }
220 
221 
222  void
223  Parser::yy_symbol_print_ (int yytype,
224  const semantic_type* yyvaluep, const location_type* yylocationp)
225  {
226  *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
227  << ' ' << yytname_[yytype] << " ("
228  << *yylocationp << ": ";
229  yy_symbol_value_print_ (yytype, yyvaluep, yylocationp);
230  *yycdebug_ << ')';
231  }
232 #endif
233 
234  void
235  Parser::yydestruct_ (const char* yymsg,
236  int yytype, semantic_type* yyvaluep, location_type* yylocationp)
237  {
238  YYUSE (yylocationp);
239  YYUSE (yymsg);
240  YYUSE (yyvaluep);
241 
242  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
243 
244  switch (yytype)
245  {
246  case 6: /* "\"string\"" */
247 
248 /* Line 480 of lalr1.cc */
249 #line 79 "parser.yy"
250  { delete (yyvaluep->stringVal); };
251 
252 /* Line 480 of lalr1.cc */
253 #line 254 "bison_parser.cpp"
254  break;
255  case 19: /* "add_se2" */
256 
257 /* Line 480 of lalr1.cc */
258 #line 80 "parser.yy"
259  { delete (yyvaluep->commandNode); };
260 
261 /* Line 480 of lalr1.cc */
262 #line 263 "bison_parser.cpp"
263  break;
264  case 20: /* "add_se3" */
265 
266 /* Line 480 of lalr1.cc */
267 #line 80 "parser.yy"
268  { delete (yyvaluep->commandNode); };
269 
270 /* Line 480 of lalr1.cc */
271 #line 272 "bison_parser.cpp"
272  break;
273  case 21: /* "fix_node" */
274 
275 /* Line 480 of lalr1.cc */
276 #line 80 "parser.yy"
277  { delete (yyvaluep->commandNode); };
278 
279 /* Line 480 of lalr1.cc */
280 #line 281 "bison_parser.cpp"
281  break;
282  case 22: /* "solve_state" */
283 
284 /* Line 480 of lalr1.cc */
285 #line 80 "parser.yy"
286  { delete (yyvaluep->commandNode); };
287 
288 /* Line 480 of lalr1.cc */
289 #line 290 "bison_parser.cpp"
290  break;
291  case 23: /* "query_state" */
292 
293 /* Line 480 of lalr1.cc */
294 #line 80 "parser.yy"
295  { delete (yyvaluep->commandNode); };
296 
297 /* Line 480 of lalr1.cc */
298 #line 299 "bison_parser.cpp"
299  break;
300  case 24: /* "command" */
301 
302 /* Line 480 of lalr1.cc */
303 #line 80 "parser.yy"
304  { delete (yyvaluep->commandNode); };
305 
306 /* Line 480 of lalr1.cc */
307 #line 308 "bison_parser.cpp"
308  break;
309 
310  default:
311  break;
312  }
313  }
314 
315  void
316  Parser::yypop_ (unsigned int n)
317  {
318  yystate_stack_.pop (n);
321  }
322 
323 #if YYDEBUG
324  std::ostream&
325  Parser::debug_stream () const
326  {
327  return *yycdebug_;
328  }
329 
330  void
331  Parser::set_debug_stream (std::ostream& o)
332  {
333  yycdebug_ = &o;
334  }
335 
336 
337  Parser::debug_level_type
338  Parser::debug_level () const
339  {
340  return yydebug_;
341  }
342 
343  void
344  Parser::set_debug_level (debug_level_type l)
345  {
346  yydebug_ = l;
347  }
348 #endif
349 
350  int
352  {
354  int yychar = yyempty_;
355  int yytoken = 0;
356 
357  /* State. */
358  int yyn;
359  int yylen = 0;
360  int yystate = 0;
361 
362  /* Error handling. */
363  int yynerrs_ = 0;
364  int yyerrstatus_ = 0;
365 
367  semantic_type yylval;
369  location_type yylloc;
371  location_type yyerror_range[2];
372 
374  semantic_type yyval;
376  location_type yyloc;
377 
378  int yyresult;
379 
380  YYCDEBUG << "Starting parse" << std::endl;
381 
382 
383  /* User initialization code. */
384 
385 /* Line 553 of lalr1.cc */
386 #line 38 "parser.yy"
387 {
388  // initialize the initial location object
389  yylloc.begin.filename = yylloc.end.filename = &driver.streamname;
390 }
391 
392 /* Line 553 of lalr1.cc */
393 #line 394 "bison_parser.cpp"
394 
395  /* Initialize the stacks. The initial state will be pushed in
396  yynewstate, since the latter expects the semantical and the
397  location values to have been already stored, initialize these
398  stacks with a primary value. */
402  yysemantic_stack_.push (yylval);
403  yylocation_stack_.push (yylloc);
404 
405  /* New state. */
406  yynewstate:
407  yystate_stack_.push (yystate);
408  YYCDEBUG << "Entering state " << yystate << std::endl;
409 
410  /* Accept? */
411  if (yystate == yyfinal_)
412  goto yyacceptlab;
413 
414  goto yybackup;
415 
416  /* Backup. */
417  yybackup:
418 
419  /* Try to take a decision without lookahead. */
420  yyn = yypact_[yystate];
421  if (yyn == yypact_ninf_)
422  goto yydefault;
423 
424  /* Read a lookahead token. */
425  if (yychar == yyempty_)
426  {
427  YYCDEBUG << "Reading a token: ";
428  yychar = yylex (&yylval, &yylloc);
429  }
430 
431 
432  /* Convert token to internal form. */
433  if (yychar <= yyeof_)
434  {
435  yychar = yytoken = yyeof_;
436  YYCDEBUG << "Now at end of input." << std::endl;
437  }
438  else
439  {
440  yytoken = yytranslate_ (yychar);
441  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
442  }
443 
444  /* If the proper action on seeing token YYTOKEN is to reduce or to
445  detect an error, take that action. */
446  yyn += yytoken;
447  if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yytoken)
448  goto yydefault;
449 
450  /* Reduce or error. */
451  yyn = yytable_[yyn];
452  if (yyn <= 0)
453  {
454  if (yyn == 0 || yyn == yytable_ninf_)
455  goto yyerrlab;
456  yyn = -yyn;
457  goto yyreduce;
458  }
459 
460  /* Shift the lookahead token. */
461  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
462 
463  /* Discard the token being shifted. */
464  yychar = yyempty_;
465 
466  yysemantic_stack_.push (yylval);
467  yylocation_stack_.push (yylloc);
468 
469  /* Count tokens shifted since error; after three, turn off error
470  status. */
471  if (yyerrstatus_)
472  --yyerrstatus_;
473 
474  yystate = yyn;
475  goto yynewstate;
476 
477  /*-----------------------------------------------------------.
478  | yydefault -- do the default action for the current state. |
479  `-----------------------------------------------------------*/
480  yydefault:
481  yyn = yydefact_[yystate];
482  if (yyn == 0)
483  goto yyerrlab;
484  goto yyreduce;
485 
486  /*-----------------------------.
487  | yyreduce -- Do a reduction. |
488  `-----------------------------*/
489  yyreduce:
490  yylen = yyr2_[yyn];
491  /* If YYLEN is nonzero, implement the default value of the action:
492  `$$ = $1'. Otherwise, use the top of the stack.
493 
494  Otherwise, the following line sets YYVAL to garbage.
495  This behavior is undocumented and Bison
496  users should not rely upon it. */
497  if (yylen)
498  yyval = yysemantic_stack_[yylen - 1];
499  else
500  yyval = yysemantic_stack_[0];
501 
502  {
504  YYLLOC_DEFAULT (yyloc, slice, yylen);
505  }
506  YY_REDUCE_PRINT (yyn);
507  switch (yyn)
508  {
509  case 2:
510 
511 /* Line 678 of lalr1.cc */
512 #line 104 "parser.yy"
513  {
514  (yyval.intList) = new std::vector<int>;
515  (yyval.intList)->push_back((yysemantic_stack_[(1) - (1)].integerVal));
516  }
517  break;
518 
519  case 3:
520 
521 /* Line 678 of lalr1.cc */
522 #line 109 "parser.yy"
523  {
524  (yysemantic_stack_[(2) - (1)].intList)->push_back((yysemantic_stack_[(2) - (2)].integerVal));
525  (yyval.intList) = (yysemantic_stack_[(2) - (1)].intList);
526  }
527  break;
528 
529  case 4:
530 
531 /* Line 678 of lalr1.cc */
532 #line 115 "parser.yy"
533  {
534  (yyval.doubleVal) = (yysemantic_stack_[(1) - (1)].integerVal);
535  }
536  break;
537 
538  case 5:
539 
540 /* Line 678 of lalr1.cc */
541 #line 119 "parser.yy"
542  {
543  (yyval.doubleVal) = (yysemantic_stack_[(1) - (1)].doubleVal);
544  }
545  break;
546 
547  case 6:
548 
549 /* Line 678 of lalr1.cc */
550 #line 124 "parser.yy"
551  {
552  (yyval.commandNode) = new AddNode(*(yysemantic_stack_[(3) - (2)].stringVal), (yysemantic_stack_[(3) - (3)].integerVal), 3);
553  delete (yysemantic_stack_[(3) - (2)].stringVal);
554  }
555  break;
556 
557  case 7:
558 
559 /* Line 678 of lalr1.cc */
560 #line 129 "parser.yy"
561  {
562  std::vector<double> values;
563  values.push_back((yysemantic_stack_[(6) - (4)].doubleVal));
564  values.push_back((yysemantic_stack_[(6) - (5)].doubleVal));
565  values.push_back((yysemantic_stack_[(6) - (6)].doubleVal));
566  (yyval.commandNode) = new AddNode(*(yysemantic_stack_[(6) - (2)].stringVal), (yysemantic_stack_[(6) - (3)].integerVal), 3, values);
567  delete (yysemantic_stack_[(6) - (2)].stringVal);
568  }
569  break;
570 
571  case 8:
572 
573 /* Line 678 of lalr1.cc */
574 #line 138 "parser.yy"
575  {
576  std::vector<double> values;
577  values.push_back((yysemantic_stack_[(14) - (6)].doubleVal));
578  values.push_back((yysemantic_stack_[(14) - (7)].doubleVal));
579  values.push_back((yysemantic_stack_[(14) - (8)].doubleVal));
580  std::vector<double> information;
581  information.push_back((yysemantic_stack_[(14) - (9)].doubleVal));
582  information.push_back((yysemantic_stack_[(14) - (10)].doubleVal));
583  information.push_back((yysemantic_stack_[(14) - (11)].doubleVal));
584  information.push_back((yysemantic_stack_[(14) - (12)].doubleVal));
585  information.push_back((yysemantic_stack_[(14) - (13)].doubleVal));
586  information.push_back((yysemantic_stack_[(14) - (14)].doubleVal));
587  (yyval.commandNode) = new AddEdge(*(yysemantic_stack_[(14) - (2)].stringVal), (yysemantic_stack_[(14) - (3)].integerVal), values.size(), (yysemantic_stack_[(14) - (4)].integerVal), (yysemantic_stack_[(14) - (5)].integerVal), values, information);
588  delete (yysemantic_stack_[(14) - (2)].stringVal);
589  }
590  break;
591 
592  case 9:
593 
594 /* Line 678 of lalr1.cc */
595 #line 155 "parser.yy"
596  {
597  (yyval.commandNode) = new AddNode(*(yysemantic_stack_[(3) - (2)].stringVal), (yysemantic_stack_[(3) - (3)].integerVal), 6);
598  delete (yysemantic_stack_[(3) - (2)].stringVal);
599  }
600  break;
601 
602  case 10:
603 
604 /* Line 678 of lalr1.cc */
605 #line 160 "parser.yy"
606  {
607  (yyval.commandNode) = new AddNode(*(yysemantic_stack_[(9) - (2)].stringVal), (yysemantic_stack_[(9) - (3)].integerVal), 6);
608  delete (yysemantic_stack_[(9) - (2)].stringVal);
609  }
610  break;
611 
612  case 11:
613 
614 /* Line 678 of lalr1.cc */
615 #line 165 "parser.yy"
616  {
617  std::vector<double> values;
618  values.push_back((yysemantic_stack_[(32) - (6)].doubleVal));
619  values.push_back((yysemantic_stack_[(32) - (7)].doubleVal));
620  values.push_back((yysemantic_stack_[(32) - (8)].doubleVal));
621  values.push_back((yysemantic_stack_[(32) - (9)].doubleVal));
622  values.push_back((yysemantic_stack_[(32) - (10)].doubleVal));
623  values.push_back((yysemantic_stack_[(32) - (11)].doubleVal));
624  std::vector<double> information;
625  information.push_back((yysemantic_stack_[(32) - (12)].doubleVal));
626  information.push_back((yysemantic_stack_[(32) - (13)].doubleVal));
627  information.push_back((yysemantic_stack_[(32) - (14)].doubleVal));
628  information.push_back((yysemantic_stack_[(32) - (15)].doubleVal));
629  information.push_back((yysemantic_stack_[(32) - (16)].doubleVal));
630  information.push_back((yysemantic_stack_[(32) - (17)].doubleVal));
631  information.push_back((yysemantic_stack_[(32) - (18)].doubleVal));
632  information.push_back((yysemantic_stack_[(32) - (19)].doubleVal));
633  information.push_back((yysemantic_stack_[(32) - (20)].doubleVal));
634  information.push_back((yysemantic_stack_[(32) - (21)].doubleVal));
635  information.push_back((yysemantic_stack_[(32) - (22)].doubleVal));
636  information.push_back((yysemantic_stack_[(32) - (23)].doubleVal));
637  information.push_back((yysemantic_stack_[(32) - (24)].doubleVal));
638  information.push_back((yysemantic_stack_[(32) - (25)].doubleVal));
639  information.push_back((yysemantic_stack_[(32) - (26)].doubleVal));
640  information.push_back((yysemantic_stack_[(32) - (27)].doubleVal));
641  information.push_back((yysemantic_stack_[(32) - (28)].doubleVal));
642  information.push_back((yysemantic_stack_[(32) - (29)].doubleVal));
643  information.push_back((yysemantic_stack_[(32) - (30)].doubleVal));
644  information.push_back((yysemantic_stack_[(32) - (31)].doubleVal));
645  information.push_back((yysemantic_stack_[(32) - (32)].doubleVal));
646  (yyval.commandNode) = new AddEdge(*(yysemantic_stack_[(32) - (2)].stringVal), (yysemantic_stack_[(32) - (3)].integerVal), values.size(), (yysemantic_stack_[(32) - (4)].integerVal), (yysemantic_stack_[(32) - (5)].integerVal), values, information);
647  delete (yysemantic_stack_[(32) - (2)].stringVal);
648  }
649  break;
650 
651  case 12:
652 
653 /* Line 678 of lalr1.cc */
654 #line 200 "parser.yy"
655  {
656  std::vector<int> values;
657  values.push_back((yysemantic_stack_[(2) - (2)].integerVal));
658  (yyval.commandNode) = new FixNode("FIX", values);
659  }
660  break;
661 
662  case 13:
663 
664 /* Line 678 of lalr1.cc */
665 #line 207 "parser.yy"
666  {
667  (yyval.commandNode) = new SolveSate("SOLVE_STATE");
668  }
669  break;
670 
671  case 14:
672 
673 /* Line 678 of lalr1.cc */
674 #line 212 "parser.yy"
675  {
676  (yyval.commandNode) = new QueryState("QUERY_STATE");
677  }
678  break;
679 
680  case 15:
681 
682 /* Line 678 of lalr1.cc */
683 #line 216 "parser.yy"
684  {
685  (yyval.commandNode) = new QueryState("QUERY_STATE", *(yysemantic_stack_[(2) - (2)].intList));
686  delete (yysemantic_stack_[(2) - (2)].intList);
687  }
688  break;
689 
690  case 16:
691 
692 /* Line 678 of lalr1.cc */
693 #line 222 "parser.yy"
694  {
695  (yyval.commandNode) = (yysemantic_stack_[(1) - (1)].commandNode);
696  }
697  break;
698 
699  case 17:
700 
701 /* Line 678 of lalr1.cc */
702 #line 226 "parser.yy"
703  {
704  (yyval.commandNode) = (yysemantic_stack_[(1) - (1)].commandNode);
705  }
706  break;
707 
708  case 18:
709 
710 /* Line 678 of lalr1.cc */
711 #line 230 "parser.yy"
712  {
713  (yyval.commandNode) = (yysemantic_stack_[(1) - (1)].commandNode);
714  }
715  break;
716 
717  case 19:
718 
719 /* Line 678 of lalr1.cc */
720 #line 234 "parser.yy"
721  {
722  (yyval.commandNode) = (yysemantic_stack_[(1) - (1)].commandNode);
723  }
724  break;
725 
726  case 20:
727 
728 /* Line 678 of lalr1.cc */
729 #line 238 "parser.yy"
730  {
731  (yyval.commandNode) = (yysemantic_stack_[(1) - (1)].commandNode);
732  }
733  break;
734 
735  case 23:
736 
737 /* Line 678 of lalr1.cc */
738 #line 245 "parser.yy"
739  {
740  driver.slamContext.process((yysemantic_stack_[(3) - (2)].commandNode));
741  delete (yysemantic_stack_[(3) - (2)].commandNode);
742  }
743  break;
744 
745 
746 
747 /* Line 678 of lalr1.cc */
748 #line 749 "bison_parser.cpp"
749  default:
750  break;
751  }
752  YY_SYMBOL_PRINT ("-> $$ =", yyr1_[yyn], &yyval, &yyloc);
753 
754  yypop_ (yylen);
755  yylen = 0;
756  YY_STACK_PRINT ();
757 
758  yysemantic_stack_.push (yyval);
759  yylocation_stack_.push (yyloc);
760 
761  /* Shift the result of the reduction. */
762  yyn = yyr1_[yyn];
763  yystate = yypgoto_[yyn - yyntokens_] + yystate_stack_[0];
764  if (0 <= yystate && yystate <= yylast_
765  && yycheck_[yystate] == yystate_stack_[0])
766  yystate = yytable_[yystate];
767  else
768  yystate = yydefgoto_[yyn - yyntokens_];
769  goto yynewstate;
770 
771  /*------------------------------------.
772  | yyerrlab -- here on detecting error |
773  `------------------------------------*/
774  yyerrlab:
775  /* If not already recovering from an error, report this error. */
776  if (!yyerrstatus_)
777  {
778  ++yynerrs_;
779  error (yylloc, yysyntax_error_ (yystate, yytoken));
780  }
781 
782  yyerror_range[0] = yylloc;
783  if (yyerrstatus_ == 3)
784  {
785  /* If just tried and failed to reuse lookahead token after an
786  error, discard it. */
787 
788  if (yychar <= yyeof_)
789  {
790  /* Return failure if at end of input. */
791  if (yychar == yyeof_)
792  YYABORT;
793  }
794  else
795  {
796  yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
797  yychar = yyempty_;
798  }
799  }
800 
801  /* Else will try to reuse lookahead token after shifting the error
802  token. */
803  goto yyerrlab1;
804 
805 
806  /*---------------------------------------------------.
807  | yyerrorlab -- error raised explicitly by YYERROR. |
808  `---------------------------------------------------*/
809  yyerrorlab:
810 
811  /* Pacify compilers like GCC when the user code never invokes
812  YYERROR and the label yyerrorlab therefore never appears in user
813  code. */
814  if (false)
815  goto yyerrorlab;
816 
817  yyerror_range[0] = yylocation_stack_[yylen - 1];
818  /* Do not reclaim the symbols of the rule which action triggered
819  this YYERROR. */
820  yypop_ (yylen);
821  yylen = 0;
822  yystate = yystate_stack_[0];
823  goto yyerrlab1;
824 
825  /*-------------------------------------------------------------.
826  | yyerrlab1 -- common code for both syntax error and YYERROR. |
827  `-------------------------------------------------------------*/
828  yyerrlab1:
829  yyerrstatus_ = 3; /* Each real token shifted decrements this. */
830 
831  for (;;)
832  {
833  yyn = yypact_[yystate];
834  if (yyn != yypact_ninf_)
835  {
836  yyn += yyterror_;
837  if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
838  {
839  yyn = yytable_[yyn];
840  if (0 < yyn)
841  break;
842  }
843  }
844 
845  /* Pop the current state because it cannot handle the error token. */
846  if (yystate_stack_.height () == 1)
847  YYABORT;
848 
849  yyerror_range[0] = yylocation_stack_[0];
850  yydestruct_ ("Error: popping",
851  yystos_[yystate],
853  yypop_ ();
854  yystate = yystate_stack_[0];
855  YY_STACK_PRINT ();
856  }
857 
858  yyerror_range[1] = yylloc;
859  // Using YYLLOC is tempting, but would change the location of
860  // the lookahead. YYLOC is available though.
861  YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
862  yysemantic_stack_.push (yylval);
863  yylocation_stack_.push (yyloc);
864 
865  /* Shift the error token. */
866  YY_SYMBOL_PRINT ("Shifting", yystos_[yyn],
868 
869  yystate = yyn;
870  goto yynewstate;
871 
872  /* Accept. */
873  yyacceptlab:
874  yyresult = 0;
875  goto yyreturn;
876 
877  /* Abort. */
878  yyabortlab:
879  yyresult = 1;
880  goto yyreturn;
881 
882  yyreturn:
883  if (yychar != yyempty_)
884  yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
885 
886  /* Do not reclaim the symbols of the rule which action triggered
887  this YYABORT or YYACCEPT. */
888  yypop_ (yylen);
889  while (yystate_stack_.height () != 1)
890  {
891  yydestruct_ ("Cleanup: popping",
892  yystos_[yystate_stack_[0]],
893  &yysemantic_stack_[0],
894  &yylocation_stack_[0]);
895  yypop_ ();
896  }
897 
898  return yyresult;
899  }
900 
901  // Generate an error message.
902  std::string
903  Parser::yysyntax_error_ (int yystate, int tok)
904  {
905  std::string res;
906  YYUSE (yystate);
907 #if YYERROR_VERBOSE
908  int yyn = yypact_[yystate];
909  if (yypact_ninf_ < yyn && yyn <= yylast_)
910  {
911  /* Start YYX at -YYN if negative to avoid negative indexes in
912  YYCHECK. */
913  int yyxbegin = yyn < 0 ? -yyn : 0;
914 
915  /* Stay within bounds of both yycheck and yytname. */
916  int yychecklim = yylast_ - yyn + 1;
917  int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
918  int count = 0;
919  for (int x = yyxbegin; x < yyxend; ++x)
920  if (yycheck_[x + yyn] == x && x != yyterror_)
921  ++count;
922 
923  // FIXME: This method of building the message is not compatible
924  // with internationalization. It should work like yacc.c does it.
925  // That is, first build a string that looks like this:
926  // "syntax error, unexpected %s or %s or %s"
927  // Then, invoke YY_ on this string.
928  // Finally, use the string as a format to output
929  // yytname_[tok], etc.
930  // Until this gets fixed, this message appears in English only.
931  res = "syntax error, unexpected ";
932  res += yytnamerr_ (yytname_[tok]);
933  if (count < 5)
934  {
935  count = 0;
936  for (int x = yyxbegin; x < yyxend; ++x)
937  if (yycheck_[x + yyn] == x && x != yyterror_)
938  {
939  res += (!count++) ? ", expecting " : " or ";
940  res += yytnamerr_ (yytname_[x]);
941  }
942  }
943  }
944  else
945 #endif
946  res = YY_("syntax error");
947  return res;
948  }
949 
950 
951  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
952  STATE-NUM. */
953  const signed char Parser::yypact_ninf_ = -24;
954  const signed char
955  Parser::yypact_[] =
956  {
957  -24, 54, -24, -24, -7, 1, -24, 10, -24, -24,
958  -24, -24, -24, 9, 31, 51, 52, 55, -24, -24,
959  56, -24, 4, 4, 58, 59, -24, -24, -24, 4,
960  4, 60, 61, 4, 4, 4, 4, -24, 4, 4,
961  4, 4, 4, 4, 4, 4, 4, -24, 4, 4,
962  4, 4, 4, 4, 4, 4, 4, 4, -24, 4,
963  4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
964  4, 4, 4, 4, 4, 4, 4, -24
965  };
966 
967  /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
968  doesn't specify something else to do. Zero means the default is an
969  error. */
970  const unsigned char
972  {
973  21, 0, 1, 22, 0, 0, 13, 14, 16, 17,
974  18, 19, 20, 0, 0, 0, 0, 0, 12, 2,
975  15, 23, 6, 9, 0, 0, 3, 4, 5, 0,
976  0, 0, 0, 0, 0, 0, 0, 7, 0, 0,
977  0, 0, 0, 0, 0, 0, 0, 10, 0, 0,
978  0, 0, 0, 0, 0, 0, 0, 0, 8, 0,
979  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
980  0, 0, 0, 0, 0, 0, 0, 11
981  };
982 
983  /* YYPGOTO[NTERM-NUM]. */
984  const signed char
985  Parser::yypgoto_[] =
986  {
987  -24, -24, -23, -24, -24, -24, -24, -24, -24, -24
988  };
989 
990  /* YYDEFGOTO[NTERM-NUM]. */
991  const signed char
993  {
994  -1, 20, 29, 8, 9, 10, 11, 12, 13, 1
995  };
996 
997  /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
998  positive, shift that token. If negative, reduce the rule which
999  number is the opposite. If zero, do what YYDEFACT says. */
1000  const signed char Parser::yytable_ninf_ = -1;
1001  const unsigned char
1002  Parser::yytable_[] =
1003  {
1004  30, 14, 15, 16, 17, 18, 33, 34, 27, 28,
1005  37, 38, 39, 40, 19, 41, 42, 43, 44, 45,
1006  46, 47, 48, 49, 21, 50, 51, 52, 53, 54,
1007  55, 56, 57, 58, 59, 22, 60, 61, 62, 63,
1008  64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
1009  74, 75, 76, 77, 2, 23, 24, 3, 0, 25,
1010  26, 4, 31, 32, 35, 36, 5, 6, 7
1011  };
1012 
1013  /* YYCHECK. */
1014  const signed char
1015  Parser::yycheck_[] =
1016  {
1017  23, 8, 9, 10, 11, 4, 29, 30, 4, 5,
1018  33, 34, 35, 36, 4, 38, 39, 40, 41, 42,
1019  43, 44, 45, 46, 15, 48, 49, 50, 51, 52,
1020  53, 54, 55, 56, 57, 4, 59, 60, 61, 62,
1021  63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
1022  73, 74, 75, 76, 0, 4, 4, 3, -1, 4,
1023  4, 7, 4, 4, 4, 4, 12, 13, 14
1024  };
1025 
1026  /* STOS_[STATE-NUM] -- The (internal number of the) accessing
1027  symbol of state STATE-NUM. */
1028  const unsigned char
1029  Parser::yystos_[] =
1030  {
1031  0, 25, 0, 3, 7, 12, 13, 14, 19, 20,
1032  21, 22, 23, 24, 8, 9, 10, 11, 4, 4,
1033  17, 15, 4, 4, 4, 4, 4, 4, 5, 18,
1034  18, 4, 4, 18, 18, 4, 4, 18, 18, 18,
1035  18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1036  18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1037  18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1038  18, 18, 18, 18, 18, 18, 18, 18
1039  };
1040 
1041 #if YYDEBUG
1042  /* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
1043  to YYLEX-NUM. */
1044  const unsigned short int
1045  Parser::yytoken_number_[] =
1046  {
1047  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1048  265, 266, 267, 268, 269, 59
1049  };
1050 #endif
1051 
1052  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1053  const unsigned char
1054  Parser::yyr1_[] =
1055  {
1056  0, 16, 17, 17, 18, 18, 19, 19, 19, 20,
1057  20, 20, 21, 22, 23, 23, 24, 24, 24, 24,
1058  24, 25, 25, 25
1059  };
1060 
1061  /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1062  const unsigned char
1063  Parser::yyr2_[] =
1064  {
1065  0, 2, 1, 2, 1, 1, 3, 6, 14, 3,
1066  9, 32, 2, 1, 1, 2, 1, 1, 1, 1,
1067  1, 0, 2, 3
1068  };
1069 
1070 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
1071  /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1072  First, the terminals, then, starting at \a yyntokens_, nonterminals. */
1073  const char*
1074  const Parser::yytname_[] =
1075  {
1076  "\"end of file\"", "error", "$undefined", "\"end of line\"",
1077  "\"integer\"", "\"double\"", "\"string\"", "\"ADD\"", "\"Vertex SE2\"",
1078  "\"Vertex SE3\"", "\"Edge SE2\"", "\"Edge SE3\"", "\"Fix\"",
1079  "\"Solve State\"", "\"Query State\"", "';'", "$accept", "int_list",
1080  "NUMBER", "add_se2", "add_se3", "fix_node", "solve_state", "query_state",
1081  "command", "start", 0
1082  };
1083 #endif
1084 
1085 #if YYDEBUG
1086  /* YYRHS -- A `-1'-separated list of the rules' RHS. */
1087  const Parser::rhs_number_type
1088  Parser::yyrhs_[] =
1089  {
1090  25, 0, -1, 4, -1, 17, 4, -1, 4, -1,
1091  5, -1, 7, 8, 4, -1, 7, 8, 4, 18,
1092  18, 18, -1, 7, 10, 4, 4, 4, 18, 18,
1093  18, 18, 18, 18, 18, 18, 18, -1, 7, 9,
1094  4, -1, 7, 9, 4, 18, 18, 18, 18, 18,
1095  18, -1, 7, 11, 4, 4, 4, 18, 18, 18,
1096  18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1097  18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
1098  18, 18, 18, 18, -1, 12, 4, -1, 13, -1,
1099  14, -1, 14, 17, -1, 19, -1, 20, -1, 21,
1100  -1, 22, -1, 23, -1, -1, 25, 3, -1, 25,
1101  24, 15, -1
1102  };
1103 
1104  /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
1105  YYRHS. */
1106  const unsigned char
1107  Parser::yyprhs_[] =
1108  {
1109  0, 0, 3, 5, 8, 10, 12, 16, 23, 38,
1110  42, 52, 85, 88, 90, 92, 95, 97, 99, 101,
1111  103, 105, 106, 109
1112  };
1113 
1114  /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
1115  const unsigned char
1116  Parser::yyrline_[] =
1117  {
1118  0, 103, 103, 108, 114, 118, 123, 128, 137, 154,
1119  159, 164, 199, 206, 211, 215, 221, 225, 229, 233,
1120  237, 242, 243, 244
1121  };
1122 
1123  // Print the state stack on the debug stream.
1124  void
1125  Parser::yystack_print_ ()
1126  {
1127  *yycdebug_ << "Stack now";
1129  i != yystate_stack_.end (); ++i)
1130  *yycdebug_ << ' ' << *i;
1131  *yycdebug_ << std::endl;
1132  }
1133 
1134  // Report on the debug stream that the rule \a yyrule is going to be reduced.
1135  void
1136  Parser::yy_reduce_print_ (int yyrule)
1137  {
1138  unsigned int yylno = yyrline_[yyrule];
1139  int yynrhs = yyr2_[yyrule];
1140  /* Print the symbols being reduced, and their result. */
1141  *yycdebug_ << "Reducing stack by rule " << yyrule - 1
1142  << " (line " << yylno << "):" << std::endl;
1143  /* The symbols being reduced. */
1144  for (int yyi = 0; yyi < yynrhs; yyi++)
1145  YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
1146  yyrhs_[yyprhs_[yyrule] + yyi],
1147  &(yysemantic_stack_[(yynrhs) - (yyi + 1)]),
1148  &(yylocation_stack_[(yynrhs) - (yyi + 1)]));
1149  }
1150 #endif // YYDEBUG
1151 
1152  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
1155  {
1156  static
1157  const token_number_type
1158  translate_table[] =
1159  {
1160  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1161  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1162  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1163  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1164  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1165  2, 2, 2, 2, 2, 2, 2, 2, 2, 15,
1166  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1167  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1168  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1169  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1170  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1171  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1172  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1173  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1174  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1175  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1176  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1177  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1178  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1179  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1180  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1181  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1182  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1183  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1184  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1185  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1186  5, 6, 7, 8, 9, 10, 11, 12, 13, 14
1187  };
1188  if ((unsigned int) t <= yyuser_token_number_max_)
1189  return translate_table[t];
1190  else
1191  return yyundef_token_;
1192  }
1193 
1194  const int Parser::yyeof_ = 0;
1195  const int Parser::yylast_ = 68;
1196  const int Parser::yynnts_ = 10;
1197  const int Parser::yyempty_ = -2;
1198  const int Parser::yyfinal_ = 2;
1199  const int Parser::yyterror_ = 1;
1200  const int Parser::yyerrcode_ = 256;
1201  const int Parser::yyntokens_ = 16;
1202 
1203  const unsigned int Parser::yyuser_token_number_max_ = 269;
1205 
1206 
1207 /* Line 1054 of lalr1.cc */
1208 #line 1 "[Bison:b4_percent_define_default]"
1209 
1210 } // SlamParser
1211 
1212 /* Line 1054 of lalr1.cc */
1213 #line 1214 "bison_parser.cpp"
1214 
1215 
1216 /* Line 1056 of lalr1.cc */
1217 #line 252 "parser.yy"
1218  /*** Additional Code ***/
1219 
1220 void SlamParser::Parser::error(const Parser::location_type& l, const std::string& m)
1221 {
1222  driver.error(l, m);
1223 }
1224 
static const int yyterror_
Definition: bison_parser.h:319
static const unsigned char yyr1_[]
For a rule, its LHS.
Definition: bison_parser.h:261
static const int yyerrcode_
Definition: bison_parser.h:320
token_number_type yytranslate_(int t)
Convert a scanner token number t to a symbol number.
virtual bool process(CommandNode *commandNode)
Protocol The SLAM executable accepts such as solving the and retrieving or vertices in the explicitly state the reprensentation poses are represented by poses by VERTEX_XYZRPY In the Quaternions and other representations could be but note that it is up to the SLAM algorithm to choose the internal representation of the angles The keyword is followed by a unique vertex ID and an optional initialization of the values
Definition: protocol.txt:7
position begin
Beginning of the located region.
Definition: location.hh:99
static const int yylast_
Definition: bison_parser.h:315
#define YY_STACK_PRINT()
virtual int parse()
void yydestruct_(const char *yymsg, int yytype, semantic_type *yyvaluep, location_type *yylocationp)
Reclaim the memory associated to a symbol.
static const token_number_type yyundef_token_
Definition: bison_parser.h:323
#define YYLLOC_DEFAULT(Current, Rhs, N)
Definition: bison_parser.h:90
static const unsigned int yyuser_token_number_max_
Definition: bison_parser.h:322
static const unsigned char yytable_[]
Definition: bison_parser.h:252
static const signed char yycheck_[]
Definition: bison_parser.h:255
static const int yyfinal_
Definition: bison_parser.h:318
static const signed char yypact_ninf_
Definition: bison_parser.h:237
semantic_stack_type yysemantic_stack_
The semantic value stack.
Definition: bison_parser.h:228
#define YYABORT
virtual void error(const location_type &loc, const std::string &msg)
state_stack_type yystate_stack_
The state stack.
Definition: bison_parser.h:226
class Driver & driver
Definition: bison_parser.h:326
std::string * filename
File name to which this position refers.
Definition: position.hh:93
virtual std::string yytnamerr_(const char *n)
Convert the symbol name n to a form suitable for a diagnostic.
void error(const class location &l, const std::string &m)
Definition: driver.cpp:72
#define YYDEBUG
Definition: bison_parser.h:69
Present a slice of the top of a stack.
Definition: stack.hh:111
const_iterator end() const
Definition: stack.hh:102
static const int yyeof_
Definition: bison_parser.h:313
static const signed char yypgoto_[]
Definition: bison_parser.h:244
unsigned char token_number_type
Internal symbol numbers.
Definition: bison_parser.h:233
#define YY_(msgid)
#define YYCDEBUG
stack< location_type > location_stack_type
location stack type.
Definition: bison_parser.h:223
if(POLICY CMP0020) cmake_policy(SET CMP0020 OLD) endif() if(Qt4_FOUND) endif() if(Qt5_FOUND) endif() ADD_LIBRARY(viewer_library $
Definition: CMakeLists.txt:2
Symbol semantic values.
Definition: bison_parser.h:119
void pop(unsigned int n=1)
Definition: stack.hh:88
#define YYUSE(e)
const_iterator begin() const
Definition: stack.hh:101
std::vector< int > * intList
Definition: bison_parser.h:129
static const signed char yypact_[]
For a state, the index in yytable_ of its portion.
Definition: bison_parser.h:236
#define yylex
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
class SlamContext & slamContext
Definition: driver.h:93
virtual std::string yysyntax_error_(int yystate, int tok)
stack< semantic_type > semantic_stack_type
Semantic value stack type.
Definition: bison_parser.h:221
Abstract a location.
Definition: location.hh:56
static const char *const yytname_[]
For a symbol, its name in clear.
Definition: bison_parser.h:267
void push(const T &t)
Definition: stack.hh:81
#define YY_REDUCE_PRINT(Rule)
static const signed char yytable_ninf_
Definition: bison_parser.h:253
static const int yyempty_
Definition: bison_parser.h:317
stack< state_type > state_stack_type
State stack type.
Definition: bison_parser.h:219
position end
End of the located region.
Definition: location.hh:101
static const int yyntokens_
Definition: bison_parser.h:321
class CommandNode * commandNode
Definition: bison_parser.h:128
static const int yynnts_
Definition: bison_parser.h:316
static const signed char yydefgoto_[]
Definition: bison_parser.h:245
std::string streamname
stream name (file or input stream) used for error messages.
Definition: driver.h:50
static const unsigned char yyr2_[]
For a rule, its RHS length.
Definition: bison_parser.h:263
void yypop_(unsigned int n=1)
Pop n symbols the three stacks.
location_stack_type yylocation_stack_
The location stack.
Definition: bison_parser.h:230
std::deque< state_type >::const_reverse_iterator const_iterator
Definition: stack.hh:55
static const unsigned char yystos_[]
For a state, its accessing symbol.
Definition: bison_parser.h:258
static const unsigned char yydefact_[]
Definition: bison_parser.h:242
Parser(class Driver &driver_yyarg)
Build a parser object.