Vcsn  2.3
Be Rational
parse.cc
Go to the documentation of this file.
1 // A Bison parser, made by GNU Bison 3.0.4.19-fbaf-dirty.
2 
3 // Skeleton implementation 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 // // "%code top" blocks.
33 #line 128 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:397
34 
36 #define TRY(Loc, Stm) \
37  do { \
38  try \
39  { \
40  Stm; \
41  } \
42  catch (std::exception& e) \
43  { \
44  error(Loc, e.what()); \
45  YYERROR; \
46  } \
47  } while (false)
48 
49 #line 50 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:397
50 
51 
52 // First part of user declarations.
53 
54 #line 55 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:404
55 
56 # ifndef YY_NULLPTR
57 # if defined __cplusplus && 201103L <= __cplusplus
58 # define YY_NULLPTR nullptr
59 # else
60 # define YY_NULLPTR 0
61 # endif
62 # endif
63 
64 #include "parse.hh"
65 
66 // User implementation prologue.
67 
68 #line 69 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:412
69 // Unqualified %code blocks.
70 #line 71 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:413
71 
72  #include <cassert>
74  #include <lib/vcsn/dot/scan.hh>
75 
76  namespace vcsn
77  {
78  namespace detail
79  {
80  namespace dot
81  {
82  static std::ostream&
83  operator<<(std::ostream& o, const states_t ss)
84  {
85  bool first = true;
86  o << '{';
87  for (auto s: ss)
88  {
89  if (!first)
90  o << ", ";
91  o << s;
92  first = false;
93  }
94  return o << '}';
95  }
96 
97  static std::ostream&
98  operator<<(std::ostream& o, const paths_t ps)
99  {
100  bool first = true;
101  o << '{';
102  for (auto t: ps.transitions)
103  {
104  if (!first)
105  o << ", ";
106  o << t.first << "->" << t.second;
107  first = false;
108  }
109  return o << '}';
110  }
111 
113  static
114  inline
116  yylex(driver& driver_)
117  {
118  return driver_.scanner_->lex(driver_);
119  }
120  }
121  }
122  }
123 
124 #line 125 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:413
125 
126 
127 #ifndef YY_
128 # if defined YYENABLE_NLS && YYENABLE_NLS
129 # if ENABLE_NLS
130 # include <libintl.h> // FIXME: INFRINGES ON USER NAME SPACE.
131 # define YY_(msgid) dgettext ("bison-runtime", msgid)
132 # endif
133 # endif
134 # ifndef YY_
135 # define YY_(msgid) msgid
136 # endif
137 #endif
138 
139 #define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
140 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
141  If N is 0, then set CURRENT to the empty location which ends
142  the previous symbol: RHS[0] (always defined). */
143 
144 # ifndef YYLLOC_DEFAULT
145 # define YYLLOC_DEFAULT(Current, Rhs, N) \
146  do \
147  if (N) \
148  { \
149  (Current).begin = YYRHSLOC (Rhs, 1).begin; \
150  (Current).end = YYRHSLOC (Rhs, N).end; \
151  } \
152  else \
153  { \
154  (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
155  } \
156  while (/*CONSTCOND*/ false)
157 # endif
158 
159 
160 // Suppress unused-variable warnings by "using" E.
161 #define YYUSE(E) ((void) (E))
162 
163 // Enable debugging if requested.
164 #if YYDEBUG
165 
166 // A pseudo ostream that takes yydebug_ into account.
167 # define YYCDEBUG if (yydebug_) (*yycdebug_)
168 
169 # define YY_SYMBOL_PRINT(Title, Symbol) \
170  do { \
171  if (yydebug_) \
172  { \
173  *yycdebug_ << Title << ' '; \
174  yy_print_ (*yycdebug_, Symbol); \
175  *yycdebug_ << std::endl; \
176  } \
177  } while (false)
178 
179 # define YY_REDUCE_PRINT(Rule) \
180  do { \
181  if (yydebug_) \
182  yy_reduce_print_ (Rule); \
183  } while (false)
184 
185 # define YY_STACK_PRINT() \
186  do { \
187  if (yydebug_) \
188  yystack_print_ (); \
189  } while (false)
190 
191 #else // !YYDEBUG
192 
193 # define YYCDEBUG if (false) std::cerr
194 # define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol)
195 # define YY_REDUCE_PRINT(Rule) static_cast<void>(0)
196 # define YY_STACK_PRINT() static_cast<void>(0)
197 
198 #endif // !YYDEBUG
199 
200 #define yyerrok (yyerrstatus_ = 0)
201 #define yyclearin (yyla.clear ())
202 
203 #define YYACCEPT goto yyacceptlab
204 #define YYABORT goto yyabortlab
205 #define YYERROR goto yyerrorlab
206 #define YYRECOVERING() (!!yyerrstatus_)
207 
208 #line 11 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:479
209 namespace vcsn { namespace detail { namespace dot {
210 #line 211 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:479
211 
212  /* Return YYSTR after stripping away unnecessary quotes and
213  backslashes, so that it's suitable for yyerror. The heuristic is
214  that double-quoting is unnecessary unless the string contains an
215  apostrophe, a comma, or backslash (other than backslash-backslash).
216  YYSTR is taken from yytname. */
217  std::string
218  parser::yytnamerr_ (const char *yystr)
219  {
220  if (*yystr == '"')
221  {
222  std::string yyr = "";
223  char const *yyp = yystr;
224 
225  for (;;)
226  switch (*++yyp)
227  {
228  case '\'':
229  case ',':
230  goto do_not_strip_quotes;
231 
232  case '\\':
233  if (*++yyp != '\\')
234  goto do_not_strip_quotes;
235  // Fall through.
236  default:
237  yyr += *yyp;
238  break;
239 
240  case '"':
241  return yyr;
242  }
243  do_not_strip_quotes: ;
244  }
245 
246  return yystr;
247  }
248 
249 
251  parser::parser (driver& driver__yyarg)
252  :
253 #if YYDEBUG
254  yydebug_ (false),
255  yycdebug_ (&std::cerr),
256 #endif
257  driver_ (driver__yyarg)
258  {}
259 
261  {}
262 
263 
264  /*---------------.
265  | Symbol types. |
266  `---------------*/
267 
268 
269 
270  // by_state.
271  inline
273  : state (empty_state)
274  {}
275 
276  inline
278  : state (other.state)
279  {}
280 
281  inline
282  void
284  {
285  state = empty_state;
286  }
287 
288  inline
289  void
291  {
292  state = that.state;
293  that.clear ();
294  }
295 
296  inline
298  : state (s)
299  {}
300 
301  inline
304  {
305  if (state == empty_state)
306  return empty_symbol;
307  else
308  return yystos_[state];
309  }
310 
311  inline
313  {}
314 
315 
316  inline
318  : super_type (s, that.location)
319  {
320  switch (that.type_get ())
321  {
322  case 31: // path
323  value.move< paths_t > (that.value);
324  break;
325 
326  case 20: // stmt_list
327  case 21: // stmt
328  case 30: // nodes
329  case 32: // edge_stmt
330  case 36: // subgraph
331  value.move< states_t > (that.value);
332  break;
333 
334  case 17: // ID
335  case 23: // attr_list
336  case 24: // attr_list.opt
337  case 25: // attr_assign
338  case 26: // a_list.1
339  case 29: // a_list.0
340  case 33: // node_stmt
341  case 34: // node_id
342  case 37: // id.opt
343  value.move< string_t > (that.value);
344  break;
345 
346  default:
347  break;
348  }
349 
350  // that is emptied.
351  that.type = empty_symbol;
352  }
353 
354  inline
357  {
358  state = that.state;
359  switch (that.type_get ())
360  {
361  case 31: // path
362  value.copy< paths_t > (that.value);
363  break;
364 
365  case 20: // stmt_list
366  case 21: // stmt
367  case 30: // nodes
368  case 32: // edge_stmt
369  case 36: // subgraph
370  value.copy< states_t > (that.value);
371  break;
372 
373  case 17: // ID
374  case 23: // attr_list
375  case 24: // attr_list.opt
376  case 25: // attr_assign
377  case 26: // a_list.1
378  case 29: // a_list.0
379  case 33: // node_stmt
380  case 34: // node_id
381  case 37: // id.opt
382  value.copy< string_t > (that.value);
383  break;
384 
385  default:
386  break;
387  }
388 
389  location = that.location;
390  return *this;
391  }
392 
393 
394  template <typename Base>
395  inline
396  void
397  parser::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
398  {
399  if (yymsg)
400  YY_SYMBOL_PRINT (yymsg, yysym);
401  }
402 
403 #if YYDEBUG
404  template <typename Base>
405  void
406  parser::yy_print_ (std::ostream& yyo,
407  const basic_symbol<Base>& yysym) const
408  {
409  std::ostream& yyoutput = yyo;
410  YYUSE (yyoutput);
411  symbol_number_type yytype = yysym.type_get ();
412  // Avoid a (spurious) G++ 4.8 warning about "array subscript is
413  // below array bounds".
414  if (yysym.empty ())
415  std::abort ();
416  yyo << (yytype < yyntokens_ ? "token" : "nterm")
417  << ' ' << yytname_[yytype] << " ("
418  << yysym.location << ": ";
419  switch (yytype)
420  {
421  case 17: // ID
422 
423 #line 172 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
424  { debug_stream() << yysym.value.template as< string_t > (); }
425 #line 426 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
426  break;
427 
428  case 20: // stmt_list
429 //-
430 //-#line 176 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
431 //- { debug_stream() << yysym.value.template as< states_t > (); }
432 //-#line 433 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
433 //- break;
434 
435  case 21: // stmt
436 
437 #line 176 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
438  { debug_stream() << yysym.value.template as< states_t > (); }
439 #line 440 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
440  break;
441 
442  case 23: // attr_list
443 //-
444 //-#line 172 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
445 //- { debug_stream() << yysym.value.template as< string_t > (); }
446 //-#line 447 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
447 //- break;
448 
449  case 24: // attr_list.opt
450 //-
451 //-#line 172 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
452 //- { debug_stream() << yysym.value.template as< string_t > (); }
453 //-#line 454 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
454 //- break;
455 
456  case 25: // attr_assign
457 //-
458 //-#line 172 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
459 //- { debug_stream() << yysym.value.template as< string_t > (); }
460 //-#line 461 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
461 //- break;
462 
463  case 26: // a_list.1
464 //-
465 //-#line 172 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
466 //- { debug_stream() << yysym.value.template as< string_t > (); }
467 //-#line 468 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
468 //- break;
469 
470  case 29: // a_list.0
471 
472 #line 172 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
473  { debug_stream() << yysym.value.template as< string_t > (); }
474 #line 475 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
475  break;
476 
477  case 30: // nodes
478 
479 #line 176 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
480  { debug_stream() << yysym.value.template as< states_t > (); }
481 #line 482 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
482  break;
483 
484  case 31: // path
485 
486 #line 280 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
487  { debug_stream() << yysym.value.template as< paths_t > (); }
488 #line 489 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
489  break;
490 
491  case 32: // edge_stmt
492 
493 #line 176 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
494  { debug_stream() << yysym.value.template as< states_t > (); }
495 #line 496 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
496  break;
497 
498  case 33: // node_stmt
499 //-
500 //-#line 172 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
501 //- { debug_stream() << yysym.value.template as< string_t > (); }
502 //-#line 503 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
503 //- break;
504 
505  case 34: // node_id
506 
507 #line 172 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
508  { debug_stream() << yysym.value.template as< string_t > (); }
509 #line 510 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
510  break;
511 
512  case 36: // subgraph
513 
514 #line 176 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
515  { debug_stream() << yysym.value.template as< states_t > (); }
516 #line 517 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
517  break;
518 
519  case 37: // id.opt
520 
521 #line 172 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:636
522  { debug_stream() << yysym.value.template as< string_t > (); }
523 #line 524 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:636
524  break;
525 
526 
527  default:
528  break;
529  }
530  yyo << ')';
531  }
532 #endif
533 
534  inline
535  void
536  parser::yypush_ (const char* m, state_type s, symbol_type& sym)
537  {
538  stack_symbol_type t (s, sym);
539  yypush_ (m, t);
540  }
541 
542  inline
543  void
544  parser::yypush_ (const char* m, stack_symbol_type& s)
545  {
546  if (m)
547  YY_SYMBOL_PRINT (m, s);
548  yystack_.push (s);
549  }
550 
551  inline
552  void
553  parser::yypop_ (unsigned int n)
554  {
555  yystack_.pop (n);
556  }
557 
558 #if YYDEBUG
559  std::ostream&
561  {
562  return *yycdebug_;
563  }
564 
565  void
566  parser::set_debug_stream (std::ostream& o)
567  {
568  yycdebug_ = &o;
569  }
570 
571 
574  {
575  return yydebug_;
576  }
577 
578  void
580  {
581  yydebug_ = l;
582  }
583 #endif // YYDEBUG
584 
585  inline parser::state_type
587  {
588  int yyr = yypgoto_[yysym - yyntokens_] + yystate;
589  if (0 <= yyr && yyr <= yylast_ && yycheck_[yyr] == yystate)
590  return yytable_[yyr];
591  else
592  return yydefgoto_[yysym - yyntokens_];
593  }
594 
595  inline bool
597  {
598  return yyvalue == yypact_ninf_;
599  }
600 
601  inline bool
603  {
604  return yyvalue == yytable_ninf_;
605  }
606 
607  int
609  {
610  // State.
611  int yyn;
613  int yylen = 0;
614 
615  // Error handling.
616  int yynerrs_ = 0;
617  int yyerrstatus_ = 0;
618 
620  symbol_type yyla;
621 
623  stack_symbol_type yyerror_range[3];
624 
626  int yyresult;
627 
628  // FIXME: This shoud be completely indented. It is not yet to
629  // avoid gratuitous conflicts when merging into the master branch.
630  try
631  {
632  YYCDEBUG << "Starting parse" << std::endl;
633 
634 
635  // User initialization code.
636  #line 145 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:741
637 {
638  yyla.location = driver_.location_;
639 }
640 
641 #line 642 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:741
642 
643  /* Initialize the stack. The initial state will be set in
644  yynewstate, since the latter expects the semantical and the
645  location values to have been already stored, initialize these
646  stacks with a primary value. */
647  yystack_.clear ();
648  yypush_ (YY_NULLPTR, 0, yyla);
649 
650  // A new symbol was pushed on the stack.
651  yynewstate:
652  YYCDEBUG << "Entering state " << yystack_[0].state << std::endl;
653 
654  // Accept?
655  if (yystack_[0].state == yyfinal_)
656  goto yyacceptlab;
657 
658  goto yybackup;
659 
660  // Backup.
661  yybackup:
662 
663  // Try to take a decision without lookahead.
664  yyn = yypact_[yystack_[0].state];
665  if (yy_pact_value_is_default_ (yyn))
666  goto yydefault;
667 
668  // Read a lookahead token.
669  if (yyla.empty ())
670  {
671  YYCDEBUG << "Reading a token: ";
672  try
673  {
674  symbol_type yylookahead (yylex (driver_));
675  yyla.move (yylookahead);
676  }
677  catch (const syntax_error& yyexc)
678  {
679  error (yyexc);
680  goto yyerrlab1;
681  }
682  }
683  YY_SYMBOL_PRINT ("Next token is", yyla);
684 
685  /* If the proper action on seeing token YYLA.TYPE is to reduce or
686  to detect an error, take that action. */
687  yyn += yyla.type_get ();
688  if (yyn < 0 || yylast_ < yyn || yycheck_[yyn] != yyla.type_get ())
689  goto yydefault;
690 
691  // Reduce or error.
692  yyn = yytable_[yyn];
693  if (yyn <= 0)
694  {
695  if (yy_table_value_is_error_ (yyn))
696  goto yyerrlab;
697  yyn = -yyn;
698  goto yyreduce;
699  }
700 
701  // Count tokens shifted since error; after three, turn off error status.
702  if (yyerrstatus_)
703  --yyerrstatus_;
704 
705  // Shift the lookahead token.
706  yypush_ ("Shifting", yyn, yyla);
707  goto yynewstate;
708 
709  /*-----------------------------------------------------------.
710  | yydefault -- do the default action for the current state. |
711  `-----------------------------------------------------------*/
712  yydefault:
713  yyn = yydefact_[yystack_[0].state];
714  if (yyn == 0)
715  goto yyerrlab;
716  goto yyreduce;
717 
718  /*-----------------------------.
719  | yyreduce -- Do a reduction. |
720  `-----------------------------*/
721  yyreduce:
722  yylen = yyr2_[yyn];
723  {
724  stack_symbol_type yylhs;
725  yylhs.state = yy_lr_goto_state_(yystack_[yylen].state, yyr1_[yyn]);
726  /* Variants are always initialized to an empty instance of the
727  correct type. The default '$$ = $1' action is NOT applied
728  when using variants. */
729  switch (yyr1_[yyn])
730  {
731  case 31: // path
732  yylhs.value.build< paths_t > ();
733  break;
734 
735  case 20: // stmt_list
736  case 21: // stmt
737  case 30: // nodes
738  case 32: // edge_stmt
739  case 36: // subgraph
740  yylhs.value.build< states_t > ();
741  break;
742 
743  case 17: // ID
744  case 23: // attr_list
745  case 24: // attr_list.opt
746  case 25: // attr_assign
747  case 26: // a_list.1
748  case 29: // a_list.0
749  case 33: // node_stmt
750  case 34: // node_id
751  case 37: // id.opt
752  yylhs.value.build< string_t > ();
753  break;
754 
755  default:
756  break;
757  }
758 
759 
760  // Compute the default @$.
761  {
763  YYLLOC_DEFAULT (yylhs.location, slice, yylen);
764  }
765 
766  // Perform the reduction.
767  YY_REDUCE_PRINT (yyn);
768  try
769  {
770  switch (yyn)
771  {
772  case 2:
773 //-#line 183 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
774 //- {}
775 //-#line 776 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
776 //- break;
777 
778  case 3:
779 #line 187 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
780  {}
781 #line 782 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
782  break;
783 
784  case 4:
785 #line 189 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
786  {
787  // Preserve the set of states.
788  std::swap(yylhs.value.as< states_t > (), yystack_[2].value.as< states_t > ());
789  for (auto s: yystack_[1].value.as< states_t > ())
790  yylhs.value.as< states_t > ().emplace_back(std::move(s));
791  }
792 #line 793 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
793  break;
794 
795  case 5:
796 #line 198 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
797  { yylhs.value.as< states_t > ().emplace_back(std::move(yystack_[0].value.as< string_t > ())); }
798 #line 799 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
799  break;
800 
801  case 6:
802 #line 199 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
803  { std::swap(yylhs.value.as< states_t > (), yystack_[0].value.as< states_t > ()); }
804 #line 805 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
805  break;
806 
807  case 7:
808 //-#line 200 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
809 //- {}
810 //-#line 811 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
811 //- break;
812 
813  case 8:
814 #line 201 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
815  {}
816 #line 817 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
817  break;
818 
819  case 9:
820 #line 202 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
821  { std::swap(yylhs.value.as< states_t > (), yystack_[0].value.as< states_t > ()); }
822 #line 823 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
823  break;
824 
825  case 10:
826 //-#line 206 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
827 //- {}
828 //-#line 829 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
829 //- break;
830 
831  case 11:
832 //-#line 207 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
833 //- {}
834 //-#line 835 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
835 //- break;
836 
837  case 12:
838 #line 208 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
839  {}
840 #line 841 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
841  break;
842 
843  case 13:
844 #line 213 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
845  {
846  std::swap(yylhs.value.as< string_t > (), yystack_[2].value.as< string_t > ().get().empty() ? yystack_[0].value.as< string_t > () : yystack_[2].value.as< string_t > ());
847  }
848 #line 849 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
849  break;
850 
851  case 14:
852 #line 221 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
853  { yylhs.value.as< string_t > () = ""; }
854 #line 855 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
855  break;
856 
857  case 15:
858 #line 222 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
859  { std::swap(yylhs.value.as< string_t > (), yystack_[0].value.as< string_t > ()); }
860 #line 861 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
861  break;
862 
863  case 16:
864 #line 227 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
865  {
866  static const string_t label{"label"};
867  static const string_t vcsn_context{"vcsn_context"};
868  if (yystack_[2].value.as< string_t > () == label)
869  std::swap(yylhs.value.as< string_t > (), yystack_[0].value.as< string_t > ());
870  else if (yystack_[2].value.as< string_t > () == vcsn_context)
871  driver_.setup_(yystack_[0].location, yystack_[0].value.as< string_t > ());
872  else
873  // Beware of the default "$$ = $1;" action.
874  yylhs.value.as< string_t > () = "";
875  }
876 #line 877 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
877  break;
878 
879  case 17:
880 #line 242 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
881  {
882  std::swap(yylhs.value.as< string_t > (), yystack_[2].value.as< string_t > ().get().empty() ? yystack_[0].value.as< string_t > () : yystack_[2].value.as< string_t > ());
883  }
884 #line 885 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
885  break;
886 
887  case 23:
888 #line 258 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
889  {}
890 #line 891 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
891  break;
892 
893  case 24:
894 #line 259 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
895  { std::swap(yylhs.value.as< string_t > (), yystack_[0].value.as< string_t > ()); }
896 #line 897 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
897  break;
898 
899  case 25:
900 #line 263 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
901  { yylhs.value.as< states_t > ().emplace_back(std::move(yystack_[0].value.as< string_t > ())); }
902 #line 903 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
903  break;
904 
905  case 26:
906 #line 264 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
907  { yylhs.value.as< states_t > () = yystack_[0].value.as< states_t > (); }
908 #line 909 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
909  break;
910 
911  case 27:
912 #line 283 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
913  {
914  for (auto s1: yystack_[2].value.as< states_t > ())
915  for (auto s2: yystack_[0].value.as< states_t > ())
916  yylhs.value.as< paths_t > ().transitions.emplace_back(s1, s2);
917  yylhs.value.as< paths_t > ().ends = yystack_[0].value.as< states_t > ();
918  }
919 #line 920 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
920  break;
921 
922  case 28:
923 #line 290 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
924  {
925  std::swap(yylhs.value.as< paths_t > ().transitions, yystack_[2].value.as< paths_t > ().transitions);
926  for (auto s1: yystack_[2].value.as< paths_t > ().ends)
927  for (auto s2: yystack_[0].value.as< states_t > ())
928  yylhs.value.as< paths_t > ().transitions.emplace_back(s1, s2);
929  yylhs.value.as< paths_t > ().ends = yystack_[0].value.as< states_t > ();
930  }
931 #line 932 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
932  break;
933 
934  case 29:
935 #line 301 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
936  {
937  for (auto t: yystack_[1].value.as< paths_t > ().transitions)
938  TRY(yystack_[0].location, driver_.edit_->add_entry(t.first, t.second, yystack_[0].value.as< string_t > ()));
939  }
940 #line 941 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
941  break;
942 
943  case 30:
944 #line 309 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
945  {
946  std::swap(yylhs.value.as< string_t > (), yystack_[1].value.as< string_t > ());
947  }
948 #line 949 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
949  break;
950 
951  case 31:
952 #line 316 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
953  {
954  // We need the editor to exist.
955  require(bool(driver_.edit_), yylhs.location, ": no vcsn_context");
956  std::swap(yylhs.value.as< string_t > (), yystack_[1].value.as< string_t > ());
957  if (yylhs.value.as< string_t > ().get()[0] == 'I')
958  TRY(yystack_[1].location, driver_.edit_->add_pre(yylhs.value.as< string_t > ()));
959  else if (yylhs.value.as< string_t > ().get()[0] == 'F')
960  TRY(yystack_[1].location, driver_.edit_->add_post(yylhs.value.as< string_t > ()));
961  else
962  // This is not needed, but it ensures that the states will be
963  // numbered by their order of appearance in the file.
964  TRY(yystack_[1].location, driver_.edit_->add_state(yylhs.value.as< string_t > ()));
965  }
966 #line 967 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
967  break;
968 
969  case 32:
970 //-#line 336 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
971 //- {}
972 //-#line 973 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
973 //- break;
974 
975  case 33:
976 //-#line 337 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
977 //- {}
978 //-#line 979 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
979 //- break;
980 
981  case 34:
982 #line 338 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
983  {}
984 #line 985 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
985  break;
986 
987  case 35:
988 //-#line 342 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
989 //- { std::swap(yylhs.value.as< states_t > (), yystack_[1].value.as< states_t > ()); }
990 //-#line 991 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
991 //- break;
992 
993  case 36:
994 #line 343 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
995  { std::swap(yylhs.value.as< states_t > (), yystack_[1].value.as< states_t > ()); }
996 #line 997 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
997  break;
998 
999  case 37:
1000 #line 347 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
1001  {}
1002 #line 1003 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
1003  break;
1004 
1005  case 38:
1006 #line 348 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
1007  { std::swap(yylhs.value.as< string_t > (), yystack_[0].value.as< string_t > ()); }
1008 #line 1009 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
1009  break;
1010 
1011 
1012 #line 1013 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
1013  default:
1014  break;
1015  }
1016  }
1017  catch (const syntax_error& yyexc)
1018  {
1019  error (yyexc);
1020  YYERROR;
1021  }
1022  YY_SYMBOL_PRINT ("-> $$ =", yylhs);
1023  yypop_ (yylen);
1024  yylen = 0;
1025  YY_STACK_PRINT ();
1026 
1027  // Shift the result of the reduction.
1028  yypush_ (YY_NULLPTR, yylhs);
1029  }
1030  goto yynewstate;
1031 
1032  /*--------------------------------------.
1033  | yyerrlab -- here on detecting error. |
1034  `--------------------------------------*/
1035  yyerrlab:
1036  // If not already recovering from an error, report this error.
1037  if (!yyerrstatus_)
1038  {
1039  ++yynerrs_;
1040  error (yyla.location, yysyntax_error_ (yystack_[0].state, yyla));
1041  }
1042 
1043 
1044  yyerror_range[1].location = yyla.location;
1045  if (yyerrstatus_ == 3)
1046  {
1047  /* If just tried and failed to reuse lookahead token after an
1048  error, discard it. */
1049 
1050  // Return failure if at end of input.
1051  if (yyla.type_get () == yyeof_)
1052  YYABORT;
1053  else if (!yyla.empty ())
1054  {
1055  yy_destroy_ ("Error: discarding", yyla);
1056  yyla.clear ();
1057  }
1058  }
1059 
1060  // Else will try to reuse lookahead token after shifting the error token.
1061  goto yyerrlab1;
1062 
1063 
1064  /*---------------------------------------------------.
1065  | yyerrorlab -- error raised explicitly by YYERROR. |
1066  `---------------------------------------------------*/
1067  yyerrorlab:
1068 
1069  /* Pacify compilers like GCC when the user code never invokes
1070  YYERROR and the label yyerrorlab therefore never appears in user
1071  code. */
1072  if (false)
1073  goto yyerrorlab;
1074  yyerror_range[1].location = yystack_[yylen].location;
1075  /* Do not reclaim the symbols of the rule whose action triggered
1076  this YYERROR. */
1077  yypop_ (yylen);
1078  yylen = 0;
1079  goto yyerrlab1;
1080 
1081  /*-------------------------------------------------------------.
1082  | yyerrlab1 -- common code for both syntax error and YYERROR. |
1083  `-------------------------------------------------------------*/
1084  yyerrlab1:
1085  yyerrstatus_ = 3; // Each real token shifted decrements this.
1086  {
1087  stack_symbol_type error_token;
1088  for (;;)
1089  {
1090  yyn = yypact_[yystack_[0].state];
1091  if (!yy_pact_value_is_default_ (yyn))
1092  {
1093  yyn += yyterror_;
1094  if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
1095  {
1096  yyn = yytable_[yyn];
1097  if (0 < yyn)
1098  break;
1099  }
1100  }
1101 
1102  // Pop the current state because it cannot handle the error token.
1103  if (yystack_.size () == 1)
1104  YYABORT;
1105 
1106  yyerror_range[1].location = yystack_[0].location;
1107  yy_destroy_ ("Error: popping", yystack_[0]);
1108  yypop_ ();
1109  YY_STACK_PRINT ();
1110  }
1111 
1112  yyerror_range[2].location = yyla.location;
1113  YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);
1114 
1115  // Shift the error token.
1116  error_token.state = yyn;
1117  yypush_ ("Shifting", error_token);
1118  }
1119  goto yynewstate;
1120 
1121  // Accept.
1122  yyacceptlab:
1123  yyresult = 0;
1124  goto yyreturn;
1125 
1126  // Abort.
1127  yyabortlab:
1128  yyresult = 1;
1129  goto yyreturn;
1130 
1131  yyreturn:
1132  if (!yyla.empty ())
1133  yy_destroy_ ("Cleanup: discarding lookahead", yyla);
1134 
1135  /* Do not reclaim the symbols of the rule whose action triggered
1136  this YYABORT or YYACCEPT. */
1137  yypop_ (yylen);
1138  while (1 < yystack_.size ())
1139  {
1140  yy_destroy_ ("Cleanup: popping", yystack_[0]);
1141  yypop_ ();
1142  }
1143 
1144  return yyresult;
1145  }
1146  catch (...)
1147  {
1148  YYCDEBUG << "Exception caught: cleaning lookahead and stack"
1149  << std::endl;
1150  // Do not try to display the values of the reclaimed symbols,
1151  // as their printer might throw an exception.
1152  if (!yyla.empty ())
1153  yy_destroy_ (YY_NULLPTR, yyla);
1154 
1155  while (1 < yystack_.size ())
1156  {
1158  yypop_ ();
1159  }
1160  throw;
1161  }
1162  }
1163 
1164  void
1166  {
1167  error (yyexc.location, yyexc.what());
1168  }
1169 
1170  // Generate an error message.
1171  std::string
1172  parser::yysyntax_error_ (state_type yystate, const symbol_type& yyla) const
1173  {
1174  // Number of reported tokens (one for the "unexpected", one per
1175  // "expected").
1176  size_t yycount = 0;
1177  // Its maximum.
1178  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1179  // Arguments of yyformat.
1180  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1181 
1182  /* There are many possibilities here to consider:
1183  - If this state is a consistent state with a default action, then
1184  the only way this function was invoked is if the default action
1185  is an error action. In that case, don't check for expected
1186  tokens because there are none.
1187  - The only way there can be no lookahead present (in yyla) is
1188  if this state is a consistent state with a default action.
1189  Thus, detecting the absence of a lookahead is sufficient to
1190  determine that there is no unexpected or expected token to
1191  report. In that case, just report a simple "syntax error".
1192  - Don't assume there isn't a lookahead just because this state is
1193  a consistent state with a default action. There might have
1194  been a previous inconsistent state, consistent state with a
1195  non-default action, or user semantic action that manipulated
1196  yyla. (However, yyla is currently not documented for users.)
1197  - Of course, the expected token list depends on states to have
1198  correct lookahead information, and it depends on the parser not
1199  to perform extra reductions after fetching a lookahead from the
1200  scanner and before detecting a syntax error. Thus, state
1201  merging (from LALR or IELR) and default reductions corrupt the
1202  expected token list. However, the list is correct for
1203  canonical LR with one exception: it will still contain any
1204  token that will not be accepted due to an error action in a
1205  later state.
1206  */
1207  if (!yyla.empty ())
1208  {
1209  int yytoken = yyla.type_get ();
1210  yyarg[yycount++] = yytname_[yytoken];
1211  int yyn = yypact_[yystate];
1212  if (!yy_pact_value_is_default_ (yyn))
1213  {
1214  /* Start YYX at -YYN if negative to avoid negative indexes in
1215  YYCHECK. In other words, skip the first -YYN actions for
1216  this state because they are default actions. */
1217  int yyxbegin = yyn < 0 ? -yyn : 0;
1218  // Stay within bounds of both yycheck and yytname.
1219  int yychecklim = yylast_ - yyn + 1;
1220  int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
1221  for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
1222  if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_
1223  && !yy_table_value_is_error_ (yytable_[yyx + yyn]))
1224  {
1225  if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1226  {
1227  yycount = 1;
1228  break;
1229  }
1230  else
1231  yyarg[yycount++] = yytname_[yyx];
1232  }
1233  }
1234  }
1235 
1236  char const* yyformat = YY_NULLPTR;
1237  switch (yycount)
1238  {
1239 #define YYCASE_(N, S) \
1240  case N: \
1241  yyformat = S; \
1242  break
1243  YYCASE_(0, YY_("syntax error"));
1244  YYCASE_(1, YY_("syntax error, unexpected %s"));
1245  YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1246  YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1247  YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1248  YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1249 #undef YYCASE_
1250  }
1251 
1252  std::string yyres;
1253  // Argument number.
1254  size_t yyi = 0;
1255  for (char const* yyp = yyformat; *yyp; ++yyp)
1256  if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
1257  {
1258  yyres += yytnamerr_ (yyarg[yyi++]);
1259  ++yyp;
1260  }
1261  else
1262  yyres += *yyp;
1263  return yyres;
1264  }
1265 
1266 
1267  const signed char parser::yypact_ninf_ = -23;
1268 
1269  const signed char parser::yytable_ninf_ = -27;
1270 
1271  const signed char
1272  parser::yypact_[] =
1273  {
1274  29, 20, 45, -23, 42, -23, -23, 1, 41, 41,
1275  41, 20, -23, -23, 5, 36, -23, -23, 40, 10,
1276  -23, -23, 26, 43, 37, -23, -23, -23, 47, 7,
1277  44, 46, -23, -23, -23, 14, 14, -23, -23, -23,
1278  48, -13, -23, 51, -23, -23, -23, 50, 52, -23,
1279  -23, -23, -23, -23, -23, 37, 41, 21, 53, -23,
1280  -23, -23, -23
1281  };
1282 
1283  const unsigned char
1284  parser::yydefact_[] =
1285  {
1286  0, 37, 0, 38, 0, 1, 3, 0, 0, 0,
1287  0, 37, 3, 2, 32, 21, 7, 8, 0, 14,
1288  6, 5, 14, 9, 23, 12, 10, 11, 0, 0,
1289  0, 0, 31, 22, 4, 0, 0, 15, 29, 30,
1290  0, 18, 24, 0, 3, 36, 16, 33, 32, 27,
1291  25, 26, 28, 19, 20, 23, 14, 0, 0, 17,
1292  13, 35, 34
1293  };
1294 
1295  const signed char
1296  parser::yypgoto_[] =
1297  {
1298  -23, -23, -11, -23, -23, 32, -22, -20, -23, -23,
1299  -23, 2, 8, -23, -23, -23, 11, -23, 13, 54
1300  };
1301 
1302  const signed char
1303  parser::yydefgoto_[] =
1304  {
1305  -1, 2, 7, 15, 16, 37, 38, 17, 42, 55,
1306  34, 43, 18, 19, 20, 21, 22, 32, 23, 4
1307  };
1308 
1309  const signed char
1310  parser::yytable_[] =
1311  {
1312  39, 29, 53, 54, 41, 8, 9, 10, 11, 12,
1313  13, 8, 9, 10, 11, 12, 45, 30, 14, 31,
1314  24, 11, 12, 36, 14, 8, 9, 10, 11, 12,
1315  61, 48, 1, 57, 60, 41, 24, 3, 14, -25,
1316  25, 26, 27, 49, 52, 5, 50, 50, 51, 51,
1317  6, 24, 33, 35, 40, 44, -26, 59, 0, 0,
1318  30, 46, 56, 47, 58, 28, 31, 0, 0, 0,
1319  62
1320  };
1321 
1322  const signed char
1323  parser::yycheck_[] =
1324  {
1325  22, 12, 15, 16, 24, 4, 5, 6, 7, 8,
1326  9, 4, 5, 6, 7, 8, 9, 12, 17, 14,
1327  10, 7, 8, 13, 17, 4, 5, 6, 7, 8,
1328  9, 17, 3, 44, 56, 55, 10, 17, 17, 13,
1329  8, 9, 10, 35, 36, 0, 35, 36, 35, 36,
1330  8, 10, 16, 13, 17, 8, 13, 55, -1, -1,
1331  12, 17, 11, 17, 14, 11, 14, -1, -1, -1,
1332  17
1333  };
1334 
1335  const unsigned char
1336  parser::yystos_[] =
1337  {
1338  0, 3, 19, 17, 37, 0, 8, 20, 4, 5,
1339  6, 7, 8, 9, 17, 21, 22, 25, 30, 31,
1340  32, 33, 34, 36, 10, 23, 23, 23, 37, 20,
1341  12, 14, 35, 16, 28, 13, 13, 23, 24, 24,
1342  17, 25, 26, 29, 8, 9, 17, 17, 17, 30,
1343  34, 36, 30, 15, 16, 27, 11, 20, 14, 29,
1344  24, 9, 17
1345  };
1346 
1347  const unsigned char
1348  parser::yyr1_[] =
1349  {
1350  0, 18, 19, 20, 20, 21, 21, 21, 21, 21,
1351  22, 22, 22, 23, 24, 24, 25, 26, 27, 27,
1352  27, 28, 28, 29, 29, 30, 30, 31, 31, 32,
1353  33, 34, 35, 35, 35, 36, 36, 37, 37
1354  };
1355 
1356  const unsigned char
1357  parser::yyr2_[] =
1358  {
1359  0, 2, 5, 0, 3, 1, 1, 1, 1, 1,
1360  2, 2, 2, 4, 0, 1, 3, 3, 0, 1,
1361  1, 0, 1, 0, 1, 1, 1, 3, 3, 2,
1362  2, 2, 0, 2, 4, 5, 3, 0, 1
1363  };
1364 
1365 
1366 
1367  // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1368  // First, the terminals, then, starting at \a yyntokens_, nonterminals.
1369  const char*
1370  const parser::yytname_[] =
1371  {
1372  "END", "error", "$undefined", "\"digraph\"", "\"edge\"", "\"graph\"",
1373  "\"node\"", "\"subgraph\"", "\"{\"", "\"}\"", "\"[\"", "\"]\"", "\"=\"",
1374  "\"->\"", "\":\"", "\",\"", "\";\"", "ID", "$accept", "graph",
1375  "stmt_list", "stmt", "attr_stmt", "attr_list", "attr_list.opt",
1376  "attr_assign", "a_list.1", "comma.opt", "semi.opt", "a_list.0", "nodes",
1377  "path", "edge_stmt", "node_stmt", "node_id", "port.opt", "subgraph",
1378  "id.opt", YY_NULLPTR
1379  };
1380 
1381 #if YYDEBUG
1382  const unsigned short int
1383  parser::yyrline_[] =
1384  {
1385  0, 183, 183, 187, 188, 198, 199, 200, 201, 202,
1386  206, 207, 208, 212, 221, 222, 226, 241, 248, 248,
1387  248, 252, 253, 258, 259, 263, 264, 282, 289, 300,
1388  308, 315, 336, 337, 338, 342, 343, 347, 348
1389  };
1390 
1391  // Print the state stack on the debug stream.
1392  void
1394  {
1395  *yycdebug_ << "Stack now";
1397  i = yystack_.begin (),
1398  i_end = yystack_.end ();
1399  i != i_end; ++i)
1400  *yycdebug_ << ' ' << i->state;
1401  *yycdebug_ << std::endl;
1402  }
1403 
1404  // Report on the debug stream that the rule \a yyrule is going to be reduced.
1405  void
1407  {
1408  unsigned int yylno = yyrline_[yyrule];
1409  int yynrhs = yyr2_[yyrule];
1410  // Print the symbols being reduced, and their result.
1411  *yycdebug_ << "Reducing stack by rule " << yyrule - 1
1412  << " (line " << yylno << "):" << std::endl;
1413  // The symbols being reduced.
1414  for (int yyi = 0; yyi < yynrhs; yyi++)
1415  YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
1416  yystack_[(yynrhs) - (yyi + 1)]);
1417  }
1418 #endif // YYDEBUG
1419 
1420 
1421 #line 11 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:1167
1422 } } } // vcsn::detail::dot
1423 #line 1424 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:1167
1424 #line 350 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:1168
1425 
1426 
1427 namespace vcsn
1428 {
1429  namespace detail
1430  {
1431  namespace dot
1432  {
1433  void
1434  parser::error(const location_type& l, const std::string& m)
1435  {
1436  driver_.error(l, m);
1437  }
1438  }
1439  }
1440 }
static const unsigned char yyr1_[]
Definition: parse.hh:636
symbol_number_type type_get() const
The (internal) type number (corresponding to state).
Definition: parse.cc:303
int symbol_number_type
Symbol type: an internal symbol number.
Definition: parse.hh:377
std::shared_ptr< vcsn::automaton_editor > edit_
An automaton editor that stores the one being built.
Definition: driver.hh:48
void yypop_(unsigned int n=1)
Pop n symbols the three stacks.
Definition: parse.cc:553
#define YY_SYMBOL_PRINT(Title, Symbol)
Definition: parse.cc:169
void push(T &t)
Steal the contents of t.
Definition: stack.hh:83
Abstract a location.
Definition: location.hh:47
int debug_level_type
Type for debugging levels.
Definition: parse.hh:560
static const signed char yytable_[]
Definition: parse.hh:627
std::ostream & debug_stream() const
The current debugging stream.
Definition: parse.cc:560
std::vector< stack_symbol_type >::const_reverse_iterator const_iterator
Definition: stack.hh:52
stack_symbol_type & operator=(const stack_symbol_type &that)
Assignment, needed by push_back.
Definition: parse.cc:356
#define YYUSE(E)
Definition: parse.cc:161
STL namespace.
std::ostream * yycdebug_
Definition: parse.hh:658
debug_level_type debug_level() const
The current debugging level.
Definition: parse.cc:573
State and public interface for Dot parsing.
Definition: driver.hh:20
Define the vcsn::detail::dot::parser class.
auto transitions(const Aut &aut) -> decltype(all_transitions(aut, is_special_t< Aut >
All the transition indexes between visible states.
Definition: automaton.hh:226
basic_symbol< by_type > symbol_type
"External" symbols: returned by the scanner.
Definition: parse.hh:477
transitions_t transitions
Definition: parse.hh:77
state_type state
The state.
Definition: parse.hh:705
static const unsigned short int yyrline_[]
Definition: parse.hh:650
const_iterator begin() const
Definition: stack.hh:112
by_state()
Default constructor.
Definition: parse.cc:272
static const signed char yycheck_[]
Definition: parse.hh:629
void yypush_(const char *m, stack_symbol_type &s)
Push a new state on the stack.
Definition: parse.cc:544
static std::ostream & operator<<(std::ostream &o, const states_t ss)
Definition: parse.cc:83
parser(driver &driver__yyarg)
Build a parser object.
Definition: parse.cc:251
location_t location_
The inital location.
Definition: driver.hh:46
state_type yy_lr_goto_state_(state_type yystate, int yysym)
Compute post-reduction state.
Definition: parse.cc:586
void yy_print_(std::ostream &yyo, const basic_symbol< Base > &yysym) const
Display a symbol type, value and location.
Definition: parse.cc:406
location(const position &b, const position &e)
Construct a location from b to e.
Definition: location.hh:52
"Internal" symbol: element of the stack.
Definition: parse.hh:709
static const signed char yytable_ninf_
Definition: parse.hh:603
void require(Bool b, Args &&...args)
If b is not verified, raise an error with args as message.
Definition: raise.hh:91
S::size_type size() const
Definition: stack.hh:105
stack_type yystack_
The stack.
Definition: parse.hh:725
void pop(unsigned int n=1)
Definition: stack.hh:91
T & as()
Accessor to a built T.
Definition: parse.hh:215
void set_debug_level(debug_level_type l)
Set the current debugging level.
Definition: parse.cc:579
static parser::symbol_type yylex(driver &driver_)
Use our local scanner object.
Definition: parse.cc:116
value_impl< detail::label_tag > label
Definition: fwd.hh:26
static const unsigned char yydefact_[]
Definition: parse.hh:616
Present a slice of the top of a stack.
Definition: stack.hh:133
#define YY_REDUCE_PRINT(Rule)
Definition: parse.cc:179
#define YYLLOC_DEFAULT(Current, Rhs, N)
Definition: parse.cc:145
void set_debug_stream(std::ostream &)
Set the current debugging stream.
Definition: parse.cc:566
static bool yy_pact_value_is_default_(int yyvalue)
Whether the given yypact_ value indicates a defaulted state.
Definition: parse.cc:596
#define YYDEBUG
Definition: parse.hh:160
static const signed char yypact_[]
Definition: parse.hh:611
#define YY_STACK_PRINT()
Definition: parse.cc:185
Definition: a-star.hh:8
static const signed char yydefgoto_[]
Definition: parse.hh:622
static const unsigned char yystos_[]
Definition: parse.hh:633
std::unique_ptr< yyFlexLexer > scanner_
The scanner.
Definition: driver.hh:38
#define YY_NULLPTR
Definition: parse.cc:60
const_iterator end() const
Definition: stack.hh:119
#define YYERROR
Definition: parse.cc:205
#define YY_(msgid)
Definition: parse.cc:135
void move(basic_symbol &s)
Destructive move, s is emptied into this.
Definition: parse.hh:1002
#define YYCASE_(N, S)
location_type location
The location.
Definition: parse.hh:435
static const signed char yypact_ninf_
Definition: parse.hh:602
virtual int parse()
Parse.
Definition: parse.cc:608
void clear()
Destroy contents, and record that is empty.
Definition: parse.hh:945
static std::string yytnamerr_(const char *n)
Convert the symbol name n to a form suitable for a diagnostic.
Definition: parse.cc:218
virtual void yy_reduce_print_(int r)
Report on the debug stream that the rule r is going to be reduced.
Definition: parse.cc:1406
int state_type
State numbers.
Definition: parse.hh:581
void error(const location_t &l, const std::string &m)
Report an error m at l.
Definition: driver.cc:69
Syntax errors thrown from user actions.
Definition: parse.hh:343
void setup_(const location_t &l, const std::string &ctx)
From context_, build edit_.
Definition: driver.cc:54
#define TRY(Loc, Stm)
Run Stm, and bounces exceptions into parse errors at Loc.
Definition: parse.cc:36
void move(self_type &other)
Move the content of other to this.
Definition: parse.hh:248
virtual void error(const location_type &loc, const std::string &msg)
Report a syntax error.
Definition: parse.cc:1434
virtual std::string yysyntax_error_(state_type yystate, const symbol_type &yyla) const
Generate an error message.
Definition: parse.cc:1172
void move(by_state &that)
Steal the symbol type from that.
Definition: parse.cc:290
static const unsigned char yyr2_[]
Definition: parse.hh:639
virtual void yystack_print_()
Print the state stack on the debug stream.
Definition: parse.cc:1393
std::ostream & dot(const Aut &aut, std::ostream &out=std::cout, format fmt={})
Print an automaton in Graphviz's Dot format.
Definition: dot.hh:377
symbol string_t
Definition: parse.hh:66
#define YYABORT
Definition: parse.cc:204
std::vector< string_t > states_t
Definition: parse.hh:69
void clear()
Record that this symbol is empty.
Definition: parse.cc:283
T & build()
Instantiate an empty T in here.
Definition: parse.hh:199
semantic_type value
The semantic value.
Definition: parse.hh:432
stack_symbol_type()
Construct an empty symbol.
Definition: parse.cc:312
bool empty() const
Whether empty.
Definition: parse.hh:994
void yy_destroy_(const char *yymsg, basic_symbol< Base > &yysym) const
Reclaim the memory associated to a symbol.
Definition: parse.cc:397
static bool yy_table_value_is_error_(int yyvalue)
Whether the given yytable_ value indicates a syntax error.
Definition: parse.cc:602
#define YYCDEBUG
Definition: parse.cc:167
Termination state number.
Definition: parse.hh:751
static const signed char yypgoto_[]
Definition: parse.hh:619
static const char *const yytname_[]
For a symbol, its name in clear.
Definition: parse.hh:647
Type access provider for state based symbols.
Definition: parse.hh:676
if(exp.max==-1)
Definition: multiply.hh:381
Last index in yytable_.
Definition: parse.hh:749