47 #define YYBISON_VERSION "2.7"
50 #define YYSKELETON_NAME "yacc.c"
66 #line 14 "../../lib/cgraph/grammar.y"
74 #define gettxt(a,b) (b)
77 static char Key[] =
"key";
108 static void appendnode(
char *name,
char *
port,
char *sport);
109 static void attrstmt(
int tkind,
char *macroname);
110 static void startgraph(
char *name,
int directed,
int strict);
111 static void getedgeitems(
int x);
112 static void newedge(
Agnode_t *t,
char *tport,
Agnode_t *h,
char *hport,
char *key);
113 static void edgerhs(
Agnode_t *n,
char *tport,
item *hlist,
char *key);
114 static void appendattr(
char *name,
char *value);
115 static void bindattrs(
int kind);
116 static void applyattrs(
void *obj);
117 static void endgraph(
void);
118 static void endnode(
void);
119 static void endedge(
void);
120 static void freestack(
void);
121 static char* concat(
char*,
char*);
122 static char* concatPort(
char*,
char*);
124 static void opensubg(
char *name);
125 static void closesubg(
void);
137 # if defined __cplusplus && 201103L <= __cplusplus
138 # define YY_NULL nullptr
145 #ifdef YYERROR_VERBOSE
146 # undef YYERROR_VERBOSE
147 # define YYERROR_VERBOSE 1
149 # define YYERROR_VERBOSE 0
154 #ifndef YY_YY_Y_TAB_H_INCLUDED
155 # define YY_YY_Y_TAB_H_INCLUDED
187 #define T_digraph 261
188 #define T_subgraph 262
198 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
202 #line 81 "../../lib/cgraph/grammar.y"
212 # define YYSTYPE_IS_TRIVIAL 1
213 # define yystype YYSTYPE
214 # define YYSTYPE_IS_DECLARED 1
220 #if defined __STDC__ || defined __cplusplus
221 int yyparse (
void *YYPARSE_PARAM);
226 #if defined __STDC__ || defined __cplusplus
252 #elif (defined __STDC__ || defined __C99__FUNC__ \
253 || defined __cplusplus || defined _MSC_VER)
272 # ifdef __SIZE_TYPE__
273 # define YYSIZE_T __SIZE_TYPE__
274 # elif defined size_t
275 # define YYSIZE_T size_t
276 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
277 || defined __cplusplus || defined _MSC_VER)
279 # define YYSIZE_T size_t
281 # define YYSIZE_T unsigned int
285 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
288 # if defined YYENABLE_NLS && YYENABLE_NLS
290 # include <libintl.h>
291 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
295 # define YY_(Msgid) Msgid
300 #if ! defined lint || defined __GNUC__
301 # define YYUSE(E) ((void) (E))
310 #if (defined __STDC__ || defined __C99__FUNC__ \
311 || defined __cplusplus || defined _MSC_VER)
324 #if ! defined yyoverflow || YYERROR_VERBOSE
328 # ifdef YYSTACK_USE_ALLOCA
329 # if YYSTACK_USE_ALLOCA
331 # define YYSTACK_ALLOC __builtin_alloca
332 # elif defined __BUILTIN_VA_ARG_INCR
335 # define YYSTACK_ALLOC __alloca
336 # elif defined _MSC_VER
338 # define alloca _alloca
340 # define YYSTACK_ALLOC alloca
341 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
342 || defined __cplusplus || defined _MSC_VER)
345 # ifndef EXIT_SUCCESS
346 # define EXIT_SUCCESS 0
353 # ifdef YYSTACK_ALLOC
355 # define YYSTACK_FREE(Ptr) do { ; } while (YYID (0))
356 # ifndef YYSTACK_ALLOC_MAXIMUM
361 # define YYSTACK_ALLOC_MAXIMUM 4032
364 # define YYSTACK_ALLOC YYMALLOC
365 # define YYSTACK_FREE YYFREE
366 # ifndef YYSTACK_ALLOC_MAXIMUM
367 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
369 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
370 && ! ((defined YYMALLOC || defined malloc) \
371 && (defined YYFREE || defined free)))
373 # ifndef EXIT_SUCCESS
374 # define EXIT_SUCCESS 0
378 # define YYMALLOC malloc
379 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
380 || defined __cplusplus || defined _MSC_VER)
386 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
387 || defined __cplusplus || defined _MSC_VER)
395 #if (! defined yyoverflow \
396 && (! defined __cplusplus \
397 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
407 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
411 # define YYSTACK_BYTES(N) \
412 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
413 + YYSTACK_GAP_MAXIMUM)
415 # define YYCOPY_NEEDED 1
422 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
425 YYSIZE_T yynewbytes; \
426 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
427 Stack = &yyptr->Stack_alloc; \
428 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
429 yyptr += yynewbytes / sizeof (*yyptr); \
435 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
439 # if defined __GNUC__ && 1 < __GNUC__
440 # define YYCOPY(Dst, Src, Count) \
441 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
443 # define YYCOPY(Dst, Src, Count) \
447 for (yyi = 0; yyi < (Count); yyi++) \
448 (Dst)[yyi] = (Src)[yyi]; \
471 #define YYMAXUTOK 268
473 #define YYTRANSLATE(YYX) \
474 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
479 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
480 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
481 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
483 2, 2, 2, 23, 17, 2, 2, 2, 2, 2,
484 2, 2, 2, 2, 2, 2, 2, 2, 18, 16,
485 2, 19, 2, 2, 22, 2, 2, 2, 2, 2,
486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
488 2, 20, 2, 21, 2, 2, 2, 2, 2, 2,
489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
491 2, 2, 2, 14, 2, 15, 2, 2, 2, 2,
492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
499 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
505 5, 6, 7, 8, 9, 10, 11, 12, 13
513 0, 0, 3, 6, 8, 9, 13, 17, 19, 20,
514 22, 23, 25, 27, 29, 30, 33, 35, 37, 38,
515 41, 44, 48, 50, 52, 53, 54, 60, 61, 63,
516 67, 69, 73, 79, 83, 85, 87, 89, 91, 94,
517 95, 97, 98, 103, 106, 107, 110, 112, 114, 118,
518 121, 123, 124, 128, 131, 133, 134, 136, 138, 139,
525 25, 0, -1, 27, 26, -1, 1, -1, -1, 14,
526 31, 15, -1, 29, 30, 28, -1, 57, -1, -1,
527 8, -1, -1, 3, -1, 6, -1, 32, -1, -1,
528 32, 34, -1, 34, -1, 16, -1, -1, 42, 33,
529 -1, 35, 33, -1, 36, 37, 45, -1, 40, -1,
530 53, -1, -1, -1, 9, 38, 36, 39, 37, -1,
531 -1, 41, -1, 40, 17, 41, -1, 57, -1, 57,
532 18, 57, -1, 57, 18, 57, 18, 57, -1, 43,
533 44, 46, -1, 52, -1, 3, -1, 4, -1, 5,
534 -1, 57, 19, -1, -1, 46, -1, -1, 45, 20,
535 47, 21, -1, 47, 48, -1, -1, 49, 56, -1,
536 50, -1, 51, -1, 57, 19, 57, -1, 22, 57,
537 -1, 50, -1, -1, 55, 54, 26, -1, 7, 57,
538 -1, 7, -1, -1, 16, -1, 17, -1, -1, 12,
539 -1, 58, -1, 13, -1, 58, 23, 13, -1
545 0, 98, 98, 99, 100, 103, 105, 108, 108, 110,
546 110, 112, 112, 114, 114, 116, 116, 118, 118, 120,
547 121, 124, 128, 128, 130, 130, 130, 131, 135, 135,
548 137, 138, 139, 142, 143, 146, 147, 148, 151, 152,
549 155, 155, 157, 159, 160, 162, 165, 165, 167, 170,
550 173, 176, 176, 179, 180, 181, 184, 184, 184, 186,
555 #if YYDEBUG || YYERROR_VERBOSE || 0
558 static const char *
const yytname[] =
560 "$end",
"error",
"$undefined",
"T_graph",
"T_node",
"T_edge",
561 "T_digraph",
"T_subgraph",
"T_strict",
"T_edgeop",
"T_list",
"T_attr",
562 "T_atom",
"T_qatom",
"'{'",
"'}'",
"';'",
"','",
"':'",
"'='",
"'['",
563 "']'",
"'@'",
"'+'",
"$accept",
"graph",
"body",
"hdr",
"optgraphname",
564 "optstrict",
"graphtype",
"optstmtlist",
"stmtlist",
"optsemi",
"stmt",
565 "compound",
"simple",
"rcompound",
"$@1",
"$@2",
"nodelist",
"node",
566 "attrstmt",
"attrtype",
"optmacroname",
"optattr",
"attrlist",
567 "optattrdefs",
"attrdefs",
"attritem",
"attrassignment",
"attrmacro",
568 "graphattrdefs",
"subgraph",
"$@3",
"optsubghdr",
"optseparator",
"atom",
578 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
579 265, 266, 267, 268, 123, 125, 59, 44, 58, 61,
587 0, 24, 25, 25, 25, 26, 27, 28, 28, 29,
588 29, 30, 30, 31, 31, 32, 32, 33, 33, 34,
589 34, 35, 36, 36, 38, 39, 37, 37, 40, 40,
590 41, 41, 41, 42, 42, 43, 43, 43, 44, 44,
591 45, 45, 46, 47, 47, 48, 49, 49, 50, 51,
592 52, 54, 53, 55, 55, 55, 56, 56, 56, 57,
599 0, 2, 2, 1, 0, 3, 3, 1, 0, 1,
600 0, 1, 1, 1, 0, 2, 1, 1, 0, 2,
601 2, 3, 1, 1, 0, 0, 5, 0, 1, 3,
602 1, 3, 5, 3, 1, 1, 1, 1, 2, 0,
603 1, 0, 4, 2, 0, 2, 1, 1, 3, 2,
604 1, 0, 3, 2, 1, 0, 1, 1, 0, 1,
613 0, 3, 9, 0, 0, 0, 1, 14, 2, 11,
614 12, 8, 35, 36, 37, 54, 59, 61, 0, 13,
615 16, 18, 27, 22, 28, 18, 39, 50, 34, 23,
616 51, 30, 60, 6, 7, 53, 5, 15, 17, 20,
617 24, 41, 0, 19, 41, 0, 0, 0, 0, 0,
618 55, 21, 40, 29, 30, 0, 33, 38, 52, 31,
619 48, 62, 25, 44, 0, 27, 0, 32, 26, 42,
620 0, 43, 58, 46, 47, 0, 49, 56, 57, 45
626 -1, 3, 8, 4, 33, 5, 11, 18, 19, 39,
627 20, 21, 22, 41, 50, 65, 23, 24, 25, 26,
628 44, 51, 52, 66, 71, 72, 27, 74, 28, 29,
634 #define YYPACT_NINF -18
637 18, -18, -18, 20, 9, 3, -18, -2, -18, -18,
638 -18, 1, -18, -18, -18, 1, -18, -18, 10, -2,
639 -18, 19, 25, 21, -18, 19, 1, -18, -18, -18,
640 -18, 11, 17, -18, -18, -18, -18, -18, -18, -18,
641 -18, -18, 1, -18, -18, 22, 9, 1, 1, 29,
642 15, 23, -18, -18, 26, 23, 27, -18, -18, 28,
643 -18, -18, -18, -18, 1, 25, -5, -18, -18, -18,
644 1, -18, 16, -18, -18, 30, -18, -18, -18, -18
650 -18, -18, -1, -18, -18, -18, -18, -18, -18, 31,
651 32, -18, 0, -17, -18, -18, -18, 12, -18, -18,
652 -18, 8, 13, -18, -18, -18, -8, -18, -18, -18,
653 -18, -18, -18, -11, -18
659 #define YYTABLE_NINF -56
662 34, 12, 13, 14, 35, 15, 9, 16, 17, 10,
663 16, 17, -55, 16, 17, 45, 69, 70, -4, 1,
664 6, -10, 15, 7, -10, 36, 2, 16, 17, 47,
665 48, 54, 77, 78, 40, 38, 59, 60, 42, 54,
666 49, 57, 61, 63, 47, 58, 64, -40, 68, 48,
667 62, 37, 55, 67, 53, 75, 43, 56, 73, 76
670 #define yypact_value_is_default(Yystate) \
671 (!!((Yystate) == (-18)))
673 #define yytable_value_is_error(Yytable_value) \
678 11, 3, 4, 5, 15, 7, 3, 12, 13, 6,
679 12, 13, 14, 12, 13, 26, 21, 22, 0, 1,
680 0, 3, 7, 14, 6, 15, 8, 12, 13, 18,
681 19, 42, 16, 17, 9, 16, 47, 48, 17, 50,
682 23, 19, 13, 20, 18, 46, 18, 20, 65, 19,
683 50, 19, 44, 64, 42, 66, 25, 44, 66, 70
690 0, 1, 8, 25, 27, 29, 0, 14, 26, 3,
691 6, 30, 3, 4, 5, 7, 12, 13, 31, 32,
692 34, 35, 36, 40, 41, 42, 43, 50, 52, 53,
693 55, 57, 58, 28, 57, 57, 15, 34, 16, 33,
694 9, 37, 17, 33, 44, 57, 54, 18, 19, 23,
695 38, 45, 46, 41, 57, 45, 46, 19, 26, 57,
696 57, 13, 36, 20, 18, 39, 47, 57, 37, 21,
697 22, 48, 49, 50, 51, 57, 57, 16, 17, 56
700 #define yyerrok (yyerrstatus = 0)
701 #define yyclearin (yychar = YYEMPTY)
705 #define YYACCEPT goto yyacceptlab
706 #define YYABORT goto yyabortlab
707 #define YYERROR goto yyerrorlab
717 #define YYFAIL goto yyerrlab
725 #define YYRECOVERING() (!!yyerrstatus)
727 #define YYBACKUP(Token, Value) \
729 if (yychar == YYEMPTY) \
733 YYPOPSTACK (yylen); \
739 yyerror (YY_("syntax error: cannot back up")); \
746 #define YYERRCODE 256
750 #ifndef YY_LOCATION_PRINT
751 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
757 # define YYLEX yylex (YYLEX_PARAM)
759 # define YYLEX yylex ()
767 # define YYFPRINTF fprintf
770 # define YYDPRINTF(Args) \
776 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
780 YYFPRINTF (stderr, "%s ", Title); \
781 yy_symbol_print (stderr, \
783 YYFPRINTF (stderr, "\n"); \
793 #if (defined __STDC__ || defined __C99__FUNC__ \
794 || defined __cplusplus || defined _MSC_VER)
799 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
802 YYSTYPE const * const yyvaluep;
805 FILE *yyo = yyoutput;
811 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
827 #if (defined __STDC__ || defined __C99__FUNC__ \
828 || defined __cplusplus || defined _MSC_VER)
830 yy_symbol_print (FILE *yyoutput,
int yytype,
YYSTYPE const *
const yyvaluep)
833 yy_symbol_print (yyoutput, yytype, yyvaluep)
836 YYSTYPE const * const yyvaluep;
840 YYFPRINTF (yyoutput,
"token %s (", yytname[yytype]);
842 YYFPRINTF (yyoutput,
"nterm %s (", yytname[yytype]);
844 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
845 YYFPRINTF (yyoutput,
")");
853 #if (defined __STDC__ || defined __C99__FUNC__ \
854 || defined __cplusplus || defined _MSC_VER)
859 yy_stack_print (yybottom, yytop)
864 YYFPRINTF (stderr,
"Stack now");
865 for (; yybottom <= yytop; yybottom++)
867 int yybot = *yybottom;
868 YYFPRINTF (stderr,
" %d", yybot);
870 YYFPRINTF (stderr,
"\n");
873 # define YY_STACK_PRINT(Bottom, Top) \
876 yy_stack_print ((Bottom), (Top)); \
884 #if (defined __STDC__ || defined __C99__FUNC__ \
885 || defined __cplusplus || defined _MSC_VER)
890 yy_reduce_print (yyvsp, yyrule)
895 int yynrhs = yyr2[yyrule];
897 unsigned long int yylno = yyrline[yyrule];
898 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %lu):\n",
901 for (yyi = 0; yyi < yynrhs; yyi++)
903 YYFPRINTF (stderr,
" $%d = ", yyi + 1);
904 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
905 &(yyvsp[(yyi + 1) - (yynrhs)])
907 YYFPRINTF (stderr,
"\n");
911 # define YY_REDUCE_PRINT(Rule) \
914 yy_reduce_print (yyvsp, Rule); \
921 # define YYDPRINTF(Args)
922 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
923 # define YY_STACK_PRINT(Bottom, Top)
924 # define YY_REDUCE_PRINT(Rule)
930 # define YYINITDEPTH 200
941 # define YYMAXDEPTH 10000
948 # if defined __GLIBC__ && defined _STRING_H
949 # define yystrlen strlen
952 #if (defined __STDC__ || defined __C99__FUNC__ \
953 || defined __cplusplus || defined _MSC_VER)
955 yystrlen (
const char *yystr)
963 for (yylen = 0; yystr[
yylen]; yylen++)
971 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
972 # define yystpcpy stpcpy
976 #if (defined __STDC__ || defined __C99__FUNC__ \
977 || defined __cplusplus || defined _MSC_VER)
979 yystpcpy (
char *yydest,
const char *yysrc)
982 yystpcpy (yydest, yysrc)
988 const char *yys = yysrc;
990 while ((*yyd++ = *yys++) !=
'\0')
1007 yytnamerr (
char *yyres,
const char *yystr)
1012 char const *yyp = yystr;
1019 goto do_not_strip_quotes;
1023 goto do_not_strip_quotes;
1036 do_not_strip_quotes: ;
1040 return yystrlen (yystr);
1042 return yystpcpy (yyres, yystr) - yyres;
1055 yysyntax_error (
YYSIZE_T *yymsg_alloc,
char **yymsg,
1060 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1062 const char *yyformat =
YY_NULL;
1064 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1098 int yyn = yypact[*
yyssp];
1099 yyarg[yycount++] = yytname[
yytoken];
1105 int yyxbegin = yyn < 0 ? -yyn : 0;
1107 int yychecklim =
YYLAST - yyn + 1;
1111 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1112 if (yycheck[yyx + yyn] == yyx && yyx !=
YYTERROR
1115 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1121 yyarg[yycount++] = yytname[yyx];
1124 if (! (yysize <= yysize1
1135 # define YYCASE_(N, S) \
1139 YYCASE_(0,
YY_(
"syntax error"));
1140 YYCASE_(1,
YY_(
"syntax error, unexpected %s"));
1141 YYCASE_(2,
YY_(
"syntax error, unexpected %s, expecting %s"));
1142 YYCASE_(3,
YY_(
"syntax error, unexpected %s, expecting %s or %s"));
1143 YYCASE_(4,
YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
1144 YYCASE_(5,
YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1149 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1155 if (*yymsg_alloc < yysize)
1157 *yymsg_alloc = 2 * yysize;
1158 if (! (yysize <= *yymsg_alloc
1170 while ((*yyp = *yyformat) !=
'\0')
1171 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount)
1173 yyp += yytnamerr (yyp, yyarg[yyi++]);
1191 #if (defined __STDC__ || defined __C99__FUNC__ \
1192 || defined __cplusplus || defined _MSC_VER)
1224 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1225 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1226 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1228 #ifndef YY_INITIAL_VALUE
1229 # define YY_INITIAL_VALUE(Value)
1243 #ifdef YYPARSE_PARAM
1244 #if (defined __STDC__ || defined __C99__FUNC__ \
1245 || defined __cplusplus || defined _MSC_VER)
1251 void *YYPARSE_PARAM;
1254 #if (defined __STDC__ || defined __C99__FUNC__ \
1255 || defined __cplusplus || defined _MSC_VER)
1299 char *yymsg = yymsgbuf;
1300 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1303 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1309 yyssp = yyss =
yyssa;
1310 yyvsp = yyvs =
yyvsa;
1313 YYDPRINTF ((stderr,
"Starting parse\n"));
1332 if (yyss + yystacksize - 1 <= yyssp)
1335 YYSIZE_T yysize = yyssp - yyss + 1;
1349 yyoverflow (
YY_(
"memory exhausted"),
1350 &yyss1, yysize *
sizeof (*yyssp),
1351 &yyvs1, yysize *
sizeof (*yyvsp),
1358 # ifndef YYSTACK_RELOCATE
1359 goto yyexhaustedlab;
1363 goto yyexhaustedlab;
1373 goto yyexhaustedlab;
1376 # undef YYSTACK_RELOCATE
1383 yyssp = yyss + yysize - 1;
1384 yyvsp = yyvs + yysize - 1;
1386 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1387 (
unsigned long int) yystacksize));
1389 if (yyss + yystacksize - 1 <= yyssp)
1393 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1418 YYDPRINTF ((stderr,
"Reading a token: "));
1424 yychar = yytoken =
YYEOF;
1425 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1436 if (yyn < 0 ||
YYLAST < yyn || yycheck[yyn] != yytoken)
1491 yyval = yyvsp[1-
yylen];
1499 #line 98 "../../lib/cgraph/grammar.y"
1500 {freestack(); endgraph();}
1505 #line 99 "../../lib/cgraph/grammar.y"
1511 #line 105 "../../lib/cgraph/grammar.y"
1512 {startgraph((yyvsp[(3) - (3)].
str),(yyvsp[(2) - (3)].i),(yyvsp[(1) - (3)].i));}
1517 #line 108 "../../lib/cgraph/grammar.y"
1518 {(yyval.
str)=(yyvsp[(1) - (1)].
str);}
1523 #line 108 "../../lib/cgraph/grammar.y"
1529 #line 110 "../../lib/cgraph/grammar.y"
1535 #line 110 "../../lib/cgraph/grammar.y"
1541 #line 112 "../../lib/cgraph/grammar.y"
1547 #line 112 "../../lib/cgraph/grammar.y"
1553 #line 125 "../../lib/cgraph/grammar.y"
1554 {
if ((yyvsp[(2) - (3)].i)) endedge();
else endnode();}
1559 #line 130 "../../lib/cgraph/grammar.y"
1565 #line 130 "../../lib/cgraph/grammar.y"
1571 #line 130 "../../lib/cgraph/grammar.y"
1577 #line 131 "../../lib/cgraph/grammar.y"
1583 #line 137 "../../lib/cgraph/grammar.y"
1584 {appendnode((yyvsp[(1) - (1)].
str),
NIL(
char*),
NIL(
char*));}
1589 #line 138 "../../lib/cgraph/grammar.y"
1590 {appendnode((yyvsp[(1) - (3)].
str),(yyvsp[(3) - (3)].
str),
NIL(
char*));}
1595 #line 139 "../../lib/cgraph/grammar.y"
1596 {appendnode((yyvsp[(1) - (5)].
str),(yyvsp[(3) - (5)].
str),(yyvsp[(5) - (5)].
str));}
1601 #line 142 "../../lib/cgraph/grammar.y"
1602 {attrstmt((yyvsp[(1) - (3)].i),(yyvsp[(2) - (3)].
str));}
1607 #line 143 "../../lib/cgraph/grammar.y"
1613 #line 146 "../../lib/cgraph/grammar.y"
1619 #line 147 "../../lib/cgraph/grammar.y"
1625 #line 148 "../../lib/cgraph/grammar.y"
1631 #line 151 "../../lib/cgraph/grammar.y"
1632 {(yyval.
str) = (yyvsp[(1) - (2)].
str);}
1637 #line 152 "../../lib/cgraph/grammar.y"
1638 {(yyval.
str) =
NIL(
char*); }
1643 #line 167 "../../lib/cgraph/grammar.y"
1644 {appendattr((yyvsp[(1) - (3)].
str),(yyvsp[(3) - (3)].
str));}
1649 #line 170 "../../lib/cgraph/grammar.y"
1650 {appendattr((yyvsp[(2) - (2)].
str),
NIL(
char*));}
1655 #line 176 "../../lib/cgraph/grammar.y"
1656 {opensubg((yyvsp[(1) - (1)].
str));}
1661 #line 176 "../../lib/cgraph/grammar.y"
1667 #line 179 "../../lib/cgraph/grammar.y"
1668 {(yyval.
str)=(yyvsp[(2) - (2)].
str);}
1673 #line 180 "../../lib/cgraph/grammar.y"
1674 {(yyval.
str)=
NIL(
char*);}
1679 #line 181 "../../lib/cgraph/grammar.y"
1680 {(yyval.
str)=
NIL(
char*);}
1685 #line 186 "../../lib/cgraph/grammar.y"
1686 {(yyval.
str) = (yyvsp[(1) - (1)].
str);}
1691 #line 187 "../../lib/cgraph/grammar.y"
1692 {(yyval.
str) = (yyvsp[(1) - (1)].
str);}
1697 #line 190 "../../lib/cgraph/grammar.y"
1698 {(yyval.
str) = (yyvsp[(1) - (1)].
str);}
1703 #line 191 "../../lib/cgraph/grammar.y"
1704 {(yyval.
str) = concat((yyvsp[(1) - (3)].
str),(yyvsp[(3) - (3)].str));}
1709 #line 1710 "y.tab.c"
1738 if (0 <= yystate && yystate <=
YYLAST && yycheck[yystate] == *yyssp)
1758 #if ! YYERROR_VERBOSE
1761 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1764 char const *yymsgp =
YY_(
"syntax error");
1765 int yysyntax_error_status;
1766 yysyntax_error_status = YYSYNTAX_ERROR;
1767 if (yysyntax_error_status == 0)
1769 else if (yysyntax_error_status == 1)
1771 if (yymsg != yymsgbuf)
1777 yymsg_alloc =
sizeof yymsgbuf;
1778 yysyntax_error_status = 2;
1782 yysyntax_error_status = YYSYNTAX_ERROR;
1787 if (yysyntax_error_status == 2)
1788 goto yyexhaustedlab;
1790 # undef YYSYNTAX_ERROR
1796 if (yyerrstatus == 3)
1801 if (yychar <=
YYEOF)
1804 if (yychar ==
YYEOF)
1866 yystos[yystate], yyvsp);
1898 #if !defined yyoverflow || YYERROR_VERBOSE
1921 while (yyssp != yyss)
1924 yystos[*yyssp], yyvsp);
1932 if (yymsg != yymsgbuf)
1936 return YYID (yyresult);
1941 #line 193 "../../lib/cgraph/grammar.y"
1944 #define NILitem NIL(item*)
1947 static item *newitem(
int tag,
void *p0,
char *p1)
1950 rv->tag = tag; rv->u.name = (
char*)p0; rv->str = p1;
1955 {
return newitem(
T_node,n,port); }
1957 static item *cons_attr(
char *name,
char *value)
1958 {
return newitem(
T_atom,name,value); }
1961 {
return newitem(
T_list,list,
NIL(
char*)); }
1984 {
return newitem(
T_edge,e,
NIL(
char*)); }
1987 static void delete_items(
item *ilist)
1991 for (p = ilist; p; p = pn) {
1994 case T_list: delete_items(p->u.list);
break;
2002 static void initlist(
list_t *list)
2008 static void deletelist(
list_t *list)
2010 delete_items(list->
first);
2017 v->next = list->
first;
2025 if (list->
last) list->
last->next = v;
2032 static void appendattr(
char *name,
char *value)
2037 v = cons_attr(name,value);
2041 static void bindattrs(
int kind)
2048 name = aptr->u.name;
2049 if ((kind ==
AGEDGE) &&
streq(name,Key))
continue;
2051 aptr->u.asym =
agattr(S->
g,kind,name,
"");
2058 static void applyattrs(
void *obj)
2063 if (aptr->tag ==
T_attr) {
2065 agxset(obj,aptr->u.asym,aptr->str);
2076 static void nomacros(
void)
2085 static void attrstmt(
int tkind,
char *macroname)
2092 if (macroname) nomacros();
2095 if (aptr->str ==
NIL(
char*)) nomacros();
2105 if (aptr->tag ==
T_atom)
continue;
2106 if (!(aptr->u.asym->fixed) || (S->
g != G))
2107 sym =
agattr(S->
g,kind,aptr->u.asym->name,aptr->str);
2118 static void appendnode(
char *name,
char *
port,
char *sport)
2123 port = concatPort (port, sport);
2135 static void endnode()
2141 applyattrs(ptr->u.n);
2150 static void getedgeitems(
int x)
2158 else {
if (S->
subg) v = cons_subg(S->
subg); S->
subg = 0;}
2163 static void endedge(
void)
2166 item *aptr,*tptr,*p;
2176 if ((aptr->tag ==
T_atom) &&
streq(aptr->u.name,Key))
2188 for (tptr = p->u.list; tptr; tptr = tptr->next)
2189 edgerhs(tptr->u.n,tptr->str,p->next,key);
2201 concat (
char*
s1,
char* s2)
2206 size_t len = strlen(s1) + strlen(s2) + 1;
2208 if (len <= BUFSIZ) sym = buf;
2209 else sym = (
char*)malloc(len);
2215 if (sym != buf) free (sym);
2222 concatPort (
char* s1,
char* s2)
2227 size_t len = strlen(s1) + strlen(s2) + 2;
2229 if (len <= BUFSIZ) sym = buf;
2230 else sym = (
char*)malloc(len);
2231 sprintf (sym,
"%s:%s", s1, s2);
2235 if (sym != buf) free (sym);
2240 static void edgerhs(
Agnode_t *tail,
char *tport,
item *hlist,
char *key)
2247 subg = hlist->u.subg;
2252 for (hptr = hlist->u.list; hptr; hptr = hptr->next)
2257 static void mkport(
Agedge_t *e,
char *name,
char *val)
2267 static void newedge(
Agnode_t *t,
char *tport,
Agnode_t *h,
char *hport,
char *key)
2278 temp = tp; tp = hp; hp = temp;
2289 static void startgraph(
char *name,
int directed,
int strict)
2306 static void endgraph()
2312 static void opensubg(
char *name)
2318 static void closesubg()
2326 static void freestack()
void s1(graph_t *, node_t *)
CGRAPH_API Agnode_t * agnode(Agraph_t *g, char *name, int createflag)
CGRAPH_API Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
Agsym_t * agattr(Agraph_t *g, int kind, char *name, char *value)
int agxset(void *obj, Agsym_t *sym, char *value)
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
void aglexinit(Agdisc_t *disc, void *ifile)
yydestruct("Cleanup: discarding lookahead", yytoken,&yylval)
CGRAPH_API Agraph_t * agread(void *chan, Agdisc_t *disc)
#define yytable_value_is_error(Yytable_value)
CGRAPH_API Agraph_t * agconcat(Agraph_t *g, void *chan, Agdisc_t *disc)
int agerr(agerrlevel_t level, const char *fmt,...)
CGRAPH_API void agfree(Agraph_t *g, void *ptr)
CGRAPH_API Agnode_t * agtail(Agedge_t *e)
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
CGRAPH_API Agraph_t * agsubg(Agraph_t *g, char *name, int cflag)
CGRAPH_API Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
CGRAPH_API Agnode_t * aghead(Agedge_t *e)
yytype_int16 yyssa[YYINITDEPTH]
CGRAPH_API int agclose(Agraph_t *g)
unsigned short int yytype_uint16
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
#define YY_INITIAL_VALUE(Value)
#define YY_REDUCE_PRINT(Rule)
CGRAPH_API int agstrfree(Agraph_t *, char *)
CGRAPH_API char * agstrdup(Agraph_t *, char *)
EXTERN Agraph_t * Ag_G_global
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
CGRAPH_API Agnode_t * agfstnode(Agraph_t *g)
#define yypact_value_is_default(Yystate)
CGRAPH_API void aginternalmapclearlocalnames(Agraph_t *g)
#define YYSTACK_ALLOC_MAXIMUM
CGRAPH_API void * agalloc(Agraph_t *g, size_t size)
CGRAPH_API Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
YY_IGNORE_MAYBE_UNINITIALIZED_END goto yynewstate
CGRAPH_API Agdisc_t AgDefaultDisc
unsigned char yytype_uint8
#define YY_STACK_PRINT(Bottom, Top)
CGRAPH_API Agnode_t * agsubnode(Agraph_t *g, Agnode_t *n, int createflag)
YYSTYPE yyvsa[YYINITDEPTH]