Vcsn  2.2
Be Rational
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
parse.hh
Go to the documentation of this file.
1 // A Bison parser, made by GNU Bison 3.0.2.
2 
3 // Skeleton interface for Bison LALR(1) parsers in C++
4 
5 // Copyright (C) 2002-2013 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_LIB_VCSN_RAT_PARSE_HH_INCLUDED
41 # define YY_YY_LIB_VCSN_RAT_PARSE_HH_INCLUDED
42 // // "%code requires" blocks.
43 #line 16 "lib/vcsn/rat/parse.yy" // lalr1.cc:372
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 "./lib/vcsn/rat/parse.hh" // lalr1.cc:372
83 
84 
85 # include <vector>
86 # include <iostream>
87 # include <stdexcept>
88 # include <string>
89 # include "stack.hh"
90 # include "location.hh"
91 
92 #ifndef YYASSERT
93 # include <cassert>
94 # define YYASSERT assert
95 #endif
96 
97 
98 #ifndef YY_ATTRIBUTE
99 # if (defined __GNUC__ \
100  && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
101  || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
102 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
103 # else
104 # define YY_ATTRIBUTE(Spec) /* empty */
105 # endif
106 #endif
107 
108 #ifndef YY_ATTRIBUTE_PURE
109 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
110 #endif
111 
112 #ifndef YY_ATTRIBUTE_UNUSED
113 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
114 #endif
115 
116 #if !defined _Noreturn \
117  && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
118 # if defined _MSC_VER && 1200 <= _MSC_VER
119 # define _Noreturn __declspec (noreturn)
120 # else
121 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
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__ && 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 /* Debug traces. */
152 #ifndef YYDEBUG
153 # define YYDEBUG 1
154 #endif
155 
156 #line 11 "lib/vcsn/rat/parse.yy" // lalr1.cc:372
157 namespace vcsn { namespace rat {
158 #line 159 "./lib/vcsn/rat/parse.hh" // lalr1.cc:372
159 
160 
161 
167  template <size_t S>
168  struct variant
169  {
172 
175  {}
176 
178  template <typename T>
179  variant (const T& t)
180  {
181  YYASSERT (sizeof (T) <= S);
182  new (yyas_<T> ()) T (t);
183  }
184 
187  {}
188 
190  template <typename T>
191  T&
192  build ()
193  {
194  return *new (yyas_<T> ()) T;
195  }
196 
198  template <typename T>
199  T&
200  build (const T& t)
201  {
202  return *new (yyas_<T> ()) T (t);
203  }
204 
206  template <typename T>
207  T&
208  as ()
209  {
210  return *yyas_<T> ();
211  }
212 
214  template <typename T>
215  const T&
216  as () const
217  {
218  return *yyas_<T> ();
219  }
220 
229  template <typename T>
230  void
231  swap (self_type& other)
232  {
233  std::swap (as<T> (), other.as<T> ());
234  }
235 
239  template <typename T>
240  void
241  move (self_type& other)
242  {
243  build<T> ();
244  swap<T> (other);
245  other.destroy<T> ();
246  }
247 
249  template <typename T>
250  void
251  copy (const self_type& other)
252  {
253  build<T> (other.as<T> ());
254  }
255 
257  template <typename T>
258  void
260  {
261  as<T> ().~T ();
262  }
263 
264  private:
266  self_type& operator=(const self_type&);
267  variant (const self_type&);
268 
270  template <typename T>
271  T*
272  yyas_ ()
273  {
274  void *yyp = yybuffer_.yyraw;
275  return static_cast<T*> (yyp);
276  }
277 
279  template <typename T>
280  const T*
281  yyas_ () const
282  {
283  const void *yyp = yybuffer_.yyraw;
284  return static_cast<const T*> (yyp);
285  }
286 
287  union
288  {
290  long double yyalign_me;
292  char yyraw[S];
293  } yybuffer_;
294  };
295 
296 
298  class parser
299  {
300  public:
301 #ifndef YYSTYPE
302  union union_type
304  {
305  // input
306  // sum
307  // tuple
308  // exp
309  char dummy1[sizeof(braced_expression)];
310 
311  // class
312  char dummy2[sizeof(class_t)];
313 
314  // weights
315  char dummy3[sizeof(dyn::weight)];
316 
317  // "*"
318  char dummy4[sizeof(irange_type)];
319 
320  // "letter"
321  // "weight"
322  char dummy5[sizeof(std::string)];
323 
324  // tuple.1
325  char dummy6[sizeof(std::vector<vcsn::dyn::expression>)];
326 };
327 
330 #else
331  typedef YYSTYPE semantic_type;
332 #endif
333  typedef location location_type;
335 
337  struct syntax_error : std::runtime_error
338  {
339  syntax_error (const location_type& l, const std::string& m);
340  location_type location;
341  };
342 
344  struct token
345  {
347  {
348  END = 0,
349  AMPERSAND = 258,
351  BACKSLASH = 260,
352  BANG = 261,
353  CARET = 262,
354  COLON = 263,
355  COMMA = 264,
356  COMPLEMENT = 265,
357  DASH = 266,
358  DOT = 267,
359  LBRACKET = 268,
360  LPAREN = 269,
361  LT_PLUS = 270,
362  ONE = 271,
363  PERCENT = 272,
364  PIPE = 273,
365  PLUS = 274,
366  RBRACKET = 275,
367  RPAREN = 276,
368  SLASH = 277,
370  ZERO = 279,
371  STAR = 280,
372  LETTER = 281,
373  WEIGHT = 282,
374  CONCAT = 283,
375  RWEIGHT = 284,
376  LWEIGHT = 285
377  };
378  };
379 
382 
384  typedef int symbol_number_type;
385 
387  typedef unsigned char token_number_type;
388 
395  template <typename Base>
397  {
399  typedef Base super_type;
400 
402  basic_symbol ();
403 
405  basic_symbol (const basic_symbol& other);
406 
408 
409  basic_symbol (typename Base::kind_type t, const location_type& l);
410 
411  basic_symbol (typename Base::kind_type t, const braced_expression v, const location_type& l);
412 
413  basic_symbol (typename Base::kind_type t, const class_t v, const location_type& l);
414 
415  basic_symbol (typename Base::kind_type t, const dyn::weight v, const location_type& l);
416 
417  basic_symbol (typename Base::kind_type t, const irange_type v, const location_type& l);
418 
419  basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l);
420 
421  basic_symbol (typename Base::kind_type t, const std::vector<vcsn::dyn::expression> v, const location_type& l);
422 
423 
425  basic_symbol (typename Base::kind_type t,
426  const semantic_type& v,
427  const location_type& l);
428 
429  ~basic_symbol ();
430 
432  void move (basic_symbol& s);
433 
435  semantic_type value;
436 
438  location_type location;
439 
440  private:
442  basic_symbol& operator= (const basic_symbol& other);
443  };
444 
446  struct by_type
447  {
449  by_type ();
450 
452  by_type (const by_type& other);
453 
455  typedef token_type kind_type;
456 
458  by_type (kind_type t);
459 
461  void move (by_type& that);
462 
465  symbol_number_type type_get () const;
466 
468  token_type token () const;
469 
470  enum { empty = 0 };
471 
474  token_number_type type;
475  };
476 
479 
480  // Symbol constructors declarations.
481  static inline
482  symbol_type
483  make_END (const location_type& l);
484 
485  static inline
486  symbol_type
487  make_AMPERSAND (const location_type& l);
488 
489  static inline
490  symbol_type
491  make_AMPERSAND_COLON (const location_type& l);
492 
493  static inline
494  symbol_type
495  make_BACKSLASH (const location_type& l);
496 
497  static inline
498  symbol_type
499  make_BANG (const location_type& l);
500 
501  static inline
502  symbol_type
503  make_CARET (const location_type& l);
504 
505  static inline
506  symbol_type
507  make_COLON (const location_type& l);
508 
509  static inline
510  symbol_type
511  make_COMMA (const location_type& l);
512 
513  static inline
514  symbol_type
515  make_COMPLEMENT (const location_type& l);
516 
517  static inline
518  symbol_type
519  make_DASH (const location_type& l);
520 
521  static inline
522  symbol_type
523  make_DOT (const location_type& l);
524 
525  static inline
526  symbol_type
527  make_LBRACKET (const location_type& l);
528 
529  static inline
530  symbol_type
531  make_LPAREN (const location_type& l);
532 
533  static inline
534  symbol_type
535  make_LT_PLUS (const location_type& l);
536 
537  static inline
538  symbol_type
539  make_ONE (const location_type& l);
540 
541  static inline
542  symbol_type
543  make_PERCENT (const location_type& l);
544 
545  static inline
546  symbol_type
547  make_PIPE (const location_type& l);
548 
549  static inline
550  symbol_type
551  make_PLUS (const location_type& l);
552 
553  static inline
554  symbol_type
555  make_RBRACKET (const location_type& l);
556 
557  static inline
558  symbol_type
559  make_RPAREN (const location_type& l);
560 
561  static inline
562  symbol_type
563  make_SLASH (const location_type& l);
564 
565  static inline
566  symbol_type
567  make_TRANSPOSITION (const location_type& l);
568 
569  static inline
570  symbol_type
571  make_ZERO (const location_type& l);
572 
573  static inline
574  symbol_type
575  make_STAR (const irange_type& v, const location_type& l);
576 
577  static inline
578  symbol_type
579  make_LETTER (const std::string& v, const location_type& l);
580 
581  static inline
582  symbol_type
583  make_WEIGHT (const std::string& v, const location_type& l);
584 
585  static inline
586  symbol_type
587  make_CONCAT (const location_type& l);
588 
589  static inline
590  symbol_type
591  make_RWEIGHT (const location_type& l);
592 
593  static inline
594  symbol_type
595  make_LWEIGHT (const location_type& l);
596 
597 
599  parser (driver& driver__yyarg);
600  virtual ~parser ();
601 
604  virtual int parse ();
605 
606 #if YYDEBUG
607  std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
610  void set_debug_stream (std::ostream &);
611 
613  typedef int debug_level_type;
615  debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
617  void set_debug_level (debug_level_type l);
618 #endif
619 
623  virtual void error (const location_type& loc, const std::string& msg);
624 
626  void error (const syntax_error& err);
627 
628  private:
630  parser (const parser&);
631  parser& operator= (const parser&);
632 
634  typedef int state_type;
635 
639  virtual std::string yysyntax_error_ (state_type yystate,
640  symbol_number_type yytoken) const;
641 
645  state_type yy_lr_goto_state_ (state_type yystate, int yysym);
646 
649  static bool yy_pact_value_is_default_ (int yyvalue);
650 
653  static bool yy_table_value_is_error_ (int yyvalue);
654 
655  static const signed char yypact_ninf_;
656  static const signed char yytable_ninf_;
657 
659  static token_number_type yytranslate_ (token_type t);
660 
661  // Tables.
662  // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
663  // STATE-NUM.
664  static const short int yypact_[];
665 
666  // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
667  // Performed when YYTABLE does not specify something else to do. Zero
668  // means the default is an error.
669  static const unsigned char yydefact_[];
670 
671  // YYPGOTO[NTERM-NUM].
672  static const signed char yypgoto_[];
673 
674  // YYDEFGOTO[NTERM-NUM].
675  static const signed char yydefgoto_[];
676 
677  // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
678  // positive, shift that token. If negative, reduce the rule whose
679  // number is the opposite. If YYTABLE_NINF, syntax error.
680  static const unsigned char yytable_[];
681 
682  static const signed char yycheck_[];
683 
684  // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
685  // symbol of state STATE-NUM.
686  static const unsigned char yystos_[];
687 
688  // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
689  static const unsigned char yyr1_[];
690 
691  // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
692  static const unsigned char yyr2_[];
693 
694 
696  static std::string yytnamerr_ (const char *n);
697 
698 
700  static const char* const yytname_[];
701 #if YYDEBUG
702  // YYRLINE[YYN] -- Source line where rule number YYN was defined.
703  static const unsigned short int yyrline_[];
705  virtual void yy_reduce_print_ (int r);
707  virtual void yystack_print_ ();
708 
709  // Debugging.
710  int yydebug_;
711  std::ostream* yycdebug_;
712 
716  template <typename Base>
717  void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
718 #endif
719 
724  template <typename Base>
725  void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
726 
727  private:
729  struct by_state
730  {
732  by_state ();
733 
735  typedef state_type kind_type;
736 
738  by_state (kind_type s);
739 
741  by_state (const by_state& other);
742 
744  void move (by_state& that);
745 
748  symbol_number_type type_get () const;
749 
750  enum { empty = 0 };
751 
753  state_type state;
754  };
755 
757  struct stack_symbol_type : basic_symbol<by_state>
758  {
764  stack_symbol_type (state_type s, symbol_type& sym);
767  };
768 
771 
773  stack_type yystack_;
774 
780  void yypush_ (const char* m, stack_symbol_type& s);
781 
788  void yypush_ (const char* m, state_type s, symbol_type& sym);
789 
791  void yypop_ (unsigned int n = 1);
792 
793  // Constants.
794  enum
795  {
796  yyeof_ = 0,
797  yylast_ = 203,
798  yynnts_ = 11,
799  yyempty_ = -2,
800  yyfinal_ = 5,
802  yyerrcode_ = 256,
804  };
805 
806 
807  // User arguments.
809  };
810 
811  // Symbol number corresponding to token number t.
812  inline
814  parser::yytranslate_ (token_type t)
815  {
816  static
817  const token_number_type
818  translate_table[] =
819  {
820  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
821  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
822  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
823  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
824  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
825  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
826  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
827  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
828  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
829  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
830  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
831  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
832  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
833  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
834  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
835  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
836  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
837  2, 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, 1, 2, 3, 4,
846  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
847  15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
848  25, 26, 27, 28, 29, 30
849  };
850  const unsigned int user_token_number_max_ = 285;
851  const token_number_type undef_token_ = 2;
852 
853  if (static_cast<int>(t) <= yyeof_)
854  return yyeof_;
855  else if (static_cast<unsigned int> (t) <= user_token_number_max_)
856  return translate_table[t];
857  else
858  return undef_token_;
859  }
860 
861  inline
862  parser::syntax_error::syntax_error (const location_type& l, const std::string& m)
863  : std::runtime_error (m)
864  , location (l)
865  {}
866 
867  // basic_symbol.
868  template <typename Base>
869  inline
871  : value ()
872  {}
873 
874  template <typename Base>
875  inline
877  : Base (other)
878  , value ()
879  , location (other.location)
880  {
881  switch (other.type_get ())
882  {
883  case 32: // input
884  case 34: // sum
885  case 35: // tuple
886  case 39: // exp
887  value.copy< braced_expression > (other.value);
888  break;
889 
890  case 41: // class
891  value.copy< class_t > (other.value);
892  break;
893 
894  case 40: // weights
895  value.copy< dyn::weight > (other.value);
896  break;
897 
898  case 25: // "*"
899  value.copy< irange_type > (other.value);
900  break;
901 
902  case 26: // "letter"
903  case 27: // "weight"
904  value.copy< std::string > (other.value);
905  break;
906 
907  case 37: // tuple.1
908  value.copy< std::vector<vcsn::dyn::expression> > (other.value);
909  break;
910 
911  default:
912  break;
913  }
914 
915  }
916 
917 
918  template <typename Base>
919  inline
920  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const semantic_type& v, const location_type& l)
921  : Base (t)
922  , value ()
923  , location (l)
924  {
925  (void) v;
926  switch (this->type_get ())
927  {
928  case 32: // input
929  case 34: // sum
930  case 35: // tuple
931  case 39: // exp
933  break;
934 
935  case 41: // class
936  value.copy< class_t > (v);
937  break;
938 
939  case 40: // weights
940  value.copy< dyn::weight > (v);
941  break;
942 
943  case 25: // "*"
944  value.copy< irange_type > (v);
945  break;
946 
947  case 26: // "letter"
948  case 27: // "weight"
949  value.copy< std::string > (v);
950  break;
951 
952  case 37: // tuple.1
953  value.copy< std::vector<vcsn::dyn::expression> > (v);
954  break;
955 
956  default:
957  break;
958  }
959 }
960 
961 
962  // Implementation of basic_symbol constructor for each type.
963 
964  template <typename Base>
965  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
966  : Base (t)
967  , value ()
968  , location (l)
969  {}
970 
971  template <typename Base>
972  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const braced_expression v, const location_type& l)
973  : Base (t)
974  , value (v)
975  , location (l)
976  {}
977 
978  template <typename Base>
979  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const class_t v, const location_type& l)
980  : Base (t)
981  , value (v)
982  , location (l)
983  {}
984 
985  template <typename Base>
986  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const dyn::weight v, const location_type& l)
987  : Base (t)
988  , value (v)
989  , location (l)
990  {}
991 
992  template <typename Base>
993  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const irange_type v, const location_type& l)
994  : Base (t)
995  , value (v)
996  , location (l)
997  {}
998 
999  template <typename Base>
1000  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l)
1001  : Base (t)
1002  , value (v)
1003  , location (l)
1004  {}
1005 
1006  template <typename Base>
1007  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::vector<vcsn::dyn::expression> v, const location_type& l)
1008  : Base (t)
1009  , value (v)
1010  , location (l)
1011  {}
1012 
1013 
1014  template <typename Base>
1015  inline
1017  {
1018  // User destructor.
1019  symbol_number_type yytype = this->type_get ();
1020  switch (yytype)
1021  {
1022  default:
1023  break;
1024  }
1025 
1026  // Type destructor.
1027  switch (yytype)
1028  {
1029  case 32: // input
1030  case 34: // sum
1031  case 35: // tuple
1032  case 39: // exp
1033  value.template destroy< braced_expression > ();
1034  break;
1035 
1036  case 41: // class
1037  value.template destroy< class_t > ();
1038  break;
1039 
1040  case 40: // weights
1041  value.template destroy< dyn::weight > ();
1042  break;
1043 
1044  case 25: // "*"
1045  value.template destroy< irange_type > ();
1046  break;
1047 
1048  case 26: // "letter"
1049  case 27: // "weight"
1050  value.template destroy< std::string > ();
1051  break;
1052 
1053  case 37: // tuple.1
1054  value.template destroy< std::vector<vcsn::dyn::expression> > ();
1055  break;
1056 
1057  default:
1058  break;
1059  }
1060 
1061  }
1062 
1063  template <typename Base>
1064  inline
1065  void
1067  {
1068  super_type::move(s);
1069  switch (this->type_get ())
1070  {
1071  case 32: // input
1072  case 34: // sum
1073  case 35: // tuple
1074  case 39: // exp
1075  value.move< braced_expression > (s.value);
1076  break;
1077 
1078  case 41: // class
1079  value.move< class_t > (s.value);
1080  break;
1081 
1082  case 40: // weights
1083  value.move< dyn::weight > (s.value);
1084  break;
1085 
1086  case 25: // "*"
1087  value.move< irange_type > (s.value);
1088  break;
1089 
1090  case 26: // "letter"
1091  case 27: // "weight"
1092  value.move< std::string > (s.value);
1093  break;
1094 
1095  case 37: // tuple.1
1096  value.move< std::vector<vcsn::dyn::expression> > (s.value);
1097  break;
1098 
1099  default:
1100  break;
1101  }
1102 
1103  location = s.location;
1104  }
1105 
1106  // by_type.
1107  inline
1109  : type (empty)
1110  {}
1111 
1112  inline
1114  : type (other.type)
1115  {}
1116 
1117  inline
1119  : type (yytranslate_ (t))
1120  {}
1121 
1122  inline
1123  void
1125  {
1126  type = that.type;
1127  that.type = empty;
1128  }
1129 
1130  inline
1131  int
1133  {
1134  return type;
1135  }
1136 
1137  inline
1140  {
1141  // YYTOKNUM[NUM] -- (External) token number corresponding to the
1142  // (internal) symbol number NUM (which must be that of a token). */
1143  static
1144  const unsigned short int
1145  yytoken_number_[] =
1146  {
1147  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1148  265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1149  275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1150  285
1151  };
1152  return static_cast<token_type> (yytoken_number_[type]);
1153  }
1154  // Implementation of make_symbol for each symbol type.
1156  parser::make_END (const location_type& l)
1157  {
1158  return symbol_type (token::END, l);
1159  }
1160 
1162  parser::make_AMPERSAND (const location_type& l)
1163  {
1164  return symbol_type (token::AMPERSAND, l);
1165  }
1166 
1168  parser::make_AMPERSAND_COLON (const location_type& l)
1169  {
1170  return symbol_type (token::AMPERSAND_COLON, l);
1171  }
1172 
1174  parser::make_BACKSLASH (const location_type& l)
1175  {
1176  return symbol_type (token::BACKSLASH, l);
1177  }
1178 
1180  parser::make_BANG (const location_type& l)
1181  {
1182  return symbol_type (token::BANG, l);
1183  }
1184 
1186  parser::make_CARET (const location_type& l)
1187  {
1188  return symbol_type (token::CARET, l);
1189  }
1190 
1192  parser::make_COLON (const location_type& l)
1193  {
1194  return symbol_type (token::COLON, l);
1195  }
1196 
1198  parser::make_COMMA (const location_type& l)
1199  {
1200  return symbol_type (token::COMMA, l);
1201  }
1202 
1204  parser::make_COMPLEMENT (const location_type& l)
1205  {
1206  return symbol_type (token::COMPLEMENT, l);
1207  }
1208 
1210  parser::make_DASH (const location_type& l)
1211  {
1212  return symbol_type (token::DASH, l);
1213  }
1214 
1216  parser::make_DOT (const location_type& l)
1217  {
1218  return symbol_type (token::DOT, l);
1219  }
1220 
1222  parser::make_LBRACKET (const location_type& l)
1223  {
1224  return symbol_type (token::LBRACKET, l);
1225  }
1226 
1228  parser::make_LPAREN (const location_type& l)
1229  {
1230  return symbol_type (token::LPAREN, l);
1231  }
1232 
1234  parser::make_LT_PLUS (const location_type& l)
1235  {
1236  return symbol_type (token::LT_PLUS, l);
1237  }
1238 
1240  parser::make_ONE (const location_type& l)
1241  {
1242  return symbol_type (token::ONE, l);
1243  }
1244 
1246  parser::make_PERCENT (const location_type& l)
1247  {
1248  return symbol_type (token::PERCENT, l);
1249  }
1250 
1252  parser::make_PIPE (const location_type& l)
1253  {
1254  return symbol_type (token::PIPE, l);
1255  }
1256 
1258  parser::make_PLUS (const location_type& l)
1259  {
1260  return symbol_type (token::PLUS, l);
1261  }
1262 
1264  parser::make_RBRACKET (const location_type& l)
1265  {
1266  return symbol_type (token::RBRACKET, l);
1267  }
1268 
1270  parser::make_RPAREN (const location_type& l)
1271  {
1272  return symbol_type (token::RPAREN, l);
1273  }
1274 
1276  parser::make_SLASH (const location_type& l)
1277  {
1278  return symbol_type (token::SLASH, l);
1279  }
1280 
1282  parser::make_TRANSPOSITION (const location_type& l)
1283  {
1284  return symbol_type (token::TRANSPOSITION, l);
1285  }
1286 
1288  parser::make_ZERO (const location_type& l)
1289  {
1290  return symbol_type (token::ZERO, l);
1291  }
1292 
1294  parser::make_STAR (const irange_type& v, const location_type& l)
1295  {
1296  return symbol_type (token::STAR, v, l);
1297  }
1298 
1300  parser::make_LETTER (const std::string& v, const location_type& l)
1301  {
1302  return symbol_type (token::LETTER, v, l);
1303  }
1304 
1306  parser::make_WEIGHT (const std::string& v, const location_type& l)
1307  {
1308  return symbol_type (token::WEIGHT, v, l);
1309  }
1310 
1312  parser::make_CONCAT (const location_type& l)
1313  {
1314  return symbol_type (token::CONCAT, l);
1315  }
1316 
1318  parser::make_RWEIGHT (const location_type& l)
1319  {
1320  return symbol_type (token::RWEIGHT, l);
1321  }
1322 
1324  parser::make_LWEIGHT (const location_type& l)
1325  {
1326  return symbol_type (token::LWEIGHT, l);
1327  }
1328 
1329 
1330 #line 11 "lib/vcsn/rat/parse.yy" // lalr1.cc:372
1331 } } // vcsn::rat
1332 #line 1333 "./lib/vcsn/rat/parse.hh" // lalr1.cc:372
1333 
1334 
1335 // // "%code provides" blocks.
1336 #line 56 "lib/vcsn/rat/parse.yy" // lalr1.cc:372
1337 
1338  #define YY_DECL_(Class) \
1339  parser::symbol_type Class lex(driver& driver_)
1340  #define YY_DECL YY_DECL_(yyFlexLexer::)
1341 
1342 #line 1343 "./lib/vcsn/rat/parse.hh" // lalr1.cc:372
1343 
1344 
1345 #endif // !YY_YY_LIB_VCSN_RAT_PARSE_HH_INCLUDED
std::shared_ptr< const detail::weight_base > weight
Definition: fwd.hh:88
A complete symbol.
Definition: parse.hh:396
char dummy3[sizeof(dyn::weight)]
Definition: parse.hh:315
int state_type
State numbers.
Definition: parse.hh:634
T & build()
Instantiate an empty T in here.
Definition: parse.hh:192
void move(by_state &that)
Steal the symbol type from that.
Definition: parse.cc:262
static symbol_type make_COMPLEMENT(const location_type &l)
Definition: parse.hh:1204
static bool yy_pact_value_is_default_(int yyvalue)
Whether the given yypact_ value indicates a defaulted state.
Definition: parse.cc:555
bool lparen
Whether there was a left-paren.
Definition: parse.hh:67
static symbol_type make_DASH(const location_type &l)
Definition: parse.hh:1210
basic_symbol< by_state > super_type
Superclass.
Definition: parse.hh:760
Definition: a-star.hh:8
T * yyas_()
Accessor to raw memory as T.
Definition: parse.hh:272
token_number_type type
The symbol type.
Definition: parse.hh:474
stack_symbol_type & operator=(const stack_symbol_type &that)
Assignment, needed by push_back.
Definition: parse.cc:329
void yy_print_(std::ostream &yyo, const basic_symbol< Base > &yysym) const
Display a symbol type, value and location.
void set_debug_level(debug_level_type l)
Set the current debugging level.
#define YYASSERT
Definition: parse.hh:94
token_type token() const
The token.
Definition: parse.hh:1139
static symbol_type make_LPAREN(const location_type &l)
Definition: parse.hh:1228
static symbol_type make_PIPE(const location_type &l)
Definition: parse.hh:1252
driver & driver_
Definition: parse.hh:808
T & as()
Accessor to a built T.
Definition: parse.hh:208
virtual void yystack_print_()
Print the state stack on the debug stream.
variant< S > self_type
Type of *this.
Definition: parse.hh:171
static const signed char yypact_ninf_
Definition: parse.hh:655
symbol_number_type type_get() const
The (internal) type number (corresponding to state).
Definition: parse.cc:275
static symbol_type make_CARET(const location_type &l)
Definition: parse.hh:1186
void move(by_type &that)
Steal the symbol type from that.
Definition: parse.hh:1124
Last index in yytable_.
Definition: parse.hh:797
static const unsigned short int yyrline_[]
Definition: parse.hh:703
virtual void error(const location_type &loc, const std::string &msg)
Report a syntax error.
Definition: parse.cc:1460
virtual std::string yysyntax_error_(state_type yystate, symbol_number_type yytoken) const
Generate an error message.
Definition: parse.cc:1171
union vcsn::rat::variant::@5 yybuffer_
static symbol_type make_PERCENT(const location_type &l)
Definition: parse.hh:1246
const T * yyas_() const
Const accessor to raw memory as T.
Definition: parse.hh:281
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:455
virtual int parse()
Parse.
Definition: parse.cc:567
void yypop_(unsigned int n=1)
Pop n symbols the three stacks.
Definition: parse.cc:512
static symbol_type make_TRANSPOSITION(const location_type &l)
Definition: parse.hh:1282
A char[S] buffer to store and retrieve objects.
Definition: parse.hh:174
static token_number_type yytranslate_(token_type t)
Convert a scanner token number t to a symbol number.
Definition: parse.hh:814
void swap(self_type &other)
Swap the content with other, of same type.
Definition: parse.hh:231
static symbol_type make_AMPERSAND(const location_type &l)
Definition: parse.hh:1162
const T & as() const
Const accessor to a built T (for printer).
Definition: parse.hh:216
Termination state number.
Definition: parse.hh:800
semantic_type value
The semantic value.
Definition: parse.hh:435
static symbol_type make_DOT(const location_type &l)
Definition: parse.hh:1216
variant()
Empty construction.
Definition: parse.hh:174
long double yyalign_me
Strongest alignment constraints.
Definition: parse.hh:290
static symbol_type make_ZERO(const location_type &l)
Definition: parse.hh:1288
int debug_level_type
Type for debugging levels.
Definition: parse.hh:613
virtual ~parser()
Definition: parse.cc:239
char yyraw[S]
A buffer large enough to store any of the semantic values.
Definition: parse.hh:292
int symbol_number_type
Internal symbol number.
Definition: parse.hh:384
syntax_error(const location_type &l, const std::string &m)
Definition: parse.hh:862
A Bison parser.
Definition: parse.hh:298
char dummy4[sizeof(irange_type)]
Definition: parse.hh:318
static bool yy_table_value_is_error_(int yyvalue)
Whether the given yytable_ value indicates a syntax error.
Definition: parse.cc:561
debug_level_type debug_level() const
The current debugging level.
static symbol_type make_AMPERSAND_COLON(const location_type &l)
Definition: parse.hh:1168
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:387
basic_symbol & operator=(const basic_symbol &other)
Assignment operator.
by_state()
Default constructor.
Definition: parse.cc:251
static symbol_type make_ONE(const location_type &l)
Definition: parse.hh:1240
basic_symbol< by_type > symbol_type
"External" symbols: returned by the scanner.
Definition: parse.hh:478
Define the vcsn::rat::stack class.
state_type kind_type
The symbol type as needed by the constructor.
Definition: parse.hh:735
~variant()
Destruction, allowed only if empty.
Definition: parse.hh:186
char dummy6[sizeof(std::vector< vcsn::dyn::expression >)]
Definition: parse.hh:325
"Internal" symbol: element of the stack.
Definition: parse.hh:757
state_type yy_lr_goto_state_(state_type yystate, int yysym)
Compute post-reduction state.
Definition: parse.cc:545
braced_expression & operator=(dyn::expression e)
Definition: parse.hh:70
std::set< std::pair< std::string, std::string >> class_t
A set of label ranges.
Definition: fwd.hh:12
stack< stack_symbol_type > stack_type
Stack type.
Definition: parse.hh:770
static symbol_type make_BACKSLASH(const location_type &l)
Definition: parse.hh:1174
static symbol_type make_END(const location_type &l)
Definition: parse.hh:1156
variant< sizeof(union_type)> semantic_type
Symbol semantic values.
Definition: parse.hh:329
void move(basic_symbol &s)
Destructive move, s is emptied into this.
Definition: parse.hh:1066
void destroy()
Destroy the stored T.
Definition: parse.hh:259
State and public interface for rational expression parsing.
Definition: driver.hh:17
virtual void yy_reduce_print_(int r)
Report on the debug stream that the rule r is going to be reduced.
static const unsigned char yytable_[]
Definition: parse.hh:680
static symbol_type make_COLON(const location_type &l)
Definition: parse.hh:1192
static const unsigned char yystos_[]
Definition: parse.hh:686
bool rparen
Whether there was a right-paren.
Definition: parse.hh:69
static const unsigned char yydefact_[]
Definition: parse.hh:669
self_type & operator=(const self_type &)
Prohibit blind copies.
static const signed char yydefgoto_[]
Definition: parse.hh:675
Define the vcsn::rat::location class.
symbol_number_type type_get() const
The (internal) type number (corresponding to type).
Definition: parse.hh:1132
char dummy1[sizeof(braced_expression)]
Definition: parse.hh:309
static symbol_type make_RBRACKET(const location_type &l)
Definition: parse.hh:1264
state_type state
The state.
Definition: parse.hh:753
static const short int yypact_[]
Definition: parse.hh:664
STL namespace.
A char[S] buffer to store and retrieve objects.
Definition: parse.hh:168
Base super_type
Alias to Base.
Definition: parse.hh:399
static symbol_type make_LT_PLUS(const location_type &l)
Definition: parse.hh:1234
Syntax errors thrown from user actions.
Definition: parse.hh:337
Number of nonterminal symbols.
Definition: parse.hh:798
by_type()
Default constructor.
Definition: parse.hh:1108
stack_symbol_type()
Construct an empty symbol.
Definition: parse.cc:281
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46
static symbol_type make_CONCAT(const location_type &l)
Definition: parse.hh:1312
variant(const T &t)
Construct and fill.
Definition: parse.hh:179
static const unsigned char yyr2_[]
Definition: parse.hh:692
std::string type(const automaton &a)
The implementation type of a.
Definition: others.cc:206
static const signed char yytable_ninf_
Definition: parse.hh:656
static symbol_type make_BANG(const location_type &l)
Definition: parse.hh:1180
void move(self_type &other)
Move the content of other to this.
Definition: parse.hh:241
static symbol_type make_RWEIGHT(const location_type &l)
Definition: parse.hh:1318
static symbol_type make_SLASH(const location_type &l)
Definition: parse.hh:1276
parser(driver &driver__yyarg)
Build a parser object.
Definition: parse.cc:230
static const signed char yycheck_[]
Definition: parse.hh:682
Type access provider for token (enum) based symbols.
Definition: parse.hh:446
T & build(const T &t)
Instantiate a T in here from t.
Definition: parse.hh:200
static symbol_type make_LBRACKET(const location_type &l)
Definition: parse.hh:1222
Type access provider for state based symbols.
Definition: parse.hh:729
An auxiliary type to compute the largest semantic type.
Definition: parse.hh:303
void set_debug_stream(std::ostream &)
Set the current debugging stream.
std::tuple< int, int > irange_type
An integer range, for quantifiers/exponents.
Definition: parse.hh:78
stack_type yystack_
The stack.
Definition: parse.hh:773
static symbol_type make_LETTER(const std::string &v, const location_type &l)
Definition: parse.hh:1300
void yypush_(const char *m, stack_symbol_type &s)
Push a new state on the stack.
Definition: parse.cc:503
basic_symbol()
Default constructor.
Definition: parse.hh:870
Number of tokens.
Definition: parse.hh:803
static symbol_type make_WEIGHT(const std::string &v, const location_type &l)
Definition: parse.hh:1306
void destroy()
Destroy the stored T.
Definition: parse.hh:265
location location_type
Symbol locations.
Definition: parse.hh:334
std::shared_ptr< detail::expression_base > expression
Definition: expression.hh:92
An expression that "remembers" whether it was in parentheses.
Definition: parse.hh:62
static const unsigned char yyr1_[]
Definition: parse.hh:689
parser & operator=(const parser &)
static const signed char yypgoto_[]
Definition: parse.hh:672
static symbol_type make_PLUS(const location_type &l)
Definition: parse.hh:1258
static symbol_type make_STAR(const irange_type &v, const location_type &l)
Definition: parse.hh:1294
void yy_destroy_(const char *yymsg, basic_symbol< Base > &yysym) const
Reclaim the memory associated to a symbol.
Definition: parse.cc:374
location_type location
The location.
Definition: parse.hh:438
static symbol_type make_LWEIGHT(const location_type &l)
Definition: parse.hh:1324
std::ostream * yycdebug_
Definition: parse.hh:711
void copy(const self_type &other)
Copy the content of other to this.
Definition: parse.hh:251
T & as()
Accessor to a built T.
Definition: parse.hh:214
char dummy2[sizeof(class_t)]
Definition: parse.hh:312
static std::string yytnamerr_(const char *n)
Convert the symbol name n to a form suitable for a diagnostic.
Definition: parse.cc:197
std::ostream & debug_stream() const
The current debugging stream.
token::yytokentype token_type
(External) token type, as returned by yylex.
Definition: parse.hh:381
static symbol_type make_RPAREN(const location_type &l)
Definition: parse.hh:1270
char dummy5[sizeof(std::string)]
Definition: parse.hh:322
static const char *const yytname_[]
For a symbol, its name in clear.
Definition: parse.hh:700
static symbol_type make_COMMA(const location_type &l)
Definition: parse.hh:1198
#define YY_ATTRIBUTE_PURE
Definition: parse.hh:109