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 aagstype YYSTYPE
214 # define YYSTYPE_IS_DECLARED 1
220 #if defined __STDC__ || defined __cplusplus
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 aagoverflow || 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 aagoverflow \
396 && (! defined __cplusplus \
397 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
407 # define YYSTACK_GAP_MAXIMUM (sizeof (union aagalloc) - 1)
411 # define YYSTACK_BYTES(N) \
412 ((N) * (sizeof (aagtype_int16) + sizeof (YYSTYPE)) \
413 + YYSTACK_GAP_MAXIMUM)
415 # define YYCOPY_NEEDED 1
422 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
425 YYSIZE_T aagnewbytes; \
426 YYCOPY (&aagptr->Stack_alloc, Stack, aagsize); \
427 Stack = &aagptr->Stack_alloc; \
428 aagnewbytes = aagstacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
429 aagptr += aagnewbytes / sizeof (*aagptr); \
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 (aagi = 0; aagi < (Count); aagi++) \
448 (Dst)[aagi] = (Src)[aagi]; \
471 #define YYMAXUTOK 268
473 #define YYTRANSLATE(YYX) \
474 ((unsigned int) (YYX) <= YYMAXUTOK ? aagtranslate[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 aagtname[] =
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 aagpact_value_is_default(Yystate) \
671 (!!((Yystate) == (-18)))
673 #define aagtable_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 aagerrok (aagerrstatus = 0)
701 #define aagclearin (aagchar = YYEMPTY)
705 #define YYACCEPT goto aagacceptlab
706 #define YYABORT goto aagabortlab
707 #define YYERROR goto aagerrorlab
717 #define YYFAIL goto aagerrlab
725 #define YYRECOVERING() (!!aagerrstatus)
727 #define YYBACKUP(Token, Value) \
729 if (aagchar == YYEMPTY) \
733 YYPOPSTACK (aaglen); \
734 aagstate = *aagssp; \
739 aagerror (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 aaglex (YYLEX_PARAM)
759 # define YYLEX aaglex ()
767 # define YYFPRINTF fprintf
770 # define YYDPRINTF(Args) \
776 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
780 YYFPRINTF (stderr, "%s ", Title); \
781 aag_symbol_print (stderr, \
783 YYFPRINTF (stderr, "\n"); \
793 #if (defined __STDC__ || defined __C99__FUNC__ \
794 || defined __cplusplus || defined _MSC_VER)
799 aag_symbol_value_print (aagoutput, aagtype, aagvaluep)
802 YYSTYPE const * const aagvaluep;
805 FILE *aago = aagoutput;
811 YYPRINT (aagoutput, aagtoknum[aagtype], *aagvaluep);
827 #if (defined __STDC__ || defined __C99__FUNC__ \
828 || defined __cplusplus || defined _MSC_VER)
830 aag_symbol_print (FILE *aagoutput,
int aagtype,
YYSTYPE const *
const aagvaluep)
833 aag_symbol_print (aagoutput, aagtype, aagvaluep)
836 YYSTYPE const * const aagvaluep;
840 YYFPRINTF (aagoutput,
"token %s (", aagtname[aagtype]);
842 YYFPRINTF (aagoutput,
"nterm %s (", aagtname[aagtype]);
844 aag_symbol_value_print (aagoutput, aagtype, aagvaluep);
845 YYFPRINTF (aagoutput,
")");
853 #if (defined __STDC__ || defined __C99__FUNC__ \
854 || defined __cplusplus || defined _MSC_VER)
859 aag_stack_print (aagbottom, aagtop)
864 YYFPRINTF (stderr,
"Stack now");
865 for (; aagbottom <= aagtop; aagbottom++)
867 int aagbot = *aagbottom;
868 YYFPRINTF (stderr,
" %d", aagbot);
870 YYFPRINTF (stderr,
"\n");
873 # define YY_STACK_PRINT(Bottom, Top) \
876 aag_stack_print ((Bottom), (Top)); \
884 #if (defined __STDC__ || defined __C99__FUNC__ \
885 || defined __cplusplus || defined _MSC_VER)
890 aag_reduce_print (aagvsp, aagrule)
895 int aagnrhs = aagr2[aagrule];
897 uint64_t aaglno = aagrline[aagrule];
898 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %lu):\n",
899 aagrule - 1, aaglno);
901 for (aagi = 0; aagi < aagnrhs; aagi++)
903 YYFPRINTF (stderr,
" $%d = ", aagi + 1);
904 aag_symbol_print (stderr, aagrhs[aagprhs[aagrule] + aagi],
905 &(aagvsp[(aagi + 1) - (aagnrhs)])
907 YYFPRINTF (stderr,
"\n");
911 # define YY_REDUCE_PRINT(Rule) \
914 aag_reduce_print (aagvsp, 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 aagstrlen strlen
952 #if (defined __STDC__ || defined __C99__FUNC__ \
953 || defined __cplusplus || defined _MSC_VER)
955 aagstrlen (
const char *aagstr)
963 for (aaglen = 0; aagstr[
aaglen]; aaglen++)
971 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
972 # define aagstpcpy stpcpy
976 #if (defined __STDC__ || defined __C99__FUNC__ \
977 || defined __cplusplus || defined _MSC_VER)
979 aagstpcpy (
char *aagdest,
const char *aagsrc)
982 aagstpcpy (aagdest, aagsrc)
987 char *aagd = aagdest;
988 const char *aags = aagsrc;
990 while ((*aagd++ = *aags++) !=
'\0')
1007 aagtnamerr (
char *aagres,
const char *aagstr)
1012 char const *aagp = aagstr;
1019 goto do_not_strip_quotes;
1022 if (*++aagp !=
'\\')
1023 goto do_not_strip_quotes;
1027 aagres[
aagn] = *aagp;
1033 aagres[
aagn] =
'\0';
1036 do_not_strip_quotes: ;
1040 return aagstrlen (aagstr);
1042 return aagstpcpy (aagres, aagstr) - aagres;
1055 aagsyntax_error (
YYSIZE_T *aagmsg_alloc,
char **aagmsg,
1060 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1062 const char *aagformat =
YY_NULL;
1064 char const *aagarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1098 int aagn = aagpact[*
aagssp];
1099 aagarg[aagcount++] = aagtname[
aagtoken];
1105 int aagxbegin = aagn < 0 ? -aagn : 0;
1107 int aagchecklim =
YYLAST - aagn + 1;
1111 for (aagx = aagxbegin; aagx < aagxend; ++aagx)
1112 if (aagcheck[aagx + aagn] == aagx && aagx !=
YYTERROR
1115 if (aagcount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1121 aagarg[aagcount++] = aagtname[aagx];
1124 if (! (aagsize <= aagsize1
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 aagsize1 = aagsize + aagstrlen (aagformat);
1155 if (*aagmsg_alloc < aagsize)
1157 *aagmsg_alloc = 2 * aagsize;
1158 if (! (aagsize <= *aagmsg_alloc
1168 char *aagp = *aagmsg;
1170 while ((*aagp = *aagformat) !=
'\0')
1171 if (*aagp ==
'%' && aagformat[1] ==
's' && aagi < aagcount)
1173 aagp += aagtnamerr (aagp, aagarg[aagi++]);
1191 #if (defined __STDC__ || defined __C99__FUNC__ \
1192 || defined __cplusplus || defined _MSC_VER)
1206 aagmsg =
"Deleting";
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)
1298 char aagmsgbuf[128];
1299 char *aagmsg = aagmsgbuf;
1300 YYSIZE_T aagmsg_alloc =
sizeof aagmsgbuf;
1303 #define YYPOPSTACK(N) (aagvsp -= (N), aagssp -= (N))
1313 YYDPRINTF ((stderr,
"Starting parse\n"));
1332 if (aagss + aagstacksize - 1 <= aagssp)
1335 YYSIZE_T aagsize = aagssp - aagss + 1;
1349 aagoverflow (
YY_(
"memory exhausted"),
1350 &aagss1, aagsize *
sizeof (*aagssp),
1351 &aagvs1, aagsize *
sizeof (*aagvsp),
1358 # ifndef YYSTACK_RELOCATE
1359 goto aagexhaustedlab;
1363 goto aagexhaustedlab;
1373 goto aagexhaustedlab;
1376 # undef YYSTACK_RELOCATE
1377 if (aagss1 != aagssa)
1383 aagssp = aagss + aagsize - 1;
1384 aagvsp = aagvs + aagsize - 1;
1386 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1387 (uint64_t) aagstacksize));
1389 if (aagss + aagstacksize - 1 <= aagssp)
1393 YYDPRINTF ((stderr,
"Entering state %d\n", aagstate));
1418 YYDPRINTF ((stderr,
"Reading a token: "));
1424 aagchar = aagtoken =
YYEOF;
1425 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1436 if (aagn < 0 ||
YYLAST < aagn || aagcheck[aagn] != aagtoken)
1438 aagn = aagtable[
aagn];
1491 aagval = aagvsp[1-
aaglen];
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((aagvsp[(3) - (3)].
str),(aagvsp[(2) - (3)].i),(aagvsp[(1) - (3)].i));}
1517 #line 108 "../../lib/cgraph/grammar.y"
1518 {(aagval.
str)=(aagvsp[(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 ((aagvsp[(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((aagvsp[(1) - (1)].
str),
NIL(
char*),
NIL(
char*));}
1589 #line 138 "../../lib/cgraph/grammar.y"
1590 {appendnode((aagvsp[(1) - (3)].
str),(aagvsp[(3) - (3)].
str),
NIL(
char*));}
1595 #line 139 "../../lib/cgraph/grammar.y"
1596 {appendnode((aagvsp[(1) - (5)].
str),(aagvsp[(3) - (5)].
str),(aagvsp[(5) - (5)].
str));}
1601 #line 142 "../../lib/cgraph/grammar.y"
1602 {attrstmt((aagvsp[(1) - (3)].i),(aagvsp[(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 {(aagval.
str) = (aagvsp[(1) - (2)].
str);}
1637 #line 152 "../../lib/cgraph/grammar.y"
1638 {(aagval.
str) =
NIL(
char*); }
1643 #line 167 "../../lib/cgraph/grammar.y"
1644 {appendattr((aagvsp[(1) - (3)].
str),(aagvsp[(3) - (3)].
str));}
1649 #line 170 "../../lib/cgraph/grammar.y"
1650 {appendattr((aagvsp[(2) - (2)].
str),
NIL(
char*));}
1655 #line 176 "../../lib/cgraph/grammar.y"
1656 {opensubg((aagvsp[(1) - (1)].
str));}
1661 #line 176 "../../lib/cgraph/grammar.y"
1667 #line 179 "../../lib/cgraph/grammar.y"
1668 {(aagval.
str)=(aagvsp[(2) - (2)].
str);}
1673 #line 180 "../../lib/cgraph/grammar.y"
1674 {(aagval.
str)=
NIL(
char*);}
1679 #line 181 "../../lib/cgraph/grammar.y"
1680 {(aagval.
str)=
NIL(
char*);}
1685 #line 186 "../../lib/cgraph/grammar.y"
1686 {(aagval.
str) = (aagvsp[(1) - (1)].
str);}
1691 #line 187 "../../lib/cgraph/grammar.y"
1692 {(aagval.
str) = (aagvsp[(1) - (1)].
str);}
1697 #line 190 "../../lib/cgraph/grammar.y"
1698 {(aagval.
str) = (aagvsp[(1) - (1)].
str);}
1703 #line 191 "../../lib/cgraph/grammar.y"
1704 {(aagval.
str) = concat((aagvsp[(1) - (3)].
str),(aagvsp[(3) - (3)].str));}
1709 #line 1710 "y.tab.c"
1738 if (0 <= aagstate && aagstate <=
YYLAST && aagcheck[aagstate] == *aagssp)
1741 aagstate = aagdefgoto[aagn -
YYNTOKENS];
1758 #if ! YYERROR_VERBOSE
1761 # define YYSYNTAX_ERROR aagsyntax_error (&aagmsg_alloc, &aagmsg, \
1764 char const *aagmsgp =
YY_(
"syntax error");
1765 int aagsyntax_error_status;
1766 aagsyntax_error_status = YYSYNTAX_ERROR;
1767 if (aagsyntax_error_status == 0)
1769 else if (aagsyntax_error_status == 1)
1771 if (aagmsg != aagmsgbuf)
1777 aagmsg_alloc =
sizeof aagmsgbuf;
1778 aagsyntax_error_status = 2;
1782 aagsyntax_error_status = YYSYNTAX_ERROR;
1787 if (aagsyntax_error_status == 2)
1788 goto aagexhaustedlab;
1790 # undef YYSYNTAX_ERROR
1796 if (aagerrstatus == 3)
1801 if (aagchar <=
YYEOF)
1804 if (aagchar ==
YYEOF)
1810 aagtoken, &aaglval);
1854 aagn = aagtable[
aagn];
1861 if (aagssp == aagss)
1866 aagstos[aagstate], aagvsp);
1898 #if !defined aagoverflow || YYERROR_VERBOSE
1915 aagtoken, &aaglval);
1921 while (aagssp != aagss)
1924 aagstos[*aagssp], aagvsp);
1928 if (aagss != aagssa)
1932 if (aagmsg != aagmsgbuf)
1936 return YYID (aagresult);
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)
unsigned short int aagtype_uint16
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)
aagdestruct("Cleanup: discarding lookahead", aagtoken,&aaglval)
#define YYSTACK_ALLOC_MAXIMUM
int agxset(void *obj, Agsym_t *sym, char *value)
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
#define aagpact_value_is_default(Yystate)
void aglexinit(Agdisc_t *disc, void *ifile)
CGRAPH_API Agraph_t * agread(void *chan, Agdisc_t *disc)
YY_IGNORE_MAYBE_UNINITIALIZED_END goto aagnewstate
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)
CGRAPH_API int agclose(Agraph_t *g)
aagtype_int16 aagss_alloc
#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
unsigned char aagtype_uint8
CGRAPH_API Agnode_t * agfstnode(Agraph_t *g)
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
#define aagtable_value_is_error(Yytable_value)
CGRAPH_API void aginternalmapclearlocalnames(Agraph_t *g)
aagtype_int16 aagssa[YYINITDEPTH]
CGRAPH_API void * agalloc(Agraph_t *g, size_t size)
YYSTYPE aagvsa[YYINITDEPTH]
CGRAPH_API Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
CGRAPH_API Agdisc_t AgDefaultDisc
#define YY_STACK_PRINT(Bottom, Top)
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
CGRAPH_API Agnode_t * agsubnode(Agraph_t *g, Agnode_t *n, int createflag)