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