Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
gmlparse.c
Go to the documentation of this file.
1/* A Bison parser, made by GNU Bison 3.5.1. */
2
3/* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 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 <http://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/* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
43
44/* Undocumented macros, especially those whose name start with YY_,
45 are private implementation details. Do not rely on them. */
46
47/* Identify Bison output. */
48#define YYBISON 1
49
50/* Bison version. */
51#define YYBISON_VERSION "3.5.1"
52
53/* Skeleton name. */
54#define YYSKELETON_NAME "yacc.c"
55
56/* Pure parsers. */
57#define YYPURE 0
58
59/* Push parsers. */
60#define YYPUSH 0
61
62/* Pull parsers. */
63#define YYPULL 1
64
65/* Substitute the type names. */
66#define YYSTYPE GMLSTYPE
67/* Substitute the variable and function names. */
68#define yyparse gmlparse
69#define yylex gmllex
70#define yyerror gmlerror
71#define yydebug gmldebug
72#define yynerrs gmlnerrs
73#define yylval gmllval
74#define yychar gmlchar
75
76/* First part of user prologue. */
77#line 19 "../../cmd/tools/gmlparse.y"
78
79#include <stdlib.h>
80#include <string.h>
81#include <arith.h>
82#include <gml2gv.h>
83#include <assert.h>
84#include <cgraph/list.h>
85#include <util/agxbuf.h>
86#include <util/alloc.h>
87#include <util/exit.h>
88
89static gmlgraph* G;
90static gmlnode* N;
91static gmledge* E;
92
93static attrs_t *L;
94
95static void free_attrs(attrs_t *a) {
96 attrs_free(a);
97 free(a);
98}
99
100DEFINE_LIST_WITH_DTOR(dts, attrs_t *, free_attrs)
101static dts_t liststk;
102
103static char *sortToStr(unsigned short sort);
104
106 if (!p) return;
107 attrs_free(&p->attrlist);
108 free (p);
109}
110
112 if (!p) return;
113 attrs_free(&p->attrlist);
114 free (p);
115}
116
118 if (!p) return;
119 nodes_free(&p->nodelist);
120 edges_free(&p->edgelist);
121 attrs_free(&p->attrlist);
122 graphs_free(p->graphlist);
123 free(p->graphlist);
124 free (p);
125}
126
127static void
129{
130 dts_free(&liststk);
131 if (L) {
132 free_attrs(L);
133 L = NULL;
134 }
135 if (N) {
136 free_node(N);
137 N = NULL;
138 }
139 if (E) {
140 free_edge(E);
141 E = NULL;
142 }
143 if (G) {
144 free_graph(G);
145 G = NULL;
146 }
147}
148
149static void
151{
152 attrs_t *const lp = gv_alloc(sizeof(attrs_t));
153
154 if (L) {
155 dts_push_back(&liststk, L);
156 }
157 L = lp;
158}
159
160static attrs_t *popAlist(void) {
161 attrs_t *lp = L;
162
163 if (!dts_is_empty(&liststk))
164 L = dts_pop_back(&liststk);
165 else
166 L = NULL;
167
168 return lp;
169}
170
171static void
172popG (void)
173{
174 G = G->parent;
175}
176
177static void
178pushG (void)
179{
180 gmlgraph* g = gv_alloc(sizeof(gmlgraph));
181
182 g->graphlist = gv_alloc(sizeof(graphs_t));
183 g->parent = G;
184 g->directed = -1;
185
186 if (G)
187 graphs_append(G->graphlist, g);
188
189 G = g;
190}
191
192static gmlnode*
193mkNode (void)
194{
195 gmlnode* np = gv_alloc(sizeof(gmlnode));
196 np->id = NULL;
197 return np;
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/* Enabling verbose error messages. */
280#ifdef YYERROR_VERBOSE
281# undef YYERROR_VERBOSE
282# define YYERROR_VERBOSE 1
283#else
284# define YYERROR_VERBOSE 0
285#endif
286
287/* Use api.header.include to #include this header
288 instead of duplicating it here. */
289#ifndef YY_GML_GMLPARSE_H_INCLUDED
290# define YY_GML_GMLPARSE_H_INCLUDED
291/* Debug traces. */
292#ifndef GMLDEBUG
293# if defined YYDEBUG
294#if YYDEBUG
295# define GMLDEBUG 1
296# else
297# define GMLDEBUG 0
298# endif
299# else /* ! defined YYDEBUG */
300# define GMLDEBUG 0
301# endif /* ! defined YYDEBUG */
302#endif /* ! defined GMLDEBUG */
303#if GMLDEBUG
304extern int gmldebug;
305#endif
306
307/* Token type. */
308#ifndef GMLTOKENTYPE
309# define GMLTOKENTYPE
311 {
312 GRAPH = 258,
313 NODE = 259,
314 EDGE = 260,
315 DIRECTED = 261,
316 SOURCE = 262,
317 TARGET = 263,
318 XVAL = 264,
319 YVAL = 265,
320 WVAL = 266,
321 HVAL = 267,
322 LABEL = 268,
323 GRAPHICS = 269,
325 TYPE = 271,
326 FILL = 272,
327 OUTLINE = 273,
330 WIDTH = 276,
331 STYLE = 277,
332 LINE = 278,
333 POINT = 279,
334 TEXT = 280,
335 FONTSIZE = 281,
336 FONTNAME = 282,
337 COLOR = 283,
338 INTEGER = 284,
339 REAL = 285,
340 STRING = 286,
341 ID = 287,
342 NAME = 288,
343 LIST = 289
344 };
345#endif
346/* Tokens. */
347#define GRAPH 258
348#define NODE 259
349#define EDGE 260
350#define DIRECTED 261
351#define SOURCE 262
352#define TARGET 263
353#define XVAL 264
354#define YVAL 265
355#define WVAL 266
356#define HVAL 267
357#define LABEL 268
358#define GRAPHICS 269
359#define LABELGRAPHICS 270
360#define TYPE 271
361#define FILL 272
362#define OUTLINE 273
363#define OUTLINESTYLE 274
364#define OUTLINEWIDTH 275
365#define WIDTH 276
366#define STYLE 277
367#define LINE 278
368#define POINT 279
369#define TEXT 280
370#define FONTSIZE 281
371#define FONTNAME 282
372#define COLOR 283
373#define INTEGER 284
374#define REAL 285
375#define STRING 286
376#define ID 287
377#define NAME 288
378#define LIST 289
379
380/* Value type. */
381#if ! defined GMLSTYPE && ! defined GMLSTYPE_IS_DECLARED
383{
384#line 197 "../../cmd/tools/gmlparse.y"
385
386 int i;
387 char *str;
391 attrs_t *list;
392
393#line 394 "gmlparse.c"
394
395};
396typedef union GMLSTYPE GMLSTYPE;
397# define GMLSTYPE_IS_TRIVIAL 1
398# define GMLSTYPE_IS_DECLARED 1
399#endif
400
401
402extern GMLSTYPE gmllval;
403
404int gmlparse (void);
405
406#endif /* !YY_GML_GMLPARSE_H_INCLUDED */
407
408
409
410#ifdef short
411# undef short
412#endif
413
414/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
415 <limits.h> and (if available) <stdint.h> are included
416 so that the code can choose integer types of a good width. */
417
418#ifndef __PTRDIFF_MAX__
419# include <limits.h> /* INFRINGES ON USER NAME SPACE */
420# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
421# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
422# define YY_STDINT_H
423# endif
424#endif
425
426/* Narrow types that promote to a signed type and that can represent a
427 signed or unsigned integer of at least N bits. In tables they can
428 save space and decrease cache pressure. Promoting to a signed type
429 helps avoid bugs in integer arithmetic. */
430
431#ifdef __INT_LEAST8_MAX__
433#elif defined YY_STDINT_H
434typedef int_least8_t yytype_int8;
435#else
436typedef signed char yytype_int8;
437#endif
438
439#ifdef __INT_LEAST16_MAX__
441#elif defined YY_STDINT_H
442typedef int_least16_t yytype_int16;
443#else
444typedef short yytype_int16;
445#endif
446
447#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
449#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
450 && UINT_LEAST8_MAX <= INT_MAX)
451typedef uint_least8_t yytype_uint8;
452#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
453typedef unsigned char yytype_uint8;
454#else
455typedef short yytype_uint8;
456#endif
457
458#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
460#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
461 && UINT_LEAST16_MAX <= INT_MAX)
462typedef uint_least16_t yytype_uint16;
463#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
464typedef unsigned short yytype_uint16;
465#else
466typedef int yytype_uint16;
467#endif
468
469#ifndef YYPTRDIFF_T
470# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
471# define YYPTRDIFF_T __PTRDIFF_TYPE__
472# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
473# elif defined PTRDIFF_MAX
474# ifndef ptrdiff_t
475# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
476# endif
477# define YYPTRDIFF_T ptrdiff_t
478# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
479# else
480# define YYPTRDIFF_T long
481# define YYPTRDIFF_MAXIMUM LONG_MAX
482# endif
483#endif
484
485#ifndef YYSIZE_T
486# ifdef __SIZE_TYPE__
487# define YYSIZE_T __SIZE_TYPE__
488# elif defined size_t
489# define YYSIZE_T size_t
490# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
491# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
492# define YYSIZE_T size_t
493# else
494# define YYSIZE_T unsigned
495# endif
496#endif
497
498#define YYSIZE_MAXIMUM \
499 YY_CAST (YYPTRDIFF_T, \
500 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
501 ? YYPTRDIFF_MAXIMUM \
502 : YY_CAST (YYSIZE_T, -1)))
503
504#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
505
506/* Stored state numbers (used for stacks). */
508
509/* State numbers in computations. */
510typedef int yy_state_fast_t;
511
512#ifndef YY_
513# if defined YYENABLE_NLS && YYENABLE_NLS
514# if ENABLE_NLS
515# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
516# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
517# endif
518# endif
519# ifndef YY_
520# define YY_(Msgid) Msgid
521# endif
522#endif
523
524#ifndef YY_ATTRIBUTE_PURE
525# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
526# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
527# else
528# define YY_ATTRIBUTE_PURE
529# endif
530#endif
531
532#ifndef YY_ATTRIBUTE_UNUSED
533# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
534# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
535# else
536# define YY_ATTRIBUTE_UNUSED
537# endif
538#endif
539
540/* Suppress unused-variable warnings by "using" E. */
541#if ! defined lint || defined __GNUC__
542# define YYUSE(E) ((void) (E))
543#else
544# define YYUSE(E) /* empty */
545#endif
546
547#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
548/* Suppress an incorrect diagnostic about yylval being uninitialized. */
549# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
550 _Pragma ("GCC diagnostic push") \
551 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
552 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
553# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
554 _Pragma ("GCC diagnostic pop")
555#else
556# define YY_INITIAL_VALUE(Value) Value
557#endif
558#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
559# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
560# define YY_IGNORE_MAYBE_UNINITIALIZED_END
561#endif
562#ifndef YY_INITIAL_VALUE
563# define YY_INITIAL_VALUE(Value) /* Nothing. */
564#endif
565
566#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
567# define YY_IGNORE_USELESS_CAST_BEGIN \
568 _Pragma ("GCC diagnostic push") \
569 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
570# define YY_IGNORE_USELESS_CAST_END \
571 _Pragma ("GCC diagnostic pop")
572#endif
573#ifndef YY_IGNORE_USELESS_CAST_BEGIN
574# define YY_IGNORE_USELESS_CAST_BEGIN
575# define YY_IGNORE_USELESS_CAST_END
576#endif
577
578
579#define YY_ASSERT(E) ((void) (0 && (E)))
580
581#if ! defined yyoverflow || YYERROR_VERBOSE
582
583/* The parser invokes alloca or malloc; define the necessary symbols. */
584
585# ifdef YYSTACK_USE_ALLOCA
586# if YYSTACK_USE_ALLOCA
587# ifdef __GNUC__
588# define YYSTACK_ALLOC __builtin_alloca
589# elif defined __BUILTIN_VA_ARG_INCR
590# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
591# elif defined _AIX
592# define YYSTACK_ALLOC __alloca
593# elif defined _MSC_VER
594# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
595# define alloca _alloca
596# else
597# define YYSTACK_ALLOC alloca
598# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
599# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
600 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
601# ifndef EXIT_SUCCESS
602# define EXIT_SUCCESS 0
603# endif
604# endif
605# endif
606# endif
607# endif
608
609# ifdef YYSTACK_ALLOC
610 /* Pacify GCC's 'empty if-body' warning. */
611# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
612# ifndef YYSTACK_ALLOC_MAXIMUM
613 /* The OS might guarantee only one guard page at the bottom of the stack,
614 and a page size can be as small as 4096 bytes. So we cannot safely
615 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
616 to allow for a few compiler-allocated temporary stack slots. */
617# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
618# endif
619# else
620# define YYSTACK_ALLOC YYMALLOC
621# define YYSTACK_FREE YYFREE
622# ifndef YYSTACK_ALLOC_MAXIMUM
623# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
624# endif
625# if (defined __cplusplus && ! defined EXIT_SUCCESS \
626 && ! ((defined YYMALLOC || defined malloc) \
627 && (defined YYFREE || defined free)))
628# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
629# ifndef EXIT_SUCCESS
630# define EXIT_SUCCESS 0
631# endif
632# endif
633# ifndef YYMALLOC
634# define YYMALLOC malloc
635# if ! defined malloc && ! defined EXIT_SUCCESS
636void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
637# endif
638# endif
639# ifndef YYFREE
640# define YYFREE free
641# if ! defined free && ! defined EXIT_SUCCESS
642void free (void *); /* INFRINGES ON USER NAME SPACE */
643# endif
644# endif
645# endif
646#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
647
648
649#if (! defined yyoverflow \
650 && (! defined __cplusplus \
651 || (defined GMLSTYPE_IS_TRIVIAL && GMLSTYPE_IS_TRIVIAL)))
652
653/* A type that is properly aligned for any stack member. */
659
660/* The size of the maximum gap between one aligned stack and the next. */
661# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
662
663/* The size of an array large to enough to hold all stacks, each with
664 N elements. */
665# define YYSTACK_BYTES(N) \
666 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
667 + YYSTACK_GAP_MAXIMUM)
668
669# define YYCOPY_NEEDED 1
670
671/* Relocate STACK from its old location to the new one. The
672 local variables YYSIZE and YYSTACKSIZE give the old and new number of
673 elements in the stack, and YYPTR gives the new location of the
674 stack. Advance YYPTR to a properly aligned location for the next
675 stack. */
676# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
677 do \
678 { \
679 YYPTRDIFF_T yynewbytes; \
680 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
681 Stack = &yyptr->Stack_alloc; \
682 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
683 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
684 } \
685 while (0)
686
687#endif
688
689#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
690/* Copy COUNT objects from SRC to DST. The source and destination do
691 not overlap. */
692# ifndef YYCOPY
693# if defined __GNUC__ && 1 < __GNUC__
694# define YYCOPY(Dst, Src, Count) \
695 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
696# else
697# define YYCOPY(Dst, Src, Count) \
698 do \
699 { \
700 YYPTRDIFF_T yyi; \
701 for (yyi = 0; yyi < (Count); yyi++) \
702 (Dst)[yyi] = (Src)[yyi]; \
703 } \
704 while (0)
705# endif
706# endif
707#endif /* !YYCOPY_NEEDED */
708
709/* YYFINAL -- State number of the termination state. */
710#define YYFINAL 55
711/* YYLAST -- Last index in YYTABLE. */
712#define YYLAST 226
713
714/* YYNTOKENS -- Number of terminals. */
715#define YYNTOKENS 37
716/* YYNNTS -- Number of nonterminals. */
717#define YYNNTS 20
718/* YYNRULES -- Number of rules. */
719#define YYNRULES 63
720/* YYNSTATES -- Number of states. */
721#define YYNSTATES 102
722
723#define YYUNDEFTOK 2
724#define YYMAXUTOK 289
725
726
727/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
728 as returned by yylex, with out-of-bounds checking. */
729#define YYTRANSLATE(YYX) \
730 (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
731
732/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
733 as returned by yylex. */
734static const yytype_int8 yytranslate[] =
735{
736 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
737 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
738 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
739 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
740 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
741 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
742 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
743 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
744 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
745 2, 35, 2, 36, 2, 2, 2, 2, 2, 2,
746 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
747 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
748 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
749 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
750 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
751 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
752 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
753 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
754 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
755 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
756 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
757 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
758 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
759 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
760 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
761 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
762 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
763 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
764 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
765};
766
767#if GMLDEBUG
768 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
769static const yytype_int16 yyrline[] =
770{
771 0, 220, 220, 221, 222, 225, 228, 231, 232, 235,
772 236, 239, 240, 241, 242, 249, 250, 253, 253, 256,
773 257, 260, 261, 264, 264, 267, 268, 271, 272, 273,
774 274, 277, 277, 280, 281, 284, 285, 288, 289, 290,
775 291, 292, 293, 294, 295, 296, 297, 298, 299, 300,
776 301, 302, 303, 304, 305, 306, 307, 308, 309, 310,
777 311, 312, 313, 314
778};
779#endif
780
781#if GMLDEBUG || YYERROR_VERBOSE || 0
782/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
783 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
784static const char *const yytname[] =
785{
786 "$end", "error", "$undefined", "GRAPH", "NODE", "EDGE", "DIRECTED",
787 "SOURCE", "TARGET", "XVAL", "YVAL", "WVAL", "HVAL", "LABEL", "GRAPHICS",
788 "LABELGRAPHICS", "TYPE", "FILL", "OUTLINE", "OUTLINESTYLE",
789 "OUTLINEWIDTH", "WIDTH", "STYLE", "LINE", "POINT", "TEXT", "FONTSIZE",
790 "FONTNAME", "COLOR", "INTEGER", "REAL", "STRING", "ID", "NAME", "LIST",
791 "'['", "']'", "$accept", "graph", "hdr", "body", "optglist", "glist",
792 "glistitem", "node", "$@1", "nlist", "nlistitem", "edge", "$@2", "elist",
793 "elistitem", "attrlist", "$@3", "optalist", "alist", "alistitem", YY_NULLPTR
794};
795#endif
796
797# ifdef YYPRINT
798/* YYTOKNUM[NUM] -- (External) token number corresponding to the
799 (internal) symbol number NUM (which must be that of a token). */
800static const yytype_int16 yytoknum[] =
801{
802 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
803 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
804 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
805 285, 286, 287, 288, 289, 91, 93
806};
807# endif
808
809#define YYPACT_NINF (-29)
810
811#define yypact_value_is_default(Yyn) \
812 ((Yyn) == YYPACT_NINF)
813
814#define YYTABLE_NINF (-35)
815
816#define yytable_value_is_error(Yyn) \
817 0
818
819 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
820 STATE-NUM. */
821static const yytype_int16 yypact[] =
822{
823 1, -29, -24, 0, 2, 3, 5, 11, 11, 6,
824 17, 18, 19, 22, -21, -28, 11, 11, 21, 24,
825 25, 28, 12, 54, 52, 193, -29, -29, -29, -29,
826 -29, -29, -29, -29, -29, -29, -29, -29, -29, -29,
827 -29, -29, -29, -29, -29, -29, -29, -29, -29, -29,
828 -29, -29, -29, -29, -29, -29, -29, 30, -29, 193,
829 58, -29, 51, -29, -29, 59, 60, 30, 78, 58,
830 -29, -29, -29, -29, -29, 80, 81, -29, -29, -29,
831 -29, -29, 168, 143, 90, 113, -29, -29, 91, 114,
832 115, 85, -29, -29, -29, -29, -29, -29, -29, -29,
833 -29, -29
834};
835
836 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
837 Performed when YYTABLE does not specify something else to do. Zero
838 means the default is an error. */
839static const yytype_int8 yydefact[] =
840{
841 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
842 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
843 0, 0, 0, 0, 0, 33, 36, 42, 41, 43,
844 44, 45, 46, 31, 47, 48, 49, 50, 51, 52,
845 53, 55, 54, 56, 57, 58, 59, 60, 62, 61,
846 63, 37, 38, 39, 40, 1, 5, 0, 35, 34,
847 8, 2, 0, 17, 23, 0, 0, 0, 0, 7,
848 10, 11, 12, 16, 32, 0, 0, 14, 15, 13,
849 6, 9, 0, 0, 0, 0, 20, 22, 0, 0,
850 0, 0, 26, 30, 21, 18, 19, 27, 28, 29,
851 24, 25
852};
853
854 /* YYPGOTO[NTERM-NUM]. */
855static const yytype_int16 yypgoto[] =
856{
857 -29, -29, 118, 105, -29, -29, 79, -29, -29, -29,
858 62, -29, -29, -29, 82, 23, -29, 138, -29, -25
859};
860
861 /* YYDEFGOTO[NTERM-NUM]. */
862static const yytype_int8 yydefgoto[] =
863{
864 -1, 23, 67, 61, 68, 69, 70, 71, 75, 85,
865 86, 72, 76, 91, 92, 34, 59, 24, 25, 26
866};
867
868 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
869 positive, shift that token. If negative, reduce the rule whose
870 number is the opposite. If YYTABLE_NINF, syntax error. */
871static const yytype_int8 yytable[] =
872{
873 58, -4, 1, 43, -34, 27, 28, 33, 41, 42,
874 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
875 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
876 29, 35, 30, 31, 22, 73, 32, 36, 44, 45,
877 46, 51, 52, 53, 73, 54, 33, 33, 37, 38,
878 39, 40, 47, 48, 55, 56, 49, 87, 93, 50,
879 87, 56, 63, 64, 65, 60, 93, 2, 3, 4,
880 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
881 15, 16, 17, 18, 19, 20, 21, 74, 77, 78,
882 66, 22, 88, 89, 2, 3, 4, 5, 6, 7,
883 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
884 18, 19, 20, 21, 80, 82, 83, 90, 22, 94,
885 97, 100, 2, 3, 4, 5, 6, 7, 8, 9,
886 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
887 20, 21, 57, 98, 99, 84, 22, 96, 81, 95,
888 88, 89, 2, 3, 4, 5, 6, 7, 8, 9,
889 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
890 20, 21, 79, 101, 0, 90, 22, 2, 3, 4,
891 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
892 15, 16, 17, 18, 19, 20, 21, 62, 0, 0,
893 84, 22, 2, 3, 4, 5, 6, 7, 8, 9,
894 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
895 20, 21, 0, 0, 0, 0, 22
896};
897
898static const yytype_int8 yycheck[] =
899{
900 25, 0, 1, 31, 3, 29, 30, 35, 29, 30,
901 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
902 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
903 30, 8, 30, 30, 33, 60, 31, 31, 15, 16,
904 17, 29, 30, 31, 69, 22, 35, 35, 31, 31,
905 31, 29, 31, 29, 0, 3, 31, 82, 83, 31,
906 85, 3, 4, 5, 6, 35, 91, 9, 10, 11,
907 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
908 22, 23, 24, 25, 26, 27, 28, 36, 29, 29,
909 32, 33, 7, 8, 9, 10, 11, 12, 13, 14,
910 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
911 25, 26, 27, 28, 36, 35, 35, 32, 33, 29,
912 29, 36, 9, 10, 11, 12, 13, 14, 15, 16,
913 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
914 27, 28, 24, 29, 29, 32, 33, 85, 69, 36,
915 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
916 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
917 27, 28, 67, 91, -1, 32, 33, 9, 10, 11,
918 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
919 22, 23, 24, 25, 26, 27, 28, 59, -1, -1,
920 32, 33, 9, 10, 11, 12, 13, 14, 15, 16,
921 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
922 27, 28, -1, -1, -1, -1, 33
923};
924
925 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
926 symbol of state STATE-NUM. */
927static const yytype_int8 yystos[] =
928{
929 0, 1, 9, 10, 11, 12, 13, 14, 15, 16,
930 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
931 27, 28, 33, 38, 54, 55, 56, 29, 30, 30,
932 30, 30, 31, 35, 52, 52, 31, 31, 31, 31,
933 29, 29, 30, 31, 52, 52, 52, 31, 29, 31,
934 31, 29, 30, 31, 52, 0, 3, 39, 56, 53,
935 35, 40, 54, 4, 5, 6, 32, 39, 41, 42,
936 43, 44, 48, 56, 36, 45, 49, 29, 29, 40,
937 36, 43, 35, 35, 32, 46, 47, 56, 7, 8,
938 32, 50, 51, 56, 29, 36, 47, 29, 29, 29,
939 36, 51
940};
941
942 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
943static const yytype_int8 yyr1[] =
944{
945 0, 37, 38, 38, 38, 39, 40, 41, 41, 42,
946 42, 43, 43, 43, 43, 43, 43, 45, 44, 46,
947 46, 47, 47, 49, 48, 50, 50, 51, 51, 51,
948 51, 53, 52, 54, 54, 55, 55, 56, 56, 56,
949 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
950 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
951 56, 56, 56, 56
952};
953
954 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
955static const yytype_int8 yyr2[] =
956{
957 0, 2, 3, 1, 0, 1, 3, 1, 0, 2,
958 1, 1, 1, 2, 2, 2, 1, 0, 5, 2,
959 1, 2, 1, 0, 5, 2, 1, 2, 2, 2,
960 1, 0, 4, 1, 0, 2, 1, 2, 2, 2,
961 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
962 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
963 2, 2, 2, 2
964};
965
966
967#define yyerrok (yyerrstatus = 0)
968#define yyclearin (yychar = YYEMPTY)
969#define YYEMPTY (-2)
970#define YYEOF 0
971
972#define YYACCEPT goto yyacceptlab
973#define YYABORT goto yyabortlab
974#define YYERROR goto yyerrorlab
975
976
977#define YYRECOVERING() (!!yyerrstatus)
978
979#define YYBACKUP(Token, Value) \
980 do \
981 if (yychar == YYEMPTY) \
982 { \
983 yychar = (Token); \
984 yylval = (Value); \
985 YYPOPSTACK (yylen); \
986 yystate = *yyssp; \
987 goto yybackup; \
988 } \
989 else \
990 { \
991 yyerror (YY_("syntax error: cannot back up")); \
992 YYERROR; \
993 } \
994 while (0)
995
996/* Error token number */
997#define YYTERROR 1
998#define YYERRCODE 256
999
1000
1001
1002/* Enable debugging if requested. */
1003#if GMLDEBUG
1004
1005# ifndef YYFPRINTF
1006# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1007# define YYFPRINTF fprintf
1008# endif
1009
1010# define YYDPRINTF(Args) \
1011do { \
1012 if (yydebug) \
1013 YYFPRINTF Args; \
1014} while (0)
1015
1016/* This macro is provided for backward compatibility. */
1017#ifndef YY_LOCATION_PRINT
1018# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1019#endif
1020
1021
1022# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1023do { \
1024 if (yydebug) \
1025 { \
1026 YYFPRINTF (stderr, "%s ", Title); \
1027 yy_symbol_print (stderr, \
1028 Type, Value); \
1029 YYFPRINTF (stderr, "\n"); \
1030 } \
1031} while (0)
1032
1033
1034/*-----------------------------------.
1035| Print this symbol's value on YYO. |
1036`-----------------------------------*/
1037
1038static void
1039yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
1040{
1041 FILE *yyoutput = yyo;
1042 YYUSE (yyoutput);
1043 if (!yyvaluep)
1044 return;
1045# ifdef YYPRINT
1046 if (yytype < YYNTOKENS)
1047 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
1048# endif
1050 YYUSE (yytype);
1052}
1053
1054
1055/*---------------------------.
1056| Print this symbol on YYO. |
1057`---------------------------*/
1058
1059static void
1060yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
1061{
1062 YYFPRINTF (yyo, "%s %s (",
1063 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1064
1065 yy_symbol_value_print (yyo, yytype, yyvaluep);
1066 YYFPRINTF (yyo, ")");
1067}
1068
1069/*------------------------------------------------------------------.
1070| yy_stack_print -- Print the state stack from its BOTTOM up to its |
1071| TOP (included). |
1072`------------------------------------------------------------------*/
1073
1074static void
1075yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1076{
1077 YYFPRINTF (stderr, "Stack now");
1078 for (; yybottom <= yytop; yybottom++)
1079 {
1080 int yybot = *yybottom;
1081 YYFPRINTF (stderr, " %d", yybot);
1082 }
1083 YYFPRINTF (stderr, "\n");
1084}
1085
1086# define YY_STACK_PRINT(Bottom, Top) \
1087do { \
1088 if (yydebug) \
1089 yy_stack_print ((Bottom), (Top)); \
1090} while (0)
1091
1092
1093/*------------------------------------------------.
1094| Report that the YYRULE is going to be reduced. |
1095`------------------------------------------------*/
1096
1097static void
1098yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule)
1099{
1100 int yylno = yyrline[yyrule];
1101 int yynrhs = yyr2[yyrule];
1102 int yyi;
1103 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1104 yyrule - 1, yylno);
1105 /* The symbols being reduced. */
1106 for (yyi = 0; yyi < yynrhs; yyi++)
1107 {
1108 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1109 yy_symbol_print (stderr,
1110 yystos[+yyssp[yyi + 1 - yynrhs]],
1111 &yyvsp[(yyi + 1) - (yynrhs)]
1112 );
1113 YYFPRINTF (stderr, "\n");
1114 }
1115}
1116
1117# define YY_REDUCE_PRINT(Rule) \
1118do { \
1119 if (yydebug) \
1120 yy_reduce_print (yyssp, yyvsp, Rule); \
1121} while (0)
1122
1123/* Nonzero means print parse trace. It is left uninitialized so that
1124 multiple parsers can coexist. */
1125int yydebug;
1126#else /* !GMLDEBUG */
1127# define YYDPRINTF(Args)
1128# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1129# define YY_STACK_PRINT(Bottom, Top)
1130# define YY_REDUCE_PRINT(Rule)
1131#endif /* !GMLDEBUG */
1132
1133
1134/* YYINITDEPTH -- initial size of the parser's stacks. */
1135#ifndef YYINITDEPTH
1136# define YYINITDEPTH 200
1137#endif
1138
1139/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1140 if the built-in stack extension method is used).
1141
1142 Do not make this value too large; the results are undefined if
1143 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1144 evaluated with infinite-precision integer arithmetic. */
1145
1146#ifndef YYMAXDEPTH
1147# define YYMAXDEPTH 10000
1148#endif
1149
1150
1151#if YYERROR_VERBOSE
1152
1153# ifndef yystrlen
1154# if defined __GLIBC__ && defined _STRING_H
1155# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
1156# else
1157/* Return the length of YYSTR. */
1158static YYPTRDIFF_T
1159yystrlen (const char *yystr)
1160{
1161 YYPTRDIFF_T yylen;
1162 for (yylen = 0; yystr[yylen]; yylen++)
1163 continue;
1164 return yylen;
1165}
1166# endif
1167# endif
1168
1169# ifndef yystpcpy
1170# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1171# define yystpcpy stpcpy
1172# else
1173/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1174 YYDEST. */
1175static char *
1176yystpcpy (char *yydest, const char *yysrc)
1177{
1178 char *yyd = yydest;
1179 const char *yys = yysrc;
1180
1181 while ((*yyd++ = *yys++) != '\0')
1182 continue;
1183
1184 return yyd - 1;
1185}
1186# endif
1187# endif
1188
1189# ifndef yytnamerr
1190/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1191 quotes and backslashes, so that it's suitable for yyerror. The
1192 heuristic is that double-quoting is unnecessary unless the string
1193 contains an apostrophe, a comma, or backslash (other than
1194 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1195 null, do not copy; instead, return the length of what the result
1196 would have been. */
1197static YYPTRDIFF_T
1198yytnamerr (char *yyres, const char *yystr)
1199{
1200 if (*yystr == '"')
1201 {
1202 YYPTRDIFF_T yyn = 0;
1203 char const *yyp = yystr;
1204
1205 for (;;)
1206 switch (*++yyp)
1207 {
1208 case '\'':
1209 case ',':
1210 goto do_not_strip_quotes;
1211
1212 case '\\':
1213 if (*++yyp != '\\')
1214 goto do_not_strip_quotes;
1215 else
1216 goto append;
1217
1218 append:
1219 default:
1220 if (yyres)
1221 yyres[yyn] = *yyp;
1222 yyn++;
1223 break;
1224
1225 case '"':
1226 if (yyres)
1227 yyres[yyn] = '\0';
1228 return yyn;
1229 }
1230 do_not_strip_quotes: ;
1231 }
1232
1233 if (yyres)
1234 return yystpcpy (yyres, yystr) - yyres;
1235 else
1236 return yystrlen (yystr);
1237}
1238# endif
1239
1240/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1241 about the unexpected token YYTOKEN for the state stack whose top is
1242 YYSSP.
1243
1244 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1245 not large enough to hold the message. In that case, also set
1246 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1247 required number of bytes is too large to store. */
1248static int
1249yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1250 yy_state_t *yyssp, int yytoken)
1251{
1252 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1253 /* Internationalized format string. */
1254 const char *yyformat = YY_NULLPTR;
1255 /* Arguments of yyformat: reported tokens (one for the "unexpected",
1256 one per "expected"). */
1257 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1258 /* Actual size of YYARG. */
1259 int yycount = 0;
1260 /* Cumulated lengths of YYARG. */
1261 YYPTRDIFF_T yysize = 0;
1262
1263 /* There are many possibilities here to consider:
1264 - If this state is a consistent state with a default action, then
1265 the only way this function was invoked is if the default action
1266 is an error action. In that case, don't check for expected
1267 tokens because there are none.
1268 - The only way there can be no lookahead present (in yychar) is if
1269 this state is a consistent state with a default action. Thus,
1270 detecting the absence of a lookahead is sufficient to determine
1271 that there is no unexpected or expected token to report. In that
1272 case, just report a simple "syntax error".
1273 - Don't assume there isn't a lookahead just because this state is a
1274 consistent state with a default action. There might have been a
1275 previous inconsistent state, consistent state with a non-default
1276 action, or user semantic action that manipulated yychar.
1277 - Of course, the expected token list depends on states to have
1278 correct lookahead information, and it depends on the parser not
1279 to perform extra reductions after fetching a lookahead from the
1280 scanner and before detecting a syntax error. Thus, state merging
1281 (from LALR or IELR) and default reductions corrupt the expected
1282 token list. However, the list is correct for canonical LR with
1283 one exception: it will still contain any token that will not be
1284 accepted due to an error action in a later state.
1285 */
1286 if (yytoken != YYEMPTY)
1287 {
1288 int yyn = yypact[+*yyssp];
1289 YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1290 yysize = yysize0;
1291 yyarg[yycount++] = yytname[yytoken];
1292 if (!yypact_value_is_default (yyn))
1293 {
1294 /* Start YYX at -YYN if negative to avoid negative indexes in
1295 YYCHECK. In other words, skip the first -YYN actions for
1296 this state because they are default actions. */
1297 int yyxbegin = yyn < 0 ? -yyn : 0;
1298 /* Stay within bounds of both yycheck and yytname. */
1299 int yychecklim = YYLAST - yyn + 1;
1300 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1301 int yyx;
1302
1303 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1304 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1305 && !yytable_value_is_error (yytable[yyx + yyn]))
1306 {
1307 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1308 {
1309 yycount = 1;
1310 yysize = yysize0;
1311 break;
1312 }
1313 yyarg[yycount++] = yytname[yyx];
1314 {
1315 YYPTRDIFF_T yysize1
1316 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1317 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1318 yysize = yysize1;
1319 else
1320 return 2;
1321 }
1322 }
1323 }
1324 }
1325
1326 switch (yycount)
1327 {
1328# define YYCASE_(N, S) \
1329 case N: \
1330 yyformat = S; \
1331 break
1332 default: /* Avoid compiler warnings. */
1333 YYCASE_(0, YY_("syntax error"));
1334 YYCASE_(1, YY_("syntax error, unexpected %s"));
1335 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1336 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1337 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1338 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1339# undef YYCASE_
1340 }
1341
1342 {
1343 /* Don't count the "%s"s in the final size, but reserve room for
1344 the terminator. */
1345 YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
1346 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1347 yysize = yysize1;
1348 else
1349 return 2;
1350 }
1351
1352 if (*yymsg_alloc < yysize)
1353 {
1354 *yymsg_alloc = 2 * yysize;
1355 if (! (yysize <= *yymsg_alloc
1356 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1357 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1358 return 1;
1359 }
1360
1361 /* Avoid sprintf, as that infringes on the user's name space.
1362 Don't have undefined behavior even if the translation
1363 produced a string with the wrong number of "%s"s. */
1364 {
1365 char *yyp = *yymsg;
1366 int yyi = 0;
1367 while ((*yyp = *yyformat) != '\0')
1368 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1369 {
1370 yyp += yytnamerr (yyp, yyarg[yyi++]);
1371 yyformat += 2;
1372 }
1373 else
1374 {
1375 ++yyp;
1376 ++yyformat;
1377 }
1378 }
1379 return 0;
1380}
1381#endif /* YYERROR_VERBOSE */
1382
1383/*-----------------------------------------------.
1384| Release the memory associated to this symbol. |
1385`-----------------------------------------------*/
1386
1387static void
1388yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1389{
1390 YYUSE (yyvaluep);
1391 if (!yymsg)
1392 yymsg = "Deleting";
1393 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1394
1396 YYUSE (yytype);
1398}
1399
1400
1401
1402
1403/* The lookahead symbol. */
1405
1406/* The semantic value of the lookahead symbol. */
1408/* Number of syntax errors so far. */
1410
1411
1412/*----------.
1413| yyparse. |
1414`----------*/
1415
1416int
1418{
1419 yy_state_fast_t yystate;
1420 /* Number of tokens to shift before error messages enabled. */
1421 int yyerrstatus;
1422
1423 /* The stacks and their tools:
1424 'yyss': related to states.
1425 'yyvs': related to semantic values.
1426
1427 Refer to the stacks through separate pointers, to allow yyoverflow
1428 to reallocate them elsewhere. */
1429
1430 /* The state stack. */
1431 yy_state_t yyssa[YYINITDEPTH];
1432 yy_state_t *yyss;
1433 yy_state_t *yyssp;
1434
1435 /* The semantic value stack. */
1436 YYSTYPE yyvsa[YYINITDEPTH];
1437 YYSTYPE *yyvs;
1438 YYSTYPE *yyvsp;
1439
1440 YYPTRDIFF_T yystacksize;
1441
1442 int yyn;
1443 int yyresult;
1444 /* Lookahead token as an internal (translated) token number. */
1445 int yytoken = 0;
1446 /* The variables used to return semantic value and location from the
1447 action routines. */
1448 YYSTYPE yyval;
1449
1450#if YYERROR_VERBOSE
1451 /* Buffer for error messages, and its allocated size. */
1452 char yymsgbuf[128];
1453 char *yymsg = yymsgbuf;
1454 YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1455#endif
1456
1457#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1458
1459 /* The number of symbols on the RHS of the reduced rule.
1460 Keep to zero when no symbol should be popped. */
1461 int yylen = 0;
1462
1463 yyssp = yyss = yyssa;
1464 yyvsp = yyvs = yyvsa;
1465 yystacksize = YYINITDEPTH;
1466
1467 YYDPRINTF ((stderr, "Starting parse\n"));
1468
1469 yystate = 0;
1470 yyerrstatus = 0;
1471 yynerrs = 0;
1472 yychar = YYEMPTY; /* Cause a token to be read. */
1473 goto yysetstate;
1474
1475
1476/*------------------------------------------------------------.
1477| yynewstate -- push a new state, which is found in yystate. |
1478`------------------------------------------------------------*/
1479yynewstate:
1480 /* In all cases, when you get here, the value and location stacks
1481 have just been pushed. So pushing a state here evens the stacks. */
1482 yyssp++;
1483
1484
1485/*--------------------------------------------------------------------.
1486| yysetstate -- set current state (the top of the stack) to yystate. |
1487`--------------------------------------------------------------------*/
1488yysetstate:
1489 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1490 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1492 *yyssp = YY_CAST (yy_state_t, yystate);
1494
1495 if (yyss + yystacksize - 1 <= yyssp)
1496#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1497 goto yyexhaustedlab;
1498#else
1499 {
1500 /* Get the current used size of the three stacks, in elements. */
1501 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1502
1503# if defined yyoverflow
1504 {
1505 /* Give user a chance to reallocate the stack. Use copies of
1506 these so that the &'s don't force the real ones into
1507 memory. */
1508 yy_state_t *yyss1 = yyss;
1509 YYSTYPE *yyvs1 = yyvs;
1510
1511 /* Each stack pointer address is followed by the size of the
1512 data in use in that stack, in bytes. This used to be a
1513 conditional around just the two extra args, but that might
1514 be undefined if yyoverflow is a macro. */
1515 yyoverflow (YY_("memory exhausted"),
1516 &yyss1, yysize * YYSIZEOF (*yyssp),
1517 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1518 &yystacksize);
1519 yyss = yyss1;
1520 yyvs = yyvs1;
1521 }
1522# else /* defined YYSTACK_RELOCATE */
1523 /* Extend the stack our own way. */
1524 if (YYMAXDEPTH <= yystacksize)
1525 goto yyexhaustedlab;
1526 yystacksize *= 2;
1527 if (YYMAXDEPTH < yystacksize)
1528 yystacksize = YYMAXDEPTH;
1529
1530 {
1531 yy_state_t *yyss1 = yyss;
1532 union yyalloc *yyptr =
1533 YY_CAST (union yyalloc *,
1534 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1535 if (! yyptr)
1536 goto yyexhaustedlab;
1537 YYSTACK_RELOCATE (yyss_alloc, yyss);
1538 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1539# undef YYSTACK_RELOCATE
1540 if (yyss1 != yyssa)
1541 YYSTACK_FREE (yyss1);
1542 }
1543# endif
1544
1545 yyssp = yyss + yysize - 1;
1546 yyvsp = yyvs + yysize - 1;
1547
1549 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1550 YY_CAST (long, yystacksize)));
1552
1553 if (yyss + yystacksize - 1 <= yyssp)
1554 YYABORT;
1555 }
1556#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1557
1558 if (yystate == YYFINAL)
1559 YYACCEPT;
1560
1561 goto yybackup;
1562
1563
1564/*-----------.
1565| yybackup. |
1566`-----------*/
1567yybackup:
1568 /* Do appropriate processing given the current state. Read a
1569 lookahead token if we need one and don't already have one. */
1570
1571 /* First try to decide what to do without reference to lookahead token. */
1572 yyn = yypact[yystate];
1573 if (yypact_value_is_default (yyn))
1574 goto yydefault;
1575
1576 /* Not known => get a lookahead token if don't already have one. */
1577
1578 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1579 if (yychar == YYEMPTY)
1580 {
1581 YYDPRINTF ((stderr, "Reading a token: "));
1582 yychar = yylex ();
1583 }
1584
1585 if (yychar <= YYEOF)
1586 {
1587 yychar = yytoken = YYEOF;
1588 YYDPRINTF ((stderr, "Now at end of input.\n"));
1589 }
1590 else
1591 {
1592 yytoken = YYTRANSLATE (yychar);
1593 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1594 }
1595
1596 /* If the proper action on seeing token YYTOKEN is to reduce or to
1597 detect an error, take that action. */
1598 yyn += yytoken;
1599 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1600 goto yydefault;
1601 yyn = yytable[yyn];
1602 if (yyn <= 0)
1603 {
1604 if (yytable_value_is_error (yyn))
1605 goto yyerrlab;
1606 yyn = -yyn;
1607 goto yyreduce;
1608 }
1609
1610 /* Count tokens shifted since error; after three, turn off error
1611 status. */
1612 if (yyerrstatus)
1613 yyerrstatus--;
1614
1615 /* Shift the lookahead token. */
1616 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1617 yystate = yyn;
1619 *++yyvsp = yylval;
1621
1622 /* Discard the shifted token. */
1623 yychar = YYEMPTY;
1624 goto yynewstate;
1625
1626
1627/*-----------------------------------------------------------.
1628| yydefault -- do the default action for the current state. |
1629`-----------------------------------------------------------*/
1630yydefault:
1631 yyn = yydefact[yystate];
1632 if (yyn == 0)
1633 goto yyerrlab;
1634 goto yyreduce;
1635
1636
1637/*-----------------------------.
1638| yyreduce -- do a reduction. |
1639`-----------------------------*/
1640yyreduce:
1641 /* yyn is the number of a rule to reduce with. */
1642 yylen = yyr2[yyn];
1643
1644 /* If YYLEN is nonzero, implement the default value of the action:
1645 '$$ = $1'.
1646
1647 Otherwise, the following line sets YYVAL to garbage.
1648 This behavior is undocumented and Bison
1649 users should not rely upon it. Assigning to YYVAL
1650 unconditionally makes the parser a bit smaller, and it avoids a
1651 GCC warning that YYVAL may be used uninitialized. */
1652 yyval = yyvsp[1-yylen];
1653
1654
1655 YY_REDUCE_PRINT (yyn);
1656 switch (yyn)
1657 {
1658 case 2:
1659#line 220 "../../cmd/tools/gmlparse.y"
1660 {gmllexeof(); if (G->parent) popG(); }
1661#line 1662 "gmlparse.c"
1662 break;
1663
1664 case 3:
1665#line 221 "../../cmd/tools/gmlparse.y"
1666 { cleanup(); YYABORT; }
1667#line 1668 "gmlparse.c"
1668 break;
1669
1670 case 5:
1671#line 225 "../../cmd/tools/gmlparse.y"
1672 { pushG(); }
1673#line 1674 "gmlparse.c"
1674 break;
1675
1676 case 11:
1677#line 239 "../../cmd/tools/gmlparse.y"
1678 { nodes_append(&G->nodelist, (yyvsp[0].np)); }
1679#line 1680 "gmlparse.c"
1680 break;
1681
1682 case 12:
1683#line 240 "../../cmd/tools/gmlparse.y"
1684 { edges_append(&G->edgelist, (yyvsp[0].ep)); }
1685#line 1686 "gmlparse.c"
1686 break;
1687
1688 case 14:
1689#line 242 "../../cmd/tools/gmlparse.y"
1690 {
1691 if (setDir((yyvsp[0].str))) {
1692 yyerror("mixed directed and undirected graphs");
1693 cleanup ();
1694 YYABORT;
1695 }
1696 }
1697#line 1698 "gmlparse.c"
1698 break;
1699
1700 case 15:
1701#line 249 "../../cmd/tools/gmlparse.y"
1702 { attrs_append(&G->attrlist, mkAttr(gv_strdup("id"), 0, INTEGER, (yyvsp[0].str), 0)); }
1703#line 1704 "gmlparse.c"
1704 break;
1705
1706 case 16:
1707#line 250 "../../cmd/tools/gmlparse.y"
1708 { attrs_append(&G->attrlist, (yyvsp[0].ap)); }
1709#line 1710 "gmlparse.c"
1710 break;
1711
1712 case 17:
1713#line 253 "../../cmd/tools/gmlparse.y"
1714 { N = mkNode(); }
1715#line 1716 "gmlparse.c"
1716 break;
1717
1718 case 18:
1719#line 253 "../../cmd/tools/gmlparse.y"
1720 { (yyval.np) = N; N = NULL; }
1721#line 1722 "gmlparse.c"
1722 break;
1723
1724 case 21:
1725#line 260 "../../cmd/tools/gmlparse.y"
1726 { N->id = (yyvsp[0].str); }
1727#line 1728 "gmlparse.c"
1728 break;
1729
1730 case 22:
1731#line 261 "../../cmd/tools/gmlparse.y"
1732 { attrs_append(&N->attrlist, (yyvsp[0].ap)); }
1733#line 1734 "gmlparse.c"
1734 break;
1735
1736 case 23:
1737#line 264 "../../cmd/tools/gmlparse.y"
1738 { E = mkEdge(); }
1739#line 1740 "gmlparse.c"
1740 break;
1741
1742 case 24:
1743#line 264 "../../cmd/tools/gmlparse.y"
1744 { (yyval.ep) = E; E = NULL; }
1745#line 1746 "gmlparse.c"
1746 break;
1747
1748 case 27:
1749#line 271 "../../cmd/tools/gmlparse.y"
1750 { E->source = (yyvsp[0].str); }
1751#line 1752 "gmlparse.c"
1752 break;
1753
1754 case 28:
1755#line 272 "../../cmd/tools/gmlparse.y"
1756 { E->target = (yyvsp[0].str); }
1757#line 1758 "gmlparse.c"
1758 break;
1759
1760 case 29:
1761#line 273 "../../cmd/tools/gmlparse.y"
1762 { attrs_append(&E->attrlist, mkAttr(gv_strdup("id"), 0, INTEGER, (yyvsp[0].str), 0)); }
1763#line 1764 "gmlparse.c"
1764 break;
1765
1766 case 30:
1767#line 274 "../../cmd/tools/gmlparse.y"
1768 { attrs_append(&E->attrlist, (yyvsp[0].ap)); }
1769#line 1770 "gmlparse.c"
1770 break;
1771
1772 case 31:
1773#line 277 "../../cmd/tools/gmlparse.y"
1774 {pushAlist(); }
1775#line 1776 "gmlparse.c"
1776 break;
1777
1778 case 32:
1779#line 277 "../../cmd/tools/gmlparse.y"
1780 { (yyval.list) = popAlist(); }
1781#line 1782 "gmlparse.c"
1782 break;
1783
1784 case 35:
1785#line 284 "../../cmd/tools/gmlparse.y"
1786 { attrs_append(L, (yyvsp[0].ap)); }
1787#line 1788 "gmlparse.c"
1788 break;
1789
1790 case 36:
1791#line 285 "../../cmd/tools/gmlparse.y"
1792 { attrs_append(L, (yyvsp[0].ap)); }
1793#line 1794 "gmlparse.c"
1794 break;
1795
1796 case 37:
1797#line 288 "../../cmd/tools/gmlparse.y"
1798 { (yyval.ap) = mkAttr ((yyvsp[-1].str), 0, INTEGER, (yyvsp[0].str), 0); }
1799#line 1800 "gmlparse.c"
1800 break;
1801
1802 case 38:
1803#line 289 "../../cmd/tools/gmlparse.y"
1804 { (yyval.ap) = mkAttr ((yyvsp[-1].str), 0, REAL, (yyvsp[0].str), 0); }
1805#line 1806 "gmlparse.c"
1806 break;
1807
1808 case 39:
1809#line 290 "../../cmd/tools/gmlparse.y"
1810 { (yyval.ap) = mkAttr ((yyvsp[-1].str), 0, STRING, (yyvsp[0].str), 0); }
1811#line 1812 "gmlparse.c"
1812 break;
1813
1814 case 40:
1815#line 291 "../../cmd/tools/gmlparse.y"
1816 { (yyval.ap) = mkAttr ((yyvsp[-1].str), 0, LIST, 0, (yyvsp[0].list)); }
1817#line 1818 "gmlparse.c"
1818 break;
1819
1820 case 41:
1821#line 292 "../../cmd/tools/gmlparse.y"
1822 { (yyval.ap) = mkAttr (0, XVAL, REAL, (yyvsp[0].str), 0); }
1823#line 1824 "gmlparse.c"
1824 break;
1825
1826 case 42:
1827#line 293 "../../cmd/tools/gmlparse.y"
1828 { (yyval.ap) = mkAttr (0, XVAL, REAL, (yyvsp[0].str), 0); }
1829#line 1830 "gmlparse.c"
1830 break;
1831
1832 case 43:
1833#line 294 "../../cmd/tools/gmlparse.y"
1834 { (yyval.ap) = mkAttr (0, YVAL, REAL, (yyvsp[0].str), 0); }
1835#line 1836 "gmlparse.c"
1836 break;
1837
1838 case 44:
1839#line 295 "../../cmd/tools/gmlparse.y"
1840 { (yyval.ap) = mkAttr (0, WVAL, REAL, (yyvsp[0].str), 0); }
1841#line 1842 "gmlparse.c"
1842 break;
1843
1844 case 45:
1845#line 296 "../../cmd/tools/gmlparse.y"
1846 { (yyval.ap) = mkAttr (0, HVAL, REAL, (yyvsp[0].str), 0); }
1847#line 1848 "gmlparse.c"
1848 break;
1849
1850 case 46:
1851#line 297 "../../cmd/tools/gmlparse.y"
1852 { (yyval.ap) = mkAttr (0, LABEL, STRING, (yyvsp[0].str), 0); }
1853#line 1854 "gmlparse.c"
1854 break;
1855
1856 case 47:
1857#line 298 "../../cmd/tools/gmlparse.y"
1858 { (yyval.ap) = mkAttr (0, GRAPHICS, LIST, 0, (yyvsp[0].list)); }
1859#line 1860 "gmlparse.c"
1860 break;
1861
1862 case 48:
1863#line 299 "../../cmd/tools/gmlparse.y"
1864 { (yyval.ap) = mkAttr (0, LABELGRAPHICS, LIST, 0, (yyvsp[0].list)); }
1865#line 1866 "gmlparse.c"
1866 break;
1867
1868 case 49:
1869#line 300 "../../cmd/tools/gmlparse.y"
1870 { (yyval.ap) = mkAttr (0, TYPE, STRING, (yyvsp[0].str), 0); }
1871#line 1872 "gmlparse.c"
1872 break;
1873
1874 case 50:
1875#line 301 "../../cmd/tools/gmlparse.y"
1876 { (yyval.ap) = mkAttr (0, FILL, STRING, (yyvsp[0].str), 0); }
1877#line 1878 "gmlparse.c"
1878 break;
1879
1880 case 51:
1881#line 302 "../../cmd/tools/gmlparse.y"
1882 { (yyval.ap) = mkAttr (0, OUTLINE, STRING, (yyvsp[0].str), 0); }
1883#line 1884 "gmlparse.c"
1884 break;
1885
1886 case 52:
1887#line 303 "../../cmd/tools/gmlparse.y"
1888 { (yyval.ap) = mkAttr (0, OUTLINESTYLE, STRING, (yyvsp[0].str), 0); }
1889#line 1890 "gmlparse.c"
1890 break;
1891
1892 case 53:
1893#line 304 "../../cmd/tools/gmlparse.y"
1894 { (yyval.ap) = mkAttr (0, OUTLINEWIDTH, INTEGER, (yyvsp[0].str), 0); }
1895#line 1896 "gmlparse.c"
1896 break;
1897
1898 case 54:
1899#line 305 "../../cmd/tools/gmlparse.y"
1900 { (yyval.ap) = mkAttr (0, WIDTH, REAL, (yyvsp[0].str), 0); }
1901#line 1902 "gmlparse.c"
1902 break;
1903
1904 case 55:
1905#line 306 "../../cmd/tools/gmlparse.y"
1906 { (yyval.ap) = mkAttr (0, WIDTH, INTEGER, (yyvsp[0].str), 0); }
1907#line 1908 "gmlparse.c"
1908 break;
1909
1910 case 56:
1911#line 307 "../../cmd/tools/gmlparse.y"
1912 { (yyval.ap) = mkAttr (0, STYLE, STRING, (yyvsp[0].str), 0); }
1913#line 1914 "gmlparse.c"
1914 break;
1915
1916 case 57:
1917#line 308 "../../cmd/tools/gmlparse.y"
1918 { (yyval.ap) = mkAttr (0, STYLE, LIST, 0, (yyvsp[0].list)); }
1919#line 1920 "gmlparse.c"
1920 break;
1921
1922 case 58:
1923#line 309 "../../cmd/tools/gmlparse.y"
1924 { (yyval.ap) = mkAttr (0, LINE, LIST, 0, (yyvsp[0].list)); }
1925#line 1926 "gmlparse.c"
1926 break;
1927
1928 case 59:
1929#line 310 "../../cmd/tools/gmlparse.y"
1930 { (yyval.ap) = mkAttr (0, POINT, LIST, 0, (yyvsp[0].list)); }
1931#line 1932 "gmlparse.c"
1932 break;
1933
1934 case 60:
1935#line 311 "../../cmd/tools/gmlparse.y"
1936 { (yyval.ap) = mkAttr (0, TEXT, STRING, (yyvsp[0].str), 0); }
1937#line 1938 "gmlparse.c"
1938 break;
1939
1940 case 61:
1941#line 312 "../../cmd/tools/gmlparse.y"
1942 { (yyval.ap) = mkAttr (0, FONTNAME, STRING, (yyvsp[0].str), 0); }
1943#line 1944 "gmlparse.c"
1944 break;
1945
1946 case 62:
1947#line 313 "../../cmd/tools/gmlparse.y"
1948 { (yyval.ap) = mkAttr (0, FONTNAME, INTEGER, (yyvsp[0].str), 0); }
1949#line 1950 "gmlparse.c"
1950 break;
1951
1952 case 63:
1953#line 314 "../../cmd/tools/gmlparse.y"
1954 { (yyval.ap) = mkAttr (0, COLOR, STRING, (yyvsp[0].str), 0); }
1955#line 1956 "gmlparse.c"
1956 break;
1957
1958
1959#line 1960 "gmlparse.c"
1960
1961 default: break;
1962 }
1963 /* User semantic actions sometimes alter yychar, and that requires
1964 that yytoken be updated with the new translation. We take the
1965 approach of translating immediately before every use of yytoken.
1966 One alternative is translating here after every semantic action,
1967 but that translation would be missed if the semantic action invokes
1968 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1969 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1970 incorrect destructor might then be invoked immediately. In the
1971 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1972 to an incorrect destructor call or verbose syntax error message
1973 before the lookahead is translated. */
1974 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1975
1976 YYPOPSTACK (yylen);
1977 yylen = 0;
1978 YY_STACK_PRINT (yyss, yyssp);
1979
1980 *++yyvsp = yyval;
1981
1982 /* Now 'shift' the result of the reduction. Determine what state
1983 that goes to, based on the state we popped back to and the rule
1984 number reduced by. */
1985 {
1986 const int yylhs = yyr1[yyn] - YYNTOKENS;
1987 const int yyi = yypgoto[yylhs] + *yyssp;
1988 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1989 ? yytable[yyi]
1990 : yydefgoto[yylhs]);
1991 }
1992
1993 goto yynewstate;
1994
1995
1996/*--------------------------------------.
1997| yyerrlab -- here on detecting error. |
1998`--------------------------------------*/
1999yyerrlab:
2000 /* Make sure we have latest lookahead translation. See comments at
2001 user semantic actions for why this is necessary. */
2002 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2003
2004 /* If not already recovering from an error, report this error. */
2005 if (!yyerrstatus)
2006 {
2007 ++yynerrs;
2008#if ! YYERROR_VERBOSE
2009 yyerror (YY_("syntax error"));
2010#else
2011# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2012 yyssp, yytoken)
2013 {
2014 char const *yymsgp = YY_("syntax error");
2015 int yysyntax_error_status;
2016 yysyntax_error_status = YYSYNTAX_ERROR;
2017 if (yysyntax_error_status == 0)
2018 yymsgp = yymsg;
2019 else if (yysyntax_error_status == 1)
2020 {
2021 if (yymsg != yymsgbuf)
2022 YYSTACK_FREE (yymsg);
2023 yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
2024 if (!yymsg)
2025 {
2026 yymsg = yymsgbuf;
2027 yymsg_alloc = sizeof yymsgbuf;
2028 yysyntax_error_status = 2;
2029 }
2030 else
2031 {
2032 yysyntax_error_status = YYSYNTAX_ERROR;
2033 yymsgp = yymsg;
2034 }
2035 }
2036 yyerror (yymsgp);
2037 if (yysyntax_error_status == 2)
2038 goto yyexhaustedlab;
2039 }
2040# undef YYSYNTAX_ERROR
2041#endif
2042 }
2043
2044
2045
2046 if (yyerrstatus == 3)
2047 {
2048 /* If just tried and failed to reuse lookahead token after an
2049 error, discard it. */
2050
2051 if (yychar <= YYEOF)
2052 {
2053 /* Return failure if at end of input. */
2054 if (yychar == YYEOF)
2055 YYABORT;
2056 }
2057 else
2058 {
2059 yydestruct ("Error: discarding",
2060 yytoken, &yylval);
2061 yychar = YYEMPTY;
2062 }
2063 }
2064
2065 /* Else will try to reuse lookahead token after shifting the error
2066 token. */
2067 goto yyerrlab1;
2068
2069
2070/*---------------------------------------------------.
2071| yyerrorlab -- error raised explicitly by YYERROR. |
2072`---------------------------------------------------*/
2073yyerrorlab:
2074 /* Pacify compilers when the user code never invokes YYERROR and the
2075 label yyerrorlab therefore never appears in user code. */
2076 if (0)
2077 YYERROR;
2078
2079 /* Do not reclaim the symbols of the rule whose action triggered
2080 this YYERROR. */
2081 YYPOPSTACK (yylen);
2082 yylen = 0;
2083 YY_STACK_PRINT (yyss, yyssp);
2084 yystate = *yyssp;
2085 goto yyerrlab1;
2086
2087
2088/*-------------------------------------------------------------.
2089| yyerrlab1 -- common code for both syntax error and YYERROR. |
2090`-------------------------------------------------------------*/
2091yyerrlab1:
2092 yyerrstatus = 3; /* Each real token shifted decrements this. */
2093
2094 for (;;)
2095 {
2096 yyn = yypact[yystate];
2097 if (!yypact_value_is_default (yyn))
2098 {
2099 yyn += YYTERROR;
2100 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2101 {
2102 yyn = yytable[yyn];
2103 if (0 < yyn)
2104 break;
2105 }
2106 }
2107
2108 /* Pop the current state because it cannot handle the error token. */
2109 if (yyssp == yyss)
2110 YYABORT;
2111
2112
2113 yydestruct ("Error: popping",
2114 yystos[yystate], yyvsp);
2115 YYPOPSTACK (1);
2116 yystate = *yyssp;
2117 YY_STACK_PRINT (yyss, yyssp);
2118 }
2119
2121 *++yyvsp = yylval;
2123
2124
2125 /* Shift the error token. */
2126 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2127
2128 yystate = yyn;
2129 goto yynewstate;
2130
2131
2132/*-------------------------------------.
2133| yyacceptlab -- YYACCEPT comes here. |
2134`-------------------------------------*/
2135yyacceptlab:
2136 yyresult = 0;
2137 goto yyreturn;
2138
2139
2140/*-----------------------------------.
2141| yyabortlab -- YYABORT comes here. |
2142`-----------------------------------*/
2143yyabortlab:
2144 yyresult = 1;
2145 goto yyreturn;
2146
2147
2148#if !defined yyoverflow || YYERROR_VERBOSE
2149/*-------------------------------------------------.
2150| yyexhaustedlab -- memory exhaustion comes here. |
2151`-------------------------------------------------*/
2152yyexhaustedlab:
2153 yyerror (YY_("memory exhausted"));
2154 yyresult = 2;
2155 /* Fall through. */
2156#endif
2157
2158
2159/*-----------------------------------------------------.
2160| yyreturn -- parsing is finished, return the result. |
2161`-----------------------------------------------------*/
2162yyreturn:
2163 if (yychar != YYEMPTY)
2164 {
2165 /* Make sure we have latest lookahead translation. See comments at
2166 user semantic actions for why this is necessary. */
2167 yytoken = YYTRANSLATE (yychar);
2168 yydestruct ("Cleanup: discarding lookahead",
2169 yytoken, &yylval);
2170 }
2171 /* Do not reclaim the symbols of the rule whose action triggered
2172 this YYABORT or YYACCEPT. */
2173 YYPOPSTACK (yylen);
2174 YY_STACK_PRINT (yyss, yyssp);
2175 while (yyssp != yyss)
2176 {
2177 yydestruct ("Cleanup: popping",
2178 yystos[+*yyssp], yyvsp);
2179 YYPOPSTACK (1);
2180 }
2181#ifndef yyoverflow
2182 if (yyss != yyssa)
2183 YYSTACK_FREE (yyss);
2184#endif
2185#if YYERROR_VERBOSE
2186 if (yymsg != yymsgbuf)
2187 YYSTACK_FREE (yymsg);
2188#endif
2189 return yyresult;
2190}
2191#line 317 "../../cmd/tools/gmlparse.y"
2192
2193
2195 if (!p) return;
2196 if (p->kind == LIST && p->u.lp)
2197 free_attrs(p->u.lp);
2198 else
2199 free (p->u.value);
2200 free (p->name);
2201 free (p);
2202}
2203
2204static void deparseList(attrs_t *alist, agxbuf *xb);
2205
2206static void
2208{
2209 if (ap->kind == LIST) {
2210 agxbprint (xb, "%s ", ap->name);
2211 deparseList (ap->u.lp, xb);
2212 }
2213 else if (ap->kind == STRING) {
2214 agxbprint (xb, "%s \"%s\"", ap->name, ap->u.value);
2215 }
2216 else {
2217 agxbprint (xb, "%s %s", ap->name, ap->u.value);
2218 }
2219}
2220
2221static void deparseList(attrs_t *alist, agxbuf *xb) {
2222 agxbput (xb, "[ ");
2223 for (size_t i = 0; alist != NULL && i < attrs_size(alist); ++i) {
2224 gmlattr *const ap = attrs_get(alist, i);
2225 deparseAttr (ap, xb);
2226 agxbputc (xb, ' ');
2227 }
2228 agxbput (xb, "]");
2229
2230}
2231
2232static void
2234{
2235 char* str;
2236
2237 if (ap->kind == LIST) {
2238 deparseList (ap->u.lp, xb);
2239 str = agxbuse (xb);
2240 }
2241 else
2242 str = ap->u.value;
2243
2244 agsafeset (obj, ap->name, str, "");
2245}
2246
2247static void addNodeLabelGraphics(Agnode_t *np, attrs_t *alist, agxbuf *unk) {
2248 int cnt = 0;
2249
2250 if (!alist)
2251 return;
2252
2253 for (size_t i = 0; i < attrs_size(alist); ++i) {
2254 gmlattr *const ap = attrs_get(alist, i);
2255 if (ap->sort == TEXT) {
2256 agsafeset (np, "label", ap->u.value, "");
2257 }
2258 else if (ap->sort == COLOR) {
2259 agsafeset (np, "fontcolor", ap->u.value, "");
2260 }
2261 else if (ap->sort == FONTSIZE) {
2262 agsafeset (np, "fontsize", ap->u.value, "");
2263 }
2264 else if (ap->sort == FONTNAME) {
2265 agsafeset (np, "fontname", ap->u.value, "");
2266 }
2267 else {
2268 if (cnt)
2269 agxbputc (unk, ' ');
2270 else {
2271 agxbput (unk, "[ ");
2272 }
2273 deparseAttr (ap, unk);
2274 cnt++;
2275 }
2276 }
2277
2278 if (cnt) {
2279 agxbput (unk, " ]");
2280 agsafeset (np, "LabelGraphics", agxbuse (unk), "");
2281 }
2282 else
2283 agxbclear (unk);
2284}
2285
2286static void addEdgeLabelGraphics(Agedge_t *ep, attrs_t *alist, agxbuf *xb,
2287 agxbuf *unk) {
2288 char* x = "0";
2289 char* y = "0";
2290 int cnt = 0;
2291
2292 if (!alist)
2293 return;
2294
2295 for (size_t i = 0; i < attrs_size(alist); ++i) {
2296 gmlattr *const ap = attrs_get(alist, i);
2297 if (ap->sort == TEXT) {
2298 agsafeset (ep, "label", ap->u.value, "");
2299 }
2300 else if (ap->sort == COLOR) {
2301 agsafeset (ep, "fontcolor", ap->u.value, "");
2302 }
2303 else if (ap->sort == FONTSIZE) {
2304 agsafeset (ep, "fontsize", ap->u.value, "");
2305 }
2306 else if (ap->sort == FONTNAME) {
2307 agsafeset (ep, "fontname", ap->u.value, "");
2308 }
2309 else if (ap->sort == XVAL) {
2310 x = ap->u.value;
2311 }
2312 else if (ap->sort == YVAL) {
2313 y = ap->u.value;
2314 }
2315 else {
2316 if (cnt)
2317 agxbputc (unk, ' ');
2318 else {
2319 agxbput (unk, "[ ");
2320 }
2321 deparseAttr (ap, unk);
2322 cnt++;
2323 }
2324 }
2325
2326 agxbprint (xb, "%s,%s", x, y);
2327 agsafeset (ep, "lp", agxbuse (xb), "");
2328
2329 if (cnt) {
2330 agxbput (unk, " ]");
2331 agsafeset (ep, "LabelGraphics", agxbuse (unk), "");
2332 }
2333 else
2334 agxbclear (unk);
2335}
2336
2337static void addNodeGraphics(Agnode_t *np, attrs_t *alist, agxbuf *xb,
2338 agxbuf *unk) {
2339 char* x = "0";
2340 char* y = "0";
2341 char buf[BUFSIZ];
2342 double d;
2343 int cnt = 0;
2344
2345 for (size_t i = 0; alist != NULL && i < attrs_size(alist); ++i) {
2346 gmlattr *const ap = attrs_get(alist, i);
2347 if (ap->sort == XVAL) {
2348 x = ap->u.value;
2349 }
2350 else if (ap->sort == YVAL) {
2351 y = ap->u.value;
2352 }
2353 else if (ap->sort == WVAL) {
2354 d = atof (ap->u.value);
2355 snprintf(buf, sizeof(buf), "%.04f", d/72.0);
2356 agsafeset (np, "width", buf, "");
2357 }
2358 else if (ap->sort == HVAL) {
2359 d = atof (ap->u.value);
2360 snprintf(buf, sizeof(buf), "%.04f", d/72.0);
2361 agsafeset (np, "height", buf, "");
2362 }
2363 else if (ap->sort == TYPE) {
2364 agsafeset (np, "shape", ap->u.value, "");
2365 }
2366 else if (ap->sort == FILL) {
2367 agsafeset (np, "color", ap->u.value, "");
2368 }
2369 else if (ap->sort == OUTLINE) {
2370 agsafeset (np, "pencolor", ap->u.value, "");
2371 }
2372 else if (ap->sort == WIDTH || ap->sort == OUTLINEWIDTH) {
2373 agsafeset (np, "penwidth", ap->u.value, "");
2374 }
2375 else if (ap->sort == STYLE || ap->sort == OUTLINESTYLE) {
2376 agsafeset (np, "style", ap->u.value, "");
2377 }
2378 else {
2379 if (cnt)
2380 agxbputc (unk, ' ');
2381 else {
2382 agxbput (unk, "[ ");
2383 }
2384 deparseAttr (ap, unk);
2385 cnt++;
2386 }
2387 }
2388
2389 agxbprint (xb, "%s,%s", x, y);
2390 agsafeset (np, "pos", agxbuse (xb), "");
2391
2392 if (cnt) {
2393 agxbput (unk, " ]");
2394 agsafeset (np, "graphics", agxbuse (unk), "");
2395 }
2396 else
2397 agxbclear (unk);
2398}
2399
2400static void addEdgePoint(Agedge_t *ep, attrs_t *alist, agxbuf *xb) {
2401 char* x = "0";
2402 char* y = "0";
2403
2404 for (size_t i = 0; alist != NULL && i < attrs_size(alist); ++i) {
2405 gmlattr *const ap = attrs_get(alist, i);
2406 if (ap->sort == XVAL) {
2407 x = ap->u.value;
2408 }
2409 else if (ap->sort == YVAL) {
2410 y = ap->u.value;
2411 }
2412 else {
2413 fprintf (stderr, "non-X/Y field in point attribute");
2414 unknown ((Agobj_t*)ep, ap, xb);
2415 }
2416 }
2417
2418 if (agxblen(xb)) agxbputc (xb, ' ');
2419 agxbprint (xb, "%s,%s", x, y);
2420}
2421
2422static void addEdgePos(Agedge_t *ep, attrs_t *alist, agxbuf *xb) {
2423 if (!alist) return;
2424 for (size_t i = 0; i < attrs_size(alist); ++i) {
2425 gmlattr *const ap = attrs_get(alist, i);
2426 if (ap->sort == POINT) {
2427 addEdgePoint (ep, ap->u.lp, xb);
2428 }
2429 else {
2430 fprintf (stderr, "non-point field in line attribute");
2431 unknown ((Agobj_t*)ep, ap, xb);
2432 }
2433 }
2434 agsafeset (ep, "pos", agxbuse (xb), "");
2435}
2436
2437static void addEdgeGraphics(Agedge_t *ep, attrs_t *alist, agxbuf *xb,
2438 agxbuf *unk) {
2439 int cnt = 0;
2440
2441 for (size_t i = 0; alist != NULL && i < attrs_size(alist); ++i) {
2442 gmlattr *const ap = attrs_get(alist, i);
2443 if (ap->sort == WIDTH) {
2444 agsafeset (ep, "penwidth", ap->u.value, "");
2445 }
2446 else if (ap->sort == STYLE) {
2447 agsafeset (ep, "style", ap->u.value, "");
2448 }
2449 else if (ap->sort == FILL) {
2450 agsafeset (ep, "color", ap->u.value, "");
2451 }
2452 else if (ap->sort == LINE) {
2453 addEdgePos (ep, ap->u.lp, xb);
2454 }
2455 else {
2456 if (cnt)
2457 agxbputc (unk, ' ');
2458 else {
2459 agxbput (unk, "[ ");
2460 }
2461 deparseAttr (ap, unk);
2462 cnt++;
2463 }
2464 }
2465
2466 if (cnt) {
2467 agxbput (unk, " ]");
2468 agsafeset (ep, "graphics", agxbuse (unk), "");
2469 }
2470 else
2471 agxbclear(unk);
2472}
2473
2474static void addAttrs(Agobj_t *obj, attrs_t *alist, agxbuf *xb, agxbuf *unk) {
2475 for (size_t i = 0; i < attrs_size(alist); ++i) {
2476 gmlattr *const ap = attrs_get(alist, i);
2477 if (ap->sort == GRAPHICS) {
2478 if (AGTYPE(obj) == AGNODE)
2479 addNodeGraphics ((Agnode_t*)obj, ap->u.lp, xb, unk);
2480 else if (AGTYPE(obj) == AGEDGE)
2481 addEdgeGraphics ((Agedge_t*)obj, ap->u.lp, xb, unk);
2482 else
2483 unknown (obj, ap, xb);
2484 }
2485 else if (ap->sort == LABELGRAPHICS) {
2486 if (AGTYPE(obj) == AGNODE)
2487 addNodeLabelGraphics ((Agnode_t*)obj, ap->u.lp, unk);
2488 else if (AGTYPE(obj) == AGEDGE)
2489 addEdgeLabelGraphics ((Agedge_t*)obj, ap->u.lp, xb, unk);
2490 else
2491 unknown (obj, ap, xb);
2492 }
2493 else
2494 unknown (obj, ap, xb);
2495 }
2496}
2497
2499 agxbuf *xb, agxbuf *unk) {
2500 Agraph_t* g;
2501 Agnode_t* n;
2502 Agnode_t* h;
2503 Agedge_t* e;
2504
2505 if (parent) {
2506 g = agsubg (parent, NULL, 1);
2507 }
2508 else if (graph->directed >= 1)
2509 g = agopen (name, Agdirected, 0);
2510 else
2511 g = agopen (name, Agundirected, 0);
2512
2513 if (!parent && L) {
2514 addAttrs ((Agobj_t*)g, L, xb, unk);
2515 }
2516 for (size_t i = 0; i < nodes_size(&graph->nodelist); ++i) {
2517 gmlnode *const np = nodes_get(&graph->nodelist, i);
2518 if (!np->id) {
2519 fprintf (stderr, "node without an id attribute");
2520 graphviz_exit (1);
2521 }
2522 n = agnode (g, np->id, 1);
2523 addAttrs((Agobj_t*)n, &np->attrlist, xb, unk);
2524 }
2525
2526 for (size_t i = 0; i < edges_size(&graph->edgelist); ++i) {
2527 gmledge *ep = edges_get(&graph->edgelist, i);
2528 if (!ep->source) {
2529 fprintf (stderr, "edge without an source attribute");
2530 graphviz_exit (1);
2531 }
2532 if (!ep->target) {
2533 fprintf (stderr, "node without an target attribute");
2534 graphviz_exit (1);
2535 }
2536 n = agnode (g, ep->source, 1);
2537 h = agnode (g, ep->target, 1);
2538 e = agedge (g, n, h, NULL, 1);
2539 addAttrs((Agobj_t*)e, &ep->attrlist, xb, unk);
2540 }
2541 for (size_t i = 0; i < graphs_size(graph->graphlist); ++i) {
2542 gmlgraph *const gp = graphs_get(graph->graphlist, i);
2543 mkGraph (gp, g, NULL, xb, unk);
2544 }
2545
2546 addAttrs((Agobj_t*)g, &graph->attrlist, xb, unk);
2547
2548 return g;
2549}
2550
2551Agraph_t*
2552gml_to_gv (char* name, FILE* fp, int cnt, int* errors)
2553{
2554 Agraph_t* g;
2555 int error;
2556
2557 if (cnt == 0)
2558 initgmlscan(fp);
2559 else
2560 initgmlscan(0);
2561
2562 L = NULL;
2563 pushAlist ();
2564 gmlparse ();
2565
2566 error = gmlerrors();
2567 *errors |= error;
2568 if (!G || error)
2569 g = NULL;
2570 else {
2571 agxbuf xb = {0};
2572 agxbuf unk = {0};
2573 g = mkGraph (G, NULL, name, &xb, &unk);
2574 agxbfree (&xb);
2575 agxbfree(&unk);
2576 }
2577
2578 cleanup ();
2579
2580 return g;
2581}
2582
2583static char *sortToStr(unsigned short sort) {
2584 char* s;
2585
2586 switch (sort) {
2587 case GRAPH :
2588 s = "graph"; break;
2589 case NODE :
2590 s = "node"; break;
2591 case EDGE :
2592 s = "edge"; break;
2593 case DIRECTED :
2594 s = "directed"; break;
2595 case ID :
2596 s = "id"; break;
2597 case SOURCE :
2598 s = "source"; break;
2599 case TARGET :
2600 s = "target"; break;
2601 case XVAL :
2602 s = "xval"; break;
2603 case YVAL :
2604 s = "yval"; break;
2605 case WVAL :
2606 s = "wval"; break;
2607 case HVAL :
2608 s = "hval"; break;
2609 case LABEL :
2610 s = "label"; break;
2611 case GRAPHICS :
2612 s = "graphics"; break;
2613 case LABELGRAPHICS :
2614 s = "labelGraphics"; break;
2615 case TYPE :
2616 s = "type"; break;
2617 case FILL :
2618 s = "fill"; break;
2619 case OUTLINE :
2620 s = "outline"; break;
2621 case OUTLINESTYLE :
2622 s = "outlineStyle"; break;
2623 case OUTLINEWIDTH :
2624 s = "outlineWidth"; break;
2625 case WIDTH :
2626 s = "width"; break;
2627 case STYLE :
2628 s = "style"; break;
2629 case LINE :
2630 s = "line"; break;
2631 case POINT :
2632 s = "point"; break;
2633 case TEXT :
2634 s = "text"; break;
2635 case FONTSIZE :
2636 s = "fontSize"; break;
2637 case FONTNAME :
2638 s = "fontName"; break;
2639 case COLOR :
2640 s = "color"; break;
2641 case INTEGER :
2642 s = "integer"; break;
2643 case REAL :
2644 s = "real"; break;
2645 case STRING :
2646 s = "string"; break;
2647 case NAME :
2648 s = "name"; break;
2649 case LIST :
2650 s = "list"; break;
2651 case '[' :
2652 s = "["; break;
2653 case ']' :
2654 s = "]"; break;
2655 default :
2656 s = NULL;break;
2657 }
2658
2659 return s;
2660}
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
yytype_int16 yy_state_t
Definition exparse.c:452
static const char *const yytname[]
Definition exparse.c:741
GML-DOT converter
int gmlerrors(void)
Definition gmlscan.l:133
void initgmlscan(FILE *)
Definition gmlscan.c:849
void gmllexeof(void)
Definition gmlscan.l:138
#define LABEL
Definition gmlparse.c:357
static char * sortToStr(unsigned short sort)
Definition gmlparse.c:2583
#define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
Definition gmlparse.c:559
#define YYMAXDEPTH
Definition gmlparse.c:1147
#define YYSTACK_FREE
Definition gmlparse.c:621
#define YY_SYMBOL_PRINT(Title, Type, Value, Location)
Definition gmlparse.c:1128
static gmlnode * N
Definition gmlparse.c:90
static const yytype_int8 yytranslate[]
Definition gmlparse.c:734
static void addEdgeGraphics(Agedge_t *ep, attrs_t *alist, agxbuf *xb, agxbuf *unk)
Definition gmlparse.c:2437
static void addAttrs(Agobj_t *obj, attrs_t *alist, agxbuf *xb, agxbuf *unk)
Definition gmlparse.c:2474
#define OUTLINESTYLE
Definition gmlparse.c:363
gmltokentype
Definition gmlparse.c:311
static void deparseAttr(gmlattr *ap, agxbuf *xb)
Definition gmlparse.c:2207
#define WIDTH
Definition gmlparse.c:365
#define YY_ASSERT(E)
Definition gmlparse.c:579
#define YY_(Msgid)
Definition gmlparse.c:520
GMLSTYPE gmllval
#define YY_IGNORE_MAYBE_UNINITIALIZED_END
Definition gmlparse.c:560
static const yytype_int8 yydefact[]
Definition gmlparse.c:839
#define YYNSTATES
Definition gmlparse.c:721
#define YYSTYPE
Definition gmlparse.c:66
#define YY_IGNORE_USELESS_CAST_END
Definition gmlparse.c:575
short yytype_int16
Definition gmlparse.c:444
#define YYUSE(E)
Definition gmlparse.c:542
static void addEdgeLabelGraphics(Agedge_t *ep, attrs_t *alist, agxbuf *xb, agxbuf *unk)
Definition gmlparse.c:2286
#define yychar
Definition gmlparse.c:74
void free_attr(gmlattr *p)
Definition gmlparse.c:2194
#define GRAPHICS
Definition gmlparse.c:358
static void free_attrs(attrs_t *a)
Definition gmlparse.c:95
#define YYEOF
Definition gmlparse.c:970
#define YYABORT
Definition gmlparse.c:973
#define yylex
Definition gmlparse.c:69
#define REAL
Definition gmlparse.c:374
#define YYSTACK_BYTES(N)
Definition gmlparse.c:665
static const yytype_int8 yycheck[]
Definition gmlparse.c:898
#define POINT
Definition gmlparse.c:368
static void addNodeLabelGraphics(Agnode_t *np, attrs_t *alist, agxbuf *unk)
Definition gmlparse.c:2247
#define NAME
Definition gmlparse.c:377
static gmledge * E
Definition gmlparse.c:91
#define YY_REDUCE_PRINT(Rule)
Definition gmlparse.c:1130
static attrs_t * L
Definition gmlparse.c:93
#define COLOR
Definition gmlparse.c:372
#define YY_CAST(Type, Val)
Definition gmlparse.c:263
static dts_t liststk
Definition gmlparse.c:101
static const yytype_int16 yypact[]
Definition gmlparse.c:821
#define TEXT
Definition gmlparse.c:369
#define TYPE
Definition gmlparse.c:360
#define YY_NULLPTR
Definition gmlparse.c:275
static void cleanup(void)
Definition gmlparse.c:128
#define FONTSIZE
Definition gmlparse.c:370
static Agraph_t * mkGraph(gmlgraph *graph, Agraph_t *parent, char *name, agxbuf *xb, agxbuf *unk)
Definition gmlparse.c:2498
static void addNodeGraphics(Agnode_t *np, attrs_t *alist, agxbuf *xb, agxbuf *unk)
Definition gmlparse.c:2337
#define FILL
Definition gmlparse.c:361
#define YYFINAL
Definition gmlparse.c:710
static gmlnode * mkNode(void)
Definition gmlparse.c:193
static int setDir(char *d)
Definition gmlparse.c:232
static void addEdgePoint(Agedge_t *ep, attrs_t *alist, agxbuf *xb)
Definition gmlparse.c:2400
static const yytype_int16 yypgoto[]
Definition gmlparse.c:855
static void yydestruct(const char *yymsg, int yytype, YYSTYPE *yyvaluep)
Definition gmlparse.c:1388
void free_graph(gmlgraph *p)
Definition gmlparse.c:117
static gmledge * mkEdge(void)
Definition gmlparse.c:201
#define yylval
Definition gmlparse.c:73
#define YYNTOKENS
Definition gmlparse.c:715
#define ID
Definition gmlparse.c:376
unsigned char yytype_uint8
Definition gmlparse.c:453
static void pushAlist(void)
Definition gmlparse.c:150
#define YY_STACK_PRINT(Bottom, Top)
Definition gmlparse.c:1129
#define OUTLINEWIDTH
Definition gmlparse.c:364
#define YYSIZE_T
Definition gmlparse.c:494
#define YYSTACK_ALLOC_MAXIMUM
Definition gmlparse.c:623
#define yydebug
Definition gmlparse.c:71
#define YY_IGNORE_USELESS_CAST_BEGIN
Definition gmlparse.c:574
static void popG(void)
Definition gmlparse.c:172
#define SOURCE
Definition gmlparse.c:351
static const yytype_int8 yyr2[]
Definition gmlparse.c:955
static void addEdgePos(Agedge_t *ep, attrs_t *alist, agxbuf *xb)
Definition gmlparse.c:2422
void * malloc(YYSIZE_T)
#define DIRECTED
Definition gmlparse.c:350
static const yytype_int8 yytable[]
Definition gmlparse.c:871
#define YYPTRDIFF_T
Definition gmlparse.c:480
#define yynerrs
Definition gmlparse.c:72
int gmlparse(void)
#define NODE
Definition gmlparse.c:348
#define TARGET
Definition gmlparse.c:352
#define yyparse
Definition gmlparse.c:1417
static gmlgraph * G
Definition gmlparse.c:89
void free_node(gmlnode *p)
Definition gmlparse.c:105
#define YYACCEPT
Definition gmlparse.c:972
#define STRING
Definition gmlparse.c:375
#define yytable_value_is_error(Yyn)
Definition gmlparse.c:816
void free_edge(gmledge *p)
Definition gmlparse.c:111
#define WVAL
Definition gmlparse.c:355
#define YYTRANSLATE(YYX)
Definition gmlparse.c:729
static const yytype_int8 yystos[]
Definition gmlparse.c:927
#define EDGE
Definition gmlparse.c:349
#define STYLE
Definition gmlparse.c:366
static const yytype_int8 yyr1[]
Definition gmlparse.c:943
#define INTEGER
Definition gmlparse.c:373
#define HVAL
Definition gmlparse.c:356
#define YYTERROR
Definition gmlparse.c:997
#define YYPOPSTACK(N)
int yy_state_fast_t
Definition gmlparse.c:510
static void deparseList(attrs_t *alist, agxbuf *xb)
Definition gmlparse.c:2221
unsigned short yytype_uint16
Definition gmlparse.c:464
static const yytype_int8 yydefgoto[]
Definition gmlparse.c:862
static gmlattr * mkAttr(char *name, unsigned short sort, unsigned short kind, char *str, attrs_t *list)
Definition gmlparse.c:209
#define YVAL
Definition gmlparse.c:354
#define YYEMPTY
Definition gmlparse.c:969
#define YYLAST
Definition gmlparse.c:712
#define YYSTACK_RELOCATE(Stack_alloc, Stack)
Definition gmlparse.c:676
#define yypact_value_is_default(Yyn)
Definition gmlparse.c:811
#define FONTNAME
Definition gmlparse.c:371
#define LABELGRAPHICS
Definition gmlparse.c:359
#define YYINITDEPTH
Definition gmlparse.c:1136
#define LIST
Definition gmlparse.c:378
signed char yytype_int8
Definition gmlparse.c:436
void free(void *)
#define XVAL
Definition gmlparse.c:353
#define YYERROR
Definition gmlparse.c:974
#define YYSIZEOF(X)
Definition gmlparse.c:504
#define YYSTACK_ALLOC
Definition gmlparse.c:620
yytype_int8 yy_state_t
Definition gmlparse.c:507
static void pushG(void)
Definition gmlparse.c:178
#define YYDPRINTF(Args)
Definition gmlparse.c:1127
Agraph_t * gml_to_gv(char *name, FILE *fp, int cnt, int *errors)
Definition gmlparse.c:2552
#define LINE
Definition gmlparse.c:367
#define OUTLINE
Definition gmlparse.c:362
#define yyerror
Definition gmlparse.c:70
static attrs_t * popAlist(void)
Definition gmlparse.c:160
#define GRAPH
Definition gmlparse.c:347
static int errors
Definition gmlscan.c:846
node NULL
Definition grammar.y:163
static int cnt(Dict_t *d, Dtlink_t **set)
Definition graph.c:210
int agsafeset(void *obj, char *name, const char *value, const char *def)
ensures the given attribute is declared before setting it locally on an object
Definition attr.c:507
Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
Definition edge.c:260
Agdesc_t Agundirected
undirected
Definition graph.c:286
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:284
Agnode_t * agnode(Agraph_t *g, char *name, int createflag)
Definition node.c:145
#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:58
Agraph_t * graph(char *name)
Definition gv.cpp:30
agxbput(xb, staging)
@ unknown
Definition gvgen.c:32
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:34
#define __INT_LEAST8_TYPE__
#define __UINT_LEAST8_TYPE__
Definition moc_predefs.h:10
#define __UINT_LEAST16_TYPE__
#define __INT_LEAST16_TYPE__
a generic header of Agraph_s, Agnode_s and Agedge_s
Definition cgraph.h:210
graph or subgraph
Definition cgraph.h:425
union gmlattr::@58 u
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
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
gmlattr * ap
Definition gmlparse.c:390
char * str
Definition gmlparse.c:387
gmledge * ep
Definition gmlparse.c:389
gmlnode * np
Definition gmlparse.c:388
attrs_t * list
Definition gmlparse.c:391
Definition grammar.c:93
YYSTYPE yyvs_alloc
Definition gmlparse.c:657
yy_state_t yyss_alloc
Definition gmlparse.c:656