ztsdb
cfgparser.hpp
1 // A Bison parser, made by GNU Bison 3.5.1.
2 
3 // Skeleton interface for Bison LALR(1) parsers in C++
4 
5 // Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
6 
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 
17 // You should have received a copy of the GNU General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 
20 // As a special exception, you may create a larger work that contains
21 // part or all of the Bison parser skeleton and distribute that work
22 // under terms of your choice, so long as that work isn't itself a
23 // parser generator using the skeleton or a modified version thereof
24 // as a parser skeleton. Alternatively, if you modify or redistribute
25 // the parser skeleton itself, you may (at your option) remove this
26 // special exception, which will cause the skeleton and the resulting
27 // Bison output files to be licensed under the GNU General Public
28 // License without this special exception.
29 
30 // This special exception was added by the Free Software Foundation in
31 // version 2.2 of Bison.
32 
33 
39 // C++ LALR(1) parser skeleton written by Akim Demaille.
40 
41 // Undocumented macros, especially those whose name start with YY_,
42 // are private implementation details. Do not rely on them.
43 
44 #ifndef YY_CFGYY_HOME_LSILVEST_REPOS_ZTSDB_GITHUB_SRC_CONFIG_PARSER_CFGPARSER_HPP_INCLUDED
45 # define YY_CFGYY_HOME_LSILVEST_REPOS_ZTSDB_GITHUB_SRC_CONFIG_PARSER_CFGPARSER_HPP_INCLUDED
46 // "%code requires" blocks.
47 #line 31 "cfgparser.y"
48 
49 #include <string>
50 #include "../config.hpp"
51 namespace cfg {
52  struct CfgCtx; // forward declaration to avoid circular dependency
53 }
54 typedef void *yyscan_t;
55 
56 #line 57 "/home/lsilvest/repos/ztsdb_github/src/config_parser/cfgparser.hpp"
57 
58 # include <cassert>
59 # include <cstdlib> // std::abort
60 # include <iostream>
61 # include <stdexcept>
62 # include <string>
63 # include <vector>
64 
65 #if defined __cplusplus
66 # define YY_CPLUSPLUS __cplusplus
67 #else
68 # define YY_CPLUSPLUS 199711L
69 #endif
70 
71 // Support move semantics when possible.
72 #if 201103L <= YY_CPLUSPLUS
73 # define YY_MOVE std::move
74 # define YY_MOVE_OR_COPY move
75 # define YY_MOVE_REF(Type) Type&&
76 # define YY_RVREF(Type) Type&&
77 # define YY_COPY(Type) Type
78 #else
79 # define YY_MOVE
80 # define YY_MOVE_OR_COPY copy
81 # define YY_MOVE_REF(Type) Type&
82 # define YY_RVREF(Type) const Type&
83 # define YY_COPY(Type) const Type&
84 #endif
85 
86 // Support noexcept when possible.
87 #if 201103L <= YY_CPLUSPLUS
88 # define YY_NOEXCEPT noexcept
89 # define YY_NOTHROW
90 #else
91 # define YY_NOEXCEPT
92 # define YY_NOTHROW throw ()
93 #endif
94 
95 // Support constexpr when possible.
96 #if 201703 <= YY_CPLUSPLUS
97 # define YY_CONSTEXPR constexpr
98 #else
99 # define YY_CONSTEXPR
100 #endif
101 # include "location.hh"
102 #include <typeinfo>
103 #ifndef YY_ASSERT
104 # include <cassert>
105 # define YY_ASSERT assert
106 #endif
107 
108 
109 #ifndef YY_ATTRIBUTE_PURE
110 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
111 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
112 # else
113 # define YY_ATTRIBUTE_PURE
114 # endif
115 #endif
116 
117 #ifndef YY_ATTRIBUTE_UNUSED
118 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
119 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
120 # else
121 # define YY_ATTRIBUTE_UNUSED
122 # endif
123 #endif
124 
125 /* Suppress unused-variable warnings by "using" E. */
126 #if ! defined lint || defined __GNUC__
127 # define YYUSE(E) ((void) (E))
128 #else
129 # define YYUSE(E) /* empty */
130 #endif
131 
132 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
133 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
134 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
135  _Pragma ("GCC diagnostic push") \
136  _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
137  _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
138 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
139  _Pragma ("GCC diagnostic pop")
140 #else
141 # define YY_INITIAL_VALUE(Value) Value
142 #endif
143 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
144 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
145 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
146 #endif
147 #ifndef YY_INITIAL_VALUE
148 # define YY_INITIAL_VALUE(Value) /* Nothing. */
149 #endif
150 
151 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
152 # define YY_IGNORE_USELESS_CAST_BEGIN \
153  _Pragma ("GCC diagnostic push") \
154  _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
155 # define YY_IGNORE_USELESS_CAST_END \
156  _Pragma ("GCC diagnostic pop")
157 #endif
158 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
159 # define YY_IGNORE_USELESS_CAST_BEGIN
160 # define YY_IGNORE_USELESS_CAST_END
161 #endif
162 
163 # ifndef YY_CAST
164 # ifdef __cplusplus
165 # define YY_CAST(Type, Val) static_cast<Type> (Val)
166 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
167 # else
168 # define YY_CAST(Type, Val) ((Type) (Val))
169 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
170 # endif
171 # endif
172 # ifndef YY_NULLPTR
173 # if defined __cplusplus
174 # if 201103L <= __cplusplus
175 # define YY_NULLPTR nullptr
176 # else
177 # define YY_NULLPTR 0
178 # endif
179 # else
180 # define YY_NULLPTR ((void*)0)
181 # endif
182 # endif
183 
184 /* Debug traces. */
185 #ifndef CFGYYDEBUG
186 # if defined YYDEBUG
187 #if YYDEBUG
188 # define CFGYYDEBUG 1
189 # else
190 # define CFGYYDEBUG 0
191 # endif
192 # else /* ! defined YYDEBUG */
193 # define CFGYYDEBUG 1
194 # endif /* ! defined YYDEBUG */
195 #endif /* ! defined CFGYYDEBUG */
196 
197 namespace cfgyy {
198 #line 199 "/home/lsilvest/repos/ztsdb_github/src/config_parser/cfgparser.hpp"
199 
200 
201 
202 
204  class parser
205  {
206  public:
207 #ifndef CFGYYSTYPE
208  class semantic_type
214  {
215  public:
218 
220  semantic_type () YY_NOEXCEPT
221  : yybuffer_ ()
222  , yytypeid_ (YY_NULLPTR)
223  {}
224 
226  template <typename T>
227  semantic_type (YY_RVREF (T) t)
228  : yytypeid_ (&typeid (T))
229  {
230  YY_ASSERT (sizeof (T) <= size);
231  new (yyas_<T> ()) T (YY_MOVE (t));
232  }
233 
235  ~semantic_type () YY_NOEXCEPT
236  {
237  YY_ASSERT (!yytypeid_);
238  }
239 
240 # if 201103L <= YY_CPLUSPLUS
241  template <typename T, typename... U>
243  T&
244  emplace (U&&... u)
245  {
246  YY_ASSERT (!yytypeid_);
247  YY_ASSERT (sizeof (T) <= size);
248  yytypeid_ = & typeid (T);
249  return *new (yyas_<T> ()) T (std::forward <U>(u)...);
250  }
251 # else
252  template <typename T>
254  T&
256  {
257  YY_ASSERT (!yytypeid_);
258  YY_ASSERT (sizeof (T) <= size);
259  yytypeid_ = & typeid (T);
260  return *new (yyas_<T> ()) T ();
261  }
262 
264  template <typename T>
265  T&
266  emplace (const T& t)
267  {
268  YY_ASSERT (!yytypeid_);
269  YY_ASSERT (sizeof (T) <= size);
270  yytypeid_ = & typeid (T);
271  return *new (yyas_<T> ()) T (t);
272  }
273 # endif
274 
277  template <typename T>
278  T&
279  build ()
280  {
281  return emplace<T> ();
282  }
283 
286  template <typename T>
287  T&
288  build (const T& t)
289  {
290  return emplace<T> (t);
291  }
292 
294  template <typename T>
295  T&
296  as () YY_NOEXCEPT
297  {
298  YY_ASSERT (yytypeid_);
299  YY_ASSERT (*yytypeid_ == typeid (T));
300  YY_ASSERT (sizeof (T) <= size);
301  return *yyas_<T> ();
302  }
303 
305  template <typename T>
306  const T&
307  as () const YY_NOEXCEPT
308  {
309  YY_ASSERT (yytypeid_);
310  YY_ASSERT (*yytypeid_ == typeid (T));
311  YY_ASSERT (sizeof (T) <= size);
312  return *yyas_<T> ();
313  }
314 
323  template <typename T>
324  void
325  swap (self_type& that) YY_NOEXCEPT
326  {
327  YY_ASSERT (yytypeid_);
328  YY_ASSERT (*yytypeid_ == *that.yytypeid_);
329  std::swap (as<T> (), that.as<T> ());
330  }
331 
335  template <typename T>
336  void
337  move (self_type& that)
338  {
339 # if 201103L <= YY_CPLUSPLUS
340  emplace<T> (std::move (that.as<T> ()));
341 # else
342  emplace<T> ();
343  swap<T> (that);
344 # endif
345  that.destroy<T> ();
346  }
347 
348 # if 201103L <= YY_CPLUSPLUS
349  template <typename T>
351  void
352  move (self_type&& that)
353  {
354  emplace<T> (std::move (that.as<T> ()));
355  that.destroy<T> ();
356  }
357 #endif
358 
360  template <typename T>
361  void
362  copy (const self_type& that)
363  {
364  emplace<T> (that.as<T> ());
365  }
366 
368  template <typename T>
369  void
371  {
372  as<T> ().~T ();
373  yytypeid_ = YY_NULLPTR;
374  }
375 
376  private:
378  self_type& operator= (const self_type&);
379  semantic_type (const self_type&);
380 
382  template <typename T>
383  T*
384  yyas_ () YY_NOEXCEPT
385  {
386  void *yyp = yybuffer_.yyraw;
387  return static_cast<T*> (yyp);
388  }
389 
391  template <typename T>
392  const T*
393  yyas_ () const YY_NOEXCEPT
394  {
395  const void *yyp = yybuffer_.yyraw;
396  return static_cast<const T*> (yyp);
397  }
398 
400  union union_type
401  {
402  // cfg
403  char dummy1[sizeof (cfg::configmap_t)];
404 
405  // DOUBLE
406  char dummy2[sizeof (double)];
407 
408  // INTEGER
409  char dummy3[sizeof (int64_t)];
410 
411  // kv
412  char dummy4[sizeof (std::pair<std::string, cfg::CfgVariant>)];
413 
414  // STRING_LITERAL
415  // SYMBOL
416  char dummy5[sizeof (std::string)];
417  };
418 
420  enum { size = sizeof (union_type) };
421 
423  union
424  {
426  long double yyalign_me;
428  char yyraw[size];
429  } yybuffer_;
430 
432  const std::type_info *yytypeid_;
433  };
434 
435 #else
436  typedef CFGYYSTYPE semantic_type;
437 #endif
438  typedef location location_type;
440 
442  struct syntax_error : std::runtime_error
443  {
444  syntax_error (const location_type& l, const std::string& m)
445  : std::runtime_error (m)
446  , location (l)
447  {}
448 
449  syntax_error (const syntax_error& s)
450  : std::runtime_error (s.what ())
451  , location (s.location)
452  {}
453 
454  ~syntax_error () YY_NOEXCEPT YY_NOTHROW;
455 
457  };
458 
460  struct token
461  {
462  enum yytokentype
463  {
464  END = 0,
465  STRING_LITERAL = 258,
466  SYMBOL = 259,
467  INTEGER = 260,
468  DOUBLE = 261,
469  EQ = 262,
470  NL = 263
471  };
472  };
473 
475  typedef token::yytokentype token_type;
476 
478  typedef int symbol_number_type;
479 
481  enum { empty_symbol = -2 };
482 
484  typedef signed char token_number_type;
485 
492  template <typename Base>
493  struct basic_symbol : Base
494  {
496  typedef Base super_type;
497 
500  : value ()
501  , location ()
502  {}
503 
504 #if 201103L <= YY_CPLUSPLUS
505  basic_symbol (basic_symbol&& that);
507 #endif
508 
510  basic_symbol (const basic_symbol& that);
511 
513 #if 201103L <= YY_CPLUSPLUS
514  basic_symbol (typename Base::kind_type t, location_type&& l)
515  : Base (t)
516  , location (std::move (l))
517  {}
518 #else
519  basic_symbol (typename Base::kind_type t, const location_type& l)
520  : Base (t)
521  , location (l)
522  {}
523 #endif
524 #if 201103L <= YY_CPLUSPLUS
525  basic_symbol (typename Base::kind_type t, cfg::configmap_t&& v, location_type&& l)
526  : Base (t)
527  , value (std::move (v))
528  , location (std::move (l))
529  {}
530 #else
531  basic_symbol (typename Base::kind_type t, const cfg::configmap_t& v, const location_type& l)
532  : Base (t)
533  , value (v)
534  , location (l)
535  {}
536 #endif
537 #if 201103L <= YY_CPLUSPLUS
538  basic_symbol (typename Base::kind_type t, double&& v, location_type&& l)
539  : Base (t)
540  , value (std::move (v))
541  , location (std::move (l))
542  {}
543 #else
544  basic_symbol (typename Base::kind_type t, const double& v, const location_type& l)
545  : Base (t)
546  , value (v)
547  , location (l)
548  {}
549 #endif
550 #if 201103L <= YY_CPLUSPLUS
551  basic_symbol (typename Base::kind_type t, int64_t&& v, location_type&& l)
552  : Base (t)
553  , value (std::move (v))
554  , location (std::move (l))
555  {}
556 #else
557  basic_symbol (typename Base::kind_type t, const int64_t& v, const location_type& l)
558  : Base (t)
559  , value (v)
560  , location (l)
561  {}
562 #endif
563 #if 201103L <= YY_CPLUSPLUS
564  basic_symbol (typename Base::kind_type t, std::pair<std::string, cfg::CfgVariant>&& v, location_type&& l)
565  : Base (t)
566  , value (std::move (v))
567  , location (std::move (l))
568  {}
569 #else
570  basic_symbol (typename Base::kind_type t, const std::pair<std::string, cfg::CfgVariant>& v, const location_type& l)
571  : Base (t)
572  , value (v)
573  , location (l)
574  {}
575 #endif
576 #if 201103L <= YY_CPLUSPLUS
577  basic_symbol (typename Base::kind_type t, std::string&& v, location_type&& l)
578  : Base (t)
579  , value (std::move (v))
580  , location (std::move (l))
581  {}
582 #else
583  basic_symbol (typename Base::kind_type t, const std::string& v, const location_type& l)
584  : Base (t)
585  , value (v)
586  , location (l)
587  {}
588 #endif
589 
592  {
593  clear ();
594  }
595 
597  void clear ()
598  {
599  // User destructor.
600  symbol_number_type yytype = this->type_get ();
601  basic_symbol<Base>& yysym = *this;
602  (void) yysym;
603  switch (yytype)
604  {
605  default:
606  break;
607  }
608 
609  // Type destructor.
610 switch (yytype)
611  {
612  case 10: // cfg
613  value.template destroy< cfg::configmap_t > ();
614  break;
615 
616  case 6: // DOUBLE
617  value.template destroy< double > ();
618  break;
619 
620  case 5: // INTEGER
621  value.template destroy< int64_t > ();
622  break;
623 
624  case 11: // kv
625  value.template destroy< std::pair<std::string, cfg::CfgVariant> > ();
626  break;
627 
628  case 3: // STRING_LITERAL
629  case 4: // SYMBOL
630  value.template destroy< std::string > ();
631  break;
632 
633  default:
634  break;
635  }
636 
637  Base::clear ();
638  }
639 
641  bool empty () const YY_NOEXCEPT;
642 
644  void move (basic_symbol& s);
645 
648 
651 
652  private:
653 #if YY_CPLUSPLUS < 201103L
654  basic_symbol& operator= (const basic_symbol& that);
656 #endif
657  };
658 
660  struct by_type
661  {
663  by_type ();
664 
665 #if 201103L <= YY_CPLUSPLUS
666  by_type (by_type&& that);
668 #endif
669 
671  by_type (const by_type& that);
672 
674  typedef token_type kind_type;
675 
677  by_type (kind_type t);
678 
680  void clear ();
681 
683  void move (by_type& that);
684 
687  symbol_number_type type_get () const YY_NOEXCEPT;
688 
692  int type;
693  };
694 
697  {
700 
703 
705 #if 201103L <= YY_CPLUSPLUS
706  symbol_type (int tok, location_type l)
707  : super_type(token_type (tok), std::move (l))
708  {
709  YY_ASSERT (tok == token::END || tok == token::EQ || tok == token::NL);
710  }
711 #else
712  symbol_type (int tok, const location_type& l)
713  : super_type(token_type (tok), l)
714  {
715  YY_ASSERT (tok == token::END || tok == token::EQ || tok == token::NL);
716  }
717 #endif
718 #if 201103L <= YY_CPLUSPLUS
719  symbol_type (int tok, double v, location_type l)
720  : super_type(token_type (tok), std::move (v), std::move (l))
721  {
722  YY_ASSERT (tok == token::DOUBLE);
723  }
724 #else
725  symbol_type (int tok, const double& v, const location_type& l)
726  : super_type(token_type (tok), v, l)
727  {
728  YY_ASSERT (tok == token::DOUBLE);
729  }
730 #endif
731 #if 201103L <= YY_CPLUSPLUS
732  symbol_type (int tok, int64_t v, location_type l)
733  : super_type(token_type (tok), std::move (v), std::move (l))
734  {
735  YY_ASSERT (tok == token::INTEGER);
736  }
737 #else
738  symbol_type (int tok, const int64_t& v, const location_type& l)
739  : super_type(token_type (tok), v, l)
740  {
741  YY_ASSERT (tok == token::INTEGER);
742  }
743 #endif
744 #if 201103L <= YY_CPLUSPLUS
745  symbol_type (int tok, std::string v, location_type l)
746  : super_type(token_type (tok), std::move (v), std::move (l))
747  {
748  YY_ASSERT (tok == token::STRING_LITERAL || tok == token::SYMBOL);
749  }
750 #else
751  symbol_type (int tok, const std::string& v, const location_type& l)
752  : super_type(token_type (tok), v, l)
753  {
754  YY_ASSERT (tok == token::STRING_LITERAL || tok == token::SYMBOL);
755  }
756 #endif
757  };
758 
760  parser (cfg::CfgCtx& ctx_yyarg, yyscan_t scanner_yyarg);
761  virtual ~parser ();
762 
765  int operator() ();
766 
769  virtual int parse ();
770 
771 #if CFGYYDEBUG
772  std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
775  void set_debug_stream (std::ostream &);
776 
778  typedef int debug_level_type;
780  debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
783 #endif
784 
788  virtual void error (const location_type& loc, const std::string& msg);
789 
791  void error (const syntax_error& err);
792 
793  // Implementation of make_symbol for each symbol type.
794 #if 201103L <= YY_CPLUSPLUS
795  static
797  make_END (location_type l)
798  {
799  return symbol_type (token::END, std::move (l));
800  }
801 #else
802  static
803  symbol_type
804  make_END (const location_type& l)
805  {
806  return symbol_type (token::END, l);
807  }
808 #endif
809 #if 201103L <= YY_CPLUSPLUS
810  static
811  symbol_type
812  make_STRING_LITERAL (std::string v, location_type l)
813  {
814  return symbol_type (token::STRING_LITERAL, std::move (v), std::move (l));
815  }
816 #else
817  static
818  symbol_type
819  make_STRING_LITERAL (const std::string& v, const location_type& l)
820  {
821  return symbol_type (token::STRING_LITERAL, v, l);
822  }
823 #endif
824 #if 201103L <= YY_CPLUSPLUS
825  static
826  symbol_type
827  make_SYMBOL (std::string v, location_type l)
828  {
829  return symbol_type (token::SYMBOL, std::move (v), std::move (l));
830  }
831 #else
832  static
833  symbol_type
834  make_SYMBOL (const std::string& v, const location_type& l)
835  {
836  return symbol_type (token::SYMBOL, v, l);
837  }
838 #endif
839 #if 201103L <= YY_CPLUSPLUS
840  static
841  symbol_type
842  make_INTEGER (int64_t v, location_type l)
843  {
844  return symbol_type (token::INTEGER, std::move (v), std::move (l));
845  }
846 #else
847  static
848  symbol_type
849  make_INTEGER (const int64_t& v, const location_type& l)
850  {
851  return symbol_type (token::INTEGER, v, l);
852  }
853 #endif
854 #if 201103L <= YY_CPLUSPLUS
855  static
856  symbol_type
857  make_DOUBLE (double v, location_type l)
858  {
859  return symbol_type (token::DOUBLE, std::move (v), std::move (l));
860  }
861 #else
862  static
863  symbol_type
864  make_DOUBLE (const double& v, const location_type& l)
865  {
866  return symbol_type (token::DOUBLE, v, l);
867  }
868 #endif
869 #if 201103L <= YY_CPLUSPLUS
870  static
871  symbol_type
872  make_EQ (location_type l)
873  {
874  return symbol_type (token::EQ, std::move (l));
875  }
876 #else
877  static
878  symbol_type
879  make_EQ (const location_type& l)
880  {
881  return symbol_type (token::EQ, l);
882  }
883 #endif
884 #if 201103L <= YY_CPLUSPLUS
885  static
886  symbol_type
887  make_NL (location_type l)
888  {
889  return symbol_type (token::NL, std::move (l));
890  }
891 #else
892  static
893  symbol_type
894  make_NL (const location_type& l)
895  {
896  return symbol_type (token::NL, l);
897  }
898 #endif
899 
900 
901  private:
903  parser (const parser&);
904  parser& operator= (const parser&);
905 
907  typedef signed char state_type;
908 
912  virtual std::string yysyntax_error_ (state_type yystate,
913  const symbol_type& yyla) const;
914 
918  static state_type yy_lr_goto_state_ (state_type yystate, int yysym);
919 
922  static bool yy_pact_value_is_default_ (int yyvalue);
923 
926  static bool yy_table_value_is_error_ (int yyvalue);
927 
928  static const signed char yypact_ninf_;
929  static const signed char yytable_ninf_;
930 
934  static token_number_type yytranslate_ (int t);
935 
936  // Tables.
937  // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
938  // STATE-NUM.
939  static const signed char yypact_[];
940 
941  // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
942  // Performed when YYTABLE does not specify something else to do. Zero
943  // means the default is an error.
944  static const signed char yydefact_[];
945 
946  // YYPGOTO[NTERM-NUM].
947  static const signed char yypgoto_[];
948 
949  // YYDEFGOTO[NTERM-NUM].
950  static const signed char yydefgoto_[];
951 
952  // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
953  // positive, shift that token. If negative, reduce the rule whose
954  // number is the opposite. If YYTABLE_NINF, syntax error.
955  static const signed char yytable_[];
956 
957  static const signed char yycheck_[];
958 
959  // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
960  // symbol of state STATE-NUM.
961  static const signed char yystos_[];
962 
963  // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
964  static const signed char yyr1_[];
965 
966  // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
967  static const signed char yyr2_[];
968 
969 
971  static std::string yytnamerr_ (const char *n);
972 
973 
975  static const char* const yytname_[];
976 #if CFGYYDEBUG
977  // YYRLINE[YYN] -- Source line where rule number YYN was defined.
978  static const signed char yyrline_[];
980  virtual void yy_reduce_print_ (int r);
982  virtual void yystack_print_ ();
983 
985  int yydebug_;
987  std::ostream* yycdebug_;
988 
992  template <typename Base>
993  void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
994 #endif
995 
1000  template <typename Base>
1001  void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
1002 
1003  private:
1005  struct by_state
1006  {
1008  by_state () YY_NOEXCEPT;
1009 
1011  typedef state_type kind_type;
1012 
1014  by_state (kind_type s) YY_NOEXCEPT;
1015 
1017  by_state (const by_state& that) YY_NOEXCEPT;
1018 
1020  void clear () YY_NOEXCEPT;
1021 
1023  void move (by_state& that);
1024 
1027  symbol_number_type type_get () const YY_NOEXCEPT;
1028 
1031  enum { empty_state = 0 };
1032 
1035  state_type state;
1036  };
1037 
1039  struct stack_symbol_type : basic_symbol<by_state>
1040  {
1042  typedef basic_symbol<by_state> super_type;
1044  stack_symbol_type ();
1046  stack_symbol_type (YY_RVREF (stack_symbol_type) that);
1048  stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
1049 #if YY_CPLUSPLUS < 201103L
1050  stack_symbol_type& operator= (stack_symbol_type& that);
1053 
1056  stack_symbol_type& operator= (const stack_symbol_type& that);
1057 #endif
1058  };
1059 
1061  template <typename T, typename S = std::vector<T> >
1062  class stack
1063  {
1064  public:
1065  // Hide our reversed order.
1066  typedef typename S::reverse_iterator iterator;
1067  typedef typename S::const_reverse_iterator const_iterator;
1068  typedef typename S::size_type size_type;
1069  typedef typename std::ptrdiff_t index_type;
1070 
1071  stack (size_type n = 200)
1072  : seq_ (n)
1073  {}
1074 
1078  const T&
1079  operator[] (index_type i) const
1080  {
1081  return seq_[size_type (size () - 1 - i)];
1082  }
1083 
1087  T&
1088  operator[] (index_type i)
1089  {
1090  return seq_[size_type (size () - 1 - i)];
1091  }
1092 
1096  void
1097  push (YY_MOVE_REF (T) t)
1098  {
1099  seq_.push_back (T ());
1100  operator[] (0).move (t);
1101  }
1102 
1104  void
1105  pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
1106  {
1107  for (; 0 < n; --n)
1108  seq_.pop_back ();
1109  }
1110 
1112  void
1113  clear () YY_NOEXCEPT
1114  {
1115  seq_.clear ();
1116  }
1117 
1119  index_type
1120  size () const YY_NOEXCEPT
1121  {
1122  return index_type (seq_.size ());
1123  }
1124 
1125  std::ptrdiff_t
1126  ssize () const YY_NOEXCEPT
1127  {
1128  return std::ptrdiff_t (size ());
1129  }
1130 
1132  const_iterator
1133  begin () const YY_NOEXCEPT
1134  {
1135  return seq_.rbegin ();
1136  }
1137 
1139  const_iterator
1140  end () const YY_NOEXCEPT
1141  {
1142  return seq_.rend ();
1143  }
1144 
1146  class slice
1147  {
1148  public:
1149  slice (const stack& stack, index_type range)
1150  : stack_ (stack)
1151  , range_ (range)
1152  {}
1153 
1154  const T&
1155  operator[] (index_type i) const
1156  {
1157  return stack_[range_ - i];
1158  }
1159 
1160  private:
1161  const stack& stack_;
1162  index_type range_;
1163  };
1164 
1165  private:
1166  stack (const stack&);
1167  stack& operator= (const stack&);
1169  S seq_;
1170  };
1171 
1172 
1174  typedef stack<stack_symbol_type> stack_type;
1175 
1177  stack_type yystack_;
1178 
1184  void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
1185 
1192  void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
1193 
1195  void yypop_ (int n = 1);
1196 
1198  static const token_number_type yy_error_token_ = 1;
1199  static const token_number_type yy_undef_token_ = 2;
1200 
1202  enum
1203  {
1204  yyeof_ = 0,
1205  yylast_ = 12,
1206  yynnts_ = 3,
1207  yyfinal_ = 5,
1208  yyntokens_ = 9
1209  };
1210 
1211 
1212  // User arguments.
1213  cfg::CfgCtx& ctx;
1214  yyscan_t scanner;
1215  };
1216 
1217  inline
1219  parser::yytranslate_ (int t)
1220  {
1221  // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
1222  // TOKEN-NUM as returned by yylex.
1223  static
1224  const token_number_type
1225  translate_table[] =
1226  {
1227  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1228  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1229  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1230  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1231  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1232  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1233  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1234  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1235  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1236  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1237  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1238  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1239  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1240  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1241  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1242  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1243  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1244  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1245  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1246  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1247  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1248  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1249  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1250  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1251  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1252  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1253  5, 6, 7, 8
1254  };
1255  const int user_token_number_max_ = 263;
1256 
1257  if (t <= 0)
1258  return yyeof_;
1259  else if (t <= user_token_number_max_)
1260  return translate_table[t];
1261  else
1262  return yy_undef_token_;
1263  }
1264 
1265  // basic_symbol.
1266 #if 201103L <= YY_CPLUSPLUS
1267  template <typename Base>
1268  parser::basic_symbol<Base>::basic_symbol (basic_symbol&& that)
1269  : Base (std::move (that))
1270  , value ()
1271  , location (std::move (that.location))
1272  {
1273  switch (this->type_get ())
1274  {
1275  case 10: // cfg
1276  value.move< cfg::configmap_t > (std::move (that.value));
1277  break;
1278 
1279  case 6: // DOUBLE
1280  value.move< double > (std::move (that.value));
1281  break;
1282 
1283  case 5: // INTEGER
1284  value.move< int64_t > (std::move (that.value));
1285  break;
1286 
1287  case 11: // kv
1288  value.move< std::pair<std::string, cfg::CfgVariant> > (std::move (that.value));
1289  break;
1290 
1291  case 3: // STRING_LITERAL
1292  case 4: // SYMBOL
1293  value.move< std::string > (std::move (that.value));
1294  break;
1295 
1296  default:
1297  break;
1298  }
1299 
1300  }
1301 #endif
1302 
1303  template <typename Base>
1305  : Base (that)
1306  , value ()
1307  , location (that.location)
1308  {
1309  switch (this->type_get ())
1310  {
1311  case 10: // cfg
1312  value.copy< cfg::configmap_t > (YY_MOVE (that.value));
1313  break;
1314 
1315  case 6: // DOUBLE
1316  value.copy< double > (YY_MOVE (that.value));
1317  break;
1318 
1319  case 5: // INTEGER
1320  value.copy< int64_t > (YY_MOVE (that.value));
1321  break;
1322 
1323  case 11: // kv
1324  value.copy< std::pair<std::string, cfg::CfgVariant> > (YY_MOVE (that.value));
1325  break;
1326 
1327  case 3: // STRING_LITERAL
1328  case 4: // SYMBOL
1329  value.copy< std::string > (YY_MOVE (that.value));
1330  break;
1331 
1332  default:
1333  break;
1334  }
1335 
1336  }
1337 
1338 
1339 
1340  template <typename Base>
1341  bool
1343  {
1344  return Base::type_get () == empty_symbol;
1345  }
1346 
1347  template <typename Base>
1348  void
1350  {
1351  super_type::move (s);
1352  switch (this->type_get ())
1353  {
1354  case 10: // cfg
1355  value.move< cfg::configmap_t > (YY_MOVE (s.value));
1356  break;
1357 
1358  case 6: // DOUBLE
1359  value.move< double > (YY_MOVE (s.value));
1360  break;
1361 
1362  case 5: // INTEGER
1363  value.move< int64_t > (YY_MOVE (s.value));
1364  break;
1365 
1366  case 11: // kv
1367  value.move< std::pair<std::string, cfg::CfgVariant> > (YY_MOVE (s.value));
1368  break;
1369 
1370  case 3: // STRING_LITERAL
1371  case 4: // SYMBOL
1372  value.move< std::string > (YY_MOVE (s.value));
1373  break;
1374 
1375  default:
1376  break;
1377  }
1378 
1379  location = YY_MOVE (s.location);
1380  }
1381 
1382  // by_type.
1383  inline
1384  parser::by_type::by_type ()
1385  : type (empty_symbol)
1386  {}
1387 
1388 #if 201103L <= YY_CPLUSPLUS
1389  inline
1391  : type (that.type)
1392  {
1393  that.clear ();
1394  }
1395 #endif
1396 
1397  inline
1399  : type (that.type)
1400  {}
1401 
1402  inline
1404  : type (yytranslate_ (t))
1405  {}
1406 
1407  inline
1408  void
1410  {
1411  type = empty_symbol;
1412  }
1413 
1414  inline
1415  void
1417  {
1418  type = that.type;
1419  that.clear ();
1420  }
1421 
1422  inline
1423  int
1424  parser::by_type::type_get () const YY_NOEXCEPT
1425  {
1426  return type;
1427  }
1428 
1429 } // cfgyy
1430 #line 1431 "/home/lsilvest/repos/ztsdb_github/src/config_parser/cfgparser.hpp"
1431 
1432 
1433 
1434 
1435 
1436 #endif // !YY_CFGYY_HOME_LSILVEST_REPOS_ZTSDB_GITHUB_SRC_CONFIG_PARSER_CFGPARSER_HPP_INCLUDED
cfgyy::parser::debug_level
debug_level_type debug_level() const YY_ATTRIBUTE_PURE
The current debugging level.
Definition: cfgparser.cpp:463
cfgyy::parser::basic_symbol::~basic_symbol
~basic_symbol()
Destroy the symbol.
Definition: cfgparser.hpp:591
cfgyy::parser::semantic_type::~semantic_type
~semantic_type() YY_NOEXCEPT
Destruction, allowed only if empty.
Definition: cfgparser.hpp:235
cfgyy::parser::semantic_type::move
void move(self_type &that)
Definition: cfgparser.hpp:337
cfgyy::parser::by_type::by_type
by_type()
Default constructor.
Definition: cfgparser.hpp:1384
cfgyy::parser::token
Tokens.
Definition: cfgparser.hpp:460
cfgyy::parser::error
virtual void error(const location_type &loc, const std::string &msg)
Definition: cfgparser.cpp:1114
cfgyy::parser::token_number_type
signed char token_number_type
Internal symbol number for tokens (subsumed by symbol_number_type).
Definition: cfgparser.hpp:484
cfgyy::parser::basic_symbol::basic_symbol
basic_symbol(typename Base::kind_type t, const location_type &l)
Constructor for valueless symbols, and symbols from each type.
Definition: cfgparser.hpp:519
cfgyy::parser::stack::slice
Present a slice of the top of a stack.
Definition: cfgparser.hpp:1146
cfgyy::parser::parse
virtual int parse()
Definition: cfgparser.cpp:504
cfgyy::parser::debug_level_type
int debug_level_type
Type for debugging levels.
Definition: cfgparser.hpp:778
cfgyy::parser::semantic_type::emplace
T & emplace(const T &t)
Instantiate a T in here from t.
Definition: cfgparser.hpp:266
cfgyy::parser::parser
parser(cfg::CfgCtx &ctx_yyarg, yyscan_t scanner_yyarg)
Build a parser object.
Definition: cfgparser.cpp:187
cfgyy::parser::basic_symbol::super_type
Base super_type
Alias to Base.
Definition: cfgparser.hpp:496
cfgyy::parser::semantic_type::self_type
semantic_type self_type
Type of *this.
Definition: cfgparser.hpp:217
cfgyy::parser::by_type
Type access provider for token (enum) based symbols.
Definition: cfgparser.hpp:660
cfgyy::parser::semantic_type::emplace
T & emplace()
Instantiate an empty T in here.
Definition: cfgparser.hpp:255
cfgyy::parser::basic_symbol::move
void move(basic_symbol &s)
Destructive move, s is emptied into this.
Definition: cfgparser.hpp:1349
cfgyy::parser::set_debug_stream
void set_debug_stream(std::ostream &)
Set the current debugging stream.
Definition: cfgparser.cpp:456
yy::parser::basic_symbol
Definition: parser.hpp:556
cfgyy::parser::by_type::type_get
symbol_number_type type_get() const YY_NOEXCEPT
Definition: cfgparser.hpp:1424
cfgyy::parser::by_type::move
void move(by_type &that)
Steal the symbol type from that.
Definition: cfgparser.hpp:1416
cfgyy::parser::basic_symbol::location
location_type location
The location.
Definition: cfgparser.hpp:650
cfgyy::parser::semantic_type
Definition: cfgparser.hpp:213
cfgyy::parser::symbol_type
"External" symbols: returned by the scanner.
Definition: cfgparser.hpp:696
cfgyy::parser::by_type::type
int type
Definition: cfgparser.hpp:692
cfgyy::parser::symbol_type::symbol_type
symbol_type(int tok, const location_type &l)
Constructor for valueless symbols, and symbols from each type.
Definition: cfgparser.hpp:712
cfgyy::parser::semantic_type::swap
void swap(self_type &that) YY_NOEXCEPT
Definition: cfgparser.hpp:325
cfgyy::parser::basic_symbol::value
semantic_type value
The semantic value.
Definition: cfgparser.hpp:647
cfgyy::parser::semantic_type::destroy
void destroy()
Destroy the stored T.
Definition: cfgparser.hpp:370
yy::parser::basic_symbol::value
semantic_type value
The semantic value.
Definition: parser.hpp:750
cfgyy::parser::location_type
location location_type
Symbol locations.
Definition: cfgparser.hpp:439
cfgyy::parser::symbol_number_type
int symbol_number_type
Symbol type: an internal symbol number.
Definition: cfgparser.hpp:478
cfgyy::parser::semantic_type::semantic_type
semantic_type() YY_NOEXCEPT
Empty construction.
Definition: cfgparser.hpp:220
cfgyy::parser::operator()
int operator()()
Definition: cfgparser.cpp:498
cfgyy::parser::symbol_type::super_type
basic_symbol< by_type > super_type
Superclass.
Definition: cfgparser.hpp:699
cfgyy::parser::semantic_type::build
T & build()
Definition: cfgparser.hpp:279
cfgyy::parser::basic_symbol::basic_symbol
basic_symbol()
Default constructor.
Definition: cfgparser.hpp:499
cfgyy::parser::set_debug_level
void set_debug_level(debug_level_type l)
Set the current debugging level.
Definition: cfgparser.cpp:469
cfgyy::parser::semantic_type::copy
void copy(const self_type &that)
Copy the content of that to this.
Definition: cfgparser.hpp:362
cfgyy::parser::semantic_type::yyraw
char yyraw[size]
A buffer large enough to store any of the semantic values.
Definition: cfgparser.hpp:428
cfg::CfgCtx
Definition: config_ctx.hpp:47
yy::parser::basic_symbol::location
location_type location
The location.
Definition: parser.hpp:753
cfgyy::parser::token_type
token::yytokentype token_type
(External) token type, as returned by yylex.
Definition: cfgparser.hpp:475
cfgyy::location
Two points in a source file.
Definition: location.hh:181
state
Definition: tz.hpp:51
cfgyy::parser::debug_stream
std::ostream & debug_stream() const YY_ATTRIBUTE_PURE
The current debugging stream.
Definition: cfgparser.cpp:450
cfgyy::parser::semantic_type::build
T & build(const T &t)
Definition: cfgparser.hpp:288
cfgyy::parser::semantic_type::as
const T & as() const YY_NOEXCEPT
Const accessor to a built T (for printer).
Definition: cfgparser.hpp:307
cfgyy::parser::semantic_type::as
T & as() YY_NOEXCEPT
Accessor to a built T.
Definition: cfgparser.hpp:296
cfgyy::parser::symbol_type::symbol_type
symbol_type()
Empty symbol.
Definition: cfgparser.hpp:702
cfgyy::parser::by_type::clear
void clear()
Record that this symbol is empty.
Definition: cfgparser.hpp:1409
cfgyy::parser::by_type::kind_type
token_type kind_type
The symbol type as needed by the constructor.
Definition: cfgparser.hpp:674
cfgyy::parser::basic_symbol::clear
void clear()
Destroy contents, and record that is empty.
Definition: cfgparser.hpp:597
cfgyy::parser::semantic_type::semantic_type
semantic_type(YY_RVREF(T) t)
Construct and fill.
Definition: cfgparser.hpp:227
cfgyy::parser::basic_symbol
Definition: cfgparser.hpp:493
cfgyy::parser::syntax_error
Syntax errors thrown from user actions.
Definition: cfgparser.hpp:442
cfgyy::parser::basic_symbol::empty
bool empty() const YY_NOEXCEPT
Whether empty.
Definition: cfgparser.hpp:1342
cfgyy::parser
A Bison parser.
Definition: cfgparser.hpp:204
cfgyy::parser::semantic_type::yyalign_me
long double yyalign_me
Strongest alignment constraints.
Definition: cfgparser.hpp:426