g2o
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SlamParser::Parser Class Reference

A Bison parser. More...

#include <bison_parser.h>

Collaboration diagram for SlamParser::Parser:
Collaboration graph
[legend]

Classes

union  semantic_type
 Symbol semantic values. More...
 
struct  token
 Tokens. More...
 

Public Types

typedef location location_type
 Symbol locations. More...
 
typedef token::yytokentype token_type
 Token type. More...
 

Public Member Functions

 Parser (class Driver &driver_yyarg)
 Build a parser object. More...
 
virtual ~Parser ()
 
virtual int parse ()
 

Private Types

typedef int state_type
 State numbers. More...
 
typedef stack< state_typestate_stack_type
 State stack type. More...
 
typedef stack< semantic_typesemantic_stack_type
 Semantic value stack type. More...
 
typedef stack< location_typelocation_stack_type
 location stack type. More...
 
typedef unsigned char token_number_type
 Internal symbol numbers. More...
 

Private Member Functions

virtual void error (const location_type &loc, const std::string &msg)
 
virtual std::string yysyntax_error_ (int yystate, int tok)
 
virtual std::string yytnamerr_ (const char *n)
 Convert the symbol name n to a form suitable for a diagnostic. More...
 
token_number_type yytranslate_ (int t)
 Convert a scanner token number t to a symbol number. More...
 
void yydestruct_ (const char *yymsg, int yytype, semantic_type *yyvaluep, location_type *yylocationp)
 Reclaim the memory associated to a symbol. More...
 
void yypop_ (unsigned int n=1)
 Pop n symbols the three stacks. More...
 

Private Attributes

state_stack_type yystate_stack_
 The state stack. More...
 
semantic_stack_type yysemantic_stack_
 The semantic value stack. More...
 
location_stack_type yylocation_stack_
 The location stack. More...
 
class Driverdriver
 

Static Private Attributes

static const signed char yypact_ []
 For a state, the index in yytable_ of its portion. More...
 
static const signed char yypact_ninf_ = -24
 
static const unsigned char yydefact_ []
 
static const signed char yypgoto_ []
 
static const signed char yydefgoto_ []
 
static const unsigned char yytable_ []
 
static const signed char yytable_ninf_ = -1
 
static const signed char yycheck_ []
 
static const unsigned char yystos_ []
 For a state, its accessing symbol. More...
 
static const unsigned char yyr1_ []
 For a rule, its LHS. More...
 
static const unsigned char yyr2_ []
 For a rule, its RHS length. More...
 
static const char *const yytname_ []
 For a symbol, its name in clear. More...
 
static const int yyeof_ = 0
 
static const int yylast_ = 68
 
static const int yynnts_ = 10
 
static const int yyempty_ = -2
 
static const int yyfinal_ = 2
 
static const int yyterror_ = 1
 
static const int yyerrcode_ = 256
 
static const int yyntokens_ = 16
 
static const unsigned int yyuser_token_number_max_ = 269
 
static const token_number_type yyundef_token_ = 2
 

Detailed Description

A Bison parser.

Definition at line 114 of file bison_parser.h.

Member Typedef Documentation

location stack type.

Definition at line 223 of file bison_parser.h.

Symbol locations.

Definition at line 140 of file bison_parser.h.

Semantic value stack type.

Definition at line 221 of file bison_parser.h.

State stack type.

Definition at line 219 of file bison_parser.h.

typedef int SlamParser::Parser::state_type
private

State numbers.

Definition at line 217 of file bison_parser.h.

typedef unsigned char SlamParser::Parser::token_number_type
private

Internal symbol numbers.

Definition at line 233 of file bison_parser.h.

Token type.

Definition at line 163 of file bison_parser.h.

Constructor & Destructor Documentation

SlamParser::Parser::Parser ( class Driver driver_yyarg)

Build a parser object.

Definition at line 189 of file bison_parser.cpp.

190  :
191 #if YYDEBUG
192  yydebug_ (false),
193  yycdebug_ (&std::cerr),
194 #endif
195  driver (driver_yyarg)
196  {
197  }
class Driver & driver
Definition: bison_parser.h:326
SlamParser::Parser::~Parser ( )
virtual

Definition at line 199 of file bison_parser.cpp.

References yyntokens_, yytname_, and YYUSE.

200  {
201  }

Member Function Documentation

void SlamParser::Parser::error ( const location_type loc,
const std::string &  msg 
)
privatevirtual

Report a syntax error.

Parameters
locwhere the syntax error is found.
msga description of the syntax error.

Definition at line 1220 of file bison_parser.cpp.

References driver, and SlamParser::Driver::error().

Referenced by parse().

1221 {
1222  driver.error(l, m);
1223 }
class Driver & driver
Definition: bison_parser.h:326
void error(const class location &l, const std::string &m)
Definition: driver.cpp:72
int SlamParser::Parser::parse ( )
virtual

