Vcsn  2.4
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/value.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  // add
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  AT = 260,
352  BACKSLASH = 261,
353  BANG = 262,
354  CARET = 263,
355  COLON = 264,
356  COMMA = 265,
357  COMPLEMENT = 266,
358  DASH = 267,
359  DOT = 268,
360  LBRACKET = 269,
361  LPAREN = 270,
362  LT_PLUS = 271,
363  ONE = 272,
364  PERCENT = 273,
365  PIPE = 274,
366  PLUS = 275,
367  RBRACKET = 276,
368  RPAREN = 277,
369  SLASH = 278,
371  TRANSPOSE = 280,
372  ZERO = 281,
373  STAR = 282,
374  LETTER = 283,
375  WEIGHT = 284,
376  CONCAT = 285,
377  RWEIGHT = 286,
378  LWEIGHT = 287
379  };
380  };
381 
384 
386  typedef int symbol_number_type;
387 
389  typedef unsigned char token_number_type;
390 
397  template <typename Base>
399  {
401  typedef Base super_type;
402 
404  basic_symbol ();
405 
407  basic_symbol (const basic_symbol& other);
408 
410 
411  basic_symbol (typename Base::kind_type t, const location_type& l);
412 
413  basic_symbol (typename Base::kind_type t, const braced_expression v, const location_type& l);
414 
415  basic_symbol (typename Base::kind_type t, const class_t v, const location_type& l);
416 
417  basic_symbol (typename Base::kind_type t, const dyn::weight v, const location_type& l);
418 
419  basic_symbol (typename Base::kind_type t, const irange_type v, const location_type& l);
420 
421  basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l);
422 
423  basic_symbol (typename Base::kind_type t, const std::vector<vcsn::dyn::expression> v, const location_type& l);
424 
425 
427  basic_symbol (typename Base::kind_type t,
428  const semantic_type& v,
429  const location_type& l);
430 
431  ~basic_symbol ();
432 
434  void move (basic_symbol& s);
435 
437  semantic_type value;
438 
440  location_type location;
441 
442  private:
444  basic_symbol& operator= (const basic_symbol& other);
445  };
446 
448  struct by_type
449  {
451  by_type ();
452 
454  by_type (const by_type& other);
455 
457  typedef token_type kind_type;
458 
460  by_type (kind_type t);
461 
463  void move (by_type& that);
464 
467  symbol_number_type type_get () const;
468 
470  token_type token () const;
471 
472  enum { empty = 0 };
473 
476  token_number_type type;
477  };
478 
481 
482  // Symbol constructors declarations.
483  static inline
484  symbol_type
485  make_END (const location_type& l);
486 
487  static inline
488  symbol_type
489  make_AMPERSAND (const location_type& l);
490 
491  static inline
492  symbol_type
493  make_AMPERSAND_COLON (const location_type& l);
494 
495  static inline
496  symbol_type
497  make_AT (const location_type& l);
498 
499  static inline
500  symbol_type
501  make_BACKSLASH (const location_type& l);
502 
503  static inline
504  symbol_type
505  make_BANG (const location_type& l);
506 
507  static inline
508  symbol_type
509  make_CARET (const location_type& l);
510 
511  static inline
512  symbol_type
513  make_COLON (const location_type& l);
514 
515  static inline
516  symbol_type
517  make_COMMA (const location_type& l);
518 
519  static inline
520  symbol_type
521  make_COMPLEMENT (const location_type& l);
522 
523  static inline
524  symbol_type
525  make_DASH (const location_type& l);
526 
527  static inline
528  symbol_type
529  make_DOT (const location_type& l);
530 
531  static inline
532  symbol_type
533  make_LBRACKET (const location_type& l);
534 
535  static inline
536  symbol_type
537  make_LPAREN (const location_type& l);
538 
539  static inline
540  symbol_type
541  make_LT_PLUS (const location_type& l);
542 
543  static inline
544  symbol_type
545  make_ONE (const location_type& l);
546 
547  static inline
548  symbol_type
549  make_PERCENT (const location_type& l);
550 
551  static inline
552  symbol_type
553  make_PIPE (const location_type& l);
554 
555  static inline
556  symbol_type
557  make_PLUS (const location_type& l);
558 
559  static inline
560  symbol_type
561  make_RBRACKET (const location_type& l);
562 
563  static inline
564  symbol_type
565  make_RPAREN (const location_type& l);
566 
567  static inline
568  symbol_type
569  make_SLASH (const location_type& l);
570 
571  static inline
572  symbol_type
573  make_TRANSPOSITION (const location_type& l);
574 
575  static inline
576  symbol_type
577  make_TRANSPOSE (const location_type& l);
578 
579  static inline
580  symbol_type
581  make_ZERO (const location_type& l);
582 
583  static inline
584  symbol_type
585  make_STAR (const irange_type& v, const location_type& l);
586 
587  static inline
588  symbol_type
589  make_LETTER (const std::string& v, const location_type& l);
590 
591  static inline
592  symbol_type
593  make_WEIGHT (const std::string& v, const location_type& l);
594 
595  static inline
596  symbol_type
597  make_CONCAT (const location_type& l);
598 
599  static inline
600  symbol_type
601  make_RWEIGHT (const location_type& l);
602 
603  static inline
604  symbol_type
605  make_LWEIGHT (const location_type& l);
606 
607 
609  parser (driver& driver__yyarg);
610  virtual ~parser ();
611 
614  virtual int parse ();
615 
616 #if YYDEBUG
617  std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
620  void set_debug_stream (std::ostream &);
621 
623  typedef int debug_level_type;
625  debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
627  void set_debug_level (debug_level_type l);
628 #endif
629 
633  virtual void error (const location_type& loc, const std::string& msg);
634 
636  void error (const syntax_error& err);
637 
638  private:
640  parser (const parser&);
641  parser& operator= (const parser&);
642 
644  typedef int state_type;
645 
649  virtual std::string yysyntax_error_ (state_type yystate,
650  symbol_number_type yytoken) const;
651 
655  state_type yy_lr_goto_state_ (state_type yystate, int yysym);
656 
659  static bool yy_pact_value_is_default_ (int yyvalue);
660 
663  static bool yy_table_value_is_error_ (int yyvalue);
664 
665  static const signed char yypact_ninf_;
666  static const signed char yytable_ninf_;
667 
669  static token_number_type yytranslate_ (token_type t);
670 
671  // Tables.
672  // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
673  // STATE-NUM.
674  static const short int yypact_[];
675 
676  // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
677  // Performed when YYTABLE does not specify something else to do. Zero
678  // means the default is an error.
679  static const unsigned char yydefact_[];
680 
681  // YYPGOTO[NTERM-NUM].
682  static const signed char yypgoto_[];
683 
684  // YYDEFGOTO[NTERM-NUM].
685  static const signed char yydefgoto_[];
686 
687  // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
688  // positive, shift that token. If negative, reduce the rule whose
689  // number is the opposite. If YYTABLE_NINF, syntax error.
690  static const unsigned char yytable_[];
691 
692  static const signed char yycheck_[];
693 
694  // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
695  // symbol of state STATE-NUM.
696  static const unsigned char yystos_[];
697 
698  // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
699  static const unsigned char yyr1_[];
700 
701  // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
702  static const unsigned char yyr2_[];
703 
704 
706  static std::string yytnamerr_ (const char *n);
707 
708 
710  static const char* const yytname_[];
711 #if YYDEBUG
712  // YYRLINE[YYN] -- Source line where rule number YYN was defined.
713  static const unsigned short int yyrline_[];
715  virtual void yy_reduce_print_ (int r);
717  virtual void yystack_print_ ();
718 
719  // Debugging.
720  int yydebug_;
721  std::ostream* yycdebug_;
722 
726  template <typename Base>
727  void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
728 #endif
729 
734  template <typename Base>
735  void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
736 
737  private:
739  struct by_state
740  {
742  by_state ();
743 
745  typedef state_type kind_type;
746 
748  by_state (kind_type s);
749 
751  by_state (const by_state& other);
752 
754  void move (by_state& that);
755 
758  symbol_number_type type_get () const;
759 
760  enum { empty = 0 };
761 
763  state_type state;
764  };
765 
767  struct stack_symbol_type : basic_symbol<by_state>
768  {
774  stack_symbol_type (state_type s, symbol_type& sym);
777  };
778 
781 
783  stack_type yystack_;
784 
790  void yypush_ (const char* m, stack_symbol_type& s);
791 
798  void yypush_ (const char* m, state_type s, symbol_type& sym);
799 
801  void yypop_ (unsigned int n = 1);
802 
803  // Constants.
804  enum
805  {
806  yyeof_ = 0,
807  yylast_ = 221,
808  yynnts_ = 11,
809  yyempty_ = -2,
810  yyfinal_ = 5,
812  yyerrcode_ = 256,
814  };
815 
816 
817  // User arguments.
819  };
820 
821  // Symbol number corresponding to token number t.
822  inline
824  parser::yytranslate_ (token_type t)
825  {
826  static
827  const token_number_type
828  translate_table[] =
829  {
830  0, 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, 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, 1, 2, 3, 4,
856  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
857  15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
858  25, 26, 27, 28, 29, 30, 31, 32
859  };
860  const unsigned int user_token_number_max_ = 287;
861  const token_number_type undef_token_ = 2;
862 
863  if (static_cast<int>(t) <= yyeof_)
864  return yyeof_;
865  else if (static_cast<unsigned int> (t) <= user_token_number_max_)
866  return translate_table[t];
867  else
868  return undef_token_;
869  }
870 
871  inline
872  parser::syntax_error::syntax_error (const location_type& l, const std::string& m)
873  : std::runtime_error (m)
874  , location (l)
875  {}
876 
877  // basic_symbol.
878  template <typename Base>
879  inline
881  : value ()
882  {}
883 
884  template <typename Base>
885  inline
887  : Base (other)
888  , value ()
889  , location (other.location)
890  {
891  switch (other.type_get ())
892  {
893  case 34: // input
894  case 36: // add
895  case 37: // tuple
896  case 41: // exp
897  value.copy< braced_expression > (other.value);
898  break;
899 
900  case 43: // class
901  value.copy< class_t > (other.value);
902  break;
903 
904  case 42: // weights
905  value.copy< dyn::weight > (other.value);
906  break;
907 
908  case 27: // "*"
909  value.copy< irange_type > (other.value);
910  break;
911 
912  case 28: // "letter"
913  case 29: // "weight"
914  value.copy< std::string > (other.value);
915  break;
916 
917  case 39: // tuple.1
918  value.copy< std::vector<vcsn::dyn::expression> > (other.value);
919  break;
920 
921  default:
922  break;
923  }
924 
925  }
926 
927 
928  template <typename Base>
929  inline
930  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const semantic_type& v, const location_type& l)
931  : Base (t)
932  , value ()
933  , location (l)
934  {
935  (void) v;
936  switch (this->type_get ())
937  {
938  case 34: // input
939  case 36: // add
940  case 37: // tuple
941  case 41: // exp
943  break;
944 
945  case 43: // class
946  value.copy< class_t > (v);
947  break;
948 
949  case 42: // weights
950  value.copy< dyn::weight > (v);
951  break;
952 
953  case 27: // "*"
954  value.copy< irange_type > (v);
955  break;
956 
957  case 28: // "letter"
958  case 29: // "weight"
959  value.copy< std::string > (v);
960  break;
961 
962  case 39: // tuple.1
963  value.copy< std::vector<vcsn::dyn::expression> > (v);
964  break;
965 
966  default:
967  break;
968  }
969 }
970 
971 
972  // Implementation of basic_symbol constructor for each type.
973 
974  template <typename Base>
975  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
976  : Base (t)
977  , value ()
978  , location (l)
979  {}
980 
981  template <typename Base>
982  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const braced_expression v, const location_type& l)
983  : Base (t)
984  , value (v)
985  , location (l)
986  {}
987 
988  template <typename Base>
989  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const class_t 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 dyn::weight 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 irange_type 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 std::string 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::vector<vcsn::dyn::expression> v, const location_type& l)
1018  : Base (t)
1019  , value (v)
1020  , location (l)
1021  {}
1022 
1023 
1024  template <typename Base>
1025  inline
1027  {
1028  // User destructor.
1029  symbol_number_type yytype = this->type_get ();
1030  switch (yytype)
1031  {
1032  default:
1033  break;
1034  }
1035 
1036  // Type destructor.
1037  switch (yytype)
1038  {
1039  case 34: // input
1040  case 36: // add
1041  case 37: // tuple
1042  case 41: // exp
1043  value.template destroy< braced_expression > ();
1044  break;
1045 
1046  case 43: // class
1047  value.template destroy< class_t > ();
1048  break;
1049 
1050  case 42: // weights
1051  value.template destroy< dyn::weight > ();
1052  break;
1053 
1054  case 27: // "*"
1055  value.template destroy< irange_type > ();
1056  break;
1057 
1058  case 28: // "letter"
1059  case 29: // "weight"
1060  value.template destroy< std::string > ();
1061  break;
1062 
1063  case 39: // tuple.1
1064  value.template destroy< std::vector<vcsn::dyn::expression> > ();
1065  break;
1066 
1067  default:
1068  break;
1069  }
1070 
1071  }
1072 
1073  template <typename Base>
1074  inline
1075  void
1077  {
1078  super_type::move(s);
1079  switch (this->type_get ())
1080  {
1081  case 34: // input
1082  case 36: // add
1083  case 37: // tuple
1084  case 41: // exp
1085  value.move< braced_expression > (s.value);
1086  break;
1087 
1088  case 43: // class
1089  value.move< class_t > (s.value);
1090  break;
1091 
1092  case 42: // weights
1093  value.move< dyn::weight > (s.value);
1094  break;
1095 
1096  case 27: // "*"
1097  value.move< irange_type > (s.value);
1098  break;
1099 
1100  case 28: // "letter"
1101  case 29: // "weight"
1102  value.move< std::string > (s.value);
1103  break;
1104 
1105  case 39: // tuple.1
1106  value.move< std::vector<vcsn::dyn::expression> > (s.value);
1107  break;
1108 
1109  default:
1110  break;
1111  }
1112 
1113  location = s.location;
1114  }
1115 
1116  // by_type.
1117  inline
1119  : type (empty)
1120  {}
1121 
1122  inline
1124  : type (other.type)
1125  {}
1126 
1127  inline
1129  : type (yytranslate_ (t))
1130  {}
1131 
1132  inline
1133  void
1135  {
1136  type = that.type;
1137  that.type = empty;
1138  }
1139 
1140  inline
1141  int
1143  {
1144  return type;
1145  }
1146 
1147  inline
1150  {
1151  // YYTOKNUM[NUM] -- (External) token number corresponding to the
1152  // (internal) symbol number NUM (which must be that of a token). */
1153  static
1154  const unsigned short int
1155  yytoken_number_[] =
1156  {
1157  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1158  265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1159  275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1160  285, 286, 287
1161  };
1162  return static_cast<token_type> (yytoken_number_[type]);
1163  }
1164  // Implementation of make_symbol for each symbol type.
1166  parser::make_END (const location_type& l)
1167  {
1168  return symbol_type (token::END, l);
1169  }
1170 
1172  parser::make_AMPERSAND (const location_type& l)
1173  {
1174  return symbol_type (token::AMPERSAND, l);
1175  }
1176 
1178  parser::make_AMPERSAND_COLON (const location_type& l)
1179  {
1180  return symbol_type (token::AMPERSAND_COLON, l);
1181  }
1182 
1184  parser::make_AT (const location_type& l)
1185  {
1186  return symbol_type (token::AT, l);
1187  }
1188 
1190  parser::make_BACKSLASH (const location_type& l)
1191  {
1192  return symbol_type (token::BACKSLASH, l);
1193  }
1194 
1196  parser::make_BANG (const location_type& l)
1197  {
1198  return symbol_type (token::BANG, l);
1199  }
1200 
1202  parser::make_CARET (const location_type& l)
1203  {
1204  return symbol_type (token::CARET, l);
1205  }
1206 
1208  parser::make_COLON (const location_type& l)
1209  {
1210  return symbol_type (token::COLON, l);
1211  }
1212 
1214  parser::make_COMMA (const location_type& l)
1215  {
1216  return symbol_type (token::COMMA, l);
1217  }
1218 
1220  parser::make_COMPLEMENT (const location_type& l)
1221  {
1222  return symbol_type (token::COMPLEMENT, l);
1223  }
1224 
1226  parser::make_DASH (const location_type& l)
1227  {
1228  return symbol_type (token::DASH, l);
1229  }
1230 
1232  parser::make_DOT (const location_type& l)
1233  {
1234  return symbol_type (token::DOT, l);
1235  }
1236 
1238  parser::make_LBRACKET (const location_type& l)
1239  {
1240  return symbol_type (token::LBRACKET, l);
1241  }
1242 
1244  parser::make_LPAREN (const location_type& l)
1245  {
1246  return symbol_type (token::LPAREN, l);
1247  }
1248 
1250  parser::make_LT_PLUS (const location_type& l)
1251  {
1252  return symbol_type (token::LT_PLUS, l);
1253  }
1254 
1256  parser::make_ONE (const location_type& l)
1257  {
1258  return symbol_type (token::ONE, l);
1259  }
1260 
1262  parser::make_PERCENT (const location_type& l)
1263  {
1264  return symbol_type (token::PERCENT, l);
1265  }
1266 
1268  parser::make_PIPE (const location_type& l)
1269  {
1270  return symbol_type (token::PIPE, l);
1271  }
1272 
1274  parser::make_PLUS (const location_type& l)
1275  {
1276  return symbol_type (token::PLUS, l);
1277  }
1278 
1280  parser::make_RBRACKET (const location_type& l)
1281  {
1282  return symbol_type (token::RBRACKET, l);
1283  }
1284 
1286  parser::make_RPAREN (const location_type& l)
1287  {
1288  return symbol_type (token::RPAREN, l);
1289  }
1290 
1292  parser::make_SLASH (const location_type& l)
1293  {
1294  return symbol_type (token::SLASH, l);
1295  }
1296 
1298  parser::make_TRANSPOSITION (const location_type& l)
1299  {
1300  return symbol_type (token::TRANSPOSITION, l);
1301  }
1302 
1304  parser::make_TRANSPOSE (const location_type& l)
1305  {
1306  return symbol_type (token::TRANSPOSE, l);
1307  }
1308 
1310  parser::make_ZERO (const location_type& l)
1311  {
1312  return symbol_type (token::ZERO, l);
1313  }
1314 
1316  parser::make_STAR (const irange_type& v, const location_type& l)
1317  {
1318  return symbol_type (token::STAR, v, l);
1319  }
1320 
1322  parser::make_LETTER (const std::string& v, const location_type& l)
1323  {
1324  return symbol_type (token::LETTER, v, l);
1325  }
1326 
1328  parser::make_WEIGHT (const std::string& v, const location_type& l)
1329  {
1330  return symbol_type (token::WEIGHT, v, l);
1331  }
1332 
1334  parser::make_CONCAT (const location_type& l)
1335  {
1336  return symbol_type (token::CONCAT, l);
1337  }
1338 
1340  parser::make_RWEIGHT (const location_type& l)
1341  {
1342  return symbol_type (token::RWEIGHT, l);
1343  }
1344 
1346  parser::make_LWEIGHT (const location_type& l)
1347  {
1348  return symbol_type (token::LWEIGHT, l);
1349  }
1350 
1351 
1352 #line 11 "lib/vcsn/rat/parse.yy" // lalr1.cc:372
1353 } } // vcsn::rat
1354 #line 1355 "./lib/vcsn/rat/parse.hh" // lalr1.cc:372
1355 
1356 
1357 // // "%code provides" blocks.
1358 #line 56 "lib/vcsn/rat/parse.yy" // lalr1.cc:372
1359 
1360  #define YY_DECL_(Class) \
1361  parser::symbol_type Class lex(driver& driver_)
1362  #define YY_DECL YY_DECL_(yyFlexLexer::)
1363 
1364 #line 1365 "./lib/vcsn/rat/parse.hh" // lalr1.cc:372
1365 
1366 
1367 #endif // !YY_YY_LIB_VCSN_RAT_PARSE_HH_INCLUDED
static symbol_type make_ONE(const location_type &l)
Definition: parse.hh:1256
char dummy3[sizeof(dyn::weight)]
Definition: parse.hh:315
Base super_type
Alias to Base.
Definition: parse.hh:401
static symbol_type make_STAR(const irange_type &v, const location_type &l)
Definition: parse.hh:1316
std::ostream * yycdebug_
Definition: parse.hh:721
driver & driver_
Definition: parse.hh:818
void destroy()
Destroy the stored T.
Definition: parse.hh:259
static symbol_type make_RWEIGHT(const location_type &l)
Definition: parse.hh:1340
bool lparen
Whether there was a left-paren.
Definition: parse.hh:67
static const unsigned char yydefact_[]
Definition: parse.hh:679
variant< sizeof(union_type)> semantic_type
Symbol semantic values.
Definition: parse.hh:329
Type access provider for token (enum) based symbols.
Definition: parse.hh:448
static symbol_type make_COLON(const location_type &l)
Definition: parse.hh:1208
Last index in yytable_.
Definition: parse.hh:807
A Bison parser.
Definition: parse.hh:298
int debug_level_type
Type for debugging levels.
Definition: parse.hh:623
virtual void error(const location_type &loc, const std::string &msg)
Report a syntax error.
Definition: parse.cc:1482
~variant()
Destruction, allowed only if empty.
Definition: parse.hh:186
static symbol_type make_PERCENT(const location_type &l)
Definition: parse.hh:1262
static symbol_type make_LT_PLUS(const location_type &l)
Definition: parse.hh:1250
static symbol_type make_COMPLEMENT(const location_type &l)
Definition: parse.hh:1220
#define YYASSERT
Definition: parse.hh:94
void yypop_(unsigned int n=1)
Pop n symbols the three stacks.
Definition: parse.cc:512
by_type()
Default constructor.
Definition: parse.hh:1118
static symbol_type make_DASH(const location_type &l)
Definition: parse.hh:1226
static symbol_type make_RBRACKET(const location_type &l)
Definition: parse.hh:1280
A complete symbol.
Definition: parse.hh:398
return v
Definition: multiply.hh:361
#define YY_ATTRIBUTE_PURE
Definition: parse.hh:109
Definition: a-star.hh:8
static const short int yypact_[]
Definition: parse.hh:674
static symbol_type make_AMPERSAND_COLON(const location_type &l)
Definition: parse.hh:1178
static symbol_type make_CONCAT(const location_type &l)
Definition: parse.hh:1334
static token_number_type yytranslate_(token_type t)
Convert a scanner token number t to a symbol number.
Definition: parse.hh:824
basic_symbol< by_type > symbol_type
"External" symbols: returned by the scanner.
Definition: parse.hh:480
void yy_print_(std::ostream &yyo, const basic_symbol< Base > &yysym) const
Display a symbol type, value and location.
stack_symbol_type()
Construct an empty symbol.
Definition: parse.cc:281
basic_symbol()
Default constructor.
Definition: parse.hh:880
Termination state number.
Definition: parse.hh:810
Syntax errors thrown from user actions.
Definition: parse.hh:337
Define the vcsn::rat::stack class.
std::tuple< int, int > irange_type
An integer range, for quantifiers/exponents.
Definition: parse.hh:78
static symbol_type make_CARET(const location_type &l)
Definition: parse.hh:1202
symbol_number_type type_get() const
The (internal) type number (corresponding to state).
Definition: parse.cc:275
virtual void yy_reduce_print_(int r)
Report on the debug stream that the rule r is going to be reduced.
static symbol_type make_ZERO(const location_type &l)
Definition: parse.hh:1310
const T & as() const
Const accessor to a built T (for printer).
Definition: parse.hh:216
static const signed char yypact_ninf_
Definition: parse.hh:665
T & as()
Accessor to a built T.
Definition: parse.hh:214
const T * yyas_() const
Const accessor to raw memory as T.
Definition: parse.hh:281
static symbol_type make_COMMA(const location_type &l)
Definition: parse.hh:1214
virtual std::string yysyntax_error_(state_type yystate, symbol_number_type yytoken) const
Generate an error message.
Definition: parse.cc:1183
char dummy2[sizeof(class_t)]
Definition: parse.hh:312
static symbol_type make_SLASH(const location_type &l)
Definition: parse.hh:1292
variant< S > self_type
Type of *this.
Definition: parse.hh:171
int state_type
State numbers.
Definition: parse.hh:644
int symbol_number_type
Internal symbol number.
Definition: parse.hh:386
location location_type
Symbol locations.
Definition: parse.hh:334
stack_symbol_type & operator=(const stack_symbol_type &that)
Assignment, needed by push_back.
Definition: parse.cc:329
void yypush_(const char *m, stack_symbol_type &s)
Push a new state on the stack.
Definition: parse.cc:503
void move(by_type &that)
Steal the symbol type from that.
Definition: parse.hh:1134
T & build(const T &t)
Instantiate a T in here from t.
Definition: parse.hh:200
state_type kind_type
The symbol type as needed by the constructor.
Definition: parse.hh:745
stack< stack_symbol_type > stack_type
Stack type.
Definition: parse.hh:780
static const signed char yypgoto_[]
Definition: parse.hh:682
symbol_number_type type_get() const
The (internal) type number (corresponding to type).
Definition: parse.hh:1142
State and public interface for rational expression parsing.
Definition: driver.hh:18
static const unsigned char yystos_[]
Definition: parse.hh:696
static symbol_type make_LWEIGHT(const location_type &l)
Definition: parse.hh:1346
A char[S] buffer to store and retrieve objects.
Definition: parse.hh:168
basic_symbol< by_state > super_type
Superclass.
Definition: parse.hh:770
static symbol_type make_AT(const location_type &l)
Definition: parse.hh:1184
char dummy5[sizeof(std::string)]
Definition: parse.hh:322
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46
void copy(const self_type &other)
Copy the content of other to this.
Definition: parse.hh:251
std::string type(const automaton &a)
The implementation type of a.
Definition: others.cc:239
static symbol_type make_BANG(const location_type &l)
Definition: parse.hh:1196
char dummy6[sizeof(std::vector< vcsn::dyn::expression >)]
Definition: parse.hh:325
parser(driver &driver__yyarg)
Build a parser object.
Definition: parse.cc:230
union vcsn::rat::variant::@5 yybuffer_
virtual int parse()
Parse.
Definition: parse.cc:567
syntax_error(const location_type &l, const std::string &m)
Definition: parse.hh:872
static const char *const yytname_[]
For a symbol, its name in clear.
Definition: parse.hh:710
void set_debug_stream(std::ostream &)
Set the current debugging stream.
braced_expression & operator=(dyn::expression e)
Definition: parse.hh:70
unsigned char token_number_type
Internal symbol number for tokens (subsumed by symbol_number_type).
Definition: parse.hh:389
virtual ~parser()
Definition: parse.cc:239
self_type & operator=(const self_type &)
Prohibit blind copies.
location_type location
The location.
Definition: parse.hh:440
char dummy4[sizeof(irange_type)]
Definition: parse.hh:318
An expression that "remembers" whether it was in parentheses.
Definition: parse.hh:62
Number of nonterminal symbols.
Definition: parse.hh:808
static symbol_type make_WEIGHT(const std::string &v, const location_type &l)
Definition: parse.hh:1328
void move(by_state &that)
Steal the symbol type from that.
Definition: parse.cc:262
T & as()
Accessor to a built T.
Definition: parse.hh:208
static const unsigned char yyr1_[]
Definition: parse.hh:699
T & build()
Instantiate an empty T in here.
Definition: parse.hh:192
char yyraw[S]
A buffer large enough to store any of the semantic values.
Definition: parse.hh:292
void swap(self_type &other)
Swap the content with other, of same type.
Definition: parse.hh:231
void move(self_type &other)
Move the content of other to this.
Definition: parse.hh:241
void yy_destroy_(const char *yymsg, basic_symbol< Base > &yysym) const
Reclaim the memory associated to a symbol.
Definition: parse.cc:374
state_type yy_lr_goto_state_(state_type yystate, int yysym)
Compute post-reduction state.
Definition: parse.cc:545
static symbol_type make_DOT(const location_type &l)
Definition: parse.hh:1232
Type access provider for state based symbols.
Definition: parse.hh:739
"Internal" symbol: element of the stack.
Definition: parse.hh:767
T * yyas_()
Accessor to raw memory as T.
Definition: parse.hh:272
static const unsigned char yytable_[]
Definition: parse.hh:690
virtual void yystack_print_()
Print the state stack on the debug stream.
token_type token() const
The token.
Definition: parse.hh:1149
variant()
Empty construction.
Definition: parse.hh:174
long double yyalign_me
Strongest alignment constraints.
Definition: parse.hh:290
static std::string yytnamerr_(const char *n)
Convert the symbol name n to a form suitable for a diagnostic.
Definition: parse.cc:197
static const signed char yydefgoto_[]
Definition: parse.hh:685
static const unsigned short int yyrline_[]
Definition: parse.hh:713
state_type state
The state.
Definition: parse.hh:763
STL namespace.
static symbol_type make_TRANSPOSITION(const location_type &l)
Definition: parse.hh:1298
dyn::expression exp
The expression parsed so far.
Definition: parse.hh:65
static bool yy_pact_value_is_default_(int yyvalue)
Whether the given yypact_ value indicates a defaulted state.
Definition: parse.cc:555
token_type kind_type
The symbol type as needed by the constructor.
Definition: parse.hh:457
Define the vcsn::rat::location class.
Abstract a location.
Definition: location.hh:47
static const unsigned char yyr2_[]
Definition: parse.hh:702
static symbol_type make_AMPERSAND(const location_type &l)
Definition: parse.hh:1172
A char[S] buffer to store and retrieve objects.
Definition: parse.hh:174
static symbol_type make_BACKSLASH(const location_type &l)
Definition: parse.hh:1190
parser & operator=(const parser &)
static symbol_type make_END(const location_type &l)
Definition: parse.hh:1166
value_impl< detail::weight_tag > weight
Definition: fwd.hh:28
static symbol_type make_PLUS(const location_type &l)
Definition: parse.hh:1274
basic_symbol & operator=(const basic_symbol &other)
Assignment operator.
bool rparen
Whether there was a right-paren.
Definition: parse.hh:69
static const signed char yytable_ninf_
Definition: parse.hh:666
char dummy1[sizeof(braced_expression)]
Definition: parse.hh:309
static symbol_type make_LPAREN(const location_type &l)
Definition: parse.hh:1244
static symbol_type make_PIPE(const location_type &l)
Definition: parse.hh:1268
token::yytokentype token_type
(External) token type, as returned by yylex.
Definition: parse.hh:383
static symbol_type make_TRANSPOSE(const location_type &l)
Definition: parse.hh:1304
std::ostream & debug_stream() const
The current debugging stream.
static const signed char yycheck_[]
Definition: parse.hh:692
stack_type yystack_
The stack.
Definition: parse.hh:783
std::set< std::pair< std::string, std::string >> class_t
A set of label ranges.
Definition: fwd.hh:12
void move(basic_symbol &s)
Destructive move, s is emptied into this.
Definition: parse.hh:1076
static symbol_type make_RPAREN(const location_type &l)
Definition: parse.hh:1286
token_number_type type
The symbol type.
Definition: parse.hh:476
static symbol_type make_LBRACKET(const location_type &l)
Definition: parse.hh:1238
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.
by_state()
Default constructor.
Definition: parse.cc:251
variant(const T &t)
Construct and fill.
Definition: parse.hh:179
static symbol_type make_LETTER(const std::string &v, const location_type &l)
Definition: parse.hh:1322
A dyn Value/ValueSet.
Definition: fwd.hh:23
value_impl< detail::expression_tag > expression
Definition: fwd.hh:25
Number of tokens.
Definition: parse.hh:813
An auxiliary type to compute the largest semantic type.
Definition: parse.hh:303
semantic_type value
The semantic value.
Definition: parse.hh:437
void set_debug_level(debug_level_type l)
Set the current debugging level.
void destroy()
Destroy the stored T.
Definition: parse.hh:265