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