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