Vcsn  2.2
Be Rational
parse.hh
Go to the documentation of this file.
1 // A Bison parser, made by GNU Bison 3.0.4.
2 
3 // Skeleton interface for Bison LALR(1) parsers in C++
4 
5 // Copyright (C) 2002-2015 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 
38 // C++ LALR(1) parser skeleton written by Akim Demaille.
39 
40 #ifndef YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_RAT_PARSE_HH_INCLUDED
41 # define YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_RAT_PARSE_HH_INCLUDED
42 // // "%code requires" blocks.
43 #line 16 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy" // lalr1.cc:377
44 
45  #include <iostream>
46  #include <tuple>
47  #include "location.hh"
49  #include <vcsn/dyn/expression.hh>
50  #include <lib/vcsn/rat/fwd.hh>
51 
52  namespace vcsn
53  {
54  namespace rat
55  {
63  {
67  bool lparen = false;
69  bool rparen = false;
71  {
72  exp = e;
73  return *this;
74  }
75  };
76 
78  using irange_type = std::tuple<int, int>;
79  }
80  }
81 
82 #line 83 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.hh" // lalr1.cc:377
83 
84 
85 # include <cstdlib> // std::abort
86 # include <iostream>
87 # include <stdexcept>
88 # include <string>
89 # include <vector>
90 # include "stack.hh"
91 # include "location.hh"
92 
93 #ifndef YYASSERT
94 # include <cassert>
95 # define YYASSERT assert
96 #endif
97 
98 
99 #ifndef YY_ATTRIBUTE
100 # if (defined __GNUC__ \
101  && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
102  || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
103 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
104 # else
105 # define YY_ATTRIBUTE(Spec) /* empty */
106 # endif
107 #endif
108 
109 #ifndef YY_ATTRIBUTE_PURE
110 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
111 #endif
112 
113 #ifndef YY_ATTRIBUTE_UNUSED
114 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
115 #endif
116 
117 #if !defined _Noreturn \
118  && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
119 # if defined _MSC_VER && 1200 <= _MSC_VER
120 # define _Noreturn __declspec (noreturn)
121 # else
122 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
123 # endif
124 #endif
125 
126 /* Suppress unused-variable warnings by "using" E. */
127 #if ! defined lint || defined __GNUC__
128 # define YYUSE(E) ((void) (E))
129 #else
130 # define YYUSE(E) /* empty */
131 #endif
132 
133 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
134 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
135 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
136  _Pragma ("GCC diagnostic push") \
137  _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
138  _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
139 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
140  _Pragma ("GCC diagnostic pop")
141 #else
142 # define YY_INITIAL_VALUE(Value) Value
143 #endif
144 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
145 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
146 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
147 #endif
148 #ifndef YY_INITIAL_VALUE
149 # define YY_INITIAL_VALUE(Value) /* Nothing. */
150 #endif
151 
152 /* Debug traces. */
153 #ifndef YYDEBUG
154 # define YYDEBUG 1
155 #endif
156 
157 #line 11 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy" // lalr1.cc:377
158 namespace vcsn { namespace rat {
159 #line 160 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.hh" // lalr1.cc:377
160 
161 
162 
168  template <size_t S>
169  struct variant
170  {
173 
176  {}
177 
179  template <typename T>
180  variant (const T& t)
181  {
182  YYASSERT (sizeof (T) <= S);
183  new (yyas_<T> ()) T (t);
184  }
185 
188  {}
189 
191  template <typename T>
192  T&
193  build ()
194  {
195  return *new (yyas_<T> ()) T;
196  }
197 
199  template <typename T>
200  T&
201  build (const T& t)
202  {
203  return *new (yyas_<T> ()) T (t);
204  }
205 
207  template <typename T>
208  T&
209  as ()
210  {
211  return *yyas_<T> ();
212  }
213 
215  template <typename T>
216  const T&
217  as () const
218  {
219  return *yyas_<T> ();
220  }
221 
230  template <typename T>
231  void
232  swap (self_type& other)
233  {
234  std::swap (as<T> (), other.as<T> ());
235  }
236 
240  template <typename T>
241  void
242  move (self_type& other)
243  {
244  build<T> ();
245  swap<T> (other);
246  other.destroy<T> ();
247  }
248 
250  template <typename T>
251  void
252  copy (const self_type& other)
253  {
254  build<T> (other.as<T> ());
255  }
256 
258  template <typename T>
259  void
261  {
262  as<T> ().~T ();
263  }
264 
265  private:
267  self_type& operator=(const self_type&);
268  variant (const self_type&);
269 
271  template <typename T>
272  T*
273  yyas_ ()
274  {
275  void *yyp = yybuffer_.yyraw;
276  return static_cast<T*> (yyp);
277  }
278 
280  template <typename T>
281  const T*
282  yyas_ () const
283  {
284  const void *yyp = yybuffer_.yyraw;
285  return static_cast<const T*> (yyp);
286  }
287 
288  union
289  {
291  long double yyalign_me;
293  char yyraw[S];
294  } yybuffer_;
295  };
296 
297 
299  class parser
300  {
301  public:
302 #ifndef YYSTYPE
303  union union_type
305  {
306  // input
307  // sum
308  // tuple
309  // exp
310  char dummy1[sizeof(braced_expression)];
311 
312  // class
313  char dummy2[sizeof(class_t)];
314 
315  // weights
316  char dummy3[sizeof(dyn::weight)];
317 
318  // "*"
319  char dummy4[sizeof(irange_type)];
320 
321  // "letter"
322  // "weight"
323  char dummy5[sizeof(std::string)];
324 
325  // tuple.1
326  char dummy6[sizeof(std::vector<vcsn::dyn::expression>)];
327 };
328 
331 #else
332  typedef YYSTYPE semantic_type;
333 #endif
334  typedef location location_type;
336 
338  struct syntax_error : std::runtime_error
339  {
340  syntax_error (const location_type& l, const std::string& m);
341  location_type location;
342  };
343 
345  struct token
346  {
348  {
349  END = 0,
350  AMPERSAND = 258,
352  BACKSLASH = 260,
353  BANG = 261,
354  CARET = 262,
355  COLON = 263,
356  COMMA = 264,
357  COMPLEMENT = 265,
358  DASH = 266,
359  DOT = 267,
360  LBRACKET = 268,
361  LPAREN = 269,
362  LT_PLUS = 270,
363  ONE = 271,
364  PERCENT = 272,
365  PIPE = 273,
366  PLUS = 274,
367  RBRACKET = 275,
368  RPAREN = 276,
369  SLASH = 277,
371  ZERO = 279,
372  STAR = 280,
373  LETTER = 281,
374  WEIGHT = 282,
375  CONCAT = 283,
376  RWEIGHT = 284,
377  LWEIGHT = 285
378  };
379  };
380 
383 
385  typedef int symbol_number_type;
386 
388  enum { empty_symbol = -2 };
389 
391  typedef unsigned char token_number_type;
392 
399  template <typename Base>
401  {
403  typedef Base super_type;
404 
406  basic_symbol ();
407 
409  basic_symbol (const basic_symbol& other);
410 
412 
413  basic_symbol (typename Base::kind_type t, const location_type& l);
414 
415  basic_symbol (typename Base::kind_type t, const braced_expression v, const location_type& l);
416 
417  basic_symbol (typename Base::kind_type t, const class_t v, const location_type& l);
418 
419  basic_symbol (typename Base::kind_type t, const dyn::weight v, const location_type& l);
420 
421  basic_symbol (typename Base::kind_type t, const irange_type v, const location_type& l);
422 
423  basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l);
424 
425  basic_symbol (typename Base::kind_type t, const std::vector<vcsn::dyn::expression> v, const location_type& l);
426 
427 
429  basic_symbol (typename Base::kind_type t,
430  const semantic_type& v,
431  const location_type& l);
432 
434  ~basic_symbol ();
435 
437  void clear ();
438 
440  bool empty () const;
441 
443  void move (basic_symbol& s);
444 
446  semantic_type value;
447 
449  location_type location;
450 
451  private:
453  basic_symbol& operator= (const basic_symbol& other);
454  };
455 
457  struct by_type
458  {
460  by_type ();
461 
463  by_type (const by_type& other);
464 
466  typedef token_type kind_type;
467 
469  by_type (kind_type t);
470 
472  void clear ();
473 
475  void move (by_type& that);
476 
479  symbol_number_type type_get () const;
480 
482  token_type token () const;
483 
487  int type;
488  };
489 
492 
493  // Symbol constructors declarations.
494  static inline
495  symbol_type
496  make_END (const location_type& l);
497 
498  static inline
499  symbol_type
500  make_AMPERSAND (const location_type& l);
501 
502  static inline
503  symbol_type
504  make_AMPERSAND_COLON (const location_type& l);
505 
506  static inline
507  symbol_type
508  make_BACKSLASH (const location_type& l);
509 
510  static inline
511  symbol_type
512  make_BANG (const location_type& l);
513 
514  static inline
515  symbol_type
516  make_CARET (const location_type& l);
517 
518  static inline
519  symbol_type
520  make_COLON (const location_type& l);
521 
522  static inline
523  symbol_type
524  make_COMMA (const location_type& l);
525 
526  static inline
527  symbol_type
528  make_COMPLEMENT (const location_type& l);
529 
530  static inline
531  symbol_type
532  make_DASH (const location_type& l);
533 
534  static inline
535  symbol_type
536  make_DOT (const location_type& l);
537 
538  static inline
539  symbol_type
540  make_LBRACKET (const location_type& l);
541 
542  static inline
543  symbol_type
544  make_LPAREN (const location_type& l);
545 
546  static inline
547  symbol_type
548  make_LT_PLUS (const location_type& l);
549 
550  static inline
551  symbol_type
552  make_ONE (const location_type& l);
553 
554  static inline
555  symbol_type
556  make_PERCENT (const location_type& l);
557 
558  static inline
559  symbol_type
560  make_PIPE (const location_type& l);
561 
562  static inline
563  symbol_type
564  make_PLUS (const location_type& l);
565 
566  static inline
567  symbol_type
568  make_RBRACKET (const location_type& l);
569 
570  static inline
571  symbol_type
572  make_RPAREN (const location_type& l);
573 
574  static inline
575  symbol_type
576  make_SLASH (const location_type& l);
577 
578  static inline
579  symbol_type
580  make_TRANSPOSITION (const location_type& l);
581 
582  static inline
583  symbol_type
584  make_ZERO (const location_type& l);
585 
586  static inline
587  symbol_type
588  make_STAR (const irange_type& v, const location_type& l);
589 
590  static inline
591  symbol_type
592  make_LETTER (const std::string& v, const location_type& l);
593 
594  static inline
595  symbol_type
596  make_WEIGHT (const std::string& v, const location_type& l);
597 
598  static inline
599  symbol_type
600  make_CONCAT (const location_type& l);
601 
602  static inline
603  symbol_type
604  make_RWEIGHT (const location_type& l);
605 
606  static inline
607  symbol_type
608  make_LWEIGHT (const location_type& l);
609 
610 
612  parser (driver& driver__yyarg);
613  virtual ~parser ();
614 
617  virtual int parse ();
618 
619 #if YYDEBUG
620  std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
623  void set_debug_stream (std::ostream &);
624 
626  typedef int debug_level_type;
628  debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
630  void set_debug_level (debug_level_type l);
631 #endif
632 
636  virtual void error (const location_type& loc, const std::string& msg);
637 
639  void error (const syntax_error& err);
640 
641  private:
643  parser (const parser&);
644  parser& operator= (const parser&);
645 
647  typedef int state_type;
648 
652  virtual std::string yysyntax_error_ (state_type yystate,
653  const symbol_type& yyla) const;
654 
658  state_type yy_lr_goto_state_ (state_type yystate, int yysym);
659 
662  static bool yy_pact_value_is_default_ (int yyvalue);
663 
666  static bool yy_table_value_is_error_ (int yyvalue);
667 
668  static const signed char yypact_ninf_;
669  static const signed char yytable_ninf_;
670 
672  static token_number_type yytranslate_ (token_type t);
673 
674  // Tables.
675  // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
676  // STATE-NUM.
677  static const short int yypact_[];
678 
679  // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
680  // Performed when YYTABLE does not specify something else to do. Zero
681  // means the default is an error.
682  static const unsigned char yydefact_[];
683 
684  // YYPGOTO[NTERM-NUM].
685  static const signed char yypgoto_[];
686 
687  // YYDEFGOTO[NTERM-NUM].
688  static const signed char yydefgoto_[];
689 
690  // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
691  // positive, shift that token. If negative, reduce the rule whose
692  // number is the opposite. If YYTABLE_NINF, syntax error.
693  static const unsigned char yytable_[];
694 
695  static const signed char yycheck_[];
696 
697  // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
698  // symbol of state STATE-NUM.
699  static const unsigned char yystos_[];
700 
701  // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
702  static const unsigned char yyr1_[];
703 
704  // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
705  static const unsigned char yyr2_[];
706 
707 
709  static std::string yytnamerr_ (const char *n);
710 
711 
713  static const char* const yytname_[];
714 #if YYDEBUG
715  // YYRLINE[YYN] -- Source line where rule number YYN was defined.
716  static const unsigned short int yyrline_[];
718  virtual void yy_reduce_print_ (int r);
720  virtual void yystack_print_ ();
721 
722  // Debugging.
723  int yydebug_;
724  std::ostream* yycdebug_;
725 
729  template <typename Base>
730  void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
731 #endif
732 
737  template <typename Base>
738  void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
739 
740  private:
742  struct by_state
743  {
745  by_state ();
746 
748  typedef state_type kind_type;
749 
751  by_state (kind_type s);
752 
754  by_state (const by_state& other);
755 
757  void clear ();
758 
760  void move (by_state& that);
761 
764  symbol_number_type type_get () const;
765 
767  enum { empty_state = -1 };
768 
771  state_type state;
772  };
773 
775  struct stack_symbol_type : basic_symbol<by_state>
776  {
782  stack_symbol_type (state_type s, symbol_type& sym);
785  };
786 
789 
791  stack_type yystack_;
792 
798  void yypush_ (const char* m, stack_symbol_type& s);
799 
806  void yypush_ (const char* m, state_type s, symbol_type& sym);
807 
809  void yypop_ (unsigned int n = 1);
810 
812  enum
813  {
814  yyeof_ = 0,
815  yylast_ = 203,
816  yynnts_ = 11,
817  yyfinal_ = 5,
819  yyerrcode_ = 256,
821  };
822 
823 
824  // User arguments.
826  };
827 
828  // Symbol number corresponding to token number t.
829  inline
831  parser::yytranslate_ (token_type t)
832  {
833  static
834  const token_number_type
835  translate_table[] =
836  {
837  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
838  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
839  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
840  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
841  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
842  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
843  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
844  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
845  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
846  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
847  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
848  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
849  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
850  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
851  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
852  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
853  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
854  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
855  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
856  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
857  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
858  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
859  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
860  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
861  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
862  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
863  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
864  15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
865  25, 26, 27, 28, 29, 30
866  };
867  const unsigned int user_token_number_max_ = 285;
868  const token_number_type undef_token_ = 2;
869 
870  if (static_cast<int>(t) <= yyeof_)
871  return yyeof_;
872  else if (static_cast<unsigned int> (t) <= user_token_number_max_)
873  return translate_table[t];
874  else
875  return undef_token_;
876  }
877 
878  inline
879  parser::syntax_error::syntax_error (const location_type& l, const std::string& m)
880  : std::runtime_error (m)
881  , location (l)
882  {}
883 
884  // basic_symbol.
885  template <typename Base>
886  inline
888  : value ()
889  {}
890 
891  template <typename Base>
892  inline
894  : Base (other)
895  , value ()
896  , location (other.location)
897  {
898  switch (other.type_get ())
899  {
900  case 32: // input
901  case 34: // sum
902  case 35: // tuple
903  case 39: // exp
904  value.copy< braced_expression > (other.value);
905  break;
906 
907  case 41: // class
908  value.copy< class_t > (other.value);
909  break;
910 
911  case 40: // weights
912  value.copy< dyn::weight > (other.value);
913  break;
914 
915  case 25: // "*"
916  value.copy< irange_type > (other.value);
917  break;
918 
919  case 26: // "letter"
920  case 27: // "weight"
921  value.copy< std::string > (other.value);
922  break;
923 
924  case 37: // tuple.1
925  value.copy< std::vector<vcsn::dyn::expression> > (other.value);
926  break;
927 
928  default:
929  break;
930  }
931 
932  }
933 
934 
935  template <typename Base>
936  inline
937  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const semantic_type& v, const location_type& l)
938  : Base (t)
939  , value ()
940  , location (l)
941  {
942  (void) v;
943  switch (this->type_get ())
944  {
945  case 32: // input
946  case 34: // sum
947  case 35: // tuple
948  case 39: // exp
950  break;
951 
952  case 41: // class
953  value.copy< class_t > (v);
954  break;
955 
956  case 40: // weights
957  value.copy< dyn::weight > (v);
958  break;
959 
960  case 25: // "*"
961  value.copy< irange_type > (v);
962  break;
963 
964  case 26: // "letter"
965  case 27: // "weight"
966  value.copy< std::string > (v);
967  break;
968 
969  case 37: // tuple.1
970  value.copy< std::vector<vcsn::dyn::expression> > (v);
971  break;
972 
973  default:
974  break;
975  }
976 }
977 
978 
979  // Implementation of basic_symbol constructor for each type.
980 
981  template <typename Base>
982  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
983  : Base (t)
984  , value ()
985  , location (l)
986  {}
987 
988  template <typename Base>
989  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const braced_expression v, const location_type& l)
990  : Base (t)
991  , value (v)
992  , location (l)
993  {}
994 
995  template <typename Base>
996  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const class_t v, const location_type& l)
997  : Base (t)
998  , value (v)
999  , location (l)
1000  {}
1001 
1002  template <typename Base>
1003  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const dyn::weight v, const location_type& l)
1004  : Base (t)
1005  , value (v)
1006  , location (l)
1007  {}
1008 
1009  template <typename Base>
1010  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const irange_type v, const location_type& l)
1011  : Base (t)
1012  , value (v)
1013  , location (l)
1014  {}
1015 
1016  template <typename Base>
1017  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l)
1018  : Base (t)
1019  , value (v)
1020  , location (l)
1021  {}
1022 
1023  template <typename Base>
1024  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::vector<vcsn::dyn::expression> v, const location_type& l)
1025  : Base (t)
1026  , value (v)
1027  , location (l)
1028  {}
1029 
1030 
1031  template <typename Base>
1032  inline
1034  {
1035  clear ();
1036  }
1037 
1038  template <typename Base>
1039  inline
1040  void
1042  {
1043  // User destructor.
1044  symbol_number_type yytype = this->type_get ();
1045  basic_symbol<Base>& yysym = *this;
1046  (void) yysym;
1047  switch (yytype)
1048  {
1049  default:
1050  break;
1051  }
1052 
1053  // Type destructor.
1054  switch (yytype)
1055  {
1056  case 32: // input
1057  case 34: // sum
1058  case 35: // tuple
1059  case 39: // exp
1060  value.template destroy< braced_expression > ();
1061  break;
1062 
1063  case 41: // class
1064  value.template destroy< class_t > ();
1065  break;
1066 
1067  case 40: // weights
1068  value.template destroy< dyn::weight > ();
1069  break;
1070 
1071  case 25: // "*"
1072  value.template destroy< irange_type > ();
1073  break;
1074 
1075  case 26: // "letter"
1076  case 27: // "weight"
1077  value.template destroy< std::string > ();
1078  break;
1079 
1080  case 37: // tuple.1
1081  value.template destroy< std::vector<vcsn::dyn::expression> > ();
1082  break;
1083 
1084  default:
1085  break;
1086  }
1087 
1088  Base::clear ();
1089  }
1090 
1091  template <typename Base>
1092  inline
1093  bool
1095  {
1096  return Base::type_get () == empty_symbol;
1097  }
1098 
1099  template <typename Base>
1100  inline
1101  void
1103  {
1104  super_type::move(s);
1105  switch (this->type_get ())
1106  {
1107  case 32: // input
1108  case 34: // sum
1109  case 35: // tuple
1110  case 39: // exp
1111  value.move< braced_expression > (s.value);
1112  break;
1113 
1114  case 41: // class
1115  value.move< class_t > (s.value);
1116  break;
1117 
1118  case 40: // weights
1119  value.move< dyn::weight > (s.value);
1120  break;
1121 
1122  case 25: // "*"
1123  value.move< irange_type > (s.value);
1124  break;
1125 
1126  case 26: // "letter"
1127  case 27: // "weight"
1128  value.move< std::string > (s.value);
1129  break;
1130 
1131  case 37: // tuple.1
1132  value.move< std::vector<vcsn::dyn::expression> > (s.value);
1133  break;
1134 
1135  default:
1136  break;
1137  }
1138 
1139  location = s.location;
1140  }
1141 
1142  // by_type.
1143  inline
1145  : type (empty_symbol)
1146  {}
1147 
1148  inline
1150  : type (other.type)
1151  {}
1152 
1153  inline
1155  : type (yytranslate_ (t))
1156  {}
1157 
1158  inline
1159  void
1161  {
1162  type = empty_symbol;
1163  }
1164 
1165  inline
1166  void
1168  {
1169  type = that.type;
1170  that.clear ();
1171  }
1172 
1173  inline
1174  int
1176  {
1177  return type;
1178  }
1179 
1180  inline
1183  {
1184  // YYTOKNUM[NUM] -- (External) token number corresponding to the
1185  // (internal) symbol number NUM (which must be that of a token). */
1186  static
1187  const unsigned short int
1188  yytoken_number_[] =
1189  {
1190  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1191  265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1192  275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1193  285
1194  };
1195  return static_cast<token_type> (yytoken_number_[type]);
1196  }
1197  // Implementation of make_symbol for each symbol type.
1199  parser::make_END (const location_type& l)
1200  {
1201  return symbol_type (token::END, l);
1202  }
1203 
1205  parser::make_AMPERSAND (const location_type& l)
1206  {
1207  return symbol_type (token::AMPERSAND, l);
1208  }
1209 
1211  parser::make_AMPERSAND_COLON (const location_type& l)
1212  {
1213  return symbol_type (token::AMPERSAND_COLON, l);
1214  }
1215 
1217  parser::make_BACKSLASH (const location_type& l)
1218  {
1219  return symbol_type (token::BACKSLASH, l);
1220  }
1221 
1223  parser::make_BANG (const location_type& l)
1224  {
1225  return symbol_type (token::BANG, l);
1226  }
1227 
1229  parser::make_CARET (const location_type& l)
1230  {
1231  return symbol_type (token::CARET, l);
1232  }
1233 
1235  parser::make_COLON (const location_type& l)
1236  {
1237  return symbol_type (token::COLON, l);
1238  }
1239 
1241  parser::make_COMMA (const location_type& l)
1242  {
1243  return symbol_type (token::COMMA, l);
1244  }
1245 
1247  parser::make_COMPLEMENT (const location_type& l)
1248  {
1249  return symbol_type (token::COMPLEMENT, l);
1250  }
1251 
1253  parser::make_DASH (const location_type& l)
1254  {
1255  return symbol_type (token::DASH, l);
1256  }
1257 
1259  parser::make_DOT (const location_type& l)
1260  {
1261  return symbol_type (token::DOT, l);
1262  }
1263 
1265  parser::make_LBRACKET (const location_type& l)
1266  {
1267  return symbol_type (token::LBRACKET, l);
1268  }
1269 
1271  parser::make_LPAREN (const location_type& l)
1272  {
1273  return symbol_type (token::LPAREN, l);
1274  }
1275 
1277  parser::make_LT_PLUS (const location_type& l)
1278  {
1279  return symbol_type (token::LT_PLUS, l);
1280  }
1281 
1283  parser::make_ONE (const location_type& l)
1284  {
1285  return symbol_type (token::ONE, l);
1286  }
1287 
1289  parser::make_PERCENT (const location_type& l)
1290  {
1291  return symbol_type (token::PERCENT, l);
1292  }
1293 
1295  parser::make_PIPE (const location_type& l)
1296  {
1297  return symbol_type (token::PIPE, l);
1298  }
1299 
1301  parser::make_PLUS (const location_type& l)
1302  {
1303  return symbol_type (token::PLUS, l);
1304  }
1305 
1307  parser::make_RBRACKET (const location_type& l)
1308  {
1309  return symbol_type (token::RBRACKET, l);
1310  }
1311 
1313  parser::make_RPAREN (const location_type& l)
1314  {
1315  return symbol_type (token::RPAREN, l);
1316  }
1317 
1319  parser::make_SLASH (const location_type& l)
1320  {
1321  return symbol_type (token::SLASH, l);
1322  }
1323 
1325  parser::make_TRANSPOSITION (const location_type& l)
1326  {
1327  return symbol_type (token::TRANSPOSITION, l);
1328  }
1329 
1331  parser::make_ZERO (const location_type& l)
1332  {
1333  return symbol_type (token::ZERO, l);
1334  }
1335 
1337  parser::make_STAR (const irange_type& v, const location_type& l)
1338  {
1339  return symbol_type (token::STAR, v, l);
1340  }
1341 
1343  parser::make_LETTER (const std::string& v, const location_type& l)
1344  {
1345  return symbol_type (token::LETTER, v, l);
1346  }
1347 
1349  parser::make_WEIGHT (const std::string& v, const location_type& l)
1350  {
1351  return symbol_type (token::WEIGHT, v, l);
1352  }
1353 
1355  parser::make_CONCAT (const location_type& l)
1356  {
1357  return symbol_type (token::CONCAT, l);
1358  }
1359 
1361  parser::make_RWEIGHT (const location_type& l)
1362  {
1363  return symbol_type (token::RWEIGHT, l);
1364  }
1365 
1367  parser::make_LWEIGHT (const location_type& l)
1368  {
1369  return symbol_type (token::LWEIGHT, l);
1370  }
1371 
1372 
1373 #line 11 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy" // lalr1.cc:377
1374 } } // vcsn::rat
1375 #line 1376 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.hh" // lalr1.cc:377
1376 
1377 
1378 // // "%code provides" blocks.
1379 #line 56 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy" // lalr1.cc:377
1380 
1381  #define YY_DECL_(Class) \
1382  parser::symbol_type Class lex(driver& driver_)
1383  #define YY_DECL YY_DECL_(yyFlexLexer::)
1384 
1385 #line 1386 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.hh" // lalr1.cc:377
1386 
1387 
1388 #endif // !YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_RAT_PARSE_HH_INCLUDED
A complete symbol.
Definition: parse.hh:400
syntax_error(const location_type &l, const std::string &m)
Definition: parse.hh:879
debug_level_type debug_level() const
The current debugging level.
Definition: parse.cc:546
int state_type
State numbers.
Definition: parse.hh:647
char dummy3[sizeof(dyn::weight)]
Definition: parse.hh:316
void move(by_state &that)
Steal the symbol type from that.
Definition: parse.cc:269
static symbol_type make_COMPLEMENT(const location_type &l)
Definition: parse.hh:1247
union vcsn::rat::variant::@5 yybuffer_
static bool yy_pact_value_is_default_(int yyvalue)
Whether the given yypact_ value indicates a defaulted state.
Definition: parse.cc:569
bool lparen
Whether there was a left-paren.
Definition: parse.hh:67
char dummy4[sizeof(irange_type)]
Definition: parse.hh:319
static symbol_type make_DASH(const location_type &l)
Definition: parse.hh:1253
T & as()
Accessor to a built T.
Definition: parse.hh:215
std::set< std::pair< std::string, std::string >> class_t
A set of label ranges.
Definition: fwd.hh:12
void yy_print_(std::ostream &yyo, const basic_symbol< Base > &yysym) const
Display a symbol type, value and location.
Definition: parse.cc:393
void set_debug_level(debug_level_type l)
Set the current debugging level.
Definition: parse.cc:552
virtual void yystack_print_()
Print the state stack on the debug stream.
Definition: parse.cc:1421
#define YY_ATTRIBUTE_PURE
Definition: parse.hh:110
token_type token() const
The token.
Definition: parse.hh:1182
static symbol_type make_LPAREN(const location_type &l)
Definition: parse.hh:1271
static symbol_type make_PIPE(const location_type &l)
Definition: parse.hh:1295
driver & driver_
Definition: parse.hh:825
std::shared_ptr< const detail::weight_base > weight
Definition: fwd.hh:88
void move(self_type &other)
Move the content of other to this.
Definition: parse.hh:242
static const signed char yypact_ninf_
Definition: parse.hh:668
const T * yyas_() const
Const accessor to raw memory as T.
Definition: parse.hh:282
symbol_number_type type_get() const
The (internal) type number (corresponding to state).
Definition: parse.cc:282
static symbol_type make_CARET(const location_type &l)
Definition: parse.hh:1229
Number of nonterminal symbols.
Definition: parse.hh:816
void move(by_type &that)
Steal the symbol type from that.
Definition: parse.hh:1167
std::tuple< int, int > irange_type
An integer range, for quantifiers/exponents.
Definition: parse.hh:78
virtual void error(const location_type &loc, const std::string &msg)
Report a syntax error.
Definition: parse.cc:1467
~basic_symbol()
Destroy the symbol.
Definition: parse.hh:1033
variant()
Empty construction.
Definition: parse.hh:175
static symbol_type make_PERCENT(const location_type &l)
Definition: parse.hh:1289
An auxiliary type to compute the largest semantic type.
Definition: parse.hh:304
Definition: a-star.hh:8
dyn::expression exp
The expression parsed so far.
Definition: parse.hh:65
token_type kind_type
The symbol type as needed by the constructor.
Definition: parse.hh:466
virtual int parse()
Parse.
Definition: parse.cc:581
stack_symbol_type()
Construct an empty symbol.
Definition: parse.cc:291
STL namespace.
void yypop_(unsigned int n=1)
Pop n symbols the three stacks.
Definition: parse.cc:526
static symbol_type make_TRANSPOSITION(const location_type &l)
Definition: parse.hh:1325
virtual void yy_reduce_print_(int r)
Report on the debug stream that the rule r is going to be reduced.
Definition: parse.cc:1434
T & build(const T &t)
Instantiate a T in here from t.
Definition: parse.hh:201
~variant()
Destruction, allowed only if empty.
Definition: parse.hh:187
static token_number_type yytranslate_(token_type t)
Convert a scanner token number t to a symbol number.
Definition: parse.hh:831
char yyraw[S]
A buffer large enough to store any of the semantic values.
Definition: parse.hh:293
T * yyas_()
Accessor to raw memory as T.
Definition: parse.hh:273
static symbol_type make_AMPERSAND(const location_type &l)
Definition: parse.hh:1205
Define the vcsn::rat::location class.
std::string type(const automaton &a)
The implementation type of a.
Definition: others.cc:206
void clear()
Record that this symbol is empty.
Definition: parse.hh:1160
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46
virtual std::string yysyntax_error_(state_type yystate, const symbol_type &yyla) const
Generate an error message.
Definition: parse.cc:1177
semantic_type value
The semantic value.
Definition: parse.hh:446
void clear()
Record that this symbol is empty.
Definition: parse.cc:262
#define YYASSERT
Definition: parse.hh:95
static symbol_type make_DOT(const location_type &l)
Definition: parse.hh:1259
Define the vcsn::rat::stack class.
static const unsigned short int yyrline_[]
Definition: parse.hh:716
variant< S > self_type
Type of *this.
Definition: parse.hh:172
void copy(const self_type &other)
Copy the content of other to this.
Definition: parse.hh:252
Last index in yytable_.
Definition: parse.hh:815
static symbol_type make_ZERO(const location_type &l)
Definition: parse.hh:1331
Number of tokens.
Definition: parse.hh:820
int debug_level_type
Type for debugging levels.
Definition: parse.hh:626
int type
The symbol type.
Definition: parse.hh:487
self_type & operator=(const self_type &)
Prohibit blind copies.
virtual ~parser()
Definition: parse.cc:239
int symbol_number_type
Symbol type: an internal symbol number.
Definition: parse.hh:385
A Bison parser.
Definition: parse.hh:299
static bool yy_table_value_is_error_(int yyvalue)
Whether the given yytable_ value indicates a syntax error.
Definition: parse.cc:575
void swap(self_type &other)
Swap the content with other, of same type.
Definition: parse.hh:232
static symbol_type make_AMPERSAND_COLON(const location_type &l)
Definition: parse.hh:1211
Abstract a location.
Definition: location.hh:47
unsigned char token_number_type
Internal symbol number for tokens (subsumed by symbol_number_type).
Definition: parse.hh:391
basic_symbol & operator=(const basic_symbol &other)
Assignment operator.
by_state()
Default constructor.
Definition: parse.cc:251
std::ostream & debug_stream() const
The current debugging stream.
Definition: parse.cc:533
static symbol_type make_ONE(const location_type &l)
Definition: parse.hh:1283
basic_symbol< by_type > symbol_type
"External" symbols: returned by the scanner.
Definition: parse.hh:491
state_type kind_type
The symbol type as needed by the constructor.
Definition: parse.hh:748
char dummy1[sizeof(braced_expression)]
Definition: parse.hh:310
state_type yy_lr_goto_state_(state_type yystate, int yysym)
Compute post-reduction state.
Definition: parse.cc:559
braced_expression & operator=(dyn::expression e)
Definition: parse.hh:70
char dummy6[sizeof(std::vector< vcsn::dyn::expression >)]
Definition: parse.hh:326
stack< stack_symbol_type > stack_type
Stack type.
Definition: parse.hh:788
static symbol_type make_BACKSLASH(const location_type &l)
Definition: parse.hh:1217
static symbol_type make_END(const location_type &l)
Definition: parse.hh:1199
variant< sizeof(union_type)> semantic_type
Symbol semantic values.
Definition: parse.hh:330
void move(basic_symbol &s)
Destructive move, s is emptied into this.
Definition: parse.hh:1102
State and public interface for rational expression parsing.
Definition: driver.hh:17
static const unsigned char yytable_[]
Definition: parse.hh:693
static symbol_type make_COLON(const location_type &l)
Definition: parse.hh:1235
static const unsigned char yystos_[]
Definition: parse.hh:699
bool rparen
Whether there was a right-paren.
Definition: parse.hh:69
static const unsigned char yydefact_[]
Definition: parse.hh:682
static const signed char yydefgoto_[]
Definition: parse.hh:688
basic_symbol< by_state > super_type
Superclass.
Definition: parse.hh:778
symbol_number_type type_get() const
The (internal) type number (corresponding to type).
Definition: parse.hh:1175
static symbol_type make_RBRACKET(const location_type &l)
Definition: parse.hh:1307
state_type state
The state.
Definition: parse.hh:771
static const short int yypact_[]
Definition: parse.hh:677
stack_symbol_type & operator=(const stack_symbol_type &that)
Assignment, needed by push_back.
Definition: parse.cc:339
Base super_type
Alias to Base.
Definition: parse.hh:403
static symbol_type make_LT_PLUS(const location_type &l)
Definition: parse.hh:1277
void destroy()
Destroy the stored T.
Definition: parse.hh:260
by_type()
Default constructor.
Definition: parse.hh:1144
Termination state number.
Definition: parse.hh:817
static symbol_type make_CONCAT(const location_type &l)
Definition: parse.hh:1355
long double yyalign_me
Strongest alignment constraints.
Definition: parse.hh:291
static const unsigned char yyr2_[]
Definition: parse.hh:705
static const signed char yytable_ninf_
Definition: parse.hh:669
static symbol_type make_BANG(const location_type &l)
Definition: parse.hh:1223
static symbol_type make_RWEIGHT(const location_type &l)
Definition: parse.hh:1361
static symbol_type make_SLASH(const location_type &l)
Definition: parse.hh:1319
parser(driver &driver__yyarg)
Build a parser object.
Definition: parse.cc:230
static const signed char yycheck_[]
Definition: parse.hh:695
Type access provider for token (enum) based symbols.
Definition: parse.hh:457
A char[S] buffer to store and retrieve objects.
Definition: parse.hh:175
static symbol_type make_LBRACKET(const location_type &l)
Definition: parse.hh:1265
Type access provider for state based symbols.
Definition: parse.hh:742
void set_debug_stream(std::ostream &)
Set the current debugging stream.
Definition: parse.cc:539
stack_type yystack_
The stack.
Definition: parse.hh:791
std::shared_ptr< detail::expression_base > expression
Definition: expression.hh:92
static symbol_type make_LETTER(const std::string &v, const location_type &l)
Definition: parse.hh:1343
void yypush_(const char *m, stack_symbol_type &s)
Push a new state on the stack.
Definition: parse.cc:517
T & build()
Instantiate an empty T in here.
Definition: parse.hh:193
variant(const T &t)
Construct and fill.
Definition: parse.hh:180
basic_symbol()
Default constructor.
Definition: parse.hh:887
static symbol_type make_WEIGHT(const std::string &v, const location_type &l)
Definition: parse.hh:1349
location location_type
Symbol locations.
Definition: parse.hh:335
An expression that "remembers" whether it was in parentheses.
Definition: parse.hh:62
static const unsigned char yyr1_[]
Definition: parse.hh:702
bool empty() const
Whether empty.
Definition: parse.hh:1094
Syntax errors thrown from user actions.
Definition: parse.hh:338
char dummy5[sizeof(std::string)]
Definition: parse.hh:323
parser & operator=(const parser &)
static const signed char yypgoto_[]
Definition: parse.hh:685
static symbol_type make_PLUS(const location_type &l)
Definition: parse.hh:1301
static symbol_type make_STAR(const irange_type &v, const location_type &l)
Definition: parse.hh:1337
void yy_destroy_(const char *yymsg, basic_symbol< Base > &yysym) const
Reclaim the memory associated to a symbol.
Definition: parse.cc:384
location_type location
The location.
Definition: parse.hh:449
static symbol_type make_LWEIGHT(const location_type &l)
Definition: parse.hh:1367
const T & as() const
Const accessor to a built T (for printer).
Definition: parse.hh:217
std::ostream * yycdebug_
Definition: parse.hh:724
"Internal" symbol: element of the stack.
Definition: parse.hh:775
static std::string yytnamerr_(const char *n)
Convert the symbol name n to a form suitable for a diagnostic.
Definition: parse.cc:197
char dummy2[sizeof(class_t)]
Definition: parse.hh:313
token::yytokentype token_type
(External) token type, as returned by yylex.
Definition: parse.hh:382
void destroy()
Destroy the stored T.
Definition: parse.hh:266
static symbol_type make_RPAREN(const location_type &l)
Definition: parse.hh:1313
T & as()
Accessor to a built T.
Definition: parse.hh:209
static const char *const yytname_[]
For a symbol, its name in clear.
Definition: parse.hh:713
void clear()
Destroy contents, and record that is empty.
Definition: parse.hh:1041
static symbol_type make_COMMA(const location_type &l)
Definition: parse.hh:1241
A char[S] buffer to store and retrieve objects.
Definition: parse.hh:169