Vcsn  2.5.dev
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: // "identifier"
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: // "identifier"
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: // "identifier"
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 282 "/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: // "identifier"
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 203 "/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 209 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
845  {}
846 #line 847 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
847  break;
848 
849  case 14:
850 #line 214 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
851  {
852  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 > ());
853  }
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  { yylhs.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 223 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
865  { std::swap(yylhs.value.as< string_t > (), yystack_[0].value.as< string_t > ()); }
866 #line 867 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
867  break;
868 
869  case 17:
870 #line 228 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
871  {
872  static const auto label = string_t{"label"};
873  static const auto ctx = string_t{"vcsn_context"};
874  if (yystack_[2].value.as< string_t > () == label)
875  std::swap(yylhs.value.as< string_t > (), yystack_[0].value.as< string_t > ());
876  else if (yystack_[2].value.as< string_t > () == ctx)
877  driver_.setup_(yystack_[0].location, yystack_[0].value.as< string_t > ());
878  else
879  // Beware of the default "$$ = $1;" action.
880  yylhs.value.as< string_t > () = "";
881  }
882 #line 883 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
883  break;
884 
885  case 18:
886 #line 243 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
887  {
888  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 > ());
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 //- {}
896 //-#line 897 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
897 //- break;
898 
899  case 25:
900 #line 260 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
901  {}
902 #line 903 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
903  break;
904 
905  case 26:
906 #line 261 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
907  { std::swap(yylhs.value.as< string_t > (), yystack_[0].value.as< string_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 265 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
913  { yylhs.value.as< states_t > ().emplace_back(std::move(yystack_[0].value.as< string_t > ())); }
914 #line 915 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
915  break;
916 
917  case 28:
918 #line 266 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
919  { yylhs.value.as< states_t > () = yystack_[0].value.as< states_t > (); }
920 #line 921 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
921  break;
922 
923  case 29:
924 #line 285 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
925  {
926  for (auto s1: yystack_[2].value.as< states_t > ())
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 30:
935 #line 292 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
936  {
937  std::swap(yylhs.value.as< paths_t > ().transitions, yystack_[2].value.as< paths_t > ().transitions);
938  for (auto s1: yystack_[2].value.as< paths_t > ().ends)
939  for (auto s2: yystack_[0].value.as< states_t > ())
940  yylhs.value.as< paths_t > ().transitions.emplace_back(s1, s2);
941  yylhs.value.as< paths_t > ().ends = yystack_[0].value.as< states_t > ();
942  }
943 #line 944 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
944  break;
945 
946  case 31:
947 #line 303 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
948  {
949  if (driver_.has_edit_(yystack_[1].location))
950  for (auto t: yystack_[1].value.as< paths_t > ().transitions)
951  TRY(yystack_[0].location, driver_.edit_->add_entry(t.first, t.second, yystack_[0].value.as< string_t > ()));
952  }
953 #line 954 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
954  break;
955 
956  case 32:
957 #line 312 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
958  {
959  std::swap(yylhs.value.as< string_t > (), yystack_[1].value.as< string_t > ());
960  }
961 #line 962 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
962  break;
963 
964  case 33:
965 #line 319 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
966  {
967  std::swap(yylhs.value.as< string_t > (), yystack_[1].value.as< string_t > ());
968  if (driver_.has_edit_(yystack_[1].location))
969  {
970  if (yylhs.value.as< string_t > ().get()[0] == 'I')
971  TRY(yystack_[1].location, driver_.edit_->add_pre(yylhs.value.as< string_t > ()));
972  else if (yylhs.value.as< string_t > ().get()[0] == 'F')
973  TRY(yystack_[1].location, driver_.edit_->add_post(yylhs.value.as< string_t > ()));
974  else
975  // This is not needed, but it ensures that the states will be
976  // numbered by their order of appearance in the file.
977  TRY(yystack_[1].location, driver_.edit_->add_state(yylhs.value.as< string_t > ()));
978  }
979  }
980 #line 981 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
981  break;
982 
983  case 34:
984 //-#line 340 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
985 //- {}
986 //-#line 987 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
987 //- break;
988 
989  case 35:
990 //-#line 341 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
991 //- {}
992 //-#line 993 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
993 //- break;
994 
995  case 36:
996 #line 342 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
997  {}
998 #line 999 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
999  break;
1000 
1001  case 37:
1002 //-#line 346 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
1003 //- { std::swap(yylhs.value.as< states_t > (), yystack_[1].value.as< states_t > ()); }
1004 //-#line 1005 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
1005 //- break;
1006 
1007  case 38:
1008 #line 347 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
1009  { std::swap(yylhs.value.as< states_t > (), yystack_[1].value.as< states_t > ()); }
1010 #line 1011 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
1011  break;
1012 
1013  case 39:
1014 #line 351 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
1015  {}
1016 #line 1017 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
1017  break;
1018 
1019  case 40:
1020 #line 352 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:859
1021  { std::swap(yylhs.value.as< string_t > (), yystack_[0].value.as< string_t > ()); }
1022 #line 1023 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
1023  break;
1024 
1025 
1026 #line 1027 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:859
1027  default:
1028  break;
1029  }
1030  }
1031  catch (const syntax_error& yyexc)
1032  {
1033  error (yyexc);
1034  YYERROR;
1035  }
1036  YY_SYMBOL_PRINT ("-> $$ =", yylhs);
1037  yypop_ (yylen);
1038  yylen = 0;
1039  YY_STACK_PRINT ();
1040 
1041  // Shift the result of the reduction.
1042  yypush_ (YY_NULLPTR, yylhs);
1043  }
1044  goto yynewstate;
1045 
1046  /*--------------------------------------.
1047  | yyerrlab -- here on detecting error. |
1048  `--------------------------------------*/
1049  yyerrlab:
1050  // If not already recovering from an error, report this error.
1051  if (!yyerrstatus_)
1052  {
1053  ++yynerrs_;
1054  error (yyla.location, yysyntax_error_ (yystack_[0].state, yyla));
1055  }
1056 
1057 
1058  yyerror_range[1].location = yyla.location;
1059  if (yyerrstatus_ == 3)
1060  {
1061  /* If just tried and failed to reuse lookahead token after an
1062  error, discard it. */
1063 
1064  // Return failure if at end of input.
1065  if (yyla.type_get () == yyeof_)
1066  YYABORT;
1067  else if (!yyla.empty ())
1068  {
1069  yy_destroy_ ("Error: discarding", yyla);
1070  yyla.clear ();
1071  }
1072  }
1073 
1074  // Else will try to reuse lookahead token after shifting the error token.
1075  goto yyerrlab1;
1076 
1077 
1078  /*---------------------------------------------------.
1079  | yyerrorlab -- error raised explicitly by YYERROR. |
1080  `---------------------------------------------------*/
1081  yyerrorlab:
1082 
1083  /* Pacify compilers like GCC when the user code never invokes
1084  YYERROR and the label yyerrorlab therefore never appears in user
1085  code. */
1086  if (false)
1087  goto yyerrorlab;
1088  yyerror_range[1].location = yystack_[yylen].location;
1089  /* Do not reclaim the symbols of the rule whose action triggered
1090  this YYERROR. */
1091  yypop_ (yylen);
1092  yylen = 0;
1093  goto yyerrlab1;
1094 
1095  /*-------------------------------------------------------------.
1096  | yyerrlab1 -- common code for both syntax error and YYERROR. |
1097  `-------------------------------------------------------------*/
1098  yyerrlab1:
1099  yyerrstatus_ = 3; // Each real token shifted decrements this.
1100  {
1101  stack_symbol_type error_token;
1102  for (;;)
1103  {
1104  yyn = yypact_[yystack_[0].state];
1105  if (!yy_pact_value_is_default_ (yyn))
1106  {
1107  yyn += yyterror_;
1108  if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
1109  {
1110  yyn = yytable_[yyn];
1111  if (0 < yyn)
1112  break;
1113  }
1114  }
1115 
1116  // Pop the current state because it cannot handle the error token.
1117  if (yystack_.size () == 1)
1118  YYABORT;
1119 
1120  yyerror_range[1].location = yystack_[0].location;
1121  yy_destroy_ ("Error: popping", yystack_[0]);
1122  yypop_ ();
1123  YY_STACK_PRINT ();
1124  }
1125 
1126  yyerror_range[2].location = yyla.location;
1127  YYLLOC_DEFAULT (error_token.location, yyerror_range, 2);
1128 
1129  // Shift the error token.
1130  error_token.state = yyn;
1131  yypush_ ("Shifting", error_token);
1132  }
1133  goto yynewstate;
1134 
1135  // Accept.
1136  yyacceptlab:
1137  yyresult = 0;
1138  goto yyreturn;
1139 
1140  // Abort.
1141  yyabortlab:
1142  yyresult = 1;
1143  goto yyreturn;
1144 
1145  yyreturn:
1146  if (!yyla.empty ())
1147  yy_destroy_ ("Cleanup: discarding lookahead", yyla);
1148 
1149  /* Do not reclaim the symbols of the rule whose action triggered
1150  this YYABORT or YYACCEPT. */
1151  yypop_ (yylen);
1152  while (1 < yystack_.size ())
1153  {
1154  yy_destroy_ ("Cleanup: popping", yystack_[0]);
1155  yypop_ ();
1156  }
1157 
1158  return yyresult;
1159  }
1160  catch (...)
1161  {
1162  YYCDEBUG << "Exception caught: cleaning lookahead and stack"
1163  << std::endl;
1164  // Do not try to display the values of the reclaimed symbols,
1165  // as their printer might throw an exception.
1166  if (!yyla.empty ())
1167  yy_destroy_ (YY_NULLPTR, yyla);
1168 
1169  while (1 < yystack_.size ())
1170  {
1172  yypop_ ();
1173  }
1174  throw;
1175  }
1176  }
1177 
1178  void
1180  {
1181  error (yyexc.location, yyexc.what());
1182  }
1183 
1184  // Generate an error message.
1185  std::string
1186  parser::yysyntax_error_ (state_type yystate, const symbol_type& yyla) const
1187  {
1188  // Number of reported tokens (one for the "unexpected", one per
1189  // "expected").
1190  size_t yycount = 0;
1191  // Its maximum.
1192  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1193  // Arguments of yyformat.
1194  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1195 
1196  /* There are many possibilities here to consider:
1197  - If this state is a consistent state with a default action, then
1198  the only way this function was invoked is if the default action
1199  is an error action. In that case, don't check for expected
1200  tokens because there are none.
1201  - The only way there can be no lookahead present (in yyla) is
1202  if this state is a consistent state with a default action.
1203  Thus, detecting the absence of a lookahead is sufficient to
1204  determine that there is no unexpected or expected token to
1205  report. In that case, just report a simple "syntax error".
1206  - Don't assume there isn't a lookahead just because this state is
1207  a consistent state with a default action. There might have
1208  been a previous inconsistent state, consistent state with a
1209  non-default action, or user semantic action that manipulated
1210  yyla. (However, yyla is currently not documented for users.)
1211  - Of course, the expected token list depends on states to have
1212  correct lookahead information, and it depends on the parser not
1213  to perform extra reductions after fetching a lookahead from the
1214  scanner and before detecting a syntax error. Thus, state
1215  merging (from LALR or IELR) and default reductions corrupt the
1216  expected token list. However, the list is correct for
1217  canonical LR with one exception: it will still contain any
1218  token that will not be accepted due to an error action in a
1219  later state.
1220  */
1221  if (!yyla.empty ())
1222  {
1223  int yytoken = yyla.type_get ();
1224  yyarg[yycount++] = yytname_[yytoken];
1225  int yyn = yypact_[yystate];
1226  if (!yy_pact_value_is_default_ (yyn))
1227  {
1228  /* Start YYX at -YYN if negative to avoid negative indexes in
1229  YYCHECK. In other words, skip the first -YYN actions for
1230  this state because they are default actions. */
1231  int yyxbegin = yyn < 0 ? -yyn : 0;
1232  // Stay within bounds of both yycheck and yytname.
1233  int yychecklim = yylast_ - yyn + 1;
1234  int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
1235  for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
1236  if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_
1237  && !yy_table_value_is_error_ (yytable_[yyx + yyn]))
1238  {
1239  if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1240  {
1241  yycount = 1;
1242  break;
1243  }
1244  else
1245  yyarg[yycount++] = yytname_[yyx];
1246  }
1247  }
1248  }
1249 
1250  char const* yyformat = YY_NULLPTR;
1251  switch (yycount)
1252  {
1253 #define YYCASE_(N, S) \
1254  case N: \
1255  yyformat = S; \
1256  break
1257  YYCASE_(0, YY_("syntax error"));
1258  YYCASE_(1, YY_("syntax error, unexpected %s"));
1259  YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1260  YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1261  YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1262  YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1263 #undef YYCASE_
1264  }
1265 
1266  std::string yyres;
1267  // Argument number.
1268  size_t yyi = 0;
1269  for (char const* yyp = yyformat; *yyp; ++yyp)
1270  if (yyp[0] == '%' && yyp[1] == 's' && yyi < yycount)
1271  {
1272  yyres += yytnamerr_ (yyarg[yyi++]);
1273  ++yyp;
1274  }
1275  else
1276  yyres += *yyp;
1277  return yyres;
1278  }
1279 
1280 
1281  const signed char parser::yypact_ninf_ = -24;
1282 
1283  const signed char parser::yytable_ninf_ = -29;
1284 
1285  const signed char
1286  parser::yypact_[] =
1287  {
1288  0, 9, 33, -24, 31, -24, -24, 1, -24, 37,
1289  37, 37, 9, -24, -24, 34, 44, -24, -24, 39,
1290  4, -24, -24, 17, 48, 14, -24, -24, -24, 41,
1291  15, 45, 46, -24, -24, -24, 21, 21, -24, -24,
1292  -24, -24, 52, 35, -24, 54, -24, -24, -24, 53,
1293  55, -24, -24, -24, -24, -24, -24, 14, 37, 36,
1294  49, -24, -24, -24, -24
1295  };
1296 
1297  const unsigned char
1298  parser::yydefact_[] =
1299  {
1300  0, 39, 0, 40, 0, 1, 3, 0, 10, 0,
1301  0, 0, 39, 3, 2, 34, 22, 7, 8, 0,
1302  15, 6, 5, 15, 9, 0, 13, 11, 12, 0,
1303  0, 0, 0, 33, 23, 4, 0, 0, 16, 31,
1304  32, 25, 0, 19, 26, 0, 3, 38, 17, 35,
1305  34, 29, 27, 28, 30, 20, 21, 0, 15, 0,
1306  0, 18, 14, 37, 36
1307  };
1308 
1309  const signed char
1310  parser::yypgoto_[] =
1311  {
1312  -24, -24, -12, -24, -24, 2, -23, -21, -24, -24,
1313  -24, 11, 18, -24, -24, -24, 20, -24, 22, 58
1314  };
1315 
1316  const signed char
1317  parser::yydefgoto_[] =
1318  {
1319  -1, 2, 7, 16, 17, 38, 39, 18, 44, 57,
1320  35, 45, 19, 20, 21, 22, 23, 33, 24, 4
1321  };
1322 
1323  const signed char
1324  parser::yytable_[] =
1325  {
1326  40, 30, 8, 1, 43, 9, 10, 11, 12, 13,
1327  14, 26, 27, 28, 25, 41, 8, 37, 15, 9,
1328  10, 11, 12, 13, 47, -24, 3, 25, 12, 13,
1329  -27, 42, 15, 5, 59, 62, 43, 8, 50, 6,
1330  9, 10, 11, 12, 13, 63, 31, 25, 32, 46,
1331  55, 56, 36, 15, 51, 54, 52, 52, 53, 53,
1332  34, -28, 48, 49, 31, 58, 64, 60, 61, 32,
1333  29
1334  };
1335 
1336  const unsigned char
1337  parser::yycheck_[] =
1338  {
1339  23, 13, 1, 3, 25, 4, 5, 6, 7, 8,
1340  9, 9, 10, 11, 10, 1, 1, 13, 17, 4,
1341  5, 6, 7, 8, 9, 11, 17, 10, 7, 8,
1342  13, 17, 17, 0, 46, 58, 57, 1, 17, 8,
1343  4, 5, 6, 7, 8, 9, 12, 10, 14, 8,
1344  15, 16, 13, 17, 36, 37, 36, 37, 36, 37,
1345  16, 13, 17, 17, 12, 11, 17, 14, 57, 14,
1346  12
1347  };
1348 
1349  const unsigned char
1350  parser::yystos_[] =
1351  {
1352  0, 3, 19, 17, 37, 0, 8, 20, 1, 4,
1353  5, 6, 7, 8, 9, 17, 21, 22, 25, 30,
1354  31, 32, 33, 34, 36, 10, 23, 23, 23, 37,
1355  20, 12, 14, 35, 16, 28, 13, 13, 23, 24,
1356  24, 1, 17, 25, 26, 29, 8, 9, 17, 17,
1357  17, 30, 34, 36, 30, 15, 16, 27, 11, 20,
1358  14, 29, 24, 9, 17
1359  };
1360 
1361  const unsigned char
1362  parser::yyr1_[] =
1363  {
1364  0, 18, 19, 20, 20, 21, 21, 21, 21, 21,
1365  21, 22, 22, 22, 23, 24, 24, 25, 26, 27,
1366  27, 27, 28, 28, 29, 29, 29, 30, 30, 31,
1367  31, 32, 33, 34, 35, 35, 35, 36, 36, 37,
1368  37
1369  };
1370 
1371  const unsigned char
1372  parser::yyr2_[] =
1373  {
1374  0, 2, 5, 0, 3, 1, 1, 1, 1, 1,
1375  1, 2, 2, 2, 4, 0, 1, 3, 3, 0,
1376  1, 1, 0, 1, 0, 1, 1, 1, 1, 3,
1377  3, 2, 2, 2, 0, 2, 4, 5, 3, 0,
1378  1
1379  };
1380 
1381 
1382 
1383  // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1384  // First, the terminals, then, starting at \a yyntokens_, nonterminals.
1385  const char*
1386  const parser::yytname_[] =
1387  {
1388  "\"end\"", "error", "$undefined", "\"digraph\"", "\"edge\"",
1389  "\"graph\"", "\"node\"", "\"subgraph\"", "\"{\"", "\"}\"", "\"[\"",
1390  "\"]\"", "\"=\"", "\"->\"", "\":\"", "\",\"", "\";\"", "\"identifier\"",
1391  "$accept", "graph", "stmt_list", "stmt", "attr_stmt", "attr_list",
1392  "attr_list.opt", "attr_assign", "a_list.1", "comma.opt", "semi.opt",
1393  "a_list.0", "nodes", "path", "edge_stmt", "node_stmt", "node_id",
1394  "port.opt", "subgraph", "id.opt", YY_NULLPTR
1395  };
1396 
1397 #if YYDEBUG
1398  const unsigned short int
1399  parser::yyrline_[] =
1400  {
1401  0, 183, 183, 187, 188, 198, 199, 200, 201, 202,
1402  203, 207, 208, 209, 213, 222, 223, 227, 242, 249,
1403  249, 249, 253, 254, 259, 260, 261, 265, 266, 284,
1404  291, 302, 311, 318, 340, 341, 342, 346, 347, 351,
1405  352
1406  };
1407 
1408  // Print the state stack on the debug stream.
1409  void
1411  {
1412  *yycdebug_ << "Stack now";
1414  i = yystack_.begin (),
1415  i_end = yystack_.end ();
1416  i != i_end; ++i)
1417  *yycdebug_ << ' ' << i->state;
1418  *yycdebug_ << std::endl;
1419  }
1420 
1421  // Report on the debug stream that the rule \a yyrule is going to be reduced.
1422  void
1424  {
1425  unsigned int yylno = yyrline_[yyrule];
1426  int yynrhs = yyr2_[yyrule];
1427  // Print the symbols being reduced, and their result.
1428  *yycdebug_ << "Reducing stack by rule " << yyrule - 1
1429  << " (line " << yylno << "):" << std::endl;
1430  // The symbols being reduced.
1431  for (int yyi = 0; yyi < yynrhs; yyi++)
1432  YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
1433  yystack_[(yynrhs) - (yyi + 1)]);
1434  }
1435 #endif // YYDEBUG
1436 
1437 
1438 #line 11 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:1167
1439 } } } // vcsn::detail::dot
1440 #line 1441 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.cc" // lalr1.cc:1167
1441 #line 354 "/Users/akim/src/lrde/2/lib/vcsn/dot/parse.yy" // lalr1.cc:1168
1442 
1443 
1444 namespace vcsn
1445 {
1446  namespace detail
1447  {
1448  namespace dot
1449  {
1450  void
1451  parser::error(const location_type& l, const std::string& m)
1452  {
1453  driver_.error(l, m);
1454  }
1455  }
1456  }
1457 }
debug_level_type debug_level() const
The current debugging level.
Definition: parse.cc:573
Abstract a location.
Definition: location.hh:47
#define YY_SYMBOL_PRINT(Title, Symbol)
Definition: parse.cc:169
std::ostream & dot(const Aut &aut, std::ostream &out=std::cout, format fmt={}, bool mathjax=false)
Print an automaton in Graphviz&#39;s Dot format.
Definition: dot.hh:435
void move(self_type &other)
Move the content of other to this.
Definition: parse.hh:248
stack_symbol_type()
Construct an empty symbol.
Definition: parse.cc:312
void set_debug_stream(std::ostream &)
Set the current debugging stream.
Definition: parse.cc:566
transitions_t transitions
Definition: parse.hh:77
void move(basic_symbol &s)
Destructive move, s is emptied into this.
Definition: parse.hh:1002
T & build()
Instantiate an empty T in here.
Definition: parse.hh:199
static const unsigned char yystos_[]
Definition: parse.hh:633
#define YYLLOC_DEFAULT(Current, Rhs, N)
Definition: parse.cc:145
#define YYCASE_(N, S)
void push(T &t)
Steal the contents of t.
Definition: stack.hh:83
location_t location_
The inital location.
Definition: driver.hh:53
static const char *const yytname_[]
For a symbol, its name in clear.
Definition: parse.hh:647
void swap(config::config_value &first, config::config_value &second)
static std::string yytnamerr_(const char *n)
Convert the symbol name n to a form suitable for a diagnostic.
Definition: parse.cc:218
stack_type yystack_
The stack.
Definition: parse.hh:725
bool empty() const
Whether empty.
Definition: parse.hh:994
Define the vcsn::detail::dot::parser class.
virtual void yystack_print_()
Print the state stack on the debug stream.
Definition: parse.cc:1410
symbol string_t
Definition: parse.hh:66
#define YY_REDUCE_PRINT(Rule)
Definition: parse.cc:179
Type access provider for state based symbols.
Definition: parse.hh:676
void clear()
Record that this symbol is empty.
Definition: parse.cc:283
std::unique_ptr< yyFlexLexer > scanner_
The scanner.
Definition: driver.hh:40
#define YY_STACK_PRINT()
Definition: parse.cc:185
void pop(unsigned int n=1)
Definition: stack.hh:91
auto transitions(const Aut &aut) -> decltype(all_transitions(aut, is_special_t< Aut >
All the transition indexes between visible states.
Definition: automaton.hh:248
Termination state number.
Definition: parse.hh:751
const_iterator end() const
Definition: stack.hh:119
void yy_destroy_(const char *yymsg, basic_symbol< Base > &yysym) const
Reclaim the memory associated to a symbol.
Definition: parse.cc:397
semantic_type value
The semantic value.
Definition: parse.hh:432
stack_symbol_type & operator=(const stack_symbol_type &that)
Assignment, needed by push_back.
Definition: parse.cc:356
Present a slice of the top of a stack.
Definition: stack.hh:133
virtual int parse()
Parse.
Definition: parse.cc:608
static const signed char yypact_ninf_
Definition: parse.hh:602
static const signed char yypgoto_[]
Definition: parse.hh:619
static parser::symbol_type yylex(driver &driver_)
Use our local scanner object.
Definition: parse.cc:116
std::vector< string_t > states_t
Definition: parse.hh:69
static const unsigned char yycheck_[]
Definition: parse.hh:629
location(const position &b, const position &e)
Construct a location from b to e.
Definition: location.hh:52
#define YY_(msgid)
Definition: parse.cc:135
std::ostream * yycdebug_
Definition: parse.hh:658
parser(driver &driver__yyarg)
Build a parser object.
Definition: parse.cc:251
int symbol_number_type
Symbol type: an internal symbol number.
Definition: parse.hh:377
static const signed char yypact_[]
Definition: parse.hh:611
static const unsigned short int yyrline_[]
Definition: parse.hh:650
#define YYDEBUG
Definition: parse.hh:160
void clear()
Destroy contents, and record that is empty.
Definition: parse.hh:945
virtual void error(const location_type &loc, const std::string &msg)
Report a syntax error.
Definition: parse.cc:1451
State and public interface for Dot parsing.
Definition: driver.hh:19
T & as()
Accessor to a built T.
Definition: parse.hh:215
static const unsigned char yydefact_[]
Definition: parse.hh:616
static const unsigned char yyr2_[]
Definition: parse.hh:639
Syntax errors thrown from user actions.
Definition: parse.hh:343
virtual void yy_reduce_print_(int r)
Report on the debug stream that the rule r is going to be reduced.
Definition: parse.cc:1423
static bool yy_pact_value_is_default_(int yyvalue)
Whether the given yypact_ value indicates a defaulted state.
Definition: parse.cc:596
void setup_(const location_t &l, const std::string &ctx)
From context_, build edit_.
Definition: driver.cc:56
static const signed char yytable_[]
Definition: parse.hh:627
void yy_print_(std::ostream &yyo, const basic_symbol< Base > &yysym) const
Display a symbol type, value and location.
Definition: parse.cc:406
void move(by_state &that)
Steal the symbol type from that.
Definition: parse.cc:290
Last index in yytable_.
Definition: parse.hh:749
if(exp.max==-1)
Definition: multiply.hh:382
static const signed char yytable_ninf_
Definition: parse.hh:603
state_type yy_lr_goto_state_(state_type yystate, int yysym)
Compute post-reduction state.
Definition: parse.cc:586
"Internal" symbol: element of the stack.
Definition: parse.hh:709
void yypop_(unsigned int n=1)
Pop n symbols the three stacks.
Definition: parse.cc:553
Definition: a-star.hh:8
value_impl< detail::label_tag > label
Definition: fwd.hh:32
virtual std::string yysyntax_error_(state_type yystate, const symbol_type &yyla) const
Generate an error message.
Definition: parse.cc:1186
void set_debug_level(debug_level_type l)
Set the current debugging level.
Definition: parse.cc:579
static std::ostream & operator<<(std::ostream &o, const states_t ss)
Definition: parse.cc:83
void error(const location_t &l, const std::string &m)
Report an error m at l.
Definition: driver.cc:84
symbol_number_type type_get() const
The (internal) type number (corresponding to state).
Definition: parse.cc:303
void copy(const self_type &other)
Copy the content of other to this.
Definition: parse.hh:258
int debug_level_type
Type for debugging levels.
Definition: parse.hh:560
std::shared_ptr< vcsn::automaton_editor > edit_
An automaton editor that stores the one being built.
Definition: driver.hh:55
int state_type
State numbers.
Definition: parse.hh:581
#define YYCDEBUG
Definition: parse.cc:167
state_type state
The state.
Definition: parse.hh:705
#define YYERROR
Definition: parse.cc:205
#define YYABORT
Definition: parse.cc:204
const_iterator begin() const
Definition: stack.hh:112
static const signed char yydefgoto_[]
Definition: parse.hh:622
S::size_type size() const
Definition: stack.hh:105
#define TRY(Loc, Stm)
Run Stm, and bounces exceptions into parse errors at Loc.
Definition: parse.cc:36
by_state()
Default constructor.
Definition: parse.cc:272
std::vector< stack_symbol_type > ::const_reverse_iterator const_iterator
Definition: stack.hh:52
STL namespace.
static bool yy_table_value_is_error_(int yyvalue)
Whether the given yytable_ value indicates a syntax error.
Definition: parse.cc:602
void yypush_(const char *m, stack_symbol_type &s)
Push a new state on the stack.
Definition: parse.cc:544
location_type location
The location.
Definition: parse.hh:435
bool has_edit_(const location_t &l)
Require that vcsn_context was defined.
Definition: driver.cc:71
static const unsigned char yyr1_[]
Definition: parse.hh:636
#define YYUSE(E)
Definition: parse.cc:161
std::ostream & debug_stream() const
The current debugging stream.
Definition: parse.cc:560
#define YY_NULLPTR
Definition: parse.cc:60