g2o
Loading...
Searching...
No Matches
bison_parser.h
Go to the documentation of this file.
1// A Bison parser, made by GNU Bison 3.8.2.
2
3// Skeleton interface for Bison LALR(1) parsers in C++
4
5// Copyright (C) 2002-2015, 2018-2021 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 <https://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
38// C++ LALR(1) parser skeleton written by Akim Demaille.
39
40// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
41// especially those whose name start with YY_ or yy_. They are
42// private implementation details that can be changed or removed.
43
44#ifndef YY_SLAMPARSER_BISON_PARSER_H_INCLUDED
45#define YY_SLAMPARSER_BISON_PARSER_H_INCLUDED
46
47#include <cstdlib> // std::abort
48#include <iostream>
49#include <stdexcept>
50#include <string>
51#include <vector>
52
53#if defined __cplusplus
54#define YY_CPLUSPLUS __cplusplus
55#else
56#define YY_CPLUSPLUS 199711L
57#endif
58
59// Support move semantics when possible.
60#if 201103L <= YY_CPLUSPLUS
61#define YY_MOVE std::move
62#define YY_MOVE_OR_COPY move
63#define YY_MOVE_REF(Type) Type&&
64#define YY_RVREF(Type) Type&&
65#define YY_COPY(Type) Type
66#else
67#define YY_MOVE
68#define YY_MOVE_OR_COPY copy
69#define YY_MOVE_REF(Type) Type&
70#define YY_RVREF(Type) const Type&
71#define YY_COPY(Type) const Type&
72#endif
73
74// Support noexcept when possible.
75#if 201103L <= YY_CPLUSPLUS
76#define YY_NOEXCEPT noexcept
77#define YY_NOTHROW
78#else
79#define YY_NOEXCEPT
80#define YY_NOTHROW throw()
81#endif
82
83// Support constexpr when possible.
84#if 201703 <= YY_CPLUSPLUS
85#define YY_CONSTEXPR constexpr
86#else
87#define YY_CONSTEXPR
88#endif
89#include "location.hh"
90
91#ifndef YY_ATTRIBUTE_PURE
92#if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
93#define YY_ATTRIBUTE_PURE __attribute__((__pure__))
94#else
95#define YY_ATTRIBUTE_PURE
96#endif
97#endif
98
99#ifndef YY_ATTRIBUTE_UNUSED
100#if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
101#define YY_ATTRIBUTE_UNUSED __attribute__((__unused__))
102#else
103#define YY_ATTRIBUTE_UNUSED
104#endif
105#endif
106
107/* Suppress unused-variable warnings by "using" E. */
108#if !defined lint || defined __GNUC__
109#define YY_USE(E) ((void)(E))
110#else
111#define YY_USE(E) /* empty */
112#endif
113
114/* Suppress an incorrect diagnostic about yylval being uninitialized. */
115#if defined __GNUC__ && !defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
116#if __GNUC__ * 100 + __GNUC_MINOR__ < 407
117#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
118 _Pragma("GCC diagnostic push") \
119 _Pragma("GCC diagnostic ignored \"-Wuninitialized\"")
120#else
121#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
122 _Pragma("GCC diagnostic push") \
123 _Pragma("GCC diagnostic ignored \"-Wuninitialized\"") \
124 _Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
125#endif
126#define YY_IGNORE_MAYBE_UNINITIALIZED_END _Pragma("GCC diagnostic pop")
127#else
128#define YY_INITIAL_VALUE(Value) Value
129#endif
130#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
131#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
132#define YY_IGNORE_MAYBE_UNINITIALIZED_END
133#endif
134#ifndef YY_INITIAL_VALUE
135#define YY_INITIAL_VALUE(Value) /* Nothing. */
136#endif
137
138#if defined __cplusplus && defined __GNUC__ && !defined __ICC && 6 <= __GNUC__
139#define YY_IGNORE_USELESS_CAST_BEGIN \
140 _Pragma("GCC diagnostic push") \
141 _Pragma("GCC diagnostic ignored \"-Wuseless-cast\"")
142#define YY_IGNORE_USELESS_CAST_END _Pragma("GCC diagnostic pop")
143#endif
144#ifndef YY_IGNORE_USELESS_CAST_BEGIN
145#define YY_IGNORE_USELESS_CAST_BEGIN
146#define YY_IGNORE_USELESS_CAST_END
147#endif
148
149#ifndef YY_CAST
150#ifdef __cplusplus
151#define YY_CAST(Type, Val) static_cast<Type>(Val)
152#define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type>(Val)
153#else
154#define YY_CAST(Type, Val) ((Type)(Val))
155#define YY_REINTERPRET_CAST(Type, Val) ((Type)(Val))
156#endif
157#endif
158#ifndef YY_NULLPTR
159#if defined __cplusplus
160#if 201103L <= __cplusplus
161#define YY_NULLPTR nullptr
162#else
163#define YY_NULLPTR 0
164#endif
165#else
166#define YY_NULLPTR ((void*)0)
167#endif
168#endif
169
170/* Debug traces. */
171#ifndef SLAMPARSERDEBUG
172#if defined YYDEBUG
173#if YYDEBUG
174#define SLAMPARSERDEBUG 1
175#else
176#define SLAMPARSERDEBUG 0
177#endif
178#else /* ! defined YYDEBUG */
179#define SLAMPARSERDEBUG 0
180#endif /* ! defined YYDEBUG */
181#endif /* ! defined SLAMPARSERDEBUG */
182
183namespace SlamParser {
184#line 190 "bison_parser.h"
185
187class Parser {
188 public:
189#ifdef SLAMPARSERSTYPE
190#ifdef __GNUC__
191#pragma GCC message \
192 "bison: do not #define SLAMPARSERSTYPE in C++, use %define api.value.type"
193#endif
194 typedef SLAMPARSERSTYPE value_type;
195#else
198#line 53 "parser.yy"
199
201 double doubleVal;
202 std::string* stringVal;
204 std::vector<int>* intList;
205
206#line 216 "bison_parser.h"
207 };
208#endif
211
214
216 struct syntax_error : std::runtime_error {
217 syntax_error(const location_type& l, const std::string& m)
218 : std::runtime_error(m), location(l) {}
219
221 : std::runtime_error(s.what()), location(s.location) {}
222
224
226 };
227
229 struct token {
231 SLAMPARSEREMPTY = -2,
232 END = 0, // "end of file"
233 SLAMPARSERerror = 256, // error
234 SLAMPARSERUNDEF = 257, // "invalid token"
235 EOL = 258, // "end of line"
236 INTEGER = 259, // "integer"
237 DOUBLE = 260, // "double"
238 STRING = 261, // "string"
239 ADD = 262, // "ADD"
240 V_SE2 = 263, // "Vertex SE2"
241 V_SE3 = 264, // "Vertex SE3"
242 E_SE2 = 265, // "Edge SE2"
243 E_SE3 = 266, // "Edge SE3"
244 FIX = 267, // "Fix"
245 SOLVE_STATE = 268, // "Solve State"
246 QUERY_STATE = 269 // "Query State"
247 };
250 };
251
254
257
259 struct symbol_kind {
261 YYNTOKENS = 16,
262 S_YYEMPTY = -2,
263 S_YYEOF = 0, // "end of file"
264 S_YYerror = 1, // error
265 S_YYUNDEF = 2, // "invalid token"
266 S_EOL = 3, // "end of line"
267 S_INTEGER = 4, // "integer"
268 S_DOUBLE = 5, // "double"
269 S_STRING = 6, // "string"
270 S_ADD = 7, // "ADD"
271 S_V_SE2 = 8, // "Vertex SE2"
272 S_V_SE3 = 9, // "Vertex SE3"
273 S_E_SE2 = 10, // "Edge SE2"
274 S_E_SE3 = 11, // "Edge SE3"
275 S_FIX = 12, // "Fix"
276 S_SOLVE_STATE = 13, // "Solve State"
277 S_QUERY_STATE = 14, // "Query State"
278 S_15_ = 15, // ';'
279 S_YYACCEPT = 16, // $accept
280 S_int_list = 17, // int_list
281 S_NUMBER = 18, // NUMBER
282 S_add_se2 = 19, // add_se2
283 S_add_se3 = 20, // add_se3
284 S_fix_node = 21, // fix_node
285 S_solve_state = 22, // solve_state
286 S_query_state = 23, // query_state
287 S_command = 24, // command
288 S_start = 25 // start
289 };
290 };
291
294
297
304 template <typename Base>
305 struct basic_symbol : Base {
307 typedef Base super_type;
308
311
312#if 201103L <= YY_CPLUSPLUS
315 : Base(std::move(that)),
316 value(std::move(that.value)),
317 location(std::move(that.location)) {}
318#endif
319
321 basic_symbol(const basic_symbol& that);
323 basic_symbol(typename Base::kind_type t, YY_MOVE_REF(location_type) l);
324
326 basic_symbol(typename Base::kind_type t, YY_RVREF(value_type) v,
327 YY_RVREF(location_type) l);
328
330 ~basic_symbol() { clear(); }
331
333 void clear() YY_NOEXCEPT { Base::clear(); }
334
336 std::string name() const YY_NOEXCEPT {
337 return Parser::symbol_name(this->kind());
338 }
339
341 symbol_kind_type type_get() const YY_NOEXCEPT;
342
344 bool empty() const YY_NOEXCEPT;
345
347 void move(basic_symbol& s);
348
351
354
355 private:
356#if YY_CPLUSPLUS < 201103L
359#endif
360 };
361
363 struct by_kind {
366
369
370#if 201103L <= YY_CPLUSPLUS
373#endif
374
376 by_kind(const by_kind& that) YY_NOEXCEPT;
377
380
382 void clear() YY_NOEXCEPT;
383
385 void move(by_kind& that);
386
389 symbol_kind_type kind() const YY_NOEXCEPT;
390
392 symbol_kind_type type_get() const YY_NOEXCEPT;
393
397 };
398
401
404
406 Parser(class Driver& driver_yyarg);
407 virtual ~Parser();
408
409#if 201103L <= YY_CPLUSPLUS
411 Parser(const Parser&) = delete;
413 Parser& operator=(const Parser&) = delete;
414#endif
415
418 int operator()();
419
422 virtual int parse();
423
424#if SLAMPARSERDEBUG
426 std::ostream& debug_stream() const YY_ATTRIBUTE_PURE;
428 void set_debug_stream(std::ostream&);
429
431 typedef int debug_level_type;
433 debug_level_type debug_level() const YY_ATTRIBUTE_PURE;
435 void set_debug_level(debug_level_type l);
436#endif
437
441 virtual void error(const location_type& loc, const std::string& msg);
442
444 void error(const syntax_error& err);
445
448 static std::string symbol_name(symbol_kind_type yysymbol);
449
450 class context {
451 public:
452 context(const Parser& yyparser, const symbol_type& yyla);
453 const symbol_type& lookahead() const YY_NOEXCEPT { return yyla_; }
454 symbol_kind_type token() const YY_NOEXCEPT { return yyla_.kind(); }
455 const location_type& location() const YY_NOEXCEPT { return yyla_.location; }
456
460 int expected_tokens(symbol_kind_type yyarg[], int yyargn) const;
461
462 private:
465 };
466
467 private:
468#if YY_CPLUSPLUS < 201103L
470 Parser(const Parser&);
473#endif
474
476 typedef signed char state_type;
477
479 int yy_syntax_error_arguments_(const context& yyctx, symbol_kind_type yyarg[],
480 int yyargn) const;
481
484 virtual std::string yysyntax_error_(const context& yyctx) const;
488 static state_type yy_lr_goto_state_(state_type yystate, int yysym);
489
492 static bool yy_pact_value_is_default_(int yyvalue) YY_NOEXCEPT;
493
496 static bool yy_table_value_is_error_(int yyvalue) YY_NOEXCEPT;
497
498 static const signed char yypact_ninf_;
499 static const signed char yytable_ninf_;
500
504 static symbol_kind_type yytranslate_(int t) YY_NOEXCEPT;
505
507 static std::string yytnamerr_(const char* yystr);
508
510 static const char* const yytname_[];
511
512 // Tables.
513 // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
514 // STATE-NUM.
515 static const signed char yypact_[];
516
517 // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
518 // Performed when YYTABLE does not specify something else to do. Zero
519 // means the default is an error.
520 static const signed char yydefact_[];
521
522 // YYPGOTO[NTERM-NUM].
523 static const signed char yypgoto_[];
524
525 // YYDEFGOTO[NTERM-NUM].
526 static const signed char yydefgoto_[];
527
528 // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
529 // positive, shift that token. If negative, reduce the rule whose
530 // number is the opposite. If YYTABLE_NINF, syntax error.
531 static const signed char yytable_[];
532
533 static const signed char yycheck_[];
534
535 // YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
536 // state STATE-NUM.
537 static const signed char yystos_[];
538
539 // YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM.
540 static const signed char yyr1_[];
541
542 // YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule
543 // RULE-NUM.
544 static const signed char yyr2_[];
545
546#if SLAMPARSERDEBUG
547 // YYRLINE[YYN] -- Source line where rule number YYN was defined.
548 static const unsigned char yyrline_[];
550 virtual void yy_reduce_print_(int r) const;
552 virtual void yy_stack_print_() const;
553
555 int yydebug_;
557 std::ostream* yycdebug_;
558
562 template <typename Base>
563 void yy_print_(std::ostream& yyo, const basic_symbol<Base>& yysym) const;
564#endif
565
570 template <typename Base>
571 void yy_destroy_(const char* yymsg, basic_symbol<Base>& yysym) const;
572
573 private:
575 struct by_state {
578
581
584
586 by_state(const by_state& that) YY_NOEXCEPT;
587
589 void clear() YY_NOEXCEPT;
590
592 void move(by_state& that);
593
596 symbol_kind_type kind() const YY_NOEXCEPT;
597
600 enum { empty_state = 0 };
601
605 };
606
608 struct stack_symbol_type : basic_symbol<by_state> {
617#if YY_CPLUSPLUS < 201103L
620 stack_symbol_type& operator=(stack_symbol_type& that);
621
624 stack_symbol_type& operator=(const stack_symbol_type& that);
625#endif
626 };
627
629 template <typename T, typename S = std::vector<T> >
630 class stack {
631 public:
632 // Hide our reversed order.
633 typedef typename S::iterator iterator;
634 typedef typename S::const_iterator const_iterator;
635 typedef typename S::size_type size_type;
636 typedef typename std::ptrdiff_t index_type;
637
638 stack(size_type n = 200) YY_NOEXCEPT : seq_(n) {}
639
640#if 201103L <= YY_CPLUSPLUS
642 stack(const stack&) = delete;
644 stack& operator=(const stack&) = delete;
645#endif
646
650 const T& operator[](index_type i) const {
651 return seq_[size_type(size() - 1 - i)];
652 }
653
657 T& operator[](index_type i) { return seq_[size_type(size() - 1 - i)]; }
658
662 void push(YY_MOVE_REF(T) t) {
663 seq_.push_back(T());
664 operator[](0).move(t);
665 }
666
668 void pop(std::ptrdiff_t n = 1) YY_NOEXCEPT {
669 for (; 0 < n; --n) seq_.pop_back();
670 }
671
673 void clear() YY_NOEXCEPT { seq_.clear(); }
674
676 index_type size() const YY_NOEXCEPT { return index_type(seq_.size()); }
677
679 const_iterator begin() const YY_NOEXCEPT { return seq_.begin(); }
680
682 const_iterator end() const YY_NOEXCEPT { return seq_.end(); }
683
685 class slice {
686 public:
687 slice(const stack& stack, index_type range) YY_NOEXCEPT : stack_(stack),
688 range_(range) {}
689
690 const T& operator[](index_type i) const { return stack_[range_ - i]; }
691
692 private:
693 const stack& stack_;
695 };
696
697 private:
698#if YY_CPLUSPLUS < 201103L
700 stack(const stack&);
703#endif
706 };
707
710
713
719 void yypush_(const char* m, YY_MOVE_REF(stack_symbol_type) sym);
720
727 void yypush_(const char* m, state_type s, YY_MOVE_REF(symbol_type) sym);
728
730 void yypop_(int n = 1) YY_NOEXCEPT;
731
733 enum {
734 yylast_ = 68,
735 yynnts_ = 10,
736 yyfinal_ = 2
737 };
738
739 // User arguments.
741};
742
743} // namespace SlamParser
744#line 833 "bison_parser.h"
745
746#endif // !YY_SLAMPARSER_BISON_PARSER_H_INCLUDED
#define YY_RVREF(Type)
#define YY_MOVE_REF(Type)
#define YY_NOEXCEPT
#define YY_ATTRIBUTE_PURE
#define YY_NOTHROW
const location_type & location() const YY_NOEXCEPT
symbol_kind_type token() const YY_NOEXCEPT
const symbol_type & lookahead() const YY_NOEXCEPT
const symbol_type & yyla_
Present a slice of the top of a stack.
const T & operator[](index_type i) const
slice(const stack &stack, index_type range) YY_NOEXCEPT
A stack with random access from its top.
stack(size_type n=200) YY_NOEXCEPT
index_type size() const YY_NOEXCEPT
Number of elements on the stack.
T & operator[](index_type i)
const T & operator[](index_type i) const
const_iterator begin() const YY_NOEXCEPT
Iterator on top of the stack (going downwards).
void pop(std::ptrdiff_t n=1) YY_NOEXCEPT
Pop elements from the stack.
stack & operator=(const stack &)
Non copyable.
void push(YY_MOVE_REF(T) t)
void clear() YY_NOEXCEPT
Pop all elements from the stack.
S::const_iterator const_iterator
stack(const stack &)
Non copyable.
const_iterator end() const YY_NOEXCEPT
Bottom of the stack.
S seq_
The wrapped container.
A Bison parser.
Parser(const Parser &)
Non copyable.
value_type semantic_type
Backward compatibility (Bison 3.8).
Parser & operator=(const Parser &)
Non copyable.
stack< stack_symbol_type > stack_type
Stack type.
location location_type
Symbol locations.
stack_type yystack_
The stack.
symbol_kind::symbol_kind_type symbol_kind_type
(Internal) symbol kind.
signed char state_type
Stored state numbers (used for stacks).
static const symbol_kind_type YYNTOKENS
The number of tokens.
token::token_kind_type token_kind_type
Token kind, as returned by yylex.
static const signed char yypact_ninf_
token_kind_type token_type
Backward compatibility alias (Bison 3.6).
class Driver & driver
static const signed char yytable_ninf_
Two points in a source file.
Definition location.hh:142
location(const position &b, const position &e)
Construct a location from b to e.
Definition location.hh:150
Definition jet.h:876
~basic_symbol()
Destroy the symbol.
basic_symbol & operator=(const basic_symbol &that)
Assignment operator.
std::string name() const YY_NOEXCEPT
The user-facing name of this symbol.
basic_symbol() YY_NOEXCEPT
Default constructor.
void clear() YY_NOEXCEPT
Destroy contents, and record that is empty.
Type access provider for token (enum) based symbols.
token_kind_type kind_type
The symbol kind as needed by the constructor.
Type access provider for state based symbols.
state_type kind_type
The symbol kind as needed by the constructor.
"Internal" symbol: element of the stack.
basic_symbol< by_state > super_type
Superclass.
"External" symbols: returned by the scanner.
Syntax errors thrown from user actions.
~syntax_error() YY_NOEXCEPT YY_NOTHROW
syntax_error(const location_type &l, const std::string &m)
syntax_error(const syntax_error &s)
token_kind_type yytokentype
Backward compatibility alias (Bison 3.6).
Symbol semantic values.
class CommandNode * commandNode
std::vector< int > * intList