Parse.

Returns
0 iff parsing succeeded.

Lookahead and lookahead in internal form.

Semantic value of the lookahead.

Location of the lookahead.

The locations where the error started and ended.

$$.

$.

Definition at line 351 of file bison_parser.cpp.

References SlamParser::location::begin, SlamParser::Parser::semantic_type::commandNode, SlamParser::Parser::semantic_type::doubleVal, driver, SlamParser::location::end, error(), SlamParser::position::filename, SlamParser::Parser::semantic_type::intList, SlamParser::SlamContext::process(), SlamParser::stack< T, S >::push(), SlamParser::Driver::slamContext, SlamParser::Driver::streamname, values, YY_REDUCE_PRINT, YY_STACK_PRINT, YY_SYMBOL_PRINT, YYABORT, YYCDEBUG, yycheck_, yydefact_, yydefgoto_, yydestruct_(), yyempty_, yyeof_, yyfinal_, yylast_, yylex, YYLLOC_DEFAULT, yylocation_stack_, yyntokens_, yypact_, yypact_ninf_, yypgoto_, yypop_(), yyr1_, yyr2_, yysemantic_stack_, yystate_stack_, yystos_, yysyntax_error_(), yytable_, yytable_ninf_, yyterror_, and yytranslate_().

Referenced by SlamParser::Driver::parse_stream().

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  {
503  slice<location_type, location_stack_type> slice (yylocation_stack_, yylen);
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  }
static const int yyterror_
Definition: bison_parser.h:319
static const unsigned char yyr1_[]
For a rule, its LHS.
Definition: bison_parser.h:261
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
static const int yylast_
Definition: bison_parser.h:315
#define YY_STACK_PRINT()
void yydestruct_(const char *yymsg, int yytype, semantic_type *yyvaluep, location_type *yylocationp)
Reclaim the memory associated to a symbol.
#define YYLLOC_DEFAULT(Current, Rhs, N)
Definition: bison_parser.h:90
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
static const int yyeof_
Definition: bison_parser.h:313
static const signed char yypgoto_[]
Definition: bison_parser.h:244
#define YYCDEBUG
stack< location_type > location_stack_type
location stack type.
Definition: bison_parser.h:223
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
location location_type
Symbol locations.
Definition: bison_parser.h:140
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
static const int yyntokens_
Definition: bison_parser.h:321
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
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
void SlamParser::Parser::yydestruct_ ( const char *  yymsg,
int  yytype,
semantic_type yyvaluep,
location_type yylocationp 
)
inlineprivate

Reclaim the memory associated to a symbol.

Parameters
yymsgWhy this token is reclaimed.
yytypeThe symbol type.
yyvaluepIts semantic value.
yylocationpIts location.

Definition at line 235 of file bison_parser.cpp.

References SlamParser::Parser::semantic_type::commandNode, SlamParser::Parser::semantic_type::stringVal, YY_SYMBOL_PRINT, and YYUSE.

Referenced by parse().

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  }
#define YYUSE(e)
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
void SlamParser::Parser::yypop_ ( unsigned int  n = 1)
inlineprivate

Pop n symbols the three stacks.

Definition at line 316 of file bison_parser.cpp.

References SlamParser::stack< T, S >::pop(), yylocation_stack_, yysemantic_stack_, and yystate_stack_.

Referenced by parse().

317  {
318  yystate_stack_.pop (n);
321  }
semantic_stack_type yysemantic_stack_
The semantic value stack.
Definition: bison_parser.h:228
state_stack_type yystate_stack_
The state stack.
Definition: bison_parser.h:226
void pop(unsigned int n=1)
Definition: stack.hh:88
location_stack_type yylocation_stack_
The location stack.
Definition: bison_parser.h:230
std::string SlamParser::Parser::yysyntax_error_ ( int  yystate,
int  tok 
)
privatevirtual

Generate an error message.

Parameters
statethe state where the error occurred.
tokthe lookahead token.

Definition at line 903 of file bison_parser.cpp.

References SlamParser::stack< T, S >::begin(), SlamParser::stack< T, S >::end(), YY_, YY_SYMBOL_PRINT, yycheck_, yydefact_, yydefgoto_, yylast_, yylocation_stack_, yyntokens_, yypact_, yypact_ninf_, yypgoto_, yyr1_, yyr2_, yysemantic_stack_, yystate_stack_, yystos_, yytable_, yytable_ninf_, yyterror_, yytname_, yytnamerr_(), and YYUSE.

