Vcsn  2.3
Be Rational
parse.hh
Go to the documentation of this file.
1 // A Bison parser, made by GNU Bison 3.0.4.19-fbaf-dirty.
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/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 "/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  // add
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  AT = 260,
353  BACKSLASH = 261,
354  BANG = 262,
355  CARET = 263,
356  COLON = 264,
357  COMMA = 265,
358  COMPLEMENT = 266,
359  DASH = 267,
360  DOT = 268,
361  LBRACKET = 269,
362  LPAREN = 270,
363  LT_PLUS = 271,
364  ONE = 272,
365  PERCENT = 273,
366  PIPE = 274,
367  PLUS = 275,
368  RBRACKET = 276,
369  RPAREN = 277,
370  SLASH = 278,
372  TRANSPOSE = 280,
373  ZERO = 281,
374  STAR = 282,
375  LETTER = 283,
376  WEIGHT = 284,
377  CONCAT = 285,
378  RWEIGHT = 286,
379  LWEIGHT = 287
380  };
381  };
382 
385 
387  typedef int symbol_number_type;
388 
390  enum { empty_symbol = -2 };
391 
393  typedef unsigned char token_number_type;
394 
401  template <typename Base>
403  {
405  typedef Base super_type;
406 
408  basic_symbol ();
409 
411  basic_symbol (const basic_symbol& other);
412 
414 
415  basic_symbol (typename Base::kind_type t, const location_type& l);
416 
417  basic_symbol (typename Base::kind_type t, const braced_expression v, const location_type& l);
418 
419  basic_symbol (typename Base::kind_type t, const class_t v, const location_type& l);
420 
421  basic_symbol (typename Base::kind_type t, const dyn::weight v, const location_type& l);
422 
423  basic_symbol (typename Base::kind_type t, const irange_type v, const location_type& l);
424 
425  basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l);
426 
427  basic_symbol (typename Base::kind_type t, const std::vector<vcsn::dyn::expression> v, const location_type& l);
428 
429 
431  basic_symbol (typename Base::kind_type t,
432  const semantic_type& v,
433  const location_type& l);
434 
436  ~basic_symbol ();
437 
439  void clear ();
440 
442  bool empty () const;
443 
445  void move (basic_symbol& s);
446 
448  semantic_type value;
449 
451  location_type location;
452 
453  private:
455  basic_symbol& operator= (const basic_symbol& other);
456  };
457 
459  struct by_type
460  {
462  by_type ();
463 
465  by_type (const by_type& other);
466 
468  typedef token_type kind_type;
469 
471  by_type (kind_type t);
472 
474  void clear ();
475 
477  void move (by_type& that);
478 
481  symbol_number_type type_get () const;
482 
484  token_type token () const;
485 
489  int type;
490  };
491 
494 
495  // Symbol constructors declarations.
496  static inline
497  symbol_type
498  make_END (const location_type& l);
499 
500  static inline
501  symbol_type
502  make_AMPERSAND (const location_type& l);
503 
504  static inline
505  symbol_type
506  make_AMPERSAND_COLON (const location_type& l);
507 
508  static inline
509  symbol_type
510  make_AT (const location_type& l);
511 
512  static inline
513  symbol_type
514  make_BACKSLASH (const location_type& l);
515 
516  static inline
517  symbol_type
518  make_BANG (const location_type& l);
519 
520  static inline
521  symbol_type
522  make_CARET (const location_type& l);
523 
524  static inline
525  symbol_type
526  make_COLON (const location_type& l);
527 
528  static inline
529  symbol_type
530  make_COMMA (const location_type& l);
531 
532  static inline
533  symbol_type
534  make_COMPLEMENT (const location_type& l);
535 
536  static inline
537  symbol_type
538  make_DASH (const location_type& l);
539 
540  static inline
541  symbol_type
542  make_DOT (const location_type& l);
543 
544  static inline
545  symbol_type
546  make_LBRACKET (const location_type& l);
547 
548  static inline
549  symbol_type
550  make_LPAREN (const location_type& l);
551 
552  static inline
553  symbol_type
554  make_LT_PLUS (const location_type& l);
555 
556  static inline
557  symbol_type
558  make_ONE (const location_type& l);
559 
560  static inline
561  symbol_type
562  make_PERCENT (const location_type& l);
563 
564  static inline
565  symbol_type
566  make_PIPE (const location_type& l);
567 
568  static inline
569  symbol_type
570  make_PLUS (const location_type& l);
571 
572  static inline
573  symbol_type
574  make_RBRACKET (const location_type& l);
575 
576  static inline
577  symbol_type
578  make_RPAREN (const location_type& l);
579 
580  static inline
581  symbol_type
582  make_SLASH (const location_type& l);
583 
584  static inline
585  symbol_type
586  make_TRANSPOSITION (const location_type& l);
587 
588  static inline
589  symbol_type
590  make_TRANSPOSE (const location_type& l);
591 
592  static inline
593  symbol_type
594  make_ZERO (const location_type& l);
595 
596  static inline
597  symbol_type
598  make_STAR (const irange_type& v, const location_type& l);
599 
600  static inline
601  symbol_type
602  make_LETTER (const std::string& v, const location_type& l);
603 
604  static inline
605  symbol_type
606  make_WEIGHT (const std::string& v, const location_type& l);
607 
608  static inline
609  symbol_type
610  make_CONCAT (const location_type& l);
611 
612  static inline
613  symbol_type
614  make_RWEIGHT (const location_type& l);
615 
616  static inline
617  symbol_type
618  make_LWEIGHT (const location_type& l);
619 
620 
622  parser (driver& driver__yyarg);
623  virtual ~parser ();
624 
627  virtual int parse ();
628 
629 #if YYDEBUG
630  std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
633  void set_debug_stream (std::ostream &);
634 
636  typedef int debug_level_type;
638  debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
640  void set_debug_level (debug_level_type l);
641 #endif
642 
646  virtual void error (const location_type& loc, const std::string& msg);
647 
649  void error (const syntax_error& err);
650 
651  private:
653  parser (const parser&);
654  parser& operator= (const parser&);
655 
657  typedef int state_type;
658 
662  virtual std::string yysyntax_error_ (state_type yystate,
663  const symbol_type& yyla) const;
664 
668  state_type yy_lr_goto_state_ (state_type yystate, int yysym);
669 
672  static bool yy_pact_value_is_default_ (int yyvalue);
673 
676  static bool yy_table_value_is_error_ (int yyvalue);
677 
678  static const signed char yypact_ninf_;
679  static const signed char yytable_ninf_;
680 
682  static token_number_type yytranslate_ (token_type t);
683 
684  // Tables.
685  // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
686  // STATE-NUM.
687  static const short int yypact_[];
688 
689  // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
690  // Performed when YYTABLE does not specify something else to do. Zero
691  // means the default is an error.
692  static const unsigned char yydefact_[];
693 
694  // YYPGOTO[NTERM-NUM].
695  static const signed char yypgoto_[];
696 
697  // YYDEFGOTO[NTERM-NUM].
698  static const signed char yydefgoto_[];
699 
700  // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
701  // positive, shift that token. If negative, reduce the rule whose
702  // number is the opposite. If YYTABLE_NINF, syntax error.
703  static const unsigned char yytable_[];
704 
705  static const signed char yycheck_[];
706 
707  // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
708  // symbol of state STATE-NUM.
709  static const unsigned char yystos_[];
710 
711  // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
712  static const unsigned char yyr1_[];
713 
714  // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
715  static const unsigned char yyr2_[];
716 
717 
719  static std::string yytnamerr_ (const char *n);
720 
721 
723  static const char* const yytname_[];
724 #if YYDEBUG
725  // YYRLINE[YYN] -- Source line where rule number YYN was defined.
726  static const unsigned short int yyrline_[];
728  virtual void yy_reduce_print_ (int r);
730  virtual void yystack_print_ ();
731 
732  // Debugging.
733  int yydebug_;
734  std::ostream* yycdebug_;
735 
739  template <typename Base>
740  void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
741 #endif
742 
747  template <typename Base>
748  void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
749 
750  private:
752  struct by_state
753  {
755  by_state ();
756 
758  typedef state_type kind_type;
759 
761  by_state (kind_type s);
762 
764  by_state (const by_state& other);
765 
767  void clear ();
768 
770  void move (by_state& that);
771 
774  symbol_number_type type_get () const;
775 
777  enum { empty_state = -1 };
778 
781  state_type state;
782  };
783 
785  struct stack_symbol_type : basic_symbol<by_state>
786  {
792  stack_symbol_type (state_type s, symbol_type& sym);
795  };
796 
799 
801  stack_type yystack_;
802 
808  void yypush_ (const char* m, stack_symbol_type& s);
809 
816  void yypush_ (const char* m, state_type s, symbol_type& sym);
817 
819  void yypop_ (unsigned int n = 1);
820 
822  enum
823  {
824  yyeof_ = 0,
825  yylast_ = 221,
826  yynnts_ = 11,
827  yyfinal_ = 5,
829  yyerrcode_ = 256,
831  };
832 
833 
834  // User arguments.
836  };
837 
838  // Symbol number corresponding to token number t.
839  inline
841  parser::yytranslate_ (token_type t)
842  {
843  static
844  const token_number_type
845  translate_table[] =
846  {
847  0, 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, 2, 2, 2, 2,
863  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
864  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
865  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
866  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
867  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
868  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
869  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
870  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
871  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
872  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
873  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
874  15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
875  25, 26, 27, 28, 29, 30, 31, 32
876  };
877  const unsigned int user_token_number_max_ = 287;
878  const token_number_type undef_token_ = 2;
879 
880  if (static_cast<int>(t) <= yyeof_)
881  return yyeof_;
882  else if (static_cast<unsigned int> (t) <= user_token_number_max_)
883  return translate_table[t];
884  else
885  return undef_token_;
886  }
887 
888  inline
889  parser::syntax_error::syntax_error (const location_type& l, const std::string& m)
890  : std::runtime_error (m)
891  , location (l)
892  {}
893 
894  // basic_symbol.
895  template <typename Base>
896  inline
898  : value ()
899  {}
900 
901  template <typename Base>
902  inline
904  : Base (other)
905  , value ()
906  , location (other.location)
907  {
908  switch (other.type_get ())
909  {
910  case 34: // input
911  case 36: // add
912  case 37: // tuple
913  case 41: // exp
914  value.copy< braced_expression > (other.value);
915  break;
916 
917  case 43: // class
918  value.copy< class_t > (other.value);
919  break;
920 
921  case 42: // weights
922  value.copy< dyn::weight > (other.value);
923  break;
924 
925  case 27: // "*"
926  value.copy< irange_type > (other.value);
927  break;
928 
929  case 28: // "letter"
930  case 29: // "weight"
931  value.copy< std::string > (other.value);
932  break;
933 
934  case 39: // tuple.1
935  value.copy< std::vector<vcsn::dyn::expression> > (other.value);
936  break;
937 
938  default:
939  break;
940  }
941 
942  }
943 
944 
945  template <typename Base>
946  inline
947  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const semantic_type& v, const location_type& l)
948  : Base (t)
949  , value ()
950  , location (l)
951  {
952  (void) v;
953  switch (this->type_get ())
954  {
955  case 34: // input
956  case 36: // add
957  case 37: // tuple
958  case 41: // exp
960  break;
961 
962  case 43: // class
963  value.copy< class_t > (v);
964  break;
965 
966  case 42: // weights
967  value.copy< dyn::weight > (v);
968  break;
969 
970  case 27: // "*"
971  value.copy< irange_type > (v);
972  break;
973 
974  case 28: // "letter"
975  case 29: // "weight"
976  value.copy< std::string > (v);
977  break;
978 
979  case 39: // tuple.1
980  value.copy< std::vector<vcsn::dyn::expression> > (v);
981  break;
982 
983  default:
984  break;
985  }
986 }
987 
988 
989  // Implementation of basic_symbol constructor for each type.
990 
991  template <typename Base>
992  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
993  : Base (t)
994  , value ()
995  , location (l)
996  {}
997 
998  template <typename Base>
999  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const braced_expression v, const location_type& l)
1000  : Base (t)
1001  , value (v)
1002  , location (l)
1003  {}
1004 
1005  template <typename Base>
1006  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const class_t v, const location_type& l)
1007  : Base (t)
1008  , value (v)
1009  , location (l)
1010  {}
1011 
1012  template <typename Base>
1013  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const dyn::weight v, const location_type& l)
1014  : Base (t)
1015  , value (v)
1016  , location (l)
1017  {}
1018 
1019  template <typename Base>
1020  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const irange_type v, const location_type& l)
1021  : Base (t)
1022  , value (v)
1023  , location (l)
1024  {}
1025 
1026  template <typename Base>
1027  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l)
1028  : Base (t)
1029  , value (v)
1030  , location (l)
1031  {}
1032 
1033  template <typename Base>
1034  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::vector<vcsn::dyn::expression> v, const location_type& l)
1035  : Base (t)
1036  , value (v)
1037  , location (l)
1038  {}
1039 
1040 
1041  template <typename Base>
1042  inline
1044  {
1045  clear ();
1046  }
1047 
1048  template <typename Base>
1049  inline
1050  void
1052  {
1053  // User destructor.
1054  symbol_number_type yytype = this->type_get ();
1055  basic_symbol<Base>& yysym = *this;
1056  (void) yysym;
1057  switch (yytype)
1058  {
1059  default:
1060  break;
1061  }
1062 
1063  // Type destructor.
1064  switch (yytype)
1065  {
1066  case 34: // input
1067  case 36: // add
1068  case 37: // tuple
1069  case 41: // exp
1070  value.template destroy< braced_expression > ();
1071  break;
1072 
1073  case 43: // class
1074  value.template destroy< class_t > ();
1075  break;
1076 
1077  case 42: // weights
1078  value.template destroy< dyn::weight > ();
1079  break;
1080 
1081  case 27: // "*"
1082  value.template destroy< irange_type > ();
1083  break;
1084 
1085  case 28: // "letter"
1086  case 29: // "weight"
1087  value.template destroy< std::string > ();
1088  break;
1089 
1090  case 39: // tuple.1
1091  value.template destroy< std::vector<vcsn::dyn::expression> > ();
1092  break;
1093 
1094  default:
1095  break;
1096  }
1097 
1098  Base::clear ();
1099  }
1100 
1101  template <typename Base>
1102  inline
1103  bool
1105  {
1106  return Base::type_get () == empty_symbol;
1107  }
1108 
1109  template <typename Base>
1110  inline
1111  void
1113  {
1114  super_type::move(s);
1115  switch (this->type_get ())
1116  {
1117  case 34: // input
1118  case 36: // add
1119  case 37: // tuple
1120  case 41: // exp
1121  value.move< braced_expression > (s.value);
1122  break;
1123 
1124  case 43: // class
1125  value.move< class_t > (s.value);
1126  break;
1127 
1128  case 42: // weights
1129  value.move< dyn::weight > (s.value);
1130  break;
1131 
1132  case 27: // "*"
1133  value.move< irange_type > (s.value);
1134  break;
1135 
1136  case 28: // "letter"
1137  case 29: // "weight"
1138  value.move< std::string > (s.value);
1139  break;
1140 
1141  case 39: // tuple.1
1142  value.move< std::vector<vcsn::dyn::expression> > (s.value);
1143  break;
1144 
1145  default:
1146  break;
1147  }
1148 
1149  location = s.location;
1150  }
1151 
1152  // by_type.
1153  inline
1155  : type (empty_symbol)
1156  {}
1157 
1158  inline
1160  : type (other.type)
1161  {}
1162 
1163  inline
1165  : type (yytranslate_ (t))
1166  {}
1167 
1168  inline
1169  void
1171  {
1172  type = empty_symbol;
1173  }
1174 
1175  inline
1176  void
1178  {
1179  type = that.type;
1180  that.clear ();
1181  }
1182 
1183  inline
1184  int
1186  {
1187  return type;
1188  }
1189 
1190  inline
1193  {
1194  // YYTOKNUM[NUM] -- (External) token number corresponding to the
1195  // (internal) symbol number NUM (which must be that of a token). */
1196  static
1197  const unsigned short int
1198  yytoken_number_[] =
1199  {
1200  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1201  265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1202  275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1203  285, 286, 287
1204  };
1205  return static_cast<token_type> (yytoken_number_[type]);
1206  }
1207  // Implementation of make_symbol for each symbol type.
1209  parser::make_END (const location_type& l)
1210  {
1211  return symbol_type (token::END, l);
1212  }
1213 
1215  parser::make_AMPERSAND (const location_type& l)
1216  {
1217  return symbol_type (token::AMPERSAND, l);
1218  }
1219 
1221  parser::make_AMPERSAND_COLON (const location_type& l)
1222  {
1223  return symbol_type (token::AMPERSAND_COLON, l);
1224  }
1225 
1227  parser::make_AT (const location_type& l)
1228  {
1229  return symbol_type (token::AT, l);
1230  }
1231 
1233  parser::make_BACKSLASH (const location_type& l)
1234  {
1235  return symbol_type (token::BACKSLASH, l);
1236  }
1237 
1239  parser::make_BANG (const location_type& l)
1240  {
1241  return symbol_type (token::BANG, l);
1242  }
1243 
1245  parser::make_CARET (const location_type& l)
1246  {
1247  return symbol_type (token::CARET, l);
1248  }
1249 
1251  parser::make_COLON (const location_type& l)
1252  {
1253  return symbol_type (token::COLON, l);
1254  }
1255 
1257  parser::make_COMMA (const location_type& l)
1258  {
1259  return symbol_type (token::COMMA, l);
1260  }
1261 
1263  parser::make_COMPLEMENT (const location_type& l)
1264  {
1265  return symbol_type (token::COMPLEMENT, l);
1266  }
1267 
1269  parser::make_DASH (const location_type& l)
1270  {
1271  return symbol_type (token::DASH, l);
1272  }
1273 
1275  parser::make_DOT (const location_type& l)
1276  {
1277  return symbol_type (token::DOT, l);
1278  }
1279 
1281  parser::make_LBRACKET (const location_type& l)
1282  {
1283  return symbol_type (token::LBRACKET, l);
1284  }
1285 
1287  parser::make_LPAREN (const location_type& l)
1288  {
1289  return symbol_type (token::LPAREN, l);
1290  }
1291 
1293  parser::make_LT_PLUS (const location_type& l)
1294  {
1295  return symbol_type (token::LT_PLUS, l);
1296  }
1297 
1299  parser::make_ONE (const location_type& l)
1300  {
1301  return symbol_type (token::ONE, l);
1302  }
1303 
1305  parser::make_PERCENT (const location_type& l)
1306  {
1307  return symbol_type (token::PERCENT, l);
1308  }
1309 
1311  parser::make_PIPE (const location_type& l)
1312  {
1313  return symbol_type (token::PIPE, l);
1314  }
1315 
1317  parser::make_PLUS (const location_type& l)
1318  {
1319  return symbol_type (token::PLUS, l);
1320  }
1321 
1323  parser::make_RBRACKET (const location_type& l)
1324  {
1325  return symbol_type (token::RBRACKET, l);
1326  }
1327 
1329  parser::make_RPAREN (const location_type& l)
1330  {
1331  return symbol_type (token::RPAREN, l);
1332  }
1333 
1335  parser::make_SLASH (const location_type& l)
1336  {
1337  return symbol_type (token::SLASH, l);
1338  }
1339 
1341  parser::make_TRANSPOSITION (const location_type& l)
1342  {
1343  return symbol_type (token::TRANSPOSITION, l);
1344  }
1345 
1347  parser::make_TRANSPOSE (const location_type& l)
1348  {
1349  return symbol_type (token::TRANSPOSE, l);
1350  }
1351 
1353  parser::make_ZERO (const location_type& l)
1354  {
1355  return symbol_type (token::ZERO, l);
1356  }
1357 
1359  parser::make_STAR (const irange_type& v, const location_type& l)
1360  {
1361  return symbol_type (token::STAR, v, l);
1362  }
1363 
1365  parser::make_LETTER (const std::string& v, const location_type& l)
1366  {
1367  return symbol_type (token::LETTER, v, l);
1368  }
1369 
1371  parser::make_WEIGHT (const std::string& v, const location_type& l)
1372  {
1373  return symbol_type (token::WEIGHT, v, l);
1374  }
1375 
1377  parser::make_CONCAT (const location_type& l)
1378  {
1379  return symbol_type (token::CONCAT, l);
1380  }
1381 
1383  parser::make_RWEIGHT (const location_type& l)
1384  {
1385  return symbol_type (token::RWEIGHT, l);
1386  }
1387 
1389  parser::make_LWEIGHT (const location_type& l)
1390  {
1391  return symbol_type (token::LWEIGHT, l);
1392  }
1393 
1394 
1395 #line 11 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy" // lalr1.cc:377
1396 } } // vcsn::rat
1397 #line 1398 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.hh" // lalr1.cc:377
1398 
1399 
1400 // // "%code provides" blocks.
1401 #line 56 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy" // lalr1.cc:377
1402 
1403  #define YY_DECL_(Class) \
1404  parser::symbol_type Class lex(driver& driver_)
1405  #define YY_DECL YY_DECL_(yyFlexLexer::)
1406 
1407 #line 1408 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.hh" // lalr1.cc:377
1408 
1409 
1410 #endif // !YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_RAT_PARSE_HH_INCLUDED
static symbol_type make_TRANSPOSE(const location_type &l)
Definition: parse.hh:1347
static symbol_type make_RBRACKET(const location_type &l)
Definition: parse.hh:1323
Base super_type
Alias to Base.
Definition: parse.hh:405
return v
Definition: multiply.hh:361
static const short int yypact_[]
Definition: parse.hh:687
static const signed char yycheck_[]
Definition: parse.hh:705
location location_type
Symbol locations.
Definition: parse.hh:335
value_impl< detail::weight_tag > weight
Definition: fwd.hh:28
static symbol_type make_AMPERSAND_COLON(const location_type &l)
Definition: parse.hh:1221
static symbol_type make_CONCAT(const location_type &l)
Definition: parse.hh:1377
bool lparen
Whether there was a left-paren.
Definition: parse.hh:67
A Bison parser.
Definition: parse.hh:299
virtual void yy_reduce_print_(int r)
Report on the debug stream that the rule r is going to be reduced.
Definition: parse.cc:1456
const T * yyas_() const
Const accessor to raw memory as T.
Definition: parse.hh:282
Type access provider for token (enum) based symbols.
Definition: parse.hh:459
A char[S] buffer to store and retrieve objects.
Definition: parse.hh:169
Abstract a location.
Definition: location.hh:47
static bool yy_pact_value_is_default_(int yyvalue)
Whether the given yypact_ value indicates a defaulted state.
Definition: parse.cc:569
std::string type(const automaton &a)
The implementation type of a.
Definition: others.cc:231
Define the vcsn::rat::location class.
static symbol_type make_BACKSLASH(const location_type &l)
Definition: parse.hh:1233
static const unsigned char yystos_[]
Definition: parse.hh:709
static symbol_type make_ZERO(const location_type &l)
Definition: parse.hh:1353
static symbol_type make_LWEIGHT(const location_type &l)
Definition: parse.hh:1389
Termination state number.
Definition: parse.hh:827
static symbol_type make_PLUS(const location_type &l)
Definition: parse.hh:1317
static const signed char yypact_ninf_
Definition: parse.hh:678
by_type()
Default constructor.
Definition: parse.hh:1154
STL namespace.
A complete symbol.
Definition: parse.hh:402
void clear()
Record that this symbol is empty.
Definition: parse.hh:1170
static symbol_type make_RWEIGHT(const location_type &l)
Definition: parse.hh:1383
static const unsigned char yydefact_[]
Definition: parse.hh:692
variant< sizeof(union_type)> semantic_type
Symbol semantic values.
Definition: parse.hh:330
Number of nonterminal symbols.
Definition: parse.hh:826
int type
The symbol type.
Definition: parse.hh:489
static symbol_type make_COLON(const location_type &l)
Definition: parse.hh:1251
basic_symbol()
Default constructor.
Definition: parse.hh:897
static symbol_type make_LBRACKET(const location_type &l)
Definition: parse.hh:1281
int debug_level_type
Type for debugging levels.
Definition: parse.hh:636
std::ostream & debug_stream() const
The current debugging stream.
Definition: parse.cc:533
symbol_number_type type_get() const
The (internal) type number (corresponding to state).
Definition: parse.cc:282
static symbol_type make_WEIGHT(const std::string &v, const location_type &l)
Definition: parse.hh:1371
void yypop_(unsigned int n=1)
Pop n symbols the three stacks.
Definition: parse.cc:526
static symbol_type make_DASH(const location_type &l)
Definition: parse.hh:1269
T & build()
Instantiate an empty T in here.
Definition: parse.hh:193
void destroy()
Destroy the stored T.
Definition: parse.hh:260
char dummy6[sizeof(std::vector< vcsn::dyn::expression >)]
Definition: parse.hh:326
virtual std::string yysyntax_error_(state_type yystate, const symbol_type &yyla) const
Generate an error message.
Definition: parse.cc:1189
void set_debug_level(debug_level_type l)
Set the current debugging level.
Definition: parse.cc:552
T * yyas_()
Accessor to raw memory as T.
Definition: parse.hh:273
static symbol_type make_AT(const location_type &l)
Definition: parse.hh:1227
static symbol_type make_STAR(const irange_type &v, const location_type &l)
Definition: parse.hh:1359
static symbol_type make_BANG(const location_type &l)
Definition: parse.hh:1239
void move(by_type &that)
Steal the symbol type from that.
Definition: parse.hh:1177
Define the vcsn::rat::stack class.
static std::string yytnamerr_(const char *n)
Convert the symbol name n to a form suitable for a diagnostic.
Definition: parse.cc:197
const T & as() const
Const accessor to a built T (for printer).
Definition: parse.hh:217
virtual int parse()
Parse.
Definition: parse.cc:581
static const char *const yytname_[]
For a symbol, its name in clear.
Definition: parse.hh:723
static symbol_type make_CARET(const location_type &l)
Definition: parse.hh:1245
A dyn Value/ValueSet.
Definition: fwd.hh:23
char yyraw[S]
A buffer large enough to store any of the semantic values.
Definition: parse.hh:293
void set_debug_stream(std::ostream &)
Set the current debugging stream.
Definition: parse.cc:539
state_type kind_type
The symbol type as needed by the constructor.
Definition: parse.hh:758
static symbol_type make_TRANSPOSITION(const location_type &l)
Definition: parse.hh:1341
virtual void error(const location_type &loc, const std::string &msg)
Report a syntax error.
Definition: parse.cc:1489
long double yyalign_me
Strongest alignment constraints.
Definition: parse.hh:291
symbol_number_type type_get() const
The (internal) type number (corresponding to type).
Definition: parse.hh:1185
T & as()
Accessor to a built T.
Definition: parse.hh:215
static symbol_type make_LT_PLUS(const location_type &l)
Definition: parse.hh:1293
int state_type
State numbers.
Definition: parse.hh:657
static const unsigned char yyr1_[]
Definition: parse.hh:712
static const unsigned char yyr2_[]
Definition: parse.hh:715
void yypush_(const char *m, stack_symbol_type &s)
Push a new state on the stack.
Definition: parse.cc:517
static symbol_type make_DOT(const location_type &l)
Definition: parse.hh:1275
static const signed char yytable_ninf_
Definition: parse.hh:679
void move(self_type &other)
Move the content of other to this.
Definition: parse.hh:242
bool empty() const
Whether empty.
Definition: parse.hh:1104
#define YYASSERT
Definition: parse.hh:95
braced_expression & operator=(dyn::expression e)
Definition: parse.hh:70
static symbol_type make_LPAREN(const location_type &l)
Definition: parse.hh:1287
stack_symbol_type()
Construct an empty symbol.
Definition: parse.cc:291
#define YY_ATTRIBUTE_PURE
Definition: parse.hh:110
location_type location
The location.
Definition: parse.hh:451
stack< stack_symbol_type > stack_type
Stack type.
Definition: parse.hh:798
Syntax errors thrown from user actions.
Definition: parse.hh:338
An expression that "remembers" whether it was in parentheses.
Definition: parse.hh:62
Definition: a-star.hh:8
void move(by_state &that)
Steal the symbol type from that.
Definition: parse.cc:269
static symbol_type make_COMMA(const location_type &l)
Definition: parse.hh:1257
static bool yy_table_value_is_error_(int yyvalue)
Whether the given yytable_ value indicates a syntax error.
Definition: parse.cc:575
static symbol_type make_SLASH(const location_type &l)
Definition: parse.hh:1335
self_type & operator=(const self_type &)
Prohibit blind copies.
static symbol_type make_LETTER(const std::string &v, const location_type &l)
Definition: parse.hh:1365
parser(driver &driver__yyarg)
Build a parser object.
Definition: parse.cc:230
void clear()
Destroy contents, and record that is empty.
Definition: parse.hh:1051
Last index in yytable_.
Definition: parse.hh:825
int symbol_number_type
Symbol type: an internal symbol number.
Definition: parse.hh:387
void swap(self_type &other)
Swap the content with other, of same type.
Definition: parse.hh:232
Type access provider for state based symbols.
Definition: parse.hh:752
char dummy4[sizeof(irange_type)]
Definition: parse.hh:319
static symbol_type make_AMPERSAND(const location_type &l)
Definition: parse.hh:1215
std::set< std::pair< std::string, std::string >> class_t
A set of label ranges.
Definition: fwd.hh:12
token_type token() const
The token.
Definition: parse.hh:1192
parser & operator=(const parser &)
static symbol_type make_END(const location_type &l)
Definition: parse.hh:1209
virtual ~parser()
Definition: parse.cc:239
stack_symbol_type & operator=(const stack_symbol_type &that)
Assignment, needed by push_back.
Definition: parse.cc:339
virtual void yystack_print_()
Print the state stack on the debug stream.
Definition: parse.cc:1443
union vcsn::rat::variant::@6 yybuffer_
driver & driver_
Definition: parse.hh:835
void destroy()
Destroy the stored T.
Definition: parse.hh:266
static symbol_type make_PIPE(const location_type &l)
Definition: parse.hh:1311
state_type state
The state.
Definition: parse.hh:781
token::yytokentype token_type
(External) token type, as returned by yylex.
Definition: parse.hh:384
static const signed char yypgoto_[]
Definition: parse.hh:695
syntax_error(const location_type &l, const std::string &m)
Definition: parse.hh:889
char dummy2[sizeof(class_t)]
Definition: parse.hh:313
basic_symbol< by_state > super_type
Superclass.
Definition: parse.hh:788
stack_type yystack_
The stack.
Definition: parse.hh:801
dyn::expression exp
The expression parsed so far.
Definition: parse.hh:65
void yy_destroy_(const char *yymsg, basic_symbol< Base > &yysym) const
Reclaim the memory associated to a symbol.
Definition: parse.cc:384
static symbol_type make_RPAREN(const location_type &l)
Definition: parse.hh:1329
token_type kind_type
The symbol type as needed by the constructor.
Definition: parse.hh:468
char dummy5[sizeof(std::string)]
Definition: parse.hh:323
char dummy3[sizeof(dyn::weight)]
Definition: parse.hh:316
static const unsigned char yytable_[]
Definition: parse.hh:703
T & as()
Accessor to a built T.
Definition: parse.hh:209
void clear()
Record that this symbol is empty.
Definition: parse.cc:262
static symbol_type make_PERCENT(const location_type &l)
Definition: parse.hh:1305
State and public interface for rational expression parsing.
Definition: driver.hh:18
static symbol_type make_COMPLEMENT(const location_type &l)
Definition: parse.hh:1263
basic_symbol & operator=(const basic_symbol &other)
Assignment operator.
bool rparen
Whether there was a right-paren.
Definition: parse.hh:69
debug_level_type debug_level() const
The current debugging level.
Definition: parse.cc:546
~basic_symbol()
Destroy the symbol.
Definition: parse.hh:1043
T & build(const T &t)
Instantiate a T in here from t.
Definition: parse.hh:201
Number of tokens.
Definition: parse.hh:830
variant(const T &t)
Construct and fill.
Definition: parse.hh:180
~variant()
Destruction, allowed only if empty.
Definition: parse.hh:187
std::tuple< int, int > irange_type
An integer range, for quantifiers/exponents.
Definition: parse.hh:78
static const signed char yydefgoto_[]
Definition: parse.hh:698
unsigned char token_number_type
Internal symbol number for tokens (subsumed by symbol_number_type).
Definition: parse.hh:393
char dummy1[sizeof(braced_expression)]
Definition: parse.hh:310
A char[S] buffer to store and retrieve objects.
Definition: parse.hh:175
static token_number_type yytranslate_(token_type t)
Convert a scanner token number t to a symbol number.
Definition: parse.hh:841
static symbol_type make_ONE(const location_type &l)
Definition: parse.hh:1299
std::ostream * yycdebug_
Definition: parse.hh:734
basic_symbol< by_type > symbol_type
"External" symbols: returned by the scanner.
Definition: parse.hh:493
void yy_print_(std::ostream &yyo, const basic_symbol< Base > &yysym) const
Display a symbol type, value and location.
Definition: parse.cc:393
void move(basic_symbol &s)
Destructive move, s is emptied into this.
Definition: parse.hh:1112
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46
by_state()
Default constructor.
Definition: parse.cc:251
variant()
Empty construction.
Definition: parse.hh:175
value_impl< detail::expression_tag > expression
Definition: fwd.hh:25
state_type yy_lr_goto_state_(state_type yystate, int yysym)
Compute post-reduction state.
Definition: parse.cc:559
An auxiliary type to compute the largest semantic type.
Definition: parse.hh:304
static const unsigned short int yyrline_[]
Definition: parse.hh:726
"Internal" symbol: element of the stack.
Definition: parse.hh:785
semantic_type value
The semantic value.
Definition: parse.hh:448
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