Vcsn  2.1
Be Rational
parse.hh
Go to the documentation of this file.
1 // A Bison parser, made by GNU Bison 3.0.4.19-fbaf.
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_DOT_PARSE_HH_INCLUDED
41 # define YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_DOT_PARSE_HH_INCLUDED
42 // // "%code requires" blocks.
43 #line 17 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:377
44 
45  #include <iostream>
46  #include <string>
47 
48  #include <vcsn/misc/symbol.hh>
49  #include <lib/vcsn/rat/location.hh>
50  #include <lib/vcsn/dot/driver.hh>
51 
52  namespace vcsn
53  {
54  namespace detail
55  {
56  namespace dot
57  {
58  // Identifiers (attributes and node names).
59  //
60  // With ref_counting I have a 20% penalty compared to using
61  // std::string. With no_tracking, I get a 10x speed up (e.g.,
62  // vcsn-cat of a determinized ladybird). But then we leak.
63  // We should try to have an arena in which the flyweight
64  // performs its allocation, and flush the whole arena once
65  // we're done parsing.
66  using string_t = symbol;
67 
68  // A set of states.
69  using states_t = std::vector<string_t>;
70 
71  // (Unlabeled) transitions.
72  using transitions_t = std::vector<std::pair<string_t, string_t>>;
73 
74  // A set of paths.
75  struct paths_t
76  {
78  // The current ends of paths. Not the same as the
79  // destinations of all the transitions, e.g., in the case of
80  // "0 -> 1 -> 2", transitions = { 0 -> 1, 1 -> 2 }, ends = {
81  // 2 }.
83  };
84  }
85  }
86  }
87 
88 #line 89 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.hh" // lalr1.cc:377
89 
90 
91 # include <cstdlib> // std::abort
92 # include <iostream>
93 # include <stdexcept>
94 # include <string>
95 # include <vector>
96 # include "stack.hh"
97 
98 
99 #ifndef YYASSERT
100 # include <cassert>
101 # define YYASSERT assert
102 #endif
103 
104 
105 #ifndef YY_ATTRIBUTE
106 # if (defined __GNUC__ \
107  && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
108  || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
109 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
110 # else
111 # define YY_ATTRIBUTE(Spec) /* empty */
112 # endif
113 #endif
114 
115 #ifndef YY_ATTRIBUTE_PURE
116 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
117 #endif
118 
119 #ifndef YY_ATTRIBUTE_UNUSED
120 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
121 #endif
122 
123 #if !defined _Noreturn \
124  && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
125 # if defined _MSC_VER && 1200 <= _MSC_VER
126 # define _Noreturn __declspec (noreturn)
127 # else
128 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
129 # endif
130 #endif
131 
132 /* Suppress unused-variable warnings by "using" E. */
133 #if ! defined lint || defined __GNUC__
134 # define YYUSE(E) ((void) (E))
135 #else
136 # define YYUSE(E) /* empty */
137 #endif
138 
139 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
140 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
141 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
142  _Pragma ("GCC diagnostic push") \
143  _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
144  _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
145 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
146  _Pragma ("GCC diagnostic pop")
147 #else
148 # define YY_INITIAL_VALUE(Value) Value
149 #endif
150 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
151 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
152 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
153 #endif
154 #ifndef YY_INITIAL_VALUE
155 # define YY_INITIAL_VALUE(Value) /* Nothing. */
156 #endif
157 
158 /* Debug traces. */
159 #ifndef YYDEBUG
160 # define YYDEBUG 1
161 #endif
162 
163 #line 11 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:377
164 namespace vcsn { namespace detail { namespace dot {
165 #line 166 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.hh" // lalr1.cc:377
166 
167 
168 
174  template <size_t S>
175  struct variant
176  {
179 
182  {}
183 
185  template <typename T>
186  variant (const T& t)
187  {
188  YYASSERT (sizeof (T) <= S);
189  new (yyas_<T> ()) T (t);
190  }
191 
194  {}
195 
197  template <typename T>
198  T&
199  build ()
200  {
201  return *new (yyas_<T> ()) T;
202  }
203 
205  template <typename T>
206  T&
207  build (const T& t)
208  {
209  return *new (yyas_<T> ()) T (t);
210  }
211 
213  template <typename T>
214  T&
215  as ()
216  {
217  return *yyas_<T> ();
218  }
219 
221  template <typename T>
222  const T&
223  as () const
224  {
225  return *yyas_<T> ();
226  }
227 
236  template <typename T>
237  void
238  swap (self_type& other)
239  {
240  std::swap (as<T> (), other.as<T> ());
241  }
242 
246  template <typename T>
247  void
248  move (self_type& other)
249  {
250  build<T> ();
251  swap<T> (other);
252  other.destroy<T> ();
253  }
254 
256  template <typename T>
257  void
258  copy (const self_type& other)
259  {
260  build<T> (other.as<T> ());
261  }
262 
264  template <typename T>
265  void
267  {
268  as<T> ().~T ();
269  }
270 
271  private:
273  self_type& operator=(const self_type&);
274  variant (const self_type&);
275 
277  template <typename T>
278  T*
279  yyas_ ()
280  {
281  void *yyp = yybuffer_.yyraw;
282  return static_cast<T*> (yyp);
283  }
284 
286  template <typename T>
287  const T*
288  yyas_ () const
289  {
290  const void *yyp = yybuffer_.yyraw;
291  return static_cast<const T*> (yyp);
292  }
293 
294  union
295  {
297  long double yyalign_me;
299  char yyraw[S];
300  } yybuffer_;
301  };
302 
303 
305  class parser
306  {
307  public:
308 #ifndef YYSTYPE
309  union union_type
311  {
312  // path
313  char dummy1[sizeof(paths_t)];
314 
315  // stmt_list
316  // stmt
317  // nodes
318  // edge_stmt
319  // subgraph
320  char dummy2[sizeof(states_t)];
321 
322  // ID
323  // attr_list
324  // attr_list.opt
325  // attr_assign
326  // a_list.1
327  // a_list.0
328  // node_stmt
329  // node_id
330  // id.opt
331  char dummy3[sizeof(string_t)];
332 };
333 
336 #else
337  typedef YYSTYPE semantic_type;
338 #endif
341 
343  struct syntax_error : std::runtime_error
344  {
345  syntax_error (const location_type& l, const std::string& m);
346  location_type location;
347  };
348 
350  struct token
351  {
353  {
354  END = 0,
355  DIGRAPH = 258,
356  EDGE = 259,
357  GRAPH = 260,
358  NODE = 261,
359  LBRACE = 262,
360  RBRACE = 263,
361  LBRACKET = 264,
362  RBRACKET = 265,
363  EQ = 266,
364  ARROW = 267,
365  COLON = 268,
366  COMMA = 269,
367  SEMI = 270,
368  ID = 271
369  };
370  };
371 
374 
376  typedef int symbol_number_type;
377 
379  enum { empty_symbol = -2 };
380 
382  typedef unsigned char token_number_type;
383 
390  template <typename Base>
392  {
394  typedef Base super_type;
395 
397  basic_symbol ();
398 
400  basic_symbol (const basic_symbol& other);
401 
403 
404  basic_symbol (typename Base::kind_type t, const location_type& l);
405 
406  basic_symbol (typename Base::kind_type t, const paths_t v, const location_type& l);
407 
408  basic_symbol (typename Base::kind_type t, const states_t v, const location_type& l);
409 
410  basic_symbol (typename Base::kind_type t, const string_t v, const location_type& l);
411 
412 
414  basic_symbol (typename Base::kind_type t,
415  const semantic_type& v,
416  const location_type& l);
417 
419  ~basic_symbol ();
420 
422  void clear ();
423 
425  bool empty () const;
426 
428  void move (basic_symbol& s);
429 
431  semantic_type value;
432 
434  location_type location;
435 
436  private:
438  basic_symbol& operator= (const basic_symbol& other);
439  };
440 
442  struct by_type
443  {
445  by_type ();
446 
448  by_type (const by_type& other);
449 
451  typedef token_type kind_type;
452 
454  by_type (kind_type t);
455 
457  void clear ();
458 
460  void move (by_type& that);
461 
464  symbol_number_type type_get () const;
465 
467  token_type token () const;
468 
472  int type;
473  };
474 
477 
478  // Symbol constructors declarations.
479  static inline
480  symbol_type
481  make_END (const location_type& l);
482 
483  static inline
484  symbol_type
485  make_DIGRAPH (const location_type& l);
486 
487  static inline
488  symbol_type
489  make_EDGE (const location_type& l);
490 
491  static inline
492  symbol_type
493  make_GRAPH (const location_type& l);
494 
495  static inline
496  symbol_type
497  make_NODE (const location_type& l);
498 
499  static inline
500  symbol_type
501  make_LBRACE (const location_type& l);
502 
503  static inline
504  symbol_type
505  make_RBRACE (const location_type& l);
506 
507  static inline
508  symbol_type
509  make_LBRACKET (const location_type& l);
510 
511  static inline
512  symbol_type
513  make_RBRACKET (const location_type& l);
514 
515  static inline
516  symbol_type
517  make_EQ (const location_type& l);
518 
519  static inline
520  symbol_type
521  make_ARROW (const location_type& l);
522 
523  static inline
524  symbol_type
525  make_COLON (const location_type& l);
526 
527  static inline
528  symbol_type
529  make_COMMA (const location_type& l);
530 
531  static inline
532  symbol_type
533  make_SEMI (const location_type& l);
534 
535  static inline
536  symbol_type
537  make_ID (const string_t& v, const location_type& l);
538 
539 
541  parser (driver& driver__yyarg);
542  virtual ~parser ();
543 
546  virtual int parse ();
547 
548 #if YYDEBUG
549  std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
552  void set_debug_stream (std::ostream &);
553 
555  typedef int debug_level_type;
557  debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
559  void set_debug_level (debug_level_type l);
560 #endif
561 
565  virtual void error (const location_type& loc, const std::string& msg);
566 
568  void error (const syntax_error& err);
569 
570  private:
572  parser (const parser&);
573  parser& operator= (const parser&);
574 
576  typedef int state_type;
577 
581  virtual std::string yysyntax_error_ (state_type yystate,
582  const symbol_type& yyla) const;
583 
587  state_type yy_lr_goto_state_ (state_type yystate, int yysym);
588 
591  static bool yy_pact_value_is_default_ (int yyvalue);
592 
595  static bool yy_table_value_is_error_ (int yyvalue);
596 
597  static const signed char yypact_ninf_;
598  static const signed char yytable_ninf_;
599 
601  static token_number_type yytranslate_ (token_type t);
602 
603  // Tables.
604  // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
605  // STATE-NUM.
606  static const signed char yypact_[];
607 
608  // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
609  // Performed when YYTABLE does not specify something else to do. Zero
610  // means the default is an error.
611  static const unsigned char yydefact_[];
612 
613  // YYPGOTO[NTERM-NUM].
614  static const signed char yypgoto_[];
615 
616  // YYDEFGOTO[NTERM-NUM].
617  static const signed char yydefgoto_[];
618 
619  // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
620  // positive, shift that token. If negative, reduce the rule whose
621  // number is the opposite. If YYTABLE_NINF, syntax error.
622  static const signed char yytable_[];
623 
624  static const signed char yycheck_[];
625 
626  // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
627  // symbol of state STATE-NUM.
628  static const unsigned char yystos_[];
629 
630  // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
631  static const unsigned char yyr1_[];
632 
633  // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
634  static const unsigned char yyr2_[];
635 
636 
638  static std::string yytnamerr_ (const char *n);
639 
640 
642  static const char* const yytname_[];
643 #if YYDEBUG
644  // YYRLINE[YYN] -- Source line where rule number YYN was defined.
645  static const unsigned short int yyrline_[];
647  virtual void yy_reduce_print_ (int r);
649  virtual void yystack_print_ ();
650 
651  // Debugging.
652  int yydebug_;
653  std::ostream* yycdebug_;
654 
658  template <typename Base>
659  void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
660 #endif
661 
666  template <typename Base>
667  void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
668 
669  private:
671  struct by_state
672  {
674  by_state ();
675 
677  typedef state_type kind_type;
678 
680  by_state (kind_type s);
681 
683  by_state (const by_state& other);
684 
686  void clear ();
687 
689  void move (by_state& that);
690 
693  symbol_number_type type_get () const;
694 
696  enum { empty_state = -1 };
697 
700  state_type state;
701  };
702 
704  struct stack_symbol_type : basic_symbol<by_state>
705  {
711  stack_symbol_type (state_type s, symbol_type& sym);
714  };
715 
718 
720  stack_type yystack_;
721 
727  void yypush_ (const char* m, stack_symbol_type& s);
728 
735  void yypush_ (const char* m, state_type s, symbol_type& sym);
736 
738  void yypop_ (unsigned int n = 1);
739 
741  enum
742  {
743  yyeof_ = 0,
744  yylast_ = 68,
745  yynnts_ = 20,
746  yyfinal_ = 5,
748  yyerrcode_ = 256,
750  };
751 
752 
753  // User arguments.
755  };
756 
757  // Symbol number corresponding to token number t.
758  inline
760  parser::yytranslate_ (token_type t)
761  {
762  static
763  const token_number_type
764  translate_table[] =
765  {
766  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
767  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
768  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
769  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
770  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
771  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
772  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
773  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
774  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
775  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
776  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
777  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
778  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
779  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
780  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
781  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
782  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
783  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
784  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
785  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
786  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
787  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
788  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
789  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
790  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
791  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
792  5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
793  15, 16, 17
794  };
795  const unsigned int user_token_number_max_ = 272;
796  const token_number_type undef_token_ = 2;
797 
798  if (static_cast<int>(t) <= yyeof_)
799  return yyeof_;
800  else if (static_cast<unsigned int> (t) <= user_token_number_max_)
801  return translate_table[t];
802  else
803  return undef_token_;
804  }
805 
806  inline
807  parser::syntax_error::syntax_error (const location_type& l, const std::string& m)
808  : std::runtime_error (m)
809  , location (l)
810  {}
811 
812  // basic_symbol.
813  template <typename Base>
814  inline
816  : value ()
817  {}
818 
819  template <typename Base>
820  inline
822  : Base (other)
823  , value ()
824  , location (other.location)
825  {
826  switch (other.type_get ())
827  {
828  case 31: // path
829  value.copy< paths_t > (other.value);
830  break;
831 
832  case 20: // stmt_list
833  case 21: // stmt
834  case 30: // nodes
835  case 32: // edge_stmt
836  case 36: // subgraph
837  value.copy< states_t > (other.value);
838  break;
839 
840  case 16: // ID
841  case 23: // attr_list
842  case 24: // attr_list.opt
843  case 25: // attr_assign
844  case 26: // a_list.1
845  case 29: // a_list.0
846  case 33: // node_stmt
847  case 34: // node_id
848  case 37: // id.opt
849  value.copy< string_t > (other.value);
850  break;
851 
852  default:
853  break;
854  }
855 
856  }
857 
858 
859  template <typename Base>
860  inline
861  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const semantic_type& v, const location_type& l)
862  : Base (t)
863  , value ()
864  , location (l)
865  {
866  (void) v;
867  switch (this->type_get ())
868  {
869  case 31: // path
870  value.copy< paths_t > (v);
871  break;
872 
873  case 20: // stmt_list
874  case 21: // stmt
875  case 30: // nodes
876  case 32: // edge_stmt
877  case 36: // subgraph
878  value.copy< states_t > (v);
879  break;
880 
881  case 16: // ID
882  case 23: // attr_list
883  case 24: // attr_list.opt
884  case 25: // attr_assign
885  case 26: // a_list.1
886  case 29: // a_list.0
887  case 33: // node_stmt
888  case 34: // node_id
889  case 37: // id.opt
890  value.copy< string_t > (v);
891  break;
892 
893  default:
894  break;
895  }
896 }
897 
898 
899  // Implementation of basic_symbol constructor for each type.
900 
901  template <typename Base>
902  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
903  : Base (t)
904  , value ()
905  , location (l)
906  {}
907 
908  template <typename Base>
909  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const paths_t v, const location_type& l)
910  : Base (t)
911  , value (v)
912  , location (l)
913  {}
914 
915  template <typename Base>
916  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const states_t v, const location_type& l)
917  : Base (t)
918  , value (v)
919  , location (l)
920  {}
921 
922  template <typename Base>
923  parser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const string_t v, const location_type& l)
924  : Base (t)
925  , value (v)
926  , location (l)
927  {}
928 
929 
930  template <typename Base>
931  inline
933  {
934  clear ();
935  }
936 
937  template <typename Base>
938  inline
939  void
941  {
942  // User destructor.
943  symbol_number_type yytype = this->type_get ();
944  basic_symbol<Base>& yysym = *this;
945  (void) yysym;
946  switch (yytype)
947  {
948  default:
949  break;
950  }
951 
952  // Type destructor.
953  switch (yytype)
954  {
955  case 31: // path
956  value.template destroy< paths_t > ();
957  break;
958 
959  case 20: // stmt_list
960  case 21: // stmt
961  case 30: // nodes
962  case 32: // edge_stmt
963  case 36: // subgraph
964  value.template destroy< states_t > ();
965  break;
966 
967  case 16: // ID
968  case 23: // attr_list
969  case 24: // attr_list.opt
970  case 25: // attr_assign
971  case 26: // a_list.1
972  case 29: // a_list.0
973  case 33: // node_stmt
974  case 34: // node_id
975  case 37: // id.opt
976  value.template destroy< string_t > ();
977  break;
978 
979  default:
980  break;
981  }
982 
983  Base::clear ();
984  }
985 
986  template <typename Base>
987  inline
988  bool
990  {
991  return Base::type_get () == empty_symbol;
992  }
993 
994  template <typename Base>
995  inline
996  void
998  {
999  super_type::move(s);
1000  switch (this->type_get ())
1001  {
1002  case 31: // path
1003  value.move< paths_t > (s.value);
1004  break;
1005 
1006  case 20: // stmt_list
1007  case 21: // stmt
1008  case 30: // nodes
1009  case 32: // edge_stmt
1010  case 36: // subgraph
1011  value.move< states_t > (s.value);
1012  break;
1013 
1014  case 16: // ID
1015  case 23: // attr_list
1016  case 24: // attr_list.opt
1017  case 25: // attr_assign
1018  case 26: // a_list.1
1019  case 29: // a_list.0
1020  case 33: // node_stmt
1021  case 34: // node_id
1022  case 37: // id.opt
1023  value.move< string_t > (s.value);
1024  break;
1025 
1026  default:
1027  break;
1028  }
1029 
1030  location = s.location;
1031  }
1032 
1033  // by_type.
1034  inline
1036  : type (empty_symbol)
1037  {}
1038 
1039  inline
1041  : type (other.type)
1042  {}
1043 
1044  inline
1046  : type (yytranslate_ (t))
1047  {}
1048 
1049  inline
1050  void
1052  {
1053  type = empty_symbol;
1054  }
1055 
1056  inline
1057  void
1059  {
1060  type = that.type;
1061  that.clear ();
1062  }
1063 
1064  inline
1065  int
1067  {
1068  return type;
1069  }
1070 
1071  inline
1074  {
1075  // YYTOKNUM[NUM] -- (External) token number corresponding to the
1076  // (internal) symbol number NUM (which must be that of a token). */
1077  static
1078  const unsigned short int
1079  yytoken_number_[] =
1080  {
1081  0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
1082  265, 266, 267, 268, 269, 270, 271, 272
1083  };
1084  return static_cast<token_type> (yytoken_number_[type]);
1085  }
1086  // Implementation of make_symbol for each symbol type.
1088  parser::make_END (const location_type& l)
1089  {
1090  return symbol_type (token::END, l);
1091  }
1092 
1094  parser::make_DIGRAPH (const location_type& l)
1095  {
1096  return symbol_type (token::DIGRAPH, l);
1097  }
1098 
1100  parser::make_EDGE (const location_type& l)
1101  {
1102  return symbol_type (token::EDGE, l);
1103  }
1104 
1106  parser::make_GRAPH (const location_type& l)
1107  {
1108  return symbol_type (token::GRAPH, l);
1109  }
1110 
1112  parser::make_NODE (const location_type& l)
1113  {
1114  return symbol_type (token::NODE, l);
1115  }
1116 
1118  parser::make_LBRACE (const location_type& l)
1119  {
1120  return symbol_type (token::LBRACE, l);
1121  }
1122 
1124  parser::make_RBRACE (const location_type& l)
1125  {
1126  return symbol_type (token::RBRACE, l);
1127  }
1128 
1130  parser::make_LBRACKET (const location_type& l)
1131  {
1132  return symbol_type (token::LBRACKET, l);
1133  }
1134 
1136  parser::make_RBRACKET (const location_type& l)
1137  {
1138  return symbol_type (token::RBRACKET, l);
1139  }
1140 
1142  parser::make_EQ (const location_type& l)
1143  {
1144  return symbol_type (token::EQ, l);
1145  }
1146 
1148  parser::make_ARROW (const location_type& l)
1149  {
1150  return symbol_type (token::ARROW, l);
1151  }
1152 
1154  parser::make_COLON (const location_type& l)
1155  {
1156  return symbol_type (token::COLON, l);
1157  }
1158 
1160  parser::make_COMMA (const location_type& l)
1161  {
1162  return symbol_type (token::COMMA, l);
1163  }
1164 
1166  parser::make_SEMI (const location_type& l)
1167  {
1168  return symbol_type (token::SEMI, l);
1169  }
1170 
1172  parser::make_ID (const string_t& v, const location_type& l)
1173  {
1174  return symbol_type (token::ID, v, l);
1175  }
1176 
1177 
1178 #line 11 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:377
1179 } } } // vcsn::detail::dot
1180 #line 1181 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.hh" // lalr1.cc:377
1181 
1182 
1183 // // "%code provides" blocks.
1184 #line 63 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:377
1185 
1186  #define YY_DECL_(Class) \
1187  parser::symbol_type Class lex(driver& driver_)
1188  #define YY_DECL YY_DECL_(yyFlexLexer::)
1189 
1190 #line 1191 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.hh" // lalr1.cc:377
1191 
1192 
1193 #endif // !YY_YY_USERS_AKIM_SRC_LRDE_2_LIB_VCSN_DOT_PARSE_HH_INCLUDED
static const unsigned short int yyrline_[]
Definition: parse.hh:645
STL namespace.
static symbol_type make_LBRACE(const location_type &l)
Definition: parse.hh:1118
char dummy1[sizeof(paths_t)]
Definition: parse.hh:313
stack< stack_symbol_type > stack_type
Stack type.
Definition: parse.hh:717
union vcsn::detail::dot::variant::@1 yybuffer_
static symbol_type make_COMMA(const location_type &l)
Definition: parse.hh:1160
char dummy2[sizeof(states_t)]
Definition: parse.hh:320
static const unsigned char yyr2_[]
Definition: parse.hh:634
void yypush_(const char *m, stack_symbol_type &s)
Push a new state on the stack.
Definition: parse.cc:544
static symbol_type make_ID(const string_t &v, const location_type &l)
Definition: parse.hh:1172
std::ostream & debug_stream() const
The current debugging stream.
Definition: parse.cc:560
int type
The symbol type.
Definition: parse.hh:472
void move(self_type &other)
Move the content of other to this.
Definition: parse.hh:248
static symbol_type make_LBRACKET(const location_type &l)
Definition: parse.hh:1130
void set_debug_stream(std::ostream &)
Set the current debugging stream.
Definition: parse.cc:566
void move(basic_symbol &s)
Destructive move, s is emptied into this.
Definition: parse.hh:997
stack_type yystack_
The stack.
Definition: parse.hh:720
T & build()
Instantiate an empty T in here.
Definition: parse.hh:199
Abstract a location.
Definition: location.hh:47
Base super_type
Alias to Base.
Definition: parse.hh:394
debug_level_type debug_level() const
The current debugging level.
Definition: parse.cc:573
Termination state number.
Definition: parse.hh:746
Type access provider for token (enum) based symbols.
Definition: parse.hh:442
static const signed char yydefgoto_[]
Definition: parse.hh:617
virtual void yy_reduce_print_(int r)
Report on the debug stream that the rule r is going to be reduced.
Definition: parse.cc:1404
stack_symbol_type()
Construct an empty symbol.
Definition: parse.cc:312
T * yyas_()
Accessor to raw memory as T.
Definition: parse.hh:279
by_type()
Default constructor.
Definition: parse.hh:1035
std::string type(const automaton &a)
The implementation type of a.
Definition: others.cc:197
std::vector< string_t > states_t
Definition: parse.hh:69
void set_debug_level(debug_level_type l)
Set the current debugging level.
Definition: parse.cc:579
static const signed char yycheck_[]
Definition: parse.hh:624
void swap(self_type &other)
Swap the content with other, of same type.
Definition: parse.hh:238
symbol_number_type type_get() const
The (internal) type number (corresponding to type).
Definition: parse.hh:1066
void yypop_(unsigned int n=1)
Pop n symbols the three stacks.
Definition: parse.cc:553
void move(by_state &that)
Steal the symbol type from that.
Definition: parse.cc:290
static const signed char yypact_ninf_
Definition: parse.hh:597
parser(driver &driver__yyarg)
Build a parser object.
Definition: parse.cc:251
void yy_print_(std::ostream &yyo, const basic_symbol< Base > &yysym) const
Display a symbol type, value and location.
Definition: parse.cc:406
Number of nonterminal symbols.
Definition: parse.hh:745
self_type & operator=(const self_type &)
Prohibit blind copies.
Syntax errors thrown from user actions.
Definition: parse.hh:343
int symbol_number_type
Symbol type: an internal symbol number.
Definition: parse.hh:376
parser & operator=(const parser &)
void destroy()
Destroy the stored T.
Definition: parse.hh:266
#define YY_ATTRIBUTE_PURE
Definition: parse.hh:116
unsigned char token_number_type
Internal symbol number for tokens (subsumed by symbol_number_type).
Definition: parse.hh:382
static symbol_type make_RBRACKET(const location_type &l)
Definition: parse.hh:1136
void clear()
Destroy contents, and record that is empty.
Definition: parse.hh:940
bool empty() const
Whether empty.
Definition: parse.hh:989
virtual std::string yysyntax_error_(state_type yystate, const symbol_type &yyla) const
Generate an error message.
Definition: parse.cc:1172
by_state()
Default constructor.
Definition: parse.cc:272
T & as()
Accessor to a built T.
Definition: parse.hh:215
"Internal" symbol: element of the stack.
Definition: parse.hh:704
virtual void yystack_print_()
Print the state stack on the debug stream.
Definition: parse.cc:1391
const T & as() const
Const accessor to a built T (for printer).
Definition: parse.hh:223
void move(by_type &that)
Steal the symbol type from that.
Definition: parse.hh:1058
std::vector< std::pair< string_t, string_t >> transitions_t
Definition: parse.hh:72
static token_number_type yytranslate_(token_type t)
Convert a scanner token number t to a symbol number.
Definition: parse.hh:760
static symbol_type make_DIGRAPH(const location_type &l)
Definition: parse.hh:1094
state_type kind_type
The symbol type as needed by the constructor.
Definition: parse.hh:677
transitions_t transitions
Definition: parse.hh:77
virtual int parse()
Parse.
Definition: parse.cc:608
token_type token() const
The token.
Definition: parse.hh:1073
Provide a variadic mul on top of a binary mul(), and one().
Definition: fwd.hh:46
static symbol_type make_EDGE(const location_type &l)
Definition: parse.hh:1100
static const signed char yytable_ninf_
Definition: parse.hh:598
Last index in yytable_.
Definition: parse.hh:744
static bool yy_pact_value_is_default_(int yyvalue)
Whether the given yypact_ value indicates a defaulted state.
Definition: parse.cc:596
void clear()
Record that this symbol is empty.
Definition: parse.cc:283
static const signed char yypact_[]
Definition: parse.hh:606
void clear()
Record that this symbol is empty.
Definition: parse.hh:1051
static symbol_type make_SEMI(const location_type &l)
Definition: parse.hh:1166
static symbol_type make_NODE(const location_type &l)
Definition: parse.hh:1112
static symbol_type make_ARROW(const location_type &l)
Definition: parse.hh:1148
static const unsigned char yyr1_[]
Definition: parse.hh:631
token::yytokentype token_type
(External) token type, as returned by yylex.
Definition: parse.hh:373
symbol string_t
Definition: parse.hh:66
static symbol_type make_COLON(const location_type &l)
Definition: parse.hh:1154
A char[S] buffer to store and retrieve objects.
Definition: parse.hh:175
vcsn::rat::location location_type
Symbol locations.
Definition: parse.hh:340
A complete symbol.
Definition: parse.hh:399
int debug_level_type
Type for debugging levels.
Definition: parse.hh:555
static const signed char yytable_[]
Definition: parse.hh:622
void yy_destroy_(const char *yymsg, basic_symbol< Base > &yysym) const
Reclaim the memory associated to a symbol.
Definition: parse.cc:397
void copy(const self_type &other)
Copy the content of other to this.
Definition: parse.hh:258
static bool yy_table_value_is_error_(int yyvalue)
Whether the given yytable_ value indicates a syntax error.
Definition: parse.cc:602
boost::flyweight< std::string, boost::flyweights::no_tracking, boost::flyweights::intermodule_holder > symbol
An internalized string.
Definition: symbol.hh:23
syntax_error(const location_type &l, const std::string &m)
Definition: parse.hh:807
#define YYASSERT
Definition: parse.hh:101
variant< S > self_type
Type of *this.
Definition: parse.hh:178
static std::string yytnamerr_(const char *n)
Convert the symbol name n to a form suitable for a diagnostic.
Definition: parse.cc:218
token_type kind_type
The symbol type as needed by the constructor.
Definition: parse.hh:451
static const signed char yypgoto_[]
Definition: parse.hh:614
char dummy3[sizeof(string_t)]
Definition: parse.hh:331
State and public interface for Dot parsing.
Definition: driver.hh:20
state_type state
The state.
Definition: parse.hh:700
basic_symbol< by_type > symbol_type
"External" symbols: returned by the scanner.
Definition: parse.hh:476
location_type location
The location.
Definition: parse.hh:434
T & build(const T &t)
Instantiate a T in here from t.
Definition: parse.hh:207
static const char *const yytname_[]
For a symbol, its name in clear.
Definition: parse.hh:642
stack_symbol_type & operator=(const stack_symbol_type &that)
Assignment, needed by push_back.
Definition: parse.cc:356
Define the vcsn::detail::dot::stack class.
static const unsigned char yystos_[]
Definition: parse.hh:628
std::ostream & dot(const Aut &aut, std::ostream &out, bool dot2tex=false)
Definition: dot.hh:371
~variant()
Destruction, allowed only if empty.
Definition: parse.hh:193
char yyraw[S]
A buffer large enough to store any of the semantic values.
Definition: parse.hh:299
virtual void error(const location_type &loc, const std::string &msg)
Report a syntax error.
Definition: parse.cc:1432
static symbol_type make_GRAPH(const location_type &l)
Definition: parse.hh:1106
basic_symbol< by_state > super_type
Superclass.
Definition: parse.hh:707
const T * yyas_() const
Const accessor to raw memory as T.
Definition: parse.hh:288
basic_symbol & operator=(const basic_symbol &other)
Assignment operator.
A Bison parser.
Definition: parse.hh:305
long double yyalign_me
Strongest alignment constraints.
Definition: parse.hh:297
static symbol_type make_RBRACE(const location_type &l)
Definition: parse.hh:1124
variant(const T &t)
Construct and fill.
Definition: parse.hh:186
Type access provider for state based symbols.
Definition: parse.hh:671
state_type yy_lr_goto_state_(state_type yystate, int yysym)
Compute post-reduction state.
Definition: parse.cc:586
An auxiliary type to compute the largest semantic type.
Definition: parse.hh:310
static const unsigned char yydefact_[]
Definition: parse.hh:611
std::ostream * yycdebug_
Definition: parse.hh:653
static symbol_type make_END(const location_type &l)
Definition: parse.hh:1088
basic_symbol()
Default constructor.
Definition: parse.hh:815
~basic_symbol()
Destroy the symbol.
Definition: parse.hh:932
semantic_type value
The semantic value.
Definition: parse.hh:431
int state_type
State numbers.
Definition: parse.hh:576
variant< sizeof(union_type)> semantic_type
Symbol semantic values.
Definition: parse.hh:335
variant()
Empty construction.
Definition: parse.hh:181
symbol_number_type type_get() const
The (internal) type number (corresponding to state).
Definition: parse.cc:303
Define the vcsn::rat::location class.
static symbol_type make_EQ(const location_type &l)
Definition: parse.hh:1142