Referenced by parse().

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  }
static const int yyterror_
Definition: bison_parser.h:319
static const int yylast_
Definition: bison_parser.h:315
static const signed char yycheck_[]
Definition: bison_parser.h:255
static const signed char yypact_ninf_
Definition: bison_parser.h:237
virtual std::string yytnamerr_(const char *n)
Convert the symbol name n to a form suitable for a diagnostic.
#define YY_(msgid)
#define YYUSE(e)
static const signed char yypact_[]
For a state, the index in yytable_ of its portion.
Definition: bison_parser.h:236
static const char *const yytname_[]
For a symbol, its name in clear.
Definition: bison_parser.h:267
static const int yyntokens_
Definition: bison_parser.h:321
std::string SlamParser::Parser::yytnamerr_ ( const char *  n)
privatevirtual

Convert the symbol name n to a form suitable for a diagnostic.

Definition at line 155 of file bison_parser.cpp.

Referenced by yysyntax_error_().

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  }
Parser::token_number_type SlamParser::Parser::yytranslate_ ( int  t)
private

Convert a scanner token number t to a symbol number.

Definition at line 1154 of file bison_parser.cpp.

References yyempty_, yyeof_, yyerrcode_, yyfinal_, yylast_, yynnts_, yyntokens_, yyterror_, yyundef_token_, and yyuser_token_number_max_.

Referenced by parse().

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  }
static const token_number_type yyundef_token_
Definition: bison_parser.h:323
static const unsigned int yyuser_token_number_max_
Definition: bison_parser.h:322
unsigned char token_number_type
Internal symbol numbers.
Definition: bison_parser.h:233

Member Data Documentation

class Driver& SlamParser::Parser::driver
private

Definition at line 326 of file bison_parser.h.

Referenced by error(), and parse().

const signed char SlamParser::Parser::yycheck_
staticprivate
Initial value:
=
{
23, 8, 9, 10, 11, 4, 29, 30, 4, 5,
33, 34, 35, 36, 4, 38, 39, 40, 41, 42,
43, 44, 45, 46, 15, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 4, 59, 60, 61, 62,
63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 0, 4, 4, 3, -1, 4,
4, 7, 4, 4, 4, 4, 12, 13, 14
}

Definition at line 255 of file bison_parser.h.

Referenced by parse(), and yysyntax_error_().

const unsigned char SlamParser::Parser::yydefact_
staticprivate
Initial value:
=
{
21, 0, 1, 22, 0, 0, 13, 14, 16, 17,
18, 19, 20, 0, 0, 0, 0, 0, 12, 2,
15, 23, 6, 9, 0, 0, 3, 4, 5, 0,
0, 0, 0, 0, 0, 0, 0, 7, 0, 0,
0, 0, 0, 0, 0, 0, 0, 10, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 11
}

For a state, default rule to reduce. Unlessyytable_ specifies something else to do. Zero means the default is an error.

Definition at line 242 of file bison_parser.h.

Referenced by parse(), and yysyntax_error_().

const signed char SlamParser::Parser::yydefgoto_
staticprivate
Initial value:
=
{
-1, 20, 29, 8, 9, 10, 11, 12, 13, 1
}

Definition at line 245 of file bison_parser.h.

Referenced by parse(), and yysyntax_error_().

const int SlamParser::Parser::yyempty_ = -2
staticprivate

Definition at line 317 of file bison_parser.h.

Referenced by parse(), and yytranslate_().

const int SlamParser::Parser::yyeof_ = 0
staticprivate

Definition at line 313 of file bison_parser.h.

Referenced by parse(), and yytranslate_().

const int SlamParser::Parser::yyerrcode_ = 256
staticprivate

Definition at line 320 of file bison_parser.h.

Referenced by yytranslate_().

const int SlamParser::Parser::yyfinal_ = 2
staticprivate

Definition at line 318 of file bison_parser.h.

Referenced by parse(), and yytranslate_().

const int SlamParser::Parser::yylast_ = 68
staticprivate

Definition at line 315 of file bison_parser.h.

Referenced by parse(), yysyntax_error_(), and yytranslate_().

location_stack_type SlamParser::Parser::yylocation_stack_
private

The location stack.

Definition at line 230 of file bison_parser.h.

Referenced by parse(), yypop_(), and yysyntax_error_().

const int SlamParser::Parser::yynnts_ = 10
staticprivate

Definition at line 316 of file bison_parser.h.

Referenced by yytranslate_().

const int SlamParser::Parser::yyntokens_ = 16
staticprivate

Definition at line 321 of file bison_parser.h.

Referenced by parse(), yysyntax_error_(), yytranslate_(), and ~Parser().

const signed char SlamParser::Parser::yypact_
staticprivate
Initial value:
=
{
-24, 54, -24, -24, -7, 1, -24, 10, -24, -24,
-24, -24, -24, 9, 31, 51, 52, 55, -24, -24,
56, -24, 4, 4, 58, 59, -24, -24, -24, 4,
4, 60, 61, 4, 4, 4, 4, -24, 4, 4,
4, 4, 4, 4, 4, 4, 4, -24, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, -24, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, -24
}

