Vcsn  2.8
Be Rational
parse.hh
Go to the documentation of this file.
1 // A Bison parser, made by GNU Bison 3.0.4.
2 
3 // Skeleton interface for Bison LALR(1) parsers in C++
4 
5 // Copyright (C) 2002-2015 Free Software Foundation, Inc.
6 
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 
17 // You should have received a copy of the GNU General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 
20 // As a special exception, you may create a larger work that contains
21 // part or all of the Bison parser skeleton and distribute that work
22 // under terms of your choice, so long as that work isn't itself a
23 // parser generator using the skeleton or a modified version thereof
24 // as a parser skeleton. Alternatively, if you modify or redistribute
25 // the parser skeleton itself, you may (at your option) remove this
26 // special exception, which will cause the skeleton and the resulting
27 // Bison output files to be licensed under the GNU General Public
28 // License without this special exception.
29 
30 // This special exception was added by the Free Software Foundation in
31 // version 2.2 of Bison.
32 
38 // C++ LALR(1) parser skeleton written by Akim Demaille.
39 
40 #ifndef YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_RAT_PARSE_HH_INCLUDED
41 # define YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_RAT_PARSE_HH_INCLUDED
42 // // "%code requires" blocks.
43 #line 16 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy" // lalr1.cc:377
44 
45  #include <iostream>
46  #include <tuple>
48  #include <vcsn/dyn/value.hh>
49  #include <vcsn/misc/location.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 <vcsn/misc/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  // "("
329  char dummy7[sizeof(symbol)];
330 };
331 
334 #else
335  typedef YYSTYPE semantic_type;
336 #endif
337  typedef location location_type;
339 
341  struct syntax_error : std::runtime_error
342  {
343  syntax_error (const location_type& l, const std::string& m);
344  location_type location;
345  };
346 
348  struct token
349  {
351  {
352  END = 0,
353  AMPERSAND = 258,
354  AMPERSAND_COLON = 259,
355  AT = 260,
356  BACKSLASH = 261,
357  BANG = 262,
358  CARET = 263,
359  COLON = 264,
360  COMMA = 265,
361  COMPLEMENT = 266,
362  DASH = 267,
363  DOT = 268,
364  LBRACKET = 269,
365  LT_PLUS = 270,
366  ONE = 271,
367  PERCENT = 272,
368  PIPE = 273,
369  PLUS = 274,
370  RBRACKET = 275,
371  RPAREN = 276,
372  SLASH = 277,
373  TRANSPOSITION = 278,
374  TRANSPOSE = 279,
375  ZERO = 280,
376  STAR = 281,
377  LETTER = 282,
378  WEIGHT = 283,
379  LPAREN = 284,
380  CONCAT = 285,
381  RWEIGHT = 286,
382  LWEIGHT = 287
383  };
384  };
385 
388 
390  typedef int symbol_number_type;
391 
393  enum { empty_symbol = -2 };
394 
396  typedef unsigned char token_number_type;
397 
404  template <typename Base>
406  {
408  typedef Base super_type;
409 
411  basic_symbol ();
412 
414  basic_symbol (const basic_symbol& other);
415 
417 
418  basic_symbol (typename Base::kind_type t, const location_type& l);
419 
420  basic_symbol (typename Base::kind_type t, const braced_expression v, const location_type& l);
421 
422  basic_symbol (typename Base::kind_type t, const class_t v, const location_type& l);
423 
424  basic_symbol (typename Base::kind_type t, const dyn::weight v, const location_type& l);
425 
426  basic_symbol (typename Base::kind_type t, const irange_type v, const location_type& l);
427 
428  basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l);
429 
430  basic_symbol (typename Base::kind_type t, const std::vector<vcsn::dyn::expression> v, const location_type& l);
431 
432  basic_symbol (typename Base::kind_type t, const symbol v, const location_type& l);
433 
434 
436  basic_symbol (typename Base::kind_type t,
437  const semantic_type& v,
438  const location_type& l);
439 
441  ~basic_symbol ();
442 
444  void clear ();
445 
447  bool empty () const;
448 
450  void move (basic_symbol& s);
451 
453  semantic_type value;
454 
456  location_type location;
457 
458  private:
460  basic_symbol& operator= (const basic_symbol& other);
461  };
462 
464  struct by_type
465  {
467  by_type ();
468 
470  by_type (const by_type& other);
471 
473  typedef token_type kind_type;
474 
476  by_type (kind_type t);
477 
479  void clear ();
480 
482  void move (by_type& that);
483 
486  symbol_number_type type_get () const;
487 
489  token_type token () const;
490 
494  int type;
495  };
496 
499 
500  // Symbol constructors declarations.
501  static inline
502  symbol_type
503  make_END (const location_type& l);
504 
505  static inline
506  symbol_type
507  make_AMPERSAND (const location_type& l);
508 
509  static inline
510  symbol_type
511  make_AMPERSAND_COLON (const location_type& l);
512 
513  static inline
514  symbol_type
515  make_AT (const location_type& l);
516 
517  static inline
518  symbol_type
519  make_BACKSLASH (const location_type& l);
520 
521  static inline
522  symbol_type
523  make_BANG (const location_type& l);
524 
525  static inline
526  symbol_type
527  make_CARET (const location_type& l);
528 
529  static inline
530  symbol_type
531  make_COLON (const location_type& l);
532 
533  static inline
534  symbol_type
535  make_COMMA (const location_type& l);
536 
537  static inline
538  symbol_type
539  make_COMPLEMENT (const location_type& l);
540 
541  static inline
542  symbol_type
543  make_DASH (const location_type& l);
544 
545  static inline
546  symbol_type
547  make_DOT (const location_type& l);
548 
549  static inline
550  symbol_type
551  make_LBRACKET (const location_type& l);
552 
553  static inline
554  symbol_type
555  make_LT_PLUS (const location_type& l);
556 
557  static inline
558  symbol_type
559  make_ONE (const location_type& l);
560 
561  static inline
562  symbol_type
563  make_PERCENT (const location_type& l);
564 
565  static inline
566  symbol_type
567  make_PIPE (const location_type& l);
568 
569  static inline
570  symbol_type
571  make_PLUS (const location_type& l);
572 
573  static inline
574  symbol_type
575  make_RBRACKET (const location_type& l);
576 
577  static inline
578  symbol_type
579  make_RPAREN (const location_type& l);
580 
581  static inline
582  symbol_type
583  make_SLASH (const location_type& l);
584 
585  static inline
586  symbol_type
587  make_TRANSPOSITION (const location_type& l);
588 
589  static inline
590  symbol_type
591  make_TRANSPOSE (const location_type& l);
592 
593  static inline
594  symbol_type
595  make_ZERO (const location_type& l);
596 
597  static inline
598  symbol_type
599  make_STAR (const irange_type& v, const location_type& l);
600 
601  static inline
602  symbol_type
603  make_LETTER (const std::string& v, const location_type& l);
604 
605  static inline
606  symbol_type
607  make_WEIGHT (const std::string& v, const location_type& l);
608 
609  static inline
610  symbol_type
611  make_LPAREN (const symbol& v, const location_type& l);
612 
613  static inline
614  symbol_type
615  make_CONCAT (const location_type& l);
616 
617  static inline
618  symbol_type
619  make_RWEIGHT (const location_type& l);
620 
621  static inline
622  symbol_type
623  make_LWEIGHT (const location_type& l);
624 
625 
627  parser (driver& driver__yyarg);
628  virtual ~parser ();
629 
632  virtual int parse ();
633 
634 #if YYDEBUG
635  std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
638  void set_debug_stream (std::ostream &);
639 
641  typedef int debug_level_type;
643  debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
645  void set_debug_level (debug_level_type l);
646 #endif
647 
651  virtual void error (const location_type& loc, const std::string& msg);
652 
654  void error (const syntax_error& err);
655 
656  private:
658  parser (const parser&);
659  parser& operator= (const parser&);
660 
662  typedef int state_type;
663 
667  virtual std::string yysyntax_error_ (state_type yystate,
668  const symbol_type& yyla) const;
669 
673  state_type yy_lr_goto_state_ (state_type yystate, int yysym);
674 
677  static bool yy_pact_value_is_default_ (int yyvalue);
678 
681  static bool yy_table_value_is_error_ (int yyvalue);
682 
683  static const signed char yypact_ninf_;
684  static const signed char yytable_ninf_;
685 
687  static token_number_type yytranslate_ (token_type t);
688 
689  // Tables.
690  // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
691  // STATE-NUM.
692  static const short int yypact_[];
693 
694  // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
695  // Performed when YYTABLE does not specify something else to do. Zero
696  // means the default is an error.
697  static const unsigned char yydefact_[];
698 
699  // YYPGOTO[NTERM-NUM].
700  static const signed char yypgoto_[];
701 
702  // YYDEFGOTO[NTERM-NUM].
703  static const signed char yydefgoto_[];
704 
705  // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
706  // positive, shift that token. If negative, reduce the rule whose
707  // number is the opposite. If YYTABLE_NINF, syntax error.
708  static const unsigned char yytable_[];
709 
710  static const signed char yycheck_[];
711 
712  // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
713  // symbol of state STATE-NUM.
714  static const unsigned char yystos_[];
715 
716  // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
717  static const unsigned char yyr1_[];
718 
719  // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
720  static const unsigned char yyr2_[];
721 
722 
724  static std::string yytnamerr_ (const char *n);
725 
726 
728  static const char* const yytname_[];
729 #if YYDEBUG
730  // YYRLINE[YYN] -- Source line where rule number YYN was defined.
731  static const unsigned short int yyrline_[];
733  virtual void yy_reduce_print_ (int r);
735  virtual void yystack_print_ ();
736 
737  // Debugging.
738  int yydebug_;
739  std::ostream* yycdebug_;
740 
744  template <typename Base>
745  void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
746 #endif
747 
752  template <typename Base>
753  void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
754 
755  private:
757  struct by_state
758  {
760  by_state ();
761 
763  typedef state_type kind_type;
764 
766  by_state (kind_type s);
767 
769  by_state (const by_state& other);
770 
772  void clear ();
773 
775  void move (by_state& that);
776 
779  symbol_number_type type_get () const;
780 
782  enum { empty_state = -1 };
783 
786  state_type state;
787  };
788 
790  struct stack_symbol_type : basic_symbol<by_state>
791  {
797  stack_symbol_type (state_type s, symbol_type& sym);
800  };
801 
804 
806  stack_type yystack_;
807 
813  void yypush_ (const char* m, stack_symbol_type& s);
814 
821  void yypush_ (const char* m, state_type s, symbol_type& sym);
822 
824  void yypop_ (unsigned int n = 1);
825 
827  enum
828  {
829  yyeof_ = 0,
830  yylast_ = 227,
831  yynnts_ = 11,
832  yyfinal_ = 5,
833  yyterror_ = 1,
834  yyerrcode_ = 256,
835  yyntokens_ = 33
836  };
837 
838 
839  // User arguments.
841  };
842 
843  // Symbol number corresponding to token number t.
844  inline
846  parser::yytranslate_ (token_type t)
847  {
848  static
849  const token_number_type
850  translate_table[] =
851  {
852  0, 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, 2, 2, 2, 2,
873  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
874  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
875  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
876  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
877  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
878  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
879  15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
880  25, 26, 27, 28, 29, 30, 31, 32
881  };
882  const unsigned int user_token_number_max_ = 287;
883  const token_number_type undef_token_ = 2;
884 
885  if (static_cast<int>(t) <= yyeof_)
886  return yyeof_;
887  else if (static_cast<unsigned int> (t) <= user_token_number_max_)
888  return translate_table[t];
889  else
890  return undef_token_;
891  }
892 
893  inline
894  parser::syntax_error::syntax_error (const location_type& l, const std::string& m)
895  : std::runtime_error (m)
896  , location (l)
897  {}
898 
899  // basic_symbol.
900  template <typename Base>
901  inline
903  : value ()
904  {}
905 
906  template <typename Base>
907  inline
909  : Base (other)
910  , value ()
911  , location (other.location)
912  {
913  switch (other.type_get ())
914  {
915  case 34: // input
916  case 36: // add
917  case 37: // tuple
918  case 41: // exp
919  value.copy< braced_expression > (other.value);
920  break;
921 
922  case 43: // class
923  value.copy< class_t > (other.value);
924  break;
925 
926  case 42: // weights
927  value.copy< dyn::weight > (other.value);
928  break;
929 
930  case 26: // "*"
931  value.copy< irange_type > (other.value);
932  break;
933 
934  case 27: // "letter"
935  case 28: // "weight"
936  value.copy< std::string > (other.value);
937  break;
938 
939  case 39: // tuple.1
940  value.copy< std::vector<vcsn::dyn::expression> > (other.value);
941  break;
942 
943  case 29: // "("
944  value.copy< symbol > (other.value);
945  break;
946 
947  default:
948  break;
949  }
950 
951  }
952 
953 
954  template <typename Base>
955  inline
956  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const semantic_type& v, const location_type& l)
957  : Base (t)
958  , value ()
959  , location (l)
960  {
961  (void) v;
962  switch (this->type_get ())
963  {
964  case 34: // input
965  case 36: // add
966  case 37: // tuple
967  case 41: // exp
968  value.copy< braced_expression > (v);
969  break;
970 
971  case 43: // class
972  value.copy< class_t > (v);
973  break;
974 
975  case 42: // weights
976  value.copy< dyn::weight > (v);
977  break;
978 
979  case 26: // "*"
980  value.copy< irange_type > (v);
981  break;
982 
983  case 27: // "letter"
984  case 28: // "weight"
985  value.copy< std::string > (v);
986  break;
987 
988  case 39: // tuple.1
989  value.copy< std::vector<vcsn::dyn::expression> > (v);
990  break;
991 
992  case 29: // "("
993  value.copy< symbol > (v);
994  break;
995 
996  default:
997  break;
998  }
999 }
1000 
1001 
1002  // Implementation of basic_symbol constructor for each type.
1003 
1004  template <typename Base>
1005  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
1006  : Base (t)
1007  , value ()
1008  , location (l)
1009  {}
1010 
1011  template <typename Base>
1012  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const braced_expression v, const location_type& l)
1013  : Base (t)
1014  , value (v)
1015  , location (l)
1016  {}
1017 
1018  template <typename Base>
1019  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const class_t v, const location_type& l)
1020  : Base (t)
1021  , value (v)
1022  , location (l)
1023  {}
1024 
1025  template <typename Base>
1026  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const dyn::weight v, const location_type& l)
1027  : Base (t)
1028  , value (v)
1029  , location (l)
1030  {}
1031 
1032  template <typename Base>
1033  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const irange_type v, const location_type& l)
1034  : Base (t)
1035  , value (v)
1036  , location (l)
1037  {}
1038 
1039  template <typename Base>
1040  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l)
1041  : Base (t)
1042  , value (v)
1043  , location (l)
1044  {}
1045 
1046  template <typename Base>
1047  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::vector<vcsn::dyn::expression> v, const location_type& l)
1048  : Base (t)
1049  , value (v)
1050  , location (l)
1051  {}
1052 
1053  template <typename Base>
1054  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const symbol v, const location_type& l)
1055  : Base (t)
1056  , value (v)
1057  , location (l)
1058  {}
1059 
1060 
1061  template <typename Base>
1062  inline
1064  {
1065  clear ();
1066  }
1067 
1068  template <typename Base>
1069  inline
1070  void
1072  {
1073  // User destructor.
1074  symbol_number_type yytype = this->type_get ();
1075  basic_symbol<Base>& yysym = *this;
1076  (void) yysym;
1077  switch (yytype)
1078  {
1079  default:
1080  break;
1081  }
1082 
1083  // Type destructor.
1084  switch (yytype)
1085  {
1086  case 34: // input
1087  case 36: // add
1088  case 37: // tuple
1089  case 41: // exp
1090  value.template destroy< braced_expression > ();
1091  break;
1092 
1093  case 43: // class
1094  value.template destroy< class_t > ();
1095  break;
1096 
1097  case 42: // weights
1098  value.template destroy< dyn::weight > ();
1099  break;
1100 
1101  case 26: // "*"
1102  value.template destroy< irange_type > ();
1103  break;
1104 
1105  case 27: // "letter"
1106  case 28: // "weight"
1107  value.template destroy< std::string > ();
1108  break;
1109 
1110  case 39: // tuple.1
1111  value.template destroy< std::vector<vcsn::dyn::expression> > ();
1112  break;
1113 
1114  case 29: // "("
1115  value.template destroy< symbol > ();
1116  break;
1117 
1118  default:
1119  break;
1120  }
1121 
1122  Base::clear ();
1123  }
1124 
1125  template <typename Base>
1126  inline
1127  bool
1129  {
1130  return Base::type_get () == empty_symbol;
1131  }
1132 
1133  template <typename Base>
1134  inline
1135  void
1137  {
1138  super_type::move(s);
1139  switch (this->type_get ())
1140  {
1141  case 34: // input
1142  case 36: // add
1143  case 37: // tuple
1144  case 41: // exp
1145  value.move< braced_expression > (s.value);
1146  break;
1147 
1148  case 43: // class
1149  value.move< class_t > (s.value);
1150  break;
1151 
1152  case 42: // weights
1153  value.move< dyn::weight > (s.value);
1154  break;
1155 
1156  case 26: // "*"
1157  value.move< irange_type > (s.value);
1158  break;
1159 
1160  case 27: // "letter"
1161  case 28: // "weight"
1162  value.move< std::string > (s.value);
1163  break;
1164 
1165  case 39: // tuple.1
1166  value.move< std::vector<vcsn::dyn::expression> > (s.value);
1167  break;
1168 
1169  case 29: // "("
1170  value.move< symbol > (s.value);
1171  break;
1172 
1173  default:
1174  break;
1175  }
1176 
1177  location = s.location;
1178  }
1179 
1180  // by_type.
1181  inline
1182  parser::by_type::by_type ()
1183  : type (empty_symbol)
1184  {}
1185 
1186  inline
1188  : type (other.type)
1189  {}
1190 
1191  inline
1193  : type (yytranslate_ (t))
1194  {}
1195 
1196  inline
1197  void
1199  {
1200  type = empty_symbol;
1201  }
1202 
1203  inline
1204  void
1206  {
1207  type = that.type;
1208  that.clear ();
1209  }
1210 
1211  inline
1212  int
1214  {
1215  return type;
1216  }
1217 
1218  inline
1221  {
1222  // YYTOKNUM[NUM] -- (External) token number corresponding to the
1223  // (internal) symbol number NUM (which must be that of a token). */
1224  static
1225  const unsigned short int
1226  yytoken_number_[] =
1227  {
1228  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1229  265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
1230  275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
1231  285, 286, 287
1232  };
1233  return static_cast<token_type> (yytoken_number_[type]);
1234  }
1235  // Implementation of make_symbol for each symbol type.
1237  parser::make_END (const location_type& l)
1238  {
1239  return symbol_type (token::END, l);
1240  }
1241 
1243  parser::make_AMPERSAND (const location_type& l)
1244  {
1245  return symbol_type (token::AMPERSAND, l);
1246  }
1247 
1249  parser::make_AMPERSAND_COLON (const location_type& l)
1250  {
1251  return symbol_type (token::AMPERSAND_COLON, l);
1252  }
1253 
1255  parser::make_AT (const location_type& l)
1256  {
1257  return symbol_type (token::AT, l);
1258  }
1259 
1261  parser::make_BACKSLASH (const location_type& l)
1262  {
1263  return symbol_type (token::BACKSLASH, l);
1264  }
1265 
1267  parser::make_BANG (const location_type& l)
1268  {
1269  return symbol_type (token::BANG, l);
1270  }
1271 
1273  parser::make_CARET (const location_type& l)
1274  {
1275  return symbol_type (token::CARET, l);
1276  }
1277 
1279  parser::make_COLON (const location_type& l)
1280  {
1281  return symbol_type (token::COLON, l);
1282  }
1283 
1285  parser::make_COMMA (const location_type& l)
1286  {
1287  return symbol_type (token::COMMA, l);
1288  }
1289 
1291  parser::make_COMPLEMENT (const location_type& l)
1292  {
1293  return symbol_type (token::COMPLEMENT, l);
1294  }
1295 
1297  parser::make_DASH (const location_type& l)
1298  {
1299  return symbol_type (token::DASH, l);
1300  }
1301 
1303  parser::make_DOT (const location_type& l)
1304  {
1305  return symbol_type (token::DOT, l);
1306  }
1307 
1309  parser::make_LBRACKET (const location_type& l)
1310  {
1311  return symbol_type (token::LBRACKET, l);
1312  }
1313 
1315  parser::make_LT_PLUS (const location_type& l)
1316  {
1317  return symbol_type (token::LT_PLUS, l);
1318  }
1319 
1321  parser::make_ONE (const location_type& l)
1322  {
1323  return symbol_type (token::ONE, l);
1324  }
1325 
1327  parser::make_PERCENT (const location_type& l)
1328  {
1329  return symbol_type (token::PERCENT, l);
1330  }
1331 
1333  parser::make_PIPE (const location_type& l)
1334  {
1335  return symbol_type (token::PIPE, l);
1336  }
1337 
1339  parser::make_PLUS (const location_type& l)
1340  {
1341  return symbol_type (token::PLUS, l);
1342  }
1343 
1345  parser::make_RBRACKET (const location_type& l)
1346  {
1347  return symbol_type (token::RBRACKET, l);
1348  }
1349 
1351  parser::make_RPAREN (const location_type& l)
1352  {
1353  return symbol_type (token::RPAREN, l);
1354  }
1355 
1357  parser::make_SLASH (const location_type& l)
1358  {
1359  return symbol_type (token::SLASH, l);
1360  }
1361 
1363  parser::make_TRANSPOSITION (const location_type& l)
1364  {
1365  return symbol_type (token::TRANSPOSITION, l);
1366  }
1367 
1369  parser::make_TRANSPOSE (const location_type& l)
1370  {
1371  return symbol_type (token::TRANSPOSE, l);
1372  }
1373 
1375  parser::make_ZERO (const location_type& l)
1376  {
1377  return symbol_type (token::ZERO, l);
1378  }
1379 
1381  parser::make_STAR (const irange_type& v, const location_type& l)
1382  {
1383  return symbol_type (token::STAR, v, l);
1384  }
1385 
1387  parser::make_LETTER (const std::string& v, const location_type& l)
1388  {
1389  return symbol_type (token::LETTER, v, l);
1390  }
1391 
1393  parser::make_WEIGHT (const std::string& v, const location_type& l)
1394  {
1395  return symbol_type (token::WEIGHT, v, l);
1396  }
1397 
1399  parser::make_LPAREN (const symbol& v, const location_type& l)
1400  {
1401  return symbol_type (token::LPAREN, v, l);
1402  }
1403 
1405  parser::make_CONCAT (const location_type& l)
1406  {
1407  return symbol_type (token::CONCAT, l);
1408  }
1409 
1411  parser::make_RWEIGHT (const location_type& l)
1412  {
1413  return symbol_type (token::RWEIGHT, l);
1414  }
1415 
1417  parser::make_LWEIGHT (const location_type& l)
1418  {
1419  return symbol_type (token::LWEIGHT, l);
1420  }
1421 
1422 
1423 #line 11 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy" // lalr1.cc:377
1424 } } // vcsn::rat
1425 #line 1426 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.hh" // lalr1.cc:377
1426 
1427 
1428 // // "%code provides" blocks.
1429 #line 56 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.yy" // lalr1.cc:377
1430 
1431  #define YY_DECL_(Class) \
1432  parser::symbol_type Class lex(driver& driver_)
1433  #define YY_DECL YY_DECL_(yyFlexLexer::)
1434 
1435 #line 1436 "/Users/akim/src/lrde/2/lib/vcsn/rat/parse.hh" // lalr1.cc:377
1436 
1437 
1438 #endif // !YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_RAT_PARSE_HH_INCLUDED
void copy(const self_type &other)
Copy the content of other to this.
Definition: parse.hh:258
token::yytokentype token_type
(External) token type, as returned by yylex.
Definition: parse.hh:387
Base super_type
Alias to Base.
Definition: parse.hh:408
A complete symbol.
Definition: parse.hh:405
driver & driver_
Definition: parse.hh:840
T & as()
Accessor to a built T.
Definition: parse.hh:215
location_type location
The location.
Definition: parse.hh:456
const T * yyas_() const
Const accessor to raw memory as T.
Definition: parse.hh:282
void destroy()
Destroy the stored T.
Definition: parse.hh:260
static symbol_type make_PERCENT(const location_type &l)
Definition: parse.hh:1327
unsigned char token_number_type
Internal symbol number for tokens (subsumed by symbol_number_type).
Definition: parse.hh:396
static symbol_type make_PLUS(const location_type &l)
Definition: parse.hh:1339
static symbol_type make_RBRACKET(const location_type &l)
Definition: parse.hh:1345
static token_number_type yytranslate_(token_type t)
Convert a scanner token number t to a symbol number.
Definition: parse.hh:846
braced_expression & operator=(dyn::expression e)
Definition: parse.hh:70
dyn::expression exp
The expression parsed so far.
Definition: parse.hh:65
Type access provider for state based symbols.
Definition: parse.hh:757
static symbol_type make_END(const location_type &l)
Definition: parse.hh:1237
state_type state
The state.
Definition: parse.hh:786
long double yyalign_me
Strongest alignment constraints.
Definition: parse.hh:291
static symbol_type make_LPAREN(const symbol &v, const location_type &l)
Definition: parse.hh:1399
T & as()
Accessor to a built T.
Definition: parse.hh:209
int state_type
State numbers.
Definition: parse.hh:662
~variant()
Destruction, allowed only if empty.
Definition: parse.hh:187
basic_symbol()
Default constructor.
Definition: parse.hh:902
semantic_type value
The semantic value.
Definition: parse.hh:453
static symbol_type make_COMPLEMENT(const location_type &l)
Definition: parse.hh:1291
static symbol_type make_CONCAT(const location_type &l)
Definition: parse.hh:1405
static symbol_type make_DASH(const location_type &l)
Definition: parse.hh:1297
void move(self_type &other)
Move the content of other to this.
Definition: parse.hh:242
static symbol_type make_AT(const location_type &l)
Definition: parse.hh:1255
token_type kind_type
The symbol type as needed by the constructor.
Definition: parse.hh:473
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
Definition: symbol.hh:21
#define YYASSERT
Definition: parse.hh:95
variant(const T &t)
Construct and fill.
Definition: parse.hh:180
syntax_error(const location_type &l, const std::string &m)
Definition: parse.hh:894
std::ostream * yycdebug_
Definition: parse.hh:739
static symbol_type make_AMPERSAND_COLON(const location_type &l)
Definition: parse.hh:1249
static symbol_type make_DOT(const location_type &l)
Definition: parse.hh:1303
static symbol_type make_PIPE(const location_type &l)
Definition: parse.hh:1333
Abstract a location.
Definition: location.hh:47
static symbol_type make_COLON(const location_type &l)
Definition: parse.hh:1279
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46
static symbol_type make_AMPERSAND(const location_type &l)
Definition: parse.hh:1243
T & build()
Instantiate an empty T in here.
Definition: parse.hh:193
State and public interface for rational expression parsing.
Definition: driver.hh:17
Type access provider for token (enum) based symbols.
Definition: parse.hh:464
variant< sizeof(union_type)> semantic_type
Symbol semantic values.
Definition: parse.hh:333
A dyn Value/ValueSet.
Definition: fwd.hh:29
An auxiliary type to compute the largest semantic type.
Definition: parse.hh:304
A char[S] buffer to store and retrieve objects.
Definition: parse.hh:175
Definition: a-star.hh:8
"Internal" symbol: element of the stack.
Definition: parse.hh:790
#define YY_ATTRIBUTE_PURE
Definition: parse.hh:110
static symbol_type make_SLASH(const location_type &l)
Definition: parse.hh:1357
void clear()
Record that this symbol is empty.
Definition: parse.hh:1198
static symbol_type make_STAR(const irange_type &v, const location_type &l)
Definition: parse.hh:1381
void swap(self_type &other)
Swap the content with other, of same type.
Definition: parse.hh:232
static symbol_type make_CARET(const location_type &l)
Definition: parse.hh:1273
static symbol_type make_RWEIGHT(const location_type &l)
Definition: parse.hh:1411
static symbol_type make_WEIGHT(const std::string &v, const location_type &l)
Definition: parse.hh:1393
static symbol_type make_ZERO(const location_type &l)
Definition: parse.hh:1375
Define the vcsn::rat::stack class.
by_type()
Default constructor.
Definition: parse.hh:1182
static symbol_type make_BANG(const location_type &l)
Definition: parse.hh:1267
static symbol_type make_RPAREN(const location_type &l)
Definition: parse.hh:1351
static symbol_type make_ONE(const location_type &l)
Definition: parse.hh:1321
static const signed char yypact_ninf_
Definition: parse.hh:683
const T & as() const
Const accessor to a built T (for printer).
Definition: parse.hh:217
static symbol_type make_TRANSPOSE(const location_type &l)
Definition: parse.hh:1369
A char[S] buffer to store and retrieve objects.
Definition: parse.hh:169
static symbol_type make_LBRACKET(const location_type &l)
Definition: parse.hh:1309
void swap(config::value &first, config::value &second)
void move(by_type &that)
Steal the symbol type from that.
Definition: parse.hh:1205
T * yyas_()
Accessor to raw memory as T.
Definition: parse.hh:273
return v
Definition: multiply.hh:362
stack< stack_symbol_type > stack_type
Stack type.
Definition: parse.hh:803
basic_symbol< by_state > super_type
Superclass.
Definition: parse.hh:793
static symbol_type make_TRANSPOSITION(const location_type &l)
Definition: parse.hh:1363
static symbol_type make_LETTER(const std::string &v, const location_type &l)
Definition: parse.hh:1387
static symbol_type make_LWEIGHT(const location_type &l)
Definition: parse.hh:1417
value_impl< detail::expression_tag > expression
Definition: fwd.hh:31
static symbol_type make_BACKSLASH(const location_type &l)
Definition: parse.hh:1261
bool lparen
Whether there was a left-paren.
Definition: parse.hh:67
bool rparen
Whether there was a right-paren.
Definition: parse.hh:69
A Bison parser.
Definition: parse.hh:299
int type
The symbol type.
Definition: parse.hh:494
static symbol_type make_COMMA(const location_type &l)
Definition: parse.hh:1285
variant< S > self_type
Type of *this.
Definition: parse.hh:172
basic_symbol< by_type > symbol_type
"External" symbols: returned by the scanner.
Definition: parse.hh:498
An expression that "remembers" whether it was in parentheses.
Definition: parse.hh:62
int symbol_number_type
Symbol type: an internal symbol number.
Definition: parse.hh:390
T & build(const T &t)
Instantiate a T in here from t.
Definition: parse.hh:201
static int debug_level()
Debug level set in the user&#39;s environment.
Definition: debug-level.hh:11
int debug_level_type
Type for debugging levels.
Definition: parse.hh:641
static symbol_type make_LT_PLUS(const location_type &l)
Definition: parse.hh:1315
void destroy()
Destroy the stored T.
Definition: parse.hh:266
STL namespace.
static const signed char yytable_ninf_
Definition: parse.hh:684
token_type token() const
The token.
Definition: parse.hh:1220
value_impl< detail::weight_tag > weight
Definition: fwd.hh:34
state_type kind_type
The symbol type as needed by the constructor.
Definition: parse.hh:763
Syntax errors thrown from user actions.
Definition: parse.hh:341
stack_type yystack_
The stack.
Definition: parse.hh:806
std::set< std::pair< std::string, std::string > > class_t
A set of label ranges.
Definition: fwd.hh:12
std::tuple< int, int > irange_type
An integer range, for quantifiers/exponents.
Definition: parse.hh:78
variant()
Empty construction.
Definition: parse.hh:175
void copy(const self_type &other)
Copy the content of other to this.
Definition: parse.hh:252
symbol_number_type type_get() const
The (internal) type number (corresponding to type).
Definition: parse.hh:1213