Graphviz 13.1.3~dev.20250829.0113
Loading...
Searching...
No Matches
gmlparse.c
Go to the documentation of this file.
1/* A Bison parser, made by GNU Bison 3.8.2. */
2
3/* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6 Inc.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <https://www.gnu.org/licenses/>. */
20
21/* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34/* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
37/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 especially those whose name start with YY_ or yy_. They are
39 private implementation details that can be changed or removed. */
40
41/* All symbols defined below should begin with yy or YY, to avoid
42 infringing on user name space. This should be done even for local
43 variables, as they might otherwise be expanded by user macros.
44 There are some unavoidable exceptions within include files to
45 define necessary library symbols; they are noted "INFRINGES ON
46 USER NAME SPACE" below. */
47
48/* Identify Bison output, and Bison version. */
49#define YYBISON 30802
50
51/* Bison version string. */
52#define YYBISON_VERSION "3.8.2"
53
54/* Skeleton name. */
55#define YYSKELETON_NAME "yacc.c"
56
57/* Pure parsers. */
58#define YYPURE 0
59
60/* Push parsers. */
61#define YYPUSH 0
62
63/* Pull parsers. */
64#define YYPULL 1
65
66/* Substitute the type names. */
67#define YYSTYPE GMLSTYPE
68/* Substitute the variable and function names. */
69#define yyparse gmlparse
70#define yylex gmllex
71#define yyerror gmlerror
72#define yydebug gmldebug
73#define yynerrs gmlnerrs
74#define yylval gmllval
75#define yychar gmlchar
76
77/* First part of user prologue. */
78#line 19 "../../cmd/tools/gmlparse.y"
79
80#include <stdlib.h>
81#include <string.h>
82#include <arith.h>
83#include <gml2gv.h>
84#include <assert.h>
85#include <util/agxbuf.h>
86#include <util/alloc.h>
87#include <util/exit.h>
88#include <util/list.h>
89
90static gmlgraph* G;
91static gmlnode* N;
92static gmledge* E;
93
94static attrs_t *L;
95
96static void free_attrs(attrs_t *a) {
97 LIST_FREE(a);
98 free(a);
99}
100
101static LIST(attrs_t *) liststk = {.dtor = free_attrs};
102
103static char *sortToStr(unsigned short sort);
104
105static void free_node(gmlnode *p) {
106 if (!p) return;
107 LIST_FREE(&p->attrlist);
108 free(p->id);
109 free (p);
110}
111
112static void free_edge(gmledge *p) {
113 if (!p) return;
114 LIST_FREE(&p->attrlist);
115 free (p);
116}
117
118static void free_graph(gmlgraph *p) {
119 if (!p) return;
120 LIST_FREE(&p->nodelist);
121 LIST_FREE(&p->edgelist);
122 LIST_FREE(&p->attrlist);
123 LIST_FREE(&p->graphlist);
124 free (p);
125}
126
127static void
129{
130 LIST_CLEAR(&liststk);
131 if (L) {
132 free_attrs(L);
133 L = NULL;
134 }
135 if (N) {
136 free_node(N);
137 N = NULL;
138 }
139 if (E) {
140 free_edge(E);
141 E = NULL;
142 }
143 if (G) {
144 free_graph(G);
145 G = NULL;
146 }
147}
148
149static void free_attr(gmlattr *p);
150
151static void
153{
154 attrs_t *const lp = gv_alloc(sizeof(attrs_t));
155 lp->dtor = free_attr;
156
157 if (L) {
158 LIST_PUSH_BACK(&liststk, L);
159 }
160 L = lp;
161}
162
163static attrs_t *popAlist(void) {
164 attrs_t *lp = L;
165
166 if (!LIST_IS_EMPTY(&liststk))
167 L = LIST_POP_BACK(&liststk);
168 else
169 L = NULL;
170
171 return lp;
172}
173
174static void
175popG (void)
176{
177 G = G->parent;
178}
179
180static void
181pushG (void)
182{
183 gmlgraph* g = gv_alloc(sizeof(gmlgraph));
184
185 g->attrlist.dtor = free_attr;
186 g->nodelist.dtor = free_node;
187 g->edgelist.dtor = free_edge;
188 g->graphlist.dtor = free_graph;
189 g->parent = G;
190 g->directed = -1;
191
192 if (G)
193 LIST_APPEND(&G->graphlist, g);
194
195 G = g;
196}
197
198static gmlnode*
199mkNode (void)
200{
201 gmlnode *const n = gv_alloc(sizeof(gmlnode));
202 n->attrlist.dtor = free_attr;
203 return n;
204}
205
206static gmledge*
207mkEdge (void)
208{
209 gmledge* ep = gv_alloc(sizeof(gmledge));
210 ep->attrlist.dtor = free_attr;
211 return ep;
212}
213
214static gmlattr *mkAttr(char* name, unsigned short sort, unsigned short kind,
215 char* str, attrs_t* list) {
216 gmlattr* gp = gv_alloc(sizeof(gmlattr));
217
218 assert (name || sort);
219 if (!name)
220 name = gv_strdup (sortToStr (sort));
221 gp->sort = sort;
222 gp->kind = kind;
223 gp->name = name;
224 if (str)
225 gp->u.value = str;
226 else {
227 if (list != NULL && LIST_IS_EMPTY(list)) {
228 free_attrs(list);
229 list = 0;
230 }
231 gp->u.lp = list;
232 }
233 return gp;
234}
235
236static int
237setDir (char* d)
238{
239 gmlgraph* g;
240 int dir = atoi (d);
241
242 free (d);
243 if (dir < 0) dir = -1;
244 else if (dir > 0) dir = 1;
245 else dir = 0;
246 G->directed = dir;
247
248 if (dir >= 0) {
249 for (g = G->parent; g; g = g->parent) {
250 if (g->directed < 0)
251 g->directed = dir;
252 else if (g->directed != dir)
253 return 1;
254 }
255 }
256
257 return 0;
258}
259
260
261#line 262 "gmlparse.c"
262
263# ifndef YY_CAST
264# ifdef __cplusplus
265# define YY_CAST(Type, Val) static_cast<Type> (Val)
266# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
267# else
268# define YY_CAST(Type, Val) ((Type) (Val))
269# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
270# endif
271# endif
272# ifndef YY_NULLPTR
273# if defined __cplusplus
274# if 201103L <= __cplusplus
275# define YY_NULLPTR nullptr
276# else
277# define YY_NULLPTR 0
278# endif
279# else
280# define YY_NULLPTR ((void*)0)
281# endif
282# endif
283
284#include "gmlparse.h"
285/* Symbol kind. */
287{
289 YYSYMBOL_YYEOF = 0, /* "end of file" */
290 YYSYMBOL_YYerror = 1, /* error */
291 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
292 YYSYMBOL_GRAPH = 3, /* GRAPH */
293 YYSYMBOL_NODE = 4, /* NODE */
294 YYSYMBOL_EDGE = 5, /* EDGE */
295 YYSYMBOL_DIRECTED = 6, /* DIRECTED */
296 YYSYMBOL_SOURCE = 7, /* SOURCE */
297 YYSYMBOL_TARGET = 8, /* TARGET */
298 YYSYMBOL_XVAL = 9, /* XVAL */
299 YYSYMBOL_YVAL = 10, /* YVAL */
300 YYSYMBOL_WVAL = 11, /* WVAL */
301 YYSYMBOL_HVAL = 12, /* HVAL */
302 YYSYMBOL_LABEL = 13, /* LABEL */
303 YYSYMBOL_GRAPHICS = 14, /* GRAPHICS */
304 YYSYMBOL_LABELGRAPHICS = 15, /* LABELGRAPHICS */
305 YYSYMBOL_TYPE = 16, /* TYPE */
306 YYSYMBOL_FILL = 17, /* FILL */
307 YYSYMBOL_OUTLINE = 18, /* OUTLINE */
308 YYSYMBOL_OUTLINESTYLE = 19, /* OUTLINESTYLE */
309 YYSYMBOL_OUTLINEWIDTH = 20, /* OUTLINEWIDTH */
310 YYSYMBOL_WIDTH = 21, /* WIDTH */
311 YYSYMBOL_STYLE = 22, /* STYLE */
312 YYSYMBOL_LINE = 23, /* LINE */
313 YYSYMBOL_POINT = 24, /* POINT */
314 YYSYMBOL_TEXT = 25, /* TEXT */
315 YYSYMBOL_FONTSIZE = 26, /* FONTSIZE */
316 YYSYMBOL_FONTNAME = 27, /* FONTNAME */
317 YYSYMBOL_COLOR = 28, /* COLOR */
318 YYSYMBOL_INTEGER = 29, /* INTEGER */
319 YYSYMBOL_REAL = 30, /* REAL */
320 YYSYMBOL_STRING = 31, /* STRING */
321 YYSYMBOL_ID = 32, /* ID */
322 YYSYMBOL_NAME = 33, /* NAME */
323 YYSYMBOL_GML_LIST = 34, /* GML_LIST */
324 YYSYMBOL_35_ = 35, /* '[' */
325 YYSYMBOL_36_ = 36, /* ']' */
326 YYSYMBOL_YYACCEPT = 37, /* $accept */
327 YYSYMBOL_graph = 38, /* graph */
328 YYSYMBOL_hdr = 39, /* hdr */
329 YYSYMBOL_body = 40, /* body */
330 YYSYMBOL_optglist = 41, /* optglist */
331 YYSYMBOL_glist = 42, /* glist */
332 YYSYMBOL_glistitem = 43, /* glistitem */
333 YYSYMBOL_node = 44, /* node */
334 YYSYMBOL_45_1 = 45, /* $@1 */
335 YYSYMBOL_nlist = 46, /* nlist */
336 YYSYMBOL_nlistitem = 47, /* nlistitem */
337 YYSYMBOL_edge = 48, /* edge */
338 YYSYMBOL_49_2 = 49, /* $@2 */
339 YYSYMBOL_elist = 50, /* elist */
340 YYSYMBOL_elistitem = 51, /* elistitem */
341 YYSYMBOL_attrlist = 52, /* attrlist */
342 YYSYMBOL_53_3 = 53, /* $@3 */
343 YYSYMBOL_optalist = 54, /* optalist */
344 YYSYMBOL_alist = 55, /* alist */
345 YYSYMBOL_alistitem = 56 /* alistitem */
348
349
350
351
352#ifdef short
353# undef short
354#endif
355
356/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
357 <limits.h> and (if available) <stdint.h> are included
358 so that the code can choose integer types of a good width. */
359
360#ifndef __PTRDIFF_MAX__
361# include <limits.h> /* INFRINGES ON USER NAME SPACE */
362# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
363# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
364# define YY_STDINT_H
365# endif
366#endif
367
368/* Narrow types that promote to a signed type and that can represent a
369 signed or unsigned integer of at least N bits. In tables they can
370 save space and decrease cache pressure. Promoting to a signed type
371 helps avoid bugs in integer arithmetic. */
372
373#ifdef __INT_LEAST8_MAX__
374typedef __INT_LEAST8_TYPE__ yytype_int8;
375#elif defined YY_STDINT_H
376typedef int_least8_t yytype_int8;
377#else
378typedef signed char yytype_int8;
379#endif
380
381#ifdef __INT_LEAST16_MAX__
382typedef __INT_LEAST16_TYPE__ yytype_int16;
383#elif defined YY_STDINT_H
384typedef int_least16_t yytype_int16;
385#else
386typedef short yytype_int16;
387#endif
388
389/* Work around bug in HP-UX 11.23, which defines these macros
390 incorrectly for preprocessor constants. This workaround can likely
391 be removed in 2023, as HPE has promised support for HP-UX 11.23
392 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
393 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
394#ifdef __hpux
395# undef UINT_LEAST8_MAX
396# undef UINT_LEAST16_MAX
397# define UINT_LEAST8_MAX 255
398# define UINT_LEAST16_MAX 65535
399#endif
400
401#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
402typedef __UINT_LEAST8_TYPE__ yytype_uint8;
403#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
404 && UINT_LEAST8_MAX <= INT_MAX)
405typedef uint_least8_t yytype_uint8;
406#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
407typedef unsigned char yytype_uint8;
408#else
409typedef short yytype_uint8;
410#endif
411
412#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
413typedef __UINT_LEAST16_TYPE__ yytype_uint16;
414#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
415 && UINT_LEAST16_MAX <= INT_MAX)
416typedef uint_least16_t yytype_uint16;
417#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
418typedef unsigned short yytype_uint16;
419#else
420typedef int yytype_uint16;
421#endif
422
423#ifndef YYPTRDIFF_T
424# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
425# define YYPTRDIFF_T __PTRDIFF_TYPE__
426# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
427# elif defined PTRDIFF_MAX
428# ifndef ptrdiff_t
429# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
430# endif
431# define YYPTRDIFF_T ptrdiff_t
432# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
433# else
434# define YYPTRDIFF_T long
435# define YYPTRDIFF_MAXIMUM LONG_MAX
436# endif
437#endif
438
439#ifndef YYSIZE_T
440# ifdef __SIZE_TYPE__
441# define YYSIZE_T __SIZE_TYPE__
442# elif defined size_t
443# define YYSIZE_T size_t
444# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
445# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
446# define YYSIZE_T size_t
447# else
448# define YYSIZE_T unsigned
449# endif
450#endif
451
452#define YYSIZE_MAXIMUM \
453 YY_CAST (YYPTRDIFF_T, \
454 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
455 ? YYPTRDIFF_MAXIMUM \
456 : YY_CAST (YYSIZE_T, -1)))
457
458#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
459
460
461/* Stored state numbers (used for stacks). */
463
464/* State numbers in computations. */
465typedef int yy_state_fast_t;
466
467#ifndef YY_
468# if defined YYENABLE_NLS && YYENABLE_NLS
469# if ENABLE_NLS
470# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
471# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
472# endif
473# endif
474# ifndef YY_
475# define YY_(Msgid) Msgid
476# endif
477#endif
478
479
480#ifndef YY_ATTRIBUTE_PURE
481# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
482# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
483# else
484# define YY_ATTRIBUTE_PURE
485# endif
486#endif
487
488#ifndef YY_ATTRIBUTE_UNUSED
489# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
490# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
491# else
492# define YY_ATTRIBUTE_UNUSED
493# endif
494#endif
495
496/* Suppress unused-variable warnings by "using" E. */
497#if ! defined lint || defined __GNUC__
498# define YY_USE(E) ((void) (E))
499#else
500# define YY_USE(E) /* empty */
501#endif
502
503/* Suppress an incorrect diagnostic about yylval being uninitialized. */
504#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
505# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
506# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
507 _Pragma ("GCC diagnostic push") \
508 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
509# else
510# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
511 _Pragma ("GCC diagnostic push") \
512 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
513 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
514# endif
515# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
516 _Pragma ("GCC diagnostic pop")
517#else
518# define YY_INITIAL_VALUE(Value) Value
519#endif
520#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
521# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
522# define YY_IGNORE_MAYBE_UNINITIALIZED_END
523#endif
524#ifndef YY_INITIAL_VALUE
525# define YY_INITIAL_VALUE(Value) /* Nothing. */
526#endif
527
528#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
529# define YY_IGNORE_USELESS_CAST_BEGIN \
530 _Pragma ("GCC diagnostic push") \
531 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
532# define YY_IGNORE_USELESS_CAST_END \
533 _Pragma ("GCC diagnostic pop")
534#endif
535#ifndef YY_IGNORE_USELESS_CAST_BEGIN
536# define YY_IGNORE_USELESS_CAST_BEGIN
537# define YY_IGNORE_USELESS_CAST_END
538#endif
539
540
541#define YY_ASSERT(E) ((void) (0 && (E)))
542
543#if !defined yyoverflow
544
545/* The parser invokes alloca or malloc; define the necessary symbols. */
546
547# ifdef YYSTACK_USE_ALLOCA
548# if YYSTACK_USE_ALLOCA
549# ifdef __GNUC__
550# define YYSTACK_ALLOC __builtin_alloca
551# elif defined __BUILTIN_VA_ARG_INCR
552# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
553# elif defined _AIX
554# define YYSTACK_ALLOC __alloca
555# elif defined _MSC_VER
556# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
557# define alloca _alloca
558# else
559# define YYSTACK_ALLOC alloca
560# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
561# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
562 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
563# ifndef EXIT_SUCCESS
564# define EXIT_SUCCESS 0
565# endif
566# endif
567# endif
568# endif
569# endif
570
571# ifdef YYSTACK_ALLOC
572 /* Pacify GCC's 'empty if-body' warning. */
573# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
574# ifndef YYSTACK_ALLOC_MAXIMUM
575 /* The OS might guarantee only one guard page at the bottom of the stack,
576 and a page size can be as small as 4096 bytes. So we cannot safely
577 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
578 to allow for a few compiler-allocated temporary stack slots. */
579# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
580# endif
581# else
582# define YYSTACK_ALLOC YYMALLOC
583# define YYSTACK_FREE YYFREE
584# ifndef YYSTACK_ALLOC_MAXIMUM
585# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
586# endif
587# if (defined __cplusplus && ! defined EXIT_SUCCESS \
588 && ! ((defined YYMALLOC || defined malloc) \
589 && (defined YYFREE || defined free)))
590# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
591# ifndef EXIT_SUCCESS
592# define EXIT_SUCCESS 0
593# endif
594# endif
595# ifndef YYMALLOC
596# define YYMALLOC malloc
597# if ! defined malloc && ! defined EXIT_SUCCESS
598void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
599# endif
600# endif
601# ifndef YYFREE
602# define YYFREE free
603# if ! defined free && ! defined EXIT_SUCCESS
604void free (void *); /* INFRINGES ON USER NAME SPACE */
605# endif
606# endif
607# endif
608#endif /* !defined yyoverflow */
609
610#if (! defined yyoverflow \
611 && (! defined __cplusplus \
612 || (defined GMLSTYPE_IS_TRIVIAL && GMLSTYPE_IS_TRIVIAL)))
613
614/* A type that is properly aligned for any stack member. */
620
621/* The size of the maximum gap between one aligned stack and the next. */
622# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
623
624/* The size of an array large to enough to hold all stacks, each with
625 N elements. */
626# define YYSTACK_BYTES(N) \
627 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
628 + YYSTACK_GAP_MAXIMUM)
629
630# define YYCOPY_NEEDED 1
631
632/* Relocate STACK from its old location to the new one. The
633 local variables YYSIZE and YYSTACKSIZE give the old and new number of
634 elements in the stack, and YYPTR gives the new location of the
635 stack. Advance YYPTR to a properly aligned location for the next
636 stack. */
637# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
638 do \
639 { \
640 YYPTRDIFF_T yynewbytes; \
641 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
642 Stack = &yyptr->Stack_alloc; \
643 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
644 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
645 } \
646 while (0)
647
648#endif
649
650#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
651/* Copy COUNT objects from SRC to DST. The source and destination do
652 not overlap. */
653# ifndef YYCOPY
654# if defined __GNUC__ && 1 < __GNUC__
655# define YYCOPY(Dst, Src, Count) \
656 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
657# else
658# define YYCOPY(Dst, Src, Count) \
659 do \
660 { \
661 YYPTRDIFF_T yyi; \
662 for (yyi = 0; yyi < (Count); yyi++) \
663 (Dst)[yyi] = (Src)[yyi]; \
664 } \
665 while (0)
666# endif
667# endif
668#endif /* !YYCOPY_NEEDED */
669
670/* YYFINAL -- State number of the termination state. */
671#define YYFINAL 55
672/* YYLAST -- Last index in YYTABLE. */
673#define YYLAST 226
674
675/* YYNTOKENS -- Number of terminals. */
676#define YYNTOKENS 37
677/* YYNNTS -- Number of nonterminals. */
678#define YYNNTS 20
679/* YYNRULES -- Number of rules. */
680#define YYNRULES 63
681/* YYNSTATES -- Number of states. */
682#define YYNSTATES 102
683
684/* YYMAXUTOK -- Last valid token kind. */
685#define YYMAXUTOK 289
686
687
688/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
689 as returned by yylex, with out-of-bounds checking. */
690#define YYTRANSLATE(YYX) \
691 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
692 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
693 : YYSYMBOL_YYUNDEF)
694
695/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
696 as returned by yylex. */
697static const yytype_int8 yytranslate[] =
698{
699 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
701 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
703 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
704 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
705 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
706 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
707 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
708 2, 35, 2, 36, 2, 2, 2, 2, 2, 2,
709 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
710 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
711 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
712 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
713 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
714 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
715 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
716 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
717 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
718 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
719 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
720 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
721 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
722 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
723 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
724 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
725 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
726 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
727 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
728};
729
730#if GMLDEBUG
731/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
732static const yytype_int16 yyrline[] =
733{
734 0, 224, 224, 225, 226, 229, 232, 235, 236, 239,
735 240, 243, 244, 245, 246, 253, 254, 257, 257, 260,
736 261, 264, 265, 268, 268, 271, 272, 275, 276, 277,
737 278, 281, 281, 284, 285, 288, 289, 292, 293, 294,
738 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
739 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
740 315, 316, 317, 318
741};
742#endif
743
745#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
746
747#if GMLDEBUG || 0
748/* The user-facing name of the symbol whose (internal) number is
749 YYSYMBOL. No bounds checking. */
750static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
751
752/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
753 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
754static const char *const yytname[] =
755{
756 "\"end of file\"", "error", "\"invalid token\"", "GRAPH", "NODE",
757 "EDGE", "DIRECTED", "SOURCE", "TARGET", "XVAL", "YVAL", "WVAL", "HVAL",
758 "LABEL", "GRAPHICS", "LABELGRAPHICS", "TYPE", "FILL", "OUTLINE",
759 "OUTLINESTYLE", "OUTLINEWIDTH", "WIDTH", "STYLE", "LINE", "POINT",
760 "TEXT", "FONTSIZE", "FONTNAME", "COLOR", "INTEGER", "REAL", "STRING",
761 "ID", "NAME", "GML_LIST", "'['", "']'", "$accept", "graph", "hdr",
762 "body", "optglist", "glist", "glistitem", "node", "$@1", "nlist",
763 "nlistitem", "edge", "$@2", "elist", "elistitem", "attrlist", "$@3",
764 "optalist", "alist", "alistitem", YY_NULLPTR
765};
766
767static const char *
769{
770 return yytname[yysymbol];
771}
772#endif
773
774#define YYPACT_NINF (-29)
775
776#define yypact_value_is_default(Yyn) \
777 ((Yyn) == YYPACT_NINF)
778
779#define YYTABLE_NINF (-35)
780
781#define yytable_value_is_error(Yyn) \
782 0
783
784/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
785 STATE-NUM. */
786static const yytype_int16 yypact[] =
787{
788 1, -29, -24, 0, 2, 3, 5, 11, 11, 6,
789 17, 18, 19, 22, -21, -28, 11, 11, 21, 24,
790 25, 28, 12, 54, 52, 193, -29, -29, -29, -29,
791 -29, -29, -29, -29, -29, -29, -29, -29, -29, -29,
792 -29, -29, -29, -29, -29, -29, -29, -29, -29, -29,
793 -29, -29, -29, -29, -29, -29, -29, 30, -29, 193,
794 58, -29, 51, -29, -29, 59, 60, 30, 78, 58,
795 -29, -29, -29, -29, -29, 80, 81, -29, -29, -29,
796 -29, -29, 168, 143, 90, 113, -29, -29, 91, 114,
797 115, 85, -29, -29, -29, -29, -29, -29, -29, -29,
798 -29, -29
799};
800
801/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
802 Performed when YYTABLE does not specify something else to do. Zero
803 means the default is an error. */
804static const yytype_int8 yydefact[] =
805{
806 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
807 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
808 0, 0, 0, 0, 0, 33, 36, 42, 41, 43,
809 44, 45, 46, 31, 47, 48, 49, 50, 51, 52,
810 53, 55, 54, 56, 57, 58, 59, 60, 62, 61,
811 63, 37, 38, 39, 40, 1, 5, 0, 35, 34,
812 8, 2, 0, 17, 23, 0, 0, 0, 0, 7,
813 10, 11, 12, 16, 32, 0, 0, 14, 15, 13,
814 6, 9, 0, 0, 0, 0, 20, 22, 0, 0,
815 0, 0, 26, 30, 21, 18, 19, 27, 28, 29,
816 24, 25
817};
818
819/* YYPGOTO[NTERM-NUM]. */
820static const yytype_int16 yypgoto[] =
821{
822 -29, -29, 118, 105, -29, -29, 79, -29, -29, -29,
823 62, -29, -29, -29, 82, 23, -29, 138, -29, -25
824};
825
826/* YYDEFGOTO[NTERM-NUM]. */
827static const yytype_int8 yydefgoto[] =
828{
829 0, 23, 67, 61, 68, 69, 70, 71, 75, 85,
830 86, 72, 76, 91, 92, 34, 59, 24, 25, 26
831};
832
833/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
834 positive, shift that token. If negative, reduce the rule whose
835 number is the opposite. If YYTABLE_NINF, syntax error. */
836static const yytype_int8 yytable[] =
837{
838 58, -4, 1, 43, -34, 27, 28, 33, 41, 42,
839 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
840 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
841 29, 35, 30, 31, 22, 73, 32, 36, 44, 45,
842 46, 51, 52, 53, 73, 54, 33, 33, 37, 38,
843 39, 40, 47, 48, 55, 56, 49, 87, 93, 50,
844 87, 56, 63, 64, 65, 60, 93, 2, 3, 4,
845 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
846 15, 16, 17, 18, 19, 20, 21, 74, 77, 78,
847 66, 22, 88, 89, 2, 3, 4, 5, 6, 7,
848 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
849 18, 19, 20, 21, 80, 82, 83, 90, 22, 94,
850 97, 100, 2, 3, 4, 5, 6, 7, 8, 9,
851 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
852 20, 21, 57, 98, 99, 84, 22, 96, 81, 95,
853 88, 89, 2, 3, 4, 5, 6, 7, 8, 9,
854 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
855 20, 21, 79, 101, 0, 90, 22, 2, 3, 4,
856 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
857 15, 16, 17, 18, 19, 20, 21, 62, 0, 0,
858 84, 22, 2, 3, 4, 5, 6, 7, 8, 9,
859 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
860 20, 21, 0, 0, 0, 0, 22
861};
862
863static const yytype_int8 yycheck[] =
864{
865 25, 0, 1, 31, 3, 29, 30, 35, 29, 30,
866 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
867 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
868 30, 8, 30, 30, 33, 60, 31, 31, 15, 16,
869 17, 29, 30, 31, 69, 22, 35, 35, 31, 31,
870 31, 29, 31, 29, 0, 3, 31, 82, 83, 31,
871 85, 3, 4, 5, 6, 35, 91, 9, 10, 11,
872 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
873 22, 23, 24, 25, 26, 27, 28, 36, 29, 29,
874 32, 33, 7, 8, 9, 10, 11, 12, 13, 14,
875 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
876 25, 26, 27, 28, 36, 35, 35, 32, 33, 29,
877 29, 36, 9, 10, 11, 12, 13, 14, 15, 16,
878 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
879 27, 28, 24, 29, 29, 32, 33, 85, 69, 36,
880 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
881 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
882 27, 28, 67, 91, -1, 32, 33, 9, 10, 11,
883 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
884 22, 23, 24, 25, 26, 27, 28, 59, -1, -1,
885 32, 33, 9, 10, 11, 12, 13, 14, 15, 16,
886 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
887 27, 28, -1, -1, -1, -1, 33
888};
889
890/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
891 state STATE-NUM. */
892static const yytype_int8 yystos[] =
893{
894 0, 1, 9, 10, 11, 12, 13, 14, 15, 16,
895 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
896 27, 28, 33, 38, 54, 55, 56, 29, 30, 30,
897 30, 30, 31, 35, 52, 52, 31, 31, 31, 31,
898 29, 29, 30, 31, 52, 52, 52, 31, 29, 31,
899 31, 29, 30, 31, 52, 0, 3, 39, 56, 53,
900 35, 40, 54, 4, 5, 6, 32, 39, 41, 42,
901 43, 44, 48, 56, 36, 45, 49, 29, 29, 40,
902 36, 43, 35, 35, 32, 46, 47, 56, 7, 8,
903 32, 50, 51, 56, 29, 36, 47, 29, 29, 29,
904 36, 51
905};
906
907/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
908static const yytype_int8 yyr1[] =
909{
910 0, 37, 38, 38, 38, 39, 40, 41, 41, 42,
911 42, 43, 43, 43, 43, 43, 43, 45, 44, 46,
912 46, 47, 47, 49, 48, 50, 50, 51, 51, 51,
913 51, 53, 52, 54, 54, 55, 55, 56, 56, 56,
914 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
915 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
916 56, 56, 56, 56
917};
918
919/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
920static const yytype_int8 yyr2[] =
921{
922 0, 2, 3, 1, 0, 1, 3, 1, 0, 2,
923 1, 1, 1, 2, 2, 2, 1, 0, 5, 2,
924 1, 2, 1, 0, 5, 2, 1, 2, 2, 2,
925 1, 0, 4, 1, 0, 2, 1, 2, 2, 2,
926 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
927 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
928 2, 2, 2, 2
929};
930
931
932enum { YYENOMEM = -2 };
933
934#define yyerrok (yyerrstatus = 0)
935#define yyclearin (yychar = GMLEMPTY)
936
937#define YYACCEPT goto yyacceptlab
938#define YYABORT goto yyabortlab
939#define YYERROR goto yyerrorlab
940#define YYNOMEM goto yyexhaustedlab
941
942
943#define YYRECOVERING() (!!yyerrstatus)
944
945#define YYBACKUP(Token, Value) \
946 do \
947 if (yychar == GMLEMPTY) \
948 { \
949 yychar = (Token); \
950 yylval = (Value); \
951 YYPOPSTACK (yylen); \
952 yystate = *yyssp; \
953 goto yybackup; \
954 } \
955 else \
956 { \
957 yyerror (YY_("syntax error: cannot back up")); \
958 YYERROR; \
959 } \
960 while (0)
961
962/* Backward compatibility with an undocumented macro.
963 Use GMLerror or GMLUNDEF. */
964#define YYERRCODE GMLUNDEF
965
966
967/* Enable debugging if requested. */
968#if GMLDEBUG
969
970# ifndef YYFPRINTF
971# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
972# define YYFPRINTF fprintf
973# endif
974
975# define YYDPRINTF(Args) \
976do { \
977 if (yydebug) \
978 YYFPRINTF Args; \
979} while (0)
980
981
982
983
984# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
985do { \
986 if (yydebug) \
987 { \
988 YYFPRINTF (stderr, "%s ", Title); \
989 yy_symbol_print (stderr, \
990 Kind, Value); \
991 YYFPRINTF (stderr, "\n"); \
992 } \
993} while (0)
994
995
996/*-----------------------------------.
997| Print this symbol's value on YYO. |
998`-----------------------------------*/
999
1000static void
1001yy_symbol_value_print (FILE *yyo,
1002 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1003{
1004 FILE *yyoutput = yyo;
1005 YY_USE (yyoutput);
1006 if (!yyvaluep)
1007 return;
1009 YY_USE (yykind);
1011}
1012
1013
1014/*---------------------------.
1015| Print this symbol on YYO. |
1016`---------------------------*/
1017
1018static void
1019yy_symbol_print (FILE *yyo,
1020 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
1021{
1022 YYFPRINTF (yyo, "%s %s (",
1023 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1024
1025 yy_symbol_value_print (yyo, yykind, yyvaluep);
1026 YYFPRINTF (yyo, ")");
1027}
1028
1029/*------------------------------------------------------------------.
1030| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1031| TOP (included). |
1032`------------------------------------------------------------------*/
1033
1034static void
1035yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1036{
1037 YYFPRINTF (stderr, "Stack now");
1038 for (; yybottom <= yytop; yybottom++)
1039 {
1040 int yybot = *yybottom;
1041 YYFPRINTF (stderr, " %d", yybot);
1042 }
1043 YYFPRINTF (stderr, "\n");
1044}
1045
1046# define YY_STACK_PRINT(Bottom, Top) \
1047do { \
1048 if (yydebug) \
1049 yy_stack_print ((Bottom), (Top)); \
1050} while (0)
1051
1052
1053/*------------------------------------------------.
1054| Report that the YYRULE is going to be reduced. |
1055`------------------------------------------------*/
1056
1057static void
1058yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
1059 int yyrule)
1060{
1061 int yylno = yyrline[yyrule];
1062 int yynrhs = yyr2[yyrule];
1063 int yyi;
1064 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1065 yyrule - 1, yylno);
1066 /* The symbols being reduced. */
1067 for (yyi = 0; yyi < yynrhs; yyi++)
1068 {
1069 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1070 yy_symbol_print (stderr,
1071 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1072 &yyvsp[(yyi + 1) - (yynrhs)]);
1073 YYFPRINTF (stderr, "\n");
1074 }
1075}
1076
1077# define YY_REDUCE_PRINT(Rule) \
1078do { \
1079 if (yydebug) \
1080 yy_reduce_print (yyssp, yyvsp, Rule); \
1081} while (0)
1082
1083/* Nonzero means print parse trace. It is left uninitialized so that
1084 multiple parsers can coexist. */
1085int yydebug;
1086#else /* !GMLDEBUG */
1087# define YYDPRINTF(Args) ((void) 0)
1088# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1089# define YY_STACK_PRINT(Bottom, Top)
1090# define YY_REDUCE_PRINT(Rule)
1091#endif /* !GMLDEBUG */
1092
1093
1094/* YYINITDEPTH -- initial size of the parser's stacks. */
1095#ifndef YYINITDEPTH
1096# define YYINITDEPTH 200
1097#endif
1098
1099/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1100 if the built-in stack extension method is used).
1101
1102 Do not make this value too large; the results are undefined if
1103 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1104 evaluated with infinite-precision integer arithmetic. */
1105
1106#ifndef YYMAXDEPTH
1107# define YYMAXDEPTH 10000
1108#endif
1109
1110
1111
1112
1113
1114
1115/*-----------------------------------------------.
1116| Release the memory associated to this symbol. |
1117`-----------------------------------------------*/
1118
1119static void
1120yydestruct (const char *yymsg,
1121 yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
1122{
1123 YY_USE (yyvaluep);
1124 if (!yymsg)
1125 yymsg = "Deleting";
1126 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1127
1129 YY_USE (yykind);
1131}
1132
1133
1134/* Lookahead token kind. */
1136
1137/* The semantic value of the lookahead symbol. */
1139/* Number of syntax errors so far. */
1141
1142
1143
1144
1145/*----------.
1146| yyparse. |
1147`----------*/
1148
1149int
1151{
1152 yy_state_fast_t yystate = 0;
1153 /* Number of tokens to shift before error messages enabled. */
1154 int yyerrstatus = 0;
1155
1156 /* Refer to the stacks through separate pointers, to allow yyoverflow
1157 to reallocate them elsewhere. */
1158
1159 /* Their size. */
1160 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1161
1162 /* The state stack: array, bottom, top. */
1163 yy_state_t yyssa[YYINITDEPTH];
1164 yy_state_t *yyss = yyssa;
1165 yy_state_t *yyssp = yyss;
1166
1167 /* The semantic value stack: array, bottom, top. */
1168 YYSTYPE yyvsa[YYINITDEPTH];
1169 YYSTYPE *yyvs = yyvsa;
1170 YYSTYPE *yyvsp = yyvs;
1171
1172 int yyn;
1173 /* The return value of yyparse. */
1174 int yyresult;
1175 /* Lookahead symbol kind. */
1177 /* The variables used to return semantic value and location from the
1178 action routines. */
1179 YYSTYPE yyval;
1180
1181
1182
1183#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1184
1185 /* The number of symbols on the RHS of the reduced rule.
1186 Keep to zero when no symbol should be popped. */
1187 int yylen = 0;
1188
1189 YYDPRINTF ((stderr, "Starting parse\n"));
1190
1191 yychar = GMLEMPTY; /* Cause a token to be read. */
1192
1193 goto yysetstate;
1194
1195
1196/*------------------------------------------------------------.
1197| yynewstate -- push a new state, which is found in yystate. |
1198`------------------------------------------------------------*/
1199yynewstate:
1200 /* In all cases, when you get here, the value and location stacks
1201 have just been pushed. So pushing a state here evens the stacks. */
1202 yyssp++;
1203
1204
1205/*--------------------------------------------------------------------.
1206| yysetstate -- set current state (the top of the stack) to yystate. |
1207`--------------------------------------------------------------------*/
1208yysetstate:
1209 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1210 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1212 *yyssp = YY_CAST (yy_state_t, yystate);
1214 YY_STACK_PRINT (yyss, yyssp);
1215
1216 if (yyss + yystacksize - 1 <= yyssp)
1217#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1218 YYNOMEM;
1219#else
1220 {
1221 /* Get the current used size of the three stacks, in elements. */
1222 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1223
1224# if defined yyoverflow
1225 {
1226 /* Give user a chance to reallocate the stack. Use copies of
1227 these so that the &'s don't force the real ones into
1228 memory. */
1229 yy_state_t *yyss1 = yyss;
1230 YYSTYPE *yyvs1 = yyvs;
1231
1232 /* Each stack pointer address is followed by the size of the
1233 data in use in that stack, in bytes. This used to be a
1234 conditional around just the two extra args, but that might
1235 be undefined if yyoverflow is a macro. */
1236 yyoverflow (YY_("memory exhausted"),
1237 &yyss1, yysize * YYSIZEOF (*yyssp),
1238 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1239 &yystacksize);
1240 yyss = yyss1;
1241 yyvs = yyvs1;
1242 }
1243# else /* defined YYSTACK_RELOCATE */
1244 /* Extend the stack our own way. */
1245 if (YYMAXDEPTH <= yystacksize)
1246 YYNOMEM;
1247 yystacksize *= 2;
1248 if (YYMAXDEPTH < yystacksize)
1249 yystacksize = YYMAXDEPTH;
1250
1251 {
1252 yy_state_t *yyss1 = yyss;
1253 union yyalloc *yyptr =
1254 YY_CAST (union yyalloc *,
1255 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1256 if (! yyptr)
1257 YYNOMEM;
1258 YYSTACK_RELOCATE (yyss_alloc, yyss);
1259 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1260# undef YYSTACK_RELOCATE
1261 if (yyss1 != yyssa)
1262 YYSTACK_FREE (yyss1);
1263 }
1264# endif
1265
1266 yyssp = yyss + yysize - 1;
1267 yyvsp = yyvs + yysize - 1;
1268
1270 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1271 YY_CAST (long, yystacksize)));
1273
1274 if (yyss + yystacksize - 1 <= yyssp)
1275 YYABORT;
1276 }
1277#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1278
1279
1280 if (yystate == YYFINAL)
1281 YYACCEPT;
1282
1283 goto yybackup;
1284
1285
1286/*-----------.
1287| yybackup. |
1288`-----------*/
1289yybackup:
1290 /* Do appropriate processing given the current state. Read a
1291 lookahead token if we need one and don't already have one. */
1292
1293 /* First try to decide what to do without reference to lookahead token. */
1294 yyn = yypact[yystate];
1295 if (yypact_value_is_default (yyn))
1296 goto yydefault;
1297
1298 /* Not known => get a lookahead token if don't already have one. */
1299
1300 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1301 if (yychar == GMLEMPTY)
1302 {
1303 YYDPRINTF ((stderr, "Reading a token\n"));
1304 yychar = yylex ();
1305 }
1306
1307 if (yychar <= GMLEOF)
1308 {
1309 yychar = GMLEOF;
1310 yytoken = YYSYMBOL_YYEOF;
1311 YYDPRINTF ((stderr, "Now at end of input.\n"));
1312 }
1313 else if (yychar == GMLerror)
1314 {
1315 /* The scanner already issued an error message, process directly
1316 to error recovery. But do not keep the error token as
1317 lookahead, it is too special and may lead us to an endless
1318 loop in error recovery. */
1319 yychar = GMLUNDEF;
1320 yytoken = YYSYMBOL_YYerror;
1321 goto yyerrlab1;
1322 }
1323 else
1324 {
1325 yytoken = YYTRANSLATE (yychar);
1326 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1327 }
1328
1329 /* If the proper action on seeing token YYTOKEN is to reduce or to
1330 detect an error, take that action. */
1331 yyn += yytoken;
1332 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1333 goto yydefault;
1334 yyn = yytable[yyn];
1335 if (yyn <= 0)
1336 {
1337 if (yytable_value_is_error (yyn))
1338 goto yyerrlab;
1339 yyn = -yyn;
1340 goto yyreduce;
1341 }
1342
1343 /* Count tokens shifted since error; after three, turn off error
1344 status. */
1345 if (yyerrstatus)
1346 yyerrstatus--;
1347
1348 /* Shift the lookahead token. */
1349 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1350 yystate = yyn;
1352 *++yyvsp = yylval;
1354
1355 /* Discard the shifted token. */
1356 yychar = GMLEMPTY;
1357 goto yynewstate;
1358
1359
1360/*-----------------------------------------------------------.
1361| yydefault -- do the default action for the current state. |
1362`-----------------------------------------------------------*/
1363yydefault:
1364 yyn = yydefact[yystate];
1365 if (yyn == 0)
1366 goto yyerrlab;
1367 goto yyreduce;
1368
1369
1370/*-----------------------------.
1371| yyreduce -- do a reduction. |
1372`-----------------------------*/
1373yyreduce:
1374 /* yyn is the number of a rule to reduce with. */
1375 yylen = yyr2[yyn];
1376
1377 /* If YYLEN is nonzero, implement the default value of the action:
1378 '$$ = $1'.
1379
1380 Otherwise, the following line sets YYVAL to garbage.
1381 This behavior is undocumented and Bison
1382 users should not rely upon it. Assigning to YYVAL
1383 unconditionally makes the parser a bit smaller, and it avoids a
1384 GCC warning that YYVAL may be used uninitialized. */
1385 yyval = yyvsp[1-yylen];
1386
1387
1388 YY_REDUCE_PRINT (yyn);
1389 switch (yyn)
1390 {
1391 case 2: /* graph: optalist hdr body */
1392#line 224 "../../cmd/tools/gmlparse.y"
1393 {gmllexeof(); if (G->parent) popG(); }
1394#line 1395 "gmlparse.c"
1395 break;
1396
1397 case 3: /* graph: error */
1398#line 225 "../../cmd/tools/gmlparse.y"
1399 { cleanup(); YYABORT; }
1400#line 1401 "gmlparse.c"
1401 break;
1402
1403 case 5: /* hdr: GRAPH */
1404#line 229 "../../cmd/tools/gmlparse.y"
1405 { pushG(); }
1406#line 1407 "gmlparse.c"
1407 break;
1408
1409 case 11: /* glistitem: node */
1410#line 243 "../../cmd/tools/gmlparse.y"
1411 { LIST_APPEND(&G->nodelist, (yyvsp[0].np)); }
1412#line 1413 "gmlparse.c"
1413 break;
1414
1415 case 12: /* glistitem: edge */
1416#line 244 "../../cmd/tools/gmlparse.y"
1417 { LIST_APPEND(&G->edgelist, (yyvsp[0].ep)); }
1418#line 1419 "gmlparse.c"
1419 break;
1420
1421 case 14: /* glistitem: DIRECTED INTEGER */
1422#line 246 "../../cmd/tools/gmlparse.y"
1423 {
1424 if (setDir((yyvsp[0].str))) {
1425 yyerror("mixed directed and undirected graphs");
1426 cleanup ();
1427 YYABORT;
1428 }
1429 }
1430#line 1431 "gmlparse.c"
1431 break;
1432
1433 case 15: /* glistitem: ID INTEGER */
1434#line 253 "../../cmd/tools/gmlparse.y"
1435 { LIST_APPEND(&G->attrlist, mkAttr(gv_strdup("id"), 0, INTEGER, (yyvsp[0].str), 0)); }
1436#line 1437 "gmlparse.c"
1437 break;
1438
1439 case 16: /* glistitem: alistitem */
1440#line 254 "../../cmd/tools/gmlparse.y"
1441 { LIST_APPEND(&G->attrlist, (yyvsp[0].ap)); }
1442#line 1443 "gmlparse.c"
1443 break;
1444
1445 case 17: /* $@1: %empty */
1446#line 257 "../../cmd/tools/gmlparse.y"
1447 { N = mkNode(); }
1448#line 1449 "gmlparse.c"
1449 break;
1450
1451 case 18: /* node: NODE $@1 '[' nlist ']' */
1452#line 257 "../../cmd/tools/gmlparse.y"
1453 { (yyval.np) = N; N = NULL; }
1454#line 1455 "gmlparse.c"
1455 break;
1456
1457 case 21: /* nlistitem: ID INTEGER */
1458#line 264 "../../cmd/tools/gmlparse.y"
1459 { N->id = (yyvsp[0].str); }
1460#line 1461 "gmlparse.c"
1461 break;
1462
1463 case 22: /* nlistitem: alistitem */
1464#line 265 "../../cmd/tools/gmlparse.y"
1465 { LIST_APPEND(&N->attrlist, (yyvsp[0].ap)); }
1466#line 1467 "gmlparse.c"
1467 break;
1468
1469 case 23: /* $@2: %empty */
1470#line 268 "../../cmd/tools/gmlparse.y"
1471 { E = mkEdge(); }
1472#line 1473 "gmlparse.c"
1473 break;
1474
1475 case 24: /* edge: EDGE $@2 '[' elist ']' */
1476#line 268 "../../cmd/tools/gmlparse.y"
1477 { (yyval.ep) = E; E = NULL; }
1478#line 1479 "gmlparse.c"
1479 break;
1480
1481 case 27: /* elistitem: SOURCE INTEGER */
1482#line 275 "../../cmd/tools/gmlparse.y"
1483 { E->source = (yyvsp[0].str); }
1484#line 1485 "gmlparse.c"
1485 break;
1486
1487 case 28: /* elistitem: TARGET INTEGER */
1488#line 276 "../../cmd/tools/gmlparse.y"
1489 { E->target = (yyvsp[0].str); }
1490#line 1491 "gmlparse.c"
1491 break;
1492
1493 case 29: /* elistitem: ID INTEGER */
1494#line 277 "../../cmd/tools/gmlparse.y"
1495 { LIST_APPEND(&E->attrlist, mkAttr(gv_strdup("id"), 0, INTEGER, (yyvsp[0].str), 0)); }
1496#line 1497 "gmlparse.c"
1497 break;
1498
1499 case 30: /* elistitem: alistitem */
1500#line 278 "../../cmd/tools/gmlparse.y"
1501 { LIST_APPEND(&E->attrlist, (yyvsp[0].ap)); }
1502#line 1503 "gmlparse.c"
1503 break;
1504
1505 case 31: /* $@3: %empty */
1506#line 281 "../../cmd/tools/gmlparse.y"
1507 {pushAlist(); }
1508#line 1509 "gmlparse.c"
1509 break;
1510
1511 case 32: /* attrlist: '[' $@3 optalist ']' */
1512#line 281 "../../cmd/tools/gmlparse.y"
1513 { (yyval.list) = popAlist(); }
1514#line 1515 "gmlparse.c"
1515 break;
1516
1517 case 35: /* alist: alist alistitem */
1518#line 288 "../../cmd/tools/gmlparse.y"
1519 { LIST_APPEND(L, (yyvsp[0].ap)); }
1520#line 1521 "gmlparse.c"
1521 break;
1522
1523 case 36: /* alist: alistitem */
1524#line 289 "../../cmd/tools/gmlparse.y"
1525 { LIST_APPEND(L, (yyvsp[0].ap)); }
1526#line 1527 "gmlparse.c"
1527 break;
1528
1529 case 37: /* alistitem: NAME INTEGER */
1530#line 292 "../../cmd/tools/gmlparse.y"
1531 { (yyval.ap) = mkAttr ((yyvsp[-1].str), 0, INTEGER, (yyvsp[0].str), 0); }
1532#line 1533 "gmlparse.c"
1533 break;
1534
1535 case 38: /* alistitem: NAME REAL */
1536#line 293 "../../cmd/tools/gmlparse.y"
1537 { (yyval.ap) = mkAttr ((yyvsp[-1].str), 0, REAL, (yyvsp[0].str), 0); }
1538#line 1539 "gmlparse.c"
1539 break;
1540
1541 case 39: /* alistitem: NAME STRING */
1542#line 294 "../../cmd/tools/gmlparse.y"
1543 { (yyval.ap) = mkAttr ((yyvsp[-1].str), 0, STRING, (yyvsp[0].str), 0); }
1544#line 1545 "gmlparse.c"
1545 break;
1546
1547 case 40: /* alistitem: NAME attrlist */
1548#line 295 "../../cmd/tools/gmlparse.y"
1549 { (yyval.ap) = mkAttr ((yyvsp[-1].str), 0, GML_LIST, 0, (yyvsp[0].list)); }
1550#line 1551 "gmlparse.c"
1551 break;
1552
1553 case 41: /* alistitem: XVAL REAL */
1554#line 296 "../../cmd/tools/gmlparse.y"
1555 { (yyval.ap) = mkAttr (0, XVAL, REAL, (yyvsp[0].str), 0); }
1556#line 1557 "gmlparse.c"
1557 break;
1558
1559 case 42: /* alistitem: XVAL INTEGER */
1560#line 297 "../../cmd/tools/gmlparse.y"
1561 { (yyval.ap) = mkAttr (0, XVAL, REAL, (yyvsp[0].str), 0); }
1562#line 1563 "gmlparse.c"
1563 break;
1564
1565 case 43: /* alistitem: YVAL REAL */
1566#line 298 "../../cmd/tools/gmlparse.y"
1567 { (yyval.ap) = mkAttr (0, YVAL, REAL, (yyvsp[0].str), 0); }
1568#line 1569 "gmlparse.c"
1569 break;
1570
1571 case 44: /* alistitem: WVAL REAL */
1572#line 299 "../../cmd/tools/gmlparse.y"
1573 { (yyval.ap) = mkAttr (0, WVAL, REAL, (yyvsp[0].str), 0); }
1574#line 1575 "gmlparse.c"
1575 break;
1576
1577 case 45: /* alistitem: HVAL REAL */
1578#line 300 "../../cmd/tools/gmlparse.y"
1579 { (yyval.ap) = mkAttr (0, HVAL, REAL, (yyvsp[0].str), 0); }
1580#line 1581 "gmlparse.c"
1581 break;
1582
1583 case 46: /* alistitem: LABEL STRING */
1584#line 301 "../../cmd/tools/gmlparse.y"
1585 { (yyval.ap) = mkAttr (0, LABEL, STRING, (yyvsp[0].str), 0); }
1586#line 1587 "gmlparse.c"
1587 break;
1588
1589 case 47: /* alistitem: GRAPHICS attrlist */
1590#line 302 "../../cmd/tools/gmlparse.y"
1591 { (yyval.ap) = mkAttr (0, GRAPHICS, GML_LIST, 0, (yyvsp[0].list)); }
1592#line 1593 "gmlparse.c"
1593 break;
1594
1595 case 48: /* alistitem: LABELGRAPHICS attrlist */
1596#line 303 "../../cmd/tools/gmlparse.y"
1597 { (yyval.ap) = mkAttr (0, LABELGRAPHICS, GML_LIST, 0, (yyvsp[0].list)); }
1598#line 1599 "gmlparse.c"
1599 break;
1600
1601 case 49: /* alistitem: TYPE STRING */
1602#line 304 "../../cmd/tools/gmlparse.y"
1603 { (yyval.ap) = mkAttr (0, TYPE, STRING, (yyvsp[0].str), 0); }
1604#line 1605 "gmlparse.c"
1605 break;
1606
1607 case 50: /* alistitem: FILL STRING */
1608#line 305 "../../cmd/tools/gmlparse.y"
1609 { (yyval.ap) = mkAttr (0, FILL, STRING, (yyvsp[0].str), 0); }
1610#line 1611 "gmlparse.c"
1611 break;
1612
1613 case 51: /* alistitem: OUTLINE STRING */
1614#line 306 "../../cmd/tools/gmlparse.y"
1615 { (yyval.ap) = mkAttr (0, OUTLINE, STRING, (yyvsp[0].str), 0); }
1616#line 1617 "gmlparse.c"
1617 break;
1618
1619 case 52: /* alistitem: OUTLINESTYLE STRING */
1620#line 307 "../../cmd/tools/gmlparse.y"
1621 { (yyval.ap) = mkAttr (0, OUTLINESTYLE, STRING, (yyvsp[0].str), 0); }
1622#line 1623 "gmlparse.c"
1623 break;
1624
1625 case 53: /* alistitem: OUTLINEWIDTH INTEGER */
1626#line 308 "../../cmd/tools/gmlparse.y"
1627 { (yyval.ap) = mkAttr (0, OUTLINEWIDTH, INTEGER, (yyvsp[0].str), 0); }
1628#line 1629 "gmlparse.c"
1629 break;
1630
1631 case 54: /* alistitem: WIDTH REAL */
1632#line 309 "../../cmd/tools/gmlparse.y"
1633 { (yyval.ap) = mkAttr (0, WIDTH, REAL, (yyvsp[0].str), 0); }
1634#line 1635 "gmlparse.c"
1635 break;
1636
1637 case 55: /* alistitem: WIDTH INTEGER */
1638#line 310 "../../cmd/tools/gmlparse.y"
1639 { (yyval.ap) = mkAttr (0, WIDTH, INTEGER, (yyvsp[0].str), 0); }
1640#line 1641 "gmlparse.c"
1641 break;
1642
1643 case 56: /* alistitem: STYLE STRING */
1644#line 311 "../../cmd/tools/gmlparse.y"
1645 { (yyval.ap) = mkAttr (0, STYLE, STRING, (yyvsp[0].str), 0); }
1646#line 1647 "gmlparse.c"
1647 break;
1648
1649 case 57: /* alistitem: STYLE attrlist */
1650#line 312 "../../cmd/tools/gmlparse.y"
1651 { (yyval.ap) = mkAttr (0, STYLE, GML_LIST, 0, (yyvsp[0].list)); }
1652#line 1653 "gmlparse.c"
1653 break;
1654
1655 case 58: /* alistitem: LINE attrlist */
1656#line 313 "../../cmd/tools/gmlparse.y"
1657 { (yyval.ap) = mkAttr (0, LINE, GML_LIST, 0, (yyvsp[0].list)); }
1658#line 1659 "gmlparse.c"
1659 break;
1660
1661 case 59: /* alistitem: POINT attrlist */
1662#line 314 "../../cmd/tools/gmlparse.y"
1663 { (yyval.ap) = mkAttr (0, POINT, GML_LIST, 0, (yyvsp[0].list)); }
1664#line 1665 "gmlparse.c"
1665 break;
1666
1667 case 60: /* alistitem: TEXT STRING */
1668#line 315 "../../cmd/tools/gmlparse.y"
1669 { (yyval.ap) = mkAttr (0, TEXT, STRING, (yyvsp[0].str), 0); }
1670#line 1671 "gmlparse.c"
1671 break;
1672
1673 case 61: /* alistitem: FONTNAME STRING */
1674#line 316 "../../cmd/tools/gmlparse.y"
1675 { (yyval.ap) = mkAttr (0, FONTNAME, STRING, (yyvsp[0].str), 0); }
1676#line 1677 "gmlparse.c"
1677 break;
1678
1679 case 62: /* alistitem: FONTSIZE INTEGER */
1680#line 317 "../../cmd/tools/gmlparse.y"
1681 { (yyval.ap) = mkAttr (0, FONTNAME, INTEGER, (yyvsp[0].str), 0); }
1682#line 1683 "gmlparse.c"
1683 break;
1684
1685 case 63: /* alistitem: COLOR STRING */
1686#line 318 "../../cmd/tools/gmlparse.y"
1687 { (yyval.ap) = mkAttr (0, COLOR, STRING, (yyvsp[0].str), 0); }
1688#line 1689 "gmlparse.c"
1689 break;
1690
1691
1692#line 1693 "gmlparse.c"
1693
1694 default: break;
1695 }
1696 /* User semantic actions sometimes alter yychar, and that requires
1697 that yytoken be updated with the new translation. We take the
1698 approach of translating immediately before every use of yytoken.
1699 One alternative is translating here after every semantic action,
1700 but that translation would be missed if the semantic action invokes
1701 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1702 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1703 incorrect destructor might then be invoked immediately. In the
1704 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1705 to an incorrect destructor call or verbose syntax error message
1706 before the lookahead is translated. */
1707 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1708
1709 YYPOPSTACK (yylen);
1710 yylen = 0;
1711
1712 *++yyvsp = yyval;
1713
1714 /* Now 'shift' the result of the reduction. Determine what state
1715 that goes to, based on the state we popped back to and the rule
1716 number reduced by. */
1717 {
1718 const int yylhs = yyr1[yyn] - YYNTOKENS;
1719 const int yyi = yypgoto[yylhs] + *yyssp;
1720 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1721 ? yytable[yyi]
1722 : yydefgoto[yylhs]);
1723 }
1724
1725 goto yynewstate;
1726
1727
1728/*--------------------------------------.
1729| yyerrlab -- here on detecting error. |
1730`--------------------------------------*/
1731yyerrlab:
1732 /* Make sure we have latest lookahead translation. See comments at
1733 user semantic actions for why this is necessary. */
1735 /* If not already recovering from an error, report this error. */
1736 if (!yyerrstatus)
1737 {
1738 ++yynerrs;
1739 yyerror (YY_("syntax error"));
1740 }
1741
1742 if (yyerrstatus == 3)
1743 {
1744 /* If just tried and failed to reuse lookahead token after an
1745 error, discard it. */
1746
1747 if (yychar <= GMLEOF)
1748 {
1749 /* Return failure if at end of input. */
1750 if (yychar == GMLEOF)
1751 YYABORT;
1752 }
1753 else
1754 {
1755 yydestruct ("Error: discarding",
1756 yytoken, &yylval);
1757 yychar = GMLEMPTY;
1758 }
1759 }
1760
1761 /* Else will try to reuse lookahead token after shifting the error
1762 token. */
1763 goto yyerrlab1;
1764
1765
1766/*---------------------------------------------------.
1767| yyerrorlab -- error raised explicitly by YYERROR. |
1768`---------------------------------------------------*/
1769yyerrorlab:
1770 /* Pacify compilers when the user code never invokes YYERROR and the
1771 label yyerrorlab therefore never appears in user code. */
1772 if (0)
1773 YYERROR;
1774 ++yynerrs;
1775
1776 /* Do not reclaim the symbols of the rule whose action triggered
1777 this YYERROR. */
1778 YYPOPSTACK (yylen);
1779 yylen = 0;
1780 YY_STACK_PRINT (yyss, yyssp);
1781 yystate = *yyssp;
1782 goto yyerrlab1;
1783
1784
1785/*-------------------------------------------------------------.
1786| yyerrlab1 -- common code for both syntax error and YYERROR. |
1787`-------------------------------------------------------------*/
1788yyerrlab1:
1789 yyerrstatus = 3; /* Each real token shifted decrements this. */
1790
1791 /* Pop stack until we find a state that shifts the error token. */
1792 for (;;)
1793 {
1794 yyn = yypact[yystate];
1795 if (!yypact_value_is_default (yyn))
1796 {
1797 yyn += YYSYMBOL_YYerror;
1798 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1799 {
1800 yyn = yytable[yyn];
1801 if (0 < yyn)
1802 break;
1803 }
1804 }
1805
1806 /* Pop the current state because it cannot handle the error token. */
1807 if (yyssp == yyss)
1808 YYABORT;
1809
1810
1811 yydestruct ("Error: popping",
1812 YY_ACCESSING_SYMBOL (yystate), yyvsp);
1813 YYPOPSTACK (1);
1814 yystate = *yyssp;
1815 YY_STACK_PRINT (yyss, yyssp);
1816 }
1817
1819 *++yyvsp = yylval;
1821
1822
1823 /* Shift the error token. */
1824 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1825
1826 yystate = yyn;
1827 goto yynewstate;
1828
1829
1830/*-------------------------------------.
1831| yyacceptlab -- YYACCEPT comes here. |
1832`-------------------------------------*/
1833yyacceptlab:
1834 yyresult = 0;
1835 goto yyreturnlab;
1836
1837
1838/*-----------------------------------.
1839| yyabortlab -- YYABORT comes here. |
1840`-----------------------------------*/
1841yyabortlab:
1842 yyresult = 1;
1843 goto yyreturnlab;
1844
1845
1846/*-----------------------------------------------------------.
1847| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1848`-----------------------------------------------------------*/
1849yyexhaustedlab:
1850 yyerror (YY_("memory exhausted"));
1851 yyresult = 2;
1852 goto yyreturnlab;
1853
1854
1855/*----------------------------------------------------------.
1856| yyreturnlab -- parsing is finished, clean up and return. |
1857`----------------------------------------------------------*/
1858yyreturnlab:
1859 if (yychar != GMLEMPTY)
1860 {
1861 /* Make sure we have latest lookahead translation. See comments at
1862 user semantic actions for why this is necessary. */
1863 yytoken = YYTRANSLATE (yychar);
1864 yydestruct ("Cleanup: discarding lookahead",
1865 yytoken, &yylval);
1866 }
1867 /* Do not reclaim the symbols of the rule whose action triggered
1868 this YYABORT or YYACCEPT. */
1869 YYPOPSTACK (yylen);
1870 YY_STACK_PRINT (yyss, yyssp);
1871 while (yyssp != yyss)
1872 {
1873 yydestruct ("Cleanup: popping",
1874 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
1875 YYPOPSTACK (1);
1876 }
1877#ifndef yyoverflow
1878 if (yyss != yyssa)
1879 YYSTACK_FREE (yyss);
1880#endif
1881
1882 return yyresult;
1883}
1884
1885#line 321 "../../cmd/tools/gmlparse.y"
1886
1887
1888static void free_attr(gmlattr *p) {
1889 if (!p) return;
1890 if (p->kind == GML_LIST && p->u.lp)
1891 free_attrs(p->u.lp);
1892 else
1893 free (p->u.value);
1894 free (p->name);
1895 free (p);
1896}
1897
1898static void deparseList(attrs_t *alist, agxbuf *xb);
1899
1900static void
1902{
1903 if (ap->kind == GML_LIST) {
1904 agxbprint (xb, "%s ", ap->name);
1905 deparseList (ap->u.lp, xb);
1906 }
1907 else if (ap->kind == STRING) {
1908 agxbprint (xb, "%s \"%s\"", ap->name, ap->u.value);
1909 }
1910 else {
1911 agxbprint (xb, "%s %s", ap->name, ap->u.value);
1912 }
1913}
1914
1915static void deparseList(attrs_t *alist, agxbuf *xb) {
1916 agxbput (xb, "[ ");
1917 for (size_t i = 0; alist != NULL && i < LIST_SIZE(alist); ++i) {
1918 gmlattr *const ap = LIST_GET(alist, i);
1919 deparseAttr (ap, xb);
1920 agxbputc (xb, ' ');
1921 }
1922 agxbput (xb, "]");
1923
1924}
1925
1926static void
1928{
1929 char* str;
1930
1931 if (ap->kind == GML_LIST) {
1932 deparseList (ap->u.lp, xb);
1933 str = agxbuse (xb);
1934 }
1935 else
1936 str = ap->u.value;
1937
1938 agsafeset (obj, ap->name, str, "");
1939}
1940
1941static void addNodeLabelGraphics(Agnode_t *np, attrs_t *alist, agxbuf *unk) {
1942 int cnt = 0;
1943
1944 if (!alist)
1945 return;
1946
1947 for (size_t i = 0; i < LIST_SIZE(alist); ++i) {
1948 gmlattr *const ap = LIST_GET(alist, i);
1949 if (ap->sort == TEXT) {
1950 agsafeset (np, "label", ap->u.value, "");
1951 }
1952 else if (ap->sort == COLOR) {
1953 agsafeset (np, "fontcolor", ap->u.value, "");
1954 }
1955 else if (ap->sort == FONTSIZE) {
1956 agsafeset (np, "fontsize", ap->u.value, "");
1957 }
1958 else if (ap->sort == FONTNAME) {
1959 agsafeset (np, "fontname", ap->u.value, "");
1960 }
1961 else {
1962 if (cnt)
1963 agxbputc (unk, ' ');
1964 else {
1965 agxbput (unk, "[ ");
1966 }
1967 deparseAttr (ap, unk);
1968 cnt++;
1969 }
1970 }
1971
1972 if (cnt) {
1973 agxbput (unk, " ]");
1974 agsafeset (np, "LabelGraphics", agxbuse (unk), "");
1975 }
1976 else
1977 agxbclear (unk);
1978}
1979
1980static void addEdgeLabelGraphics(Agedge_t *ep, attrs_t *alist, agxbuf *xb,
1981 agxbuf *unk) {
1982 char* x = "0";
1983 char* y = "0";
1984 int cnt = 0;
1985
1986 if (!alist)
1987 return;
1988
1989 for (size_t i = 0; i < LIST_SIZE(alist); ++i) {
1990 gmlattr *const ap = LIST_GET(alist, i);
1991 if (ap->sort == TEXT) {
1992 agsafeset (ep, "label", ap->u.value, "");
1993 }
1994 else if (ap->sort == COLOR) {
1995 agsafeset (ep, "fontcolor", ap->u.value, "");
1996 }
1997 else if (ap->sort == FONTSIZE) {
1998 agsafeset (ep, "fontsize", ap->u.value, "");
1999 }
2000 else if (ap->sort == FONTNAME) {
2001 agsafeset (ep, "fontname", ap->u.value, "");
2002 }
2003 else if (ap->sort == XVAL) {
2004 x = ap->u.value;
2005 }
2006 else if (ap->sort == YVAL) {
2007 y = ap->u.value;
2008 }
2009 else {
2010 if (cnt)
2011 agxbputc (unk, ' ');
2012 else {
2013 agxbput (unk, "[ ");
2014 }
2015 deparseAttr (ap, unk);
2016 cnt++;
2017 }
2018 }
2019
2020 agxbprint (xb, "%s,%s", x, y);
2021 agsafeset (ep, "lp", agxbuse (xb), "");
2022
2023 if (cnt) {
2024 agxbput (unk, " ]");
2025 agsafeset (ep, "LabelGraphics", agxbuse (unk), "");
2026 }
2027 else
2028 agxbclear (unk);
2029}
2030
2031static void addNodeGraphics(Agnode_t *np, attrs_t *alist, agxbuf *xb,
2032 agxbuf *unk) {
2033 char* x = "0";
2034 char* y = "0";
2035 char buf[BUFSIZ];
2036 double d;
2037 int cnt = 0;
2038
2039 for (size_t i = 0; alist != NULL && i < LIST_SIZE(alist); ++i) {
2040 gmlattr *const ap = LIST_GET(alist, i);
2041 if (ap->sort == XVAL) {
2042 x = ap->u.value;
2043 }
2044 else if (ap->sort == YVAL) {
2045 y = ap->u.value;
2046 }
2047 else if (ap->sort == WVAL) {
2048 d = atof (ap->u.value);
2049 snprintf(buf, sizeof(buf), "%.04f", d/72.0);
2050 agsafeset (np, "width", buf, "");
2051 }
2052 else if (ap->sort == HVAL) {
2053 d = atof (ap->u.value);
2054 snprintf(buf, sizeof(buf), "%.04f", d/72.0);
2055 agsafeset (np, "height", buf, "");
2056 }
2057 else if (ap->sort == TYPE) {
2058 agsafeset (np, "shape", ap->u.value, "");
2059 }
2060 else if (ap->sort == FILL) {
2061 agsafeset (np, "color", ap->u.value, "");
2062 }
2063 else if (ap->sort == OUTLINE) {
2064 agsafeset (np, "pencolor", ap->u.value, "");
2065 }
2066 else if (ap->sort == WIDTH || ap->sort == OUTLINEWIDTH) {
2067 agsafeset (np, "penwidth", ap->u.value, "");
2068 }
2069 else if (ap->sort == STYLE || ap->sort == OUTLINESTYLE) {
2070 agsafeset (np, "style", ap->u.value, "");
2071 }
2072 else {
2073 if (cnt)
2074 agxbputc (unk, ' ');
2075 else {
2076 agxbput (unk, "[ ");
2077 }
2078 deparseAttr (ap, unk);
2079 cnt++;
2080 }
2081 }
2082
2083 agxbprint (xb, "%s,%s", x, y);
2084 agsafeset (np, "pos", agxbuse (xb), "");
2085
2086 if (cnt) {
2087 agxbput (unk, " ]");
2088 agsafeset (np, "graphics", agxbuse (unk), "");
2089 }
2090 else
2091 agxbclear (unk);
2092}
2093
2094static void addEdgePoint(Agedge_t *ep, attrs_t *alist, agxbuf *xb) {
2095 char* x = "0";
2096 char* y = "0";
2097
2098 for (size_t i = 0; alist != NULL && i < LIST_SIZE(alist); ++i) {
2099 gmlattr *const ap = LIST_GET(alist, i);
2100 if (ap->sort == XVAL) {
2101 x = ap->u.value;
2102 }
2103 else if (ap->sort == YVAL) {
2104 y = ap->u.value;
2105 }
2106 else {
2107 fprintf (stderr, "non-X/Y field in point attribute");
2108 unknown ((Agobj_t*)ep, ap, xb);
2109 }
2110 }
2111
2112 if (agxblen(xb)) agxbputc (xb, ' ');
2113 agxbprint (xb, "%s,%s", x, y);
2114}
2115
2116static void addEdgePos(Agedge_t *ep, attrs_t *alist, agxbuf *xb) {
2117 if (!alist) return;
2118 for (size_t i = 0; i < LIST_SIZE(alist); ++i) {
2119 gmlattr *const ap = LIST_GET(alist, i);
2120 if (ap->sort == POINT) {
2121 addEdgePoint (ep, ap->u.lp, xb);
2122 }
2123 else {
2124 fprintf (stderr, "non-point field in line attribute");
2125 unknown ((Agobj_t*)ep, ap, xb);
2126 }
2127 }
2128 agsafeset (ep, "pos", agxbuse (xb), "");
2129}
2130
2131static void addEdgeGraphics(Agedge_t *ep, attrs_t *alist, agxbuf *xb,
2132 agxbuf *unk) {
2133 int cnt = 0;
2134
2135 for (size_t i = 0; alist != NULL && i < LIST_SIZE(alist); ++i) {
2136 gmlattr *const ap = LIST_GET(alist, i);
2137 if (ap->sort == WIDTH) {
2138 agsafeset (ep, "penwidth", ap->u.value, "");
2139 }
2140 else if (ap->sort == STYLE) {
2141 agsafeset (ep, "style", ap->u.value, "");
2142 }
2143 else if (ap->sort == FILL) {
2144 agsafeset (ep, "color", ap->u.value, "");
2145 }
2146 else if (ap->sort == LINE) {
2147 addEdgePos (ep, ap->u.lp, xb);
2148 }
2149 else {
2150 if (cnt)
2151 agxbputc (unk, ' ');
2152 else {
2153 agxbput (unk, "[ ");
2154 }
2155 deparseAttr (ap, unk);
2156 cnt++;
2157 }
2158 }
2159
2160 if (cnt) {
2161 agxbput (unk, " ]");
2162 agsafeset (ep, "graphics", agxbuse (unk), "");
2163 }
2164 else
2165 agxbclear(unk);
2166}
2167
2168static void addAttrs(Agobj_t *obj, attrs_t *alist, agxbuf *xb, agxbuf *unk) {
2169 for (size_t i = 0; i < LIST_SIZE(alist); ++i) {
2170 gmlattr *const ap = LIST_GET(alist, i);
2171 if (ap->sort == GRAPHICS) {
2172 if (AGTYPE(obj) == AGNODE)
2173 addNodeGraphics ((Agnode_t*)obj, ap->u.lp, xb, unk);
2174 else if (AGTYPE(obj) == AGEDGE)
2175 addEdgeGraphics ((Agedge_t*)obj, ap->u.lp, xb, unk);
2176 else
2177 unknown (obj, ap, xb);
2178 }
2179 else if (ap->sort == LABELGRAPHICS) {
2180 if (AGTYPE(obj) == AGNODE)
2181 addNodeLabelGraphics ((Agnode_t*)obj, ap->u.lp, unk);
2182 else if (AGTYPE(obj) == AGEDGE)
2183 addEdgeLabelGraphics ((Agedge_t*)obj, ap->u.lp, xb, unk);
2184 else
2185 unknown (obj, ap, xb);
2186 }
2187 else
2188 unknown (obj, ap, xb);
2189 }
2190}
2191
2193 agxbuf *xb, agxbuf *unk) {
2194 Agraph_t* g;
2195 Agnode_t* n;
2196 Agnode_t* h;
2197 Agedge_t* e;
2198
2199 if (parent) {
2200 g = agsubg (parent, NULL, 1);
2201 }
2202 else if (graph->directed >= 1)
2203 g = agopen (name, Agdirected, 0);
2204 else
2205 g = agopen (name, Agundirected, 0);
2206
2207 if (!parent && L) {
2208 addAttrs ((Agobj_t*)g, L, xb, unk);
2209 }
2210 for (size_t i = 0; i < LIST_SIZE(&graph->nodelist); ++i) {
2211 gmlnode *const np = LIST_GET(&graph->nodelist, i);
2212 if (!np->id) {
2213 fprintf (stderr, "node without an id attribute");
2214 graphviz_exit (1);
2215 }
2216 n = agnode (g, np->id, 1);
2217 addAttrs((Agobj_t*)n, &np->attrlist, xb, unk);
2218 }
2219
2220 for (size_t i = 0; i < LIST_SIZE(&graph->edgelist); ++i) {
2221 gmledge *ep = LIST_GET(&graph->edgelist, i);
2222 if (!ep->source) {
2223 fprintf (stderr, "edge without an source attribute");
2224 graphviz_exit (1);
2225 }
2226 if (!ep->target) {
2227 fprintf (stderr, "node without an target attribute");
2228 graphviz_exit (1);
2229 }
2230 n = agnode (g, ep->source, 1);
2231 h = agnode (g, ep->target, 1);
2232 e = agedge (g, n, h, NULL, 1);
2233 addAttrs((Agobj_t*)e, &ep->attrlist, xb, unk);
2234 }
2235 for (size_t i = 0; i < LIST_SIZE(&graph->graphlist); ++i) {
2236 gmlgraph *const gp = LIST_GET(&graph->graphlist, i);
2237 mkGraph (gp, g, NULL, xb, unk);
2238 }
2239
2240 addAttrs((Agobj_t*)g, &graph->attrlist, xb, unk);
2241
2242 return g;
2243}
2244
2245Agraph_t*
2246gml_to_gv (char* name, FILE* fp, int cnt, int* errors)
2247{
2248 Agraph_t* g;
2249 int error;
2250
2251 if (cnt == 0)
2252 initgmlscan(fp);
2253 else
2254 initgmlscan(0);
2255
2256 L = NULL;
2257 pushAlist ();
2258 gmlparse ();
2259
2260 error = gmlerrors();
2261 *errors |= error;
2262 if (!G || error)
2263 g = NULL;
2264 else {
2265 agxbuf xb = {0};
2266 agxbuf unk = {0};
2267 g = mkGraph (G, NULL, name, &xb, &unk);
2268 agxbfree (&xb);
2269 agxbfree(&unk);
2270 }
2271
2272 cleanup ();
2273
2274 return g;
2275}
2276
2277static char *sortToStr(unsigned short sort) {
2278 char* s;
2279
2280 switch (sort) {
2281 case GRAPH :
2282 s = "graph"; break;
2283 case NODE :
2284 s = "node"; break;
2285 case EDGE :
2286 s = "edge"; break;
2287 case DIRECTED :
2288 s = "directed"; break;
2289 case ID :
2290 s = "id"; break;
2291 case SOURCE :
2292 s = "source"; break;
2293 case TARGET :
2294 s = "target"; break;
2295 case XVAL :
2296 s = "xval"; break;
2297 case YVAL :
2298 s = "yval"; break;
2299 case WVAL :
2300 s = "wval"; break;
2301 case HVAL :
2302 s = "hval"; break;
2303 case LABEL :
2304 s = "label"; break;
2305 case GRAPHICS :
2306 s = "graphics"; break;
2307 case LABELGRAPHICS :
2308 s = "labelGraphics"; break;
2309 case TYPE :
2310 s = "type"; break;
2311 case FILL :
2312 s = "fill"; break;
2313 case OUTLINE :
2314 s = "outline"; break;
2315 case OUTLINESTYLE :
2316 s = "outlineStyle"; break;
2317 case OUTLINEWIDTH :
2318 s = "outlineWidth"; break;
2319 case WIDTH :
2320 s = "width"; break;
2321 case STYLE :
2322 s = "style"; break;
2323 case LINE :
2324 s = "line"; break;
2325 case POINT :
2326 s = "point"; break;
2327 case TEXT :
2328 s = "text"; break;
2329 case FONTSIZE :
2330 s = "fontSize"; break;
2331 case FONTNAME :
2332 s = "fontName"; break;
2333 case COLOR :
2334 s = "color"; break;
2335 case INTEGER :
2336 s = "integer"; break;
2337 case REAL :
2338 s = "real"; break;
2339 case STRING :
2340 s = "string"; break;
2341 case NAME :
2342 s = "name"; break;
2343 case GML_LIST :
2344 s = "list"; break;
2345 case '[' :
2346 s = "["; break;
2347 case ']' :
2348 s = "]"; break;
2349 default :
2350 s = NULL;break;
2351 }
2352
2353 return s;
2354}
static void agxbfree(agxbuf *xb)
free any malloced resources
Definition agxbuf.h:77
static int agxbprint(agxbuf *xb, const char *fmt,...)
Printf-style output to an agxbuf.
Definition agxbuf.h:233
static void agxbclear(agxbuf *xb)
resets pointer to data
Definition agxbuf.h:293
static WUR char * agxbuse(agxbuf *xb)
Definition agxbuf.h:306
static size_t agxblen(const agxbuf *xb)
return number of characters currently stored
Definition agxbuf.h:88
static int agxbputc(agxbuf *xb, char c)
add character to buffer
Definition agxbuf.h:276
Memory allocation wrappers that exit on failure.
static char * gv_strdup(const char *original)
Definition alloc.h:101
static void * gv_alloc(size_t size)
Definition alloc.h:47
#define parent(i)
Definition closest.c:81
static NORETURN void graphviz_exit(int status)
Definition exit.h:23
static const char * yysymbol_name(yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED
Definition exparse.c:733
yytype_int16 yy_state_t
Definition exparse.c:403
static const char *const yytname[]
Definition exparse.c:708
#define DIRECTED
Definition gc.c:48
GML-DOT converter
int gmlerrors(void)
Definition gmlscan.l:121
void initgmlscan(FILE *)
Definition gmlscan.c:850
void gmllexeof(void)
Definition gmlscan.l:126
static char * sortToStr(unsigned short sort)
Definition gmlparse.c:2277
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
Definition gmlparse.c:521
#define YYMAXDEPTH
Definition gmlparse.c:1107
#define YYSTACK_FREE
Definition gmlparse.c:583
static gmlnode * N
Definition gmlparse.c:91
static const yytype_int8 yytranslate[]
Definition gmlparse.c:697
static void addEdgeGraphics(Agedge_t *ep, attrs_t *alist, agxbuf *xb, agxbuf *unk)
Definition gmlparse.c:2131
static void addAttrs(Agobj_t *obj, attrs_t *alist, agxbuf *xb, agxbuf *unk)
Definition gmlparse.c:2168
yysymbol_kind_t
Definition gmlparse.c:287
@ YYSYMBOL_EDGE
Definition gmlparse.c:294
@ YYSYMBOL_POINT
Definition gmlparse.c:313
@ YYSYMBOL_53_3
Definition gmlparse.c:342
@ YYSYMBOL_HVAL
Definition gmlparse.c:301
@ YYSYMBOL_STRING
Definition gmlparse.c:320
@ YYSYMBOL_YYUNDEF
Definition gmlparse.c:291
@ YYSYMBOL_nlistitem
Definition gmlparse.c:336
@ YYSYMBOL_DIRECTED
Definition gmlparse.c:295
@ YYSYMBOL_alist
Definition gmlparse.c:344
@ YYSYMBOL_optglist
Definition gmlparse.c:330
@ YYSYMBOL_YVAL
Definition gmlparse.c:299
@ YYSYMBOL_45_1
Definition gmlparse.c:334
@ YYSYMBOL_YYerror
Definition gmlparse.c:290
@ YYSYMBOL_body
Definition gmlparse.c:329
@ YYSYMBOL_TEXT
Definition gmlparse.c:314
@ YYSYMBOL_ID
Definition gmlparse.c:321
@ YYSYMBOL_graph
Definition gmlparse.c:327
@ YYSYMBOL_TARGET
Definition gmlparse.c:297
@ YYSYMBOL_SOURCE
Definition gmlparse.c:296
@ YYSYMBOL_hdr
Definition gmlparse.c:328
@ YYSYMBOL_LABELGRAPHICS
Definition gmlparse.c:304
@ YYSYMBOL_NODE
Definition gmlparse.c:293
@ YYSYMBOL_GRAPH
Definition gmlparse.c:292
@ YYSYMBOL_LABEL
Definition gmlparse.c:302
@ YYSYMBOL_glistitem
Definition gmlparse.c:332
@ YYSYMBOL_attrlist
Definition gmlparse.c:341
@ YYSYMBOL_35_
Definition gmlparse.c:324
@ YYSYMBOL_COLOR
Definition gmlparse.c:317
@ YYSYMBOL_OUTLINEWIDTH
Definition gmlparse.c:309
@ YYSYMBOL_elist
Definition gmlparse.c:339
@ YYSYMBOL_edge
Definition gmlparse.c:337
@ YYSYMBOL_GML_LIST
Definition gmlparse.c:323
@ YYSYMBOL_optalist
Definition gmlparse.c:343
@ YYSYMBOL_49_2
Definition gmlparse.c:338
@ YYSYMBOL_WIDTH
Definition gmlparse.c:310
@ YYSYMBOL_36_
Definition gmlparse.c:325
@ YYSYMBOL_YYACCEPT
Definition gmlparse.c:326
@ YYSYMBOL_FILL
Definition gmlparse.c:306
@ YYSYMBOL_OUTLINE
Definition gmlparse.c:307
@ YYSYMBOL_OUTLINESTYLE
Definition gmlparse.c:308
@ YYSYMBOL_TYPE
Definition gmlparse.c:305
@ YYSYMBOL_YYEOF
Definition gmlparse.c:289
@ YYSYMBOL_glist
Definition gmlparse.c:331
@ YYSYMBOL_elistitem
Definition gmlparse.c:340
@ YYSYMBOL_INTEGER
Definition gmlparse.c:318
@ YYSYMBOL_FONTSIZE
Definition gmlparse.c:315
@ YYSYMBOL_node
Definition gmlparse.c:333
@ YYSYMBOL_YYEMPTY
Definition gmlparse.c:288
@ YYSYMBOL_nlist
Definition gmlparse.c:335
@ YYSYMBOL_STYLE
Definition gmlparse.c:311
@ YYSYMBOL_WVAL
Definition gmlparse.c:300
@ YYSYMBOL_FONTNAME
Definition gmlparse.c:316
@ YYSYMBOL_NAME
Definition gmlparse.c:322
@ YYSYMBOL_XVAL
Definition gmlparse.c:298
@ YYSYMBOL_REAL
Definition gmlparse.c:319
@ YYSYMBOL_alistitem
Definition gmlparse.c:345
@ YYSYMBOL_LINE
Definition gmlparse.c:312
@ YYSYMBOL_GRAPHICS
Definition gmlparse.c:303
static void deparseAttr(gmlattr *ap, agxbuf *xb)
Definition gmlparse.c:1901
#define YY_ASSERT(E)
Definition gmlparse.c:541
#define YY_(Msgid)
Definition gmlparse.c:475
#define YYNOMEM
Definition gmlparse.c:940
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
Definition gmlparse.c:522
static const yytype_int8 yydefact[]
Definition gmlparse.c:804
#define YYNSTATES
Definition gmlparse.c:682
#define YYSTYPE
Definition gmlparse.c:67
#define YY_IGNORE_USELESS_CAST_END
Definition gmlparse.c:537
short yytype_int16
Definition gmlparse.c:386
static void addEdgeLabelGraphics(Agedge_t *ep, attrs_t *alist, agxbuf *xb, agxbuf *unk)
Definition gmlparse.c:1980
#define yychar
Definition gmlparse.c:75
static void free_attrs(attrs_t *a)
Definition gmlparse.c:96
#define YYABORT
Definition gmlparse.c:938
#define yylex
Definition gmlparse.c:70
#define YYSTACK_BYTES(N)
Definition gmlparse.c:626
static const yytype_int8 yycheck[]
Definition gmlparse.c:863
static void addNodeLabelGraphics(Agnode_t *np, attrs_t *alist, agxbuf *unk)
Definition gmlparse.c:1941
static gmledge * E
Definition gmlparse.c:92
#define YY_REDUCE_PRINT(Rule)
Definition gmlparse.c:1090
static attrs_t * L
Definition gmlparse.c:94
#define YY_CAST(Type, Val)
Definition gmlparse.c:268
static void yydestruct(const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
Definition gmlparse.c:1120
static const yytype_int16 yypact[]
Definition gmlparse.c:786
#define YY_NULLPTR
Definition gmlparse.c:280
static void cleanup(void)
Definition gmlparse.c:128
static Agraph_t * mkGraph(gmlgraph *graph, Agraph_t *parent, char *name, agxbuf *xb, agxbuf *unk)
Definition gmlparse.c:2192
static void addNodeGraphics(Agnode_t *np, attrs_t *alist, agxbuf *xb, agxbuf *unk)
Definition gmlparse.c:2031
#define YYFINAL
Definition gmlparse.c:671
static gmlnode * mkNode(void)
Definition gmlparse.c:199
#define YY_ACCESSING_SYMBOL(State)
Definition gmlparse.c:745
#define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
Definition gmlparse.c:1088
static int setDir(char *d)
Definition gmlparse.c:237
static void addEdgePoint(Agedge_t *ep, attrs_t *alist, agxbuf *xb)
Definition gmlparse.c:2094
static const yytype_int16 yypgoto[]
Definition gmlparse.c:820
static void free_edge(gmledge *p)
Definition gmlparse.c:112
static void free_node(gmlnode *p)
Definition gmlparse.c:105
static gmledge * mkEdge(void)
Definition gmlparse.c:207
#define yylval
Definition gmlparse.c:74
#define YYNTOKENS
Definition gmlparse.c:676
unsigned char yytype_uint8
Definition gmlparse.c:407
static void pushAlist(void)
Definition gmlparse.c:152
#define YY_STACK_PRINT(Bottom, Top)
Definition gmlparse.c:1089
#define YYSIZE_T
Definition gmlparse.c:448
#define yydebug
Definition gmlparse.c:72
#define YY_IGNORE_USELESS_CAST_BEGIN
Definition gmlparse.c:536
static void free_graph(gmlgraph *p)
Definition gmlparse.c:118
static void popG(void)
Definition gmlparse.c:175
static const yytype_int8 yyr2[]
Definition gmlparse.c:920
static void addEdgePos(Agedge_t *ep, attrs_t *alist, agxbuf *xb)
Definition gmlparse.c:2116
void * malloc(YYSIZE_T)
static const yytype_int8 yytable[]
Definition gmlparse.c:836
#define YYPTRDIFF_T
Definition gmlparse.c:434
#define yynerrs
Definition gmlparse.c:73
@ YYENOMEM
Definition gmlparse.c:932
#define yyparse
Definition gmlparse.c:1150
static gmlgraph * G
Definition gmlparse.c:90
static void free_attr(gmlattr *p)
Definition gmlparse.c:1888
#define YYACCEPT
Definition gmlparse.c:937
#define yytable_value_is_error(Yyn)
Definition gmlparse.c:781
#define YYTRANSLATE(YYX)
Definition gmlparse.c:690
static const yytype_int8 yystos[]
Definition gmlparse.c:892
#define YY_ATTRIBUTE_UNUSED
Definition gmlparse.c:492
static const yytype_int8 yyr1[]
Definition gmlparse.c:908
#define YYPOPSTACK(N)
int yy_state_fast_t
Definition gmlparse.c:465
static void deparseList(attrs_t *alist, agxbuf *xb)
Definition gmlparse.c:1915
unsigned short yytype_uint16
Definition gmlparse.c:418
static const yytype_int8 yydefgoto[]
Definition gmlparse.c:827
static gmlattr * mkAttr(char *name, unsigned short sort, unsigned short kind, char *str, attrs_t *list)
Definition gmlparse.c:214
#define YYLAST
Definition gmlparse.c:673
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
Definition gmlparse.c:637
#define yypact_value_is_default(Yyn)
Definition gmlparse.c:776
#define YYINITDEPTH
Definition gmlparse.c:1096
signed char yytype_int8
Definition gmlparse.c:378
void free(void *)
#define YYERROR
Definition gmlparse.c:939
#define YYSIZEOF(X)
Definition gmlparse.c:458
#define YYSTACK_ALLOC
Definition gmlparse.c:582
yytype_int8 yy_state_t
Definition gmlparse.c:462
static void pushG(void)
Definition gmlparse.c:181
#define YYDPRINTF(Args)
Definition gmlparse.c:1087
Agraph_t * gml_to_gv(char *name, FILE *fp, int cnt, int *errors)
Definition gmlparse.c:2246
#define YY_USE(E)
Definition gmlparse.c:498
#define yyerror
Definition gmlparse.c:71
static attrs_t * popAlist(void)
Definition gmlparse.c:163
#define LABEL
Definition gmlparse.h:115
#define GMLUNDEF
Definition gmlparse.h:104
#define OUTLINESTYLE
Definition gmlparse.h:121
#define WIDTH
Definition gmlparse.h:123
#define GRAPHICS
Definition gmlparse.h:116
#define REAL
Definition gmlparse.h:132
#define POINT
Definition gmlparse.h:126
#define NAME
Definition gmlparse.h:135
#define COLOR
Definition gmlparse.h:130
#define TEXT
Definition gmlparse.h:127
#define TYPE
Definition gmlparse.h:118
#define FONTSIZE
Definition gmlparse.h:128
#define GML_LIST
Definition gmlparse.h:136
#define FILL
Definition gmlparse.h:119
#define ID
Definition gmlparse.h:134
#define OUTLINEWIDTH
Definition gmlparse.h:122
#define SOURCE
Definition gmlparse.h:109
int gmlparse(void)
#define NODE
Definition gmlparse.h:106
#define GMLEMPTY
Definition gmlparse.h:101
#define GMLEOF
Definition gmlparse.h:102
#define TARGET
Definition gmlparse.h:110
#define STRING
Definition gmlparse.h:133
#define WVAL
Definition gmlparse.h:113
#define EDGE
Definition gmlparse.h:107
#define STYLE
Definition gmlparse.h:124
#define INTEGER
Definition gmlparse.h:131
#define HVAL
Definition gmlparse.h:114
#define YVAL
Definition gmlparse.h:112
#define FONTNAME
Definition gmlparse.h:129
#define LABELGRAPHICS
Definition gmlparse.h:117
#define XVAL
Definition gmlparse.h:111
#define LINE
Definition gmlparse.h:125
#define OUTLINE
Definition gmlparse.h:120
#define GMLerror
Definition gmlparse.h:103
#define GRAPH
Definition gmlparse.h:105
static int errors
Definition gmlscan.c:847
node NULL
Definition grammar.y:181
static int cnt(Dict_t *d, Dtlink_t **set)
Definition graph.c:196
int agsafeset(void *obj, char *name, const char *value, const char *def)
set an attribute’s value and default, ensuring it is declared before setting it locally
Definition attr.c:560
Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
Definition edge.c:253
Agdesc_t Agundirected
undirected
Definition graph.c:272
Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
creates a new graph with the given name and kind
Definition graph.c:42
Agdesc_t Agdirected
directed
Definition graph.c:270
Agnode_t * agnode(Agraph_t *g, char *name, int createflag)
Definition node.c:141
#define AGTYPE(obj)
returns AGRAPH, AGNODE, or AGEDGE depending on the type of the object
Definition cgraph.h:216
@ AGEDGE
Definition cgraph.h:207
@ AGNODE
Definition cgraph.h:207
Agraph_t * agsubg(Agraph_t *g, char *name, int cflag)
Definition subg.c:53
Agraph_t * graph(char *name)
Definition gv.cpp:30
agxbput(xb, staging)
@ unknown
Definition gvgen.c:33
textitem scanner parser str
Definition htmlparse.y:218
table Syntax error
Definition htmlparse.y:288
type-generic dynamically expanding list
#define LIST(type)
Definition list.h:55
#define LIST_SIZE(list)
Definition list.h:80
#define LIST_CLEAR(list)
Definition list.h:249
#define LIST_APPEND(list, item)
Definition list.h:132
#define LIST_FREE(list)
Definition list.h:379
#define LIST_POP_BACK(list)
Definition list.h:416
#define LIST_IS_EMPTY(list)
Definition list.h:90
#define LIST_PUSH_BACK(list, item)
Definition list.h:393
#define LIST_GET(list, index)
Definition list.h:165
a generic header of Agraph_s, Agnode_s and Agedge_s
Definition cgraph.h:210
graph or subgraph
Definition cgraph.h:424
void * lp
actually an attrs_t *
Definition gml2gv.h:16
char * value
Definition gml2gv.h:15
unsigned short kind
Definition gml2gv.h:11
union gmlattr::@59 u
unsigned short sort
Definition gml2gv.h:12
char * name
Definition gml2gv.h:13
char * source
Definition gml2gv.h:28
attrs_t attrlist
Definition gml2gv.h:30
char * target
Definition gml2gv.h:29
int directed
Definition gml2gv.h:35
struct gmlgraph * parent
Definition gml2gv.h:34
attrs_t attrlist
Definition gml2gv.h:36
attrs_t attrlist
Definition gml2gv.h:24
char * id
Definition gml2gv.h:23
Definition grammar.c:90
YYSTYPE yyvs_alloc
Definition gmlparse.c:618
yy_state_t yyss_alloc
Definition gmlparse.c:617