For a state, the index in yytable_ of its portion.

Definition at line 236 of file bison_parser.h.

Referenced by parse(), and yysyntax_error_().

const signed char SlamParser::Parser::yypact_ninf_ = -24
staticprivate

Definition at line 237 of file bison_parser.h.

Referenced by parse(), and yysyntax_error_().

const signed char SlamParser::Parser::yypgoto_
staticprivate
Initial value:
=
{
-24, -24, -23, -24, -24, -24, -24, -24, -24, -24
}

Definition at line 244 of file bison_parser.h.

Referenced by parse(), and yysyntax_error_().

const unsigned char SlamParser::Parser::yyr1_
staticprivate
Initial value:
=
{
0, 16, 17, 17, 18, 18, 19, 19, 19, 20,
20, 20, 21, 22, 23, 23, 24, 24, 24, 24,
24, 25, 25, 25
}

For a rule, its LHS.

Definition at line 261 of file bison_parser.h.

Referenced by parse(), and yysyntax_error_().

const unsigned char SlamParser::Parser::yyr2_
staticprivate
Initial value:
=
{
0, 2, 1, 2, 1, 1, 3, 6, 14, 3,
9, 32, 2, 1, 1, 2, 1, 1, 1, 1,
1, 0, 2, 3
}

For a rule, its RHS length.

Definition at line 263 of file bison_parser.h.

Referenced by parse(), and yysyntax_error_().

semantic_stack_type SlamParser::Parser::yysemantic_stack_
private

The semantic value stack.

Definition at line 228 of file bison_parser.h.

Referenced by parse(), yypop_(), and yysyntax_error_().

state_stack_type SlamParser::Parser::yystate_stack_
private

The state stack.

Definition at line 226 of file bison_parser.h.

Referenced by parse(), yypop_(), and yysyntax_error_().

const unsigned char SlamParser::Parser::yystos_
staticprivate
Initial value:
=
{
0, 25, 0, 3, 7, 12, 13, 14, 19, 20,
21, 22, 23, 24, 8, 9, 10, 11, 4, 4,
17, 15, 4, 4, 4, 4, 4, 4, 5, 18,
18, 4, 4, 18, 18, 4, 4, 18, 18, 18,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
18, 18, 18, 18, 18, 18, 18, 18
}

For a state, its accessing symbol.

Definition at line 258 of file bison_parser.h.

Referenced by parse(), and yysyntax_error_().

const unsigned char SlamParser::Parser::yytable_
staticprivate
Initial value:
=
{
30, 14, 15, 16, 17, 18, 33, 34, 27, 28,
37, 38, 39, 40, 19, 41, 42, 43, 44, 45,
46, 47, 48, 49, 21, 50, 51, 52, 53, 54,
55, 56, 57, 58, 59, 22, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
74, 75, 76, 77, 2, 23, 24, 3, 0, 25,
26, 4, 31, 32, 35, 36, 5, 6, 7
}

What to do in a state. yytable_[yypact_[s]]: what to do in state s.

  • if positive, shift that token.
  • if negative, reduce the rule which number is the opposite.
  • if zero, do what YYDEFACT says.

Definition at line 252 of file bison_parser.h.

Referenced by parse(), and yysyntax_error_().

const signed char SlamParser::Parser::yytable_ninf_ = -1
staticprivate

Definition at line 253 of file bison_parser.h.

Referenced by parse(), and yysyntax_error_().

const int SlamParser::Parser::yyterror_ = 1
staticprivate

Definition at line 319 of file bison_parser.h.

Referenced by parse(), yysyntax_error_(), and yytranslate_().

const char *const SlamParser::Parser::yytname_
staticprivate
Initial value:
=
{
"\"end of file\"", "error", "$undefined", "\"end of line\"",
"\"integer\"", "\"double\"", "\"string\"", "\"ADD\"", "\"Vertex SE2\"",
"\"Vertex SE3\"", "\"Edge SE2\"", "\"Edge SE3\"", "\"Fix\"",
"\"Solve State\"", "\"Query State\"", "';'", "$accept", "int_list",
"NUMBER", "add_se2", "add_se3", "fix_node", "solve_state", "query_state",
"command", "start", 0
}

For a symbol, its name in clear.

Definition at line 267 of file bison_parser.h.

Referenced by yysyntax_error_(), and ~Parser().

const Parser::token_number_type SlamParser::Parser::yyundef_token_ = 2
staticprivate

Definition at line 323 of file bison_parser.h.

Referenced by yytranslate_().

const unsigned int SlamParser::Parser::yyuser_token_number_max_ = 269
staticprivate

Definition at line 322 of file bison_parser.h.

Referenced by yytranslate_().


The documentation for this class was generated from the following files: