Coverage Report

Created: 2025-10-28 07:02

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/igraph/build/src/io/parsers/gml-parser.c
Line
Count
Source
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 1
58
59
/* Push parsers.  */
60
#define YYPUSH 0
61
62
/* Pull parsers.  */
63
#define YYPULL 1
64
65
66
/* Substitute the variable and function names.  */
67
#define yyparse         igraph_gml_yyparse
68
60.2M
#define yylex           igraph_gml_yylex
69
672
#define yyerror         igraph_gml_yyerror
70
#define yydebug         igraph_gml_yydebug
71
19.2k
#define yynerrs         igraph_gml_yynerrs
72
73
/* First part of user prologue.  */
74
#line 21 "/src/igraph/src/io/gml-parser.y"
75
76
77
/*
78
   igraph library.
79
   Copyright (C) 2009-2012  Gabor Csardi <csardi.gabor@gmail.com>
80
   334 Harvard st, Cambridge, MA, 02138 USA
81
82
   This program is free software; you can redistribute it and/or modify
83
   it under the terms of the GNU General Public License as published by
84
   the Free Software Foundation; either version 2 of the License, or
85
   (at your option) any later version.
86
87
   This program is distributed in the hope that it will be useful,
88
   but WITHOUT ANY WARRANTY; without even the implied warranty of
89
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
90
   GNU General Public License for more details.
91
92
   You should have received a copy of the GNU General Public License
93
   along with this program; if not, write to the Free Software
94
   Foundation, Inc.,  51 Franklin Street, Fifth Floor, Boston, MA
95
   02110-1301 USA
96
97
*/
98
99
#include "igraph_error.h"
100
#include "igraph_memory.h"
101
102
#include "io/gml-header.h"
103
#include "io/gml-tree.h"
104
#include "io/parsers/gml-parser.h"
105
#include "io/parsers/gml-lexer.h"
106
#include "io/parse_utils.h"
107
#include "internal/hacks.h" /* strcasecmp & strndup */
108
#include "math/safe_intop.h"
109
110
#include <stdio.h>
111
#include <math.h>
112
#include <string.h>
113
114
int igraph_gml_yyerror(YYLTYPE* locp, igraph_i_gml_parsedata_t *context,
115
                       const char *s);
116
static igraph_error_t igraph_i_gml_get_keyword(const char *s, size_t len, char **res);
117
static igraph_error_t igraph_i_gml_get_string(const char *s, size_t len, char **res);
118
static igraph_error_t igraph_i_gml_make_numeric(const char *name,
119
                                                int line,
120
                                                igraph_real_t value,
121
                                                igraph_gml_tree_t **tree);
122
static igraph_error_t igraph_i_gml_make_string(const char *name,
123
                                               int line,
124
                                               char *value,
125
                                               igraph_gml_tree_t **tree);
126
static igraph_error_t igraph_i_gml_make_list(const char *name,
127
                                             int line,
128
                                             igraph_gml_tree_t *list,
129
                                             igraph_gml_tree_t **tree);
130
static igraph_error_t igraph_i_gml_make_empty(igraph_gml_tree_t **tree);
131
static igraph_error_t igraph_i_gml_merge(igraph_gml_tree_t *t1, igraph_gml_tree_t* t2);
132
133
60.2M
#define scanner context->scanner
134
135
136
#line 137 "/src/igraph/build/src/io/parsers/gml-parser.c"
137
138
# ifndef YY_CAST
139
#  ifdef __cplusplus
140
#   define YY_CAST(Type, Val) static_cast<Type> (Val)
141
#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
142
#  else
143
152M
#   define YY_CAST(Type, Val) ((Type) (Val))
144
#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
145
#  endif
146
# endif
147
# ifndef YY_NULLPTR
148
#  if defined __cplusplus
149
#   if 201103L <= __cplusplus
150
#    define YY_NULLPTR nullptr
151
#   else
152
#    define YY_NULLPTR 0
153
#   endif
154
#  else
155
2.41k
#   define YY_NULLPTR ((void*)0)
156
#  endif
157
# endif
158
159
/* Enabling verbose error messages.  */
160
#ifdef YYERROR_VERBOSE
161
# undef YYERROR_VERBOSE
162
# define YYERROR_VERBOSE 1
163
#else
164
# define YYERROR_VERBOSE 1
165
#endif
166
167
/* Use api.header.include to #include this header
168
   instead of duplicating it here.  */
169
#ifndef YY_IGRAPH_GML_YY_SRC_IGRAPH_BUILD_SRC_IO_PARSERS_GML_PARSER_H_INCLUDED
170
# define YY_IGRAPH_GML_YY_SRC_IGRAPH_BUILD_SRC_IO_PARSERS_GML_PARSER_H_INCLUDED
171
/* Debug traces.  */
172
#ifndef YYDEBUG
173
# define YYDEBUG 0
174
#endif
175
#if YYDEBUG
176
extern int igraph_gml_yydebug;
177
#endif
178
179
/* Token type.  */
180
#ifndef YYTOKENTYPE
181
# define YYTOKENTYPE
182
  enum yytokentype
183
  {
184
    END = 0,
185
    STRING = 258,
186
    NUM = 259,
187
    KEYWORD = 260,
188
    LISTOPEN = 261,
189
    LISTCLOSE = 262,
190
    ERROR = 263
191
  };
192
#endif
193
194
/* Value type.  */
195
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
196
union YYSTYPE
197
{
198
#line 94 "/src/igraph/src/io/gml-parser.y"
199
200
   char *str;
201
   igraph_gml_tree_t *tree;
202
   igraph_real_t real;
203
204
#line 205 "/src/igraph/build/src/io/parsers/gml-parser.c"
205
206
};
207
typedef union YYSTYPE YYSTYPE;
208
# define YYSTYPE_IS_TRIVIAL 1
209
# define YYSTYPE_IS_DECLARED 1
210
#endif
211
212
/* Location type.  */
213
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
214
typedef struct YYLTYPE YYLTYPE;
215
struct YYLTYPE
216
{
217
  int first_line;
218
  int first_column;
219
  int last_line;
220
  int last_column;
221
};
222
# define YYLTYPE_IS_DECLARED 1
223
# define YYLTYPE_IS_TRIVIAL 1
224
#endif
225
226
227
228
int igraph_gml_yyparse (igraph_i_gml_parsedata_t* context);
229
230
#endif /* !YY_IGRAPH_GML_YY_SRC_IGRAPH_BUILD_SRC_IO_PARSERS_GML_PARSER_H_INCLUDED  */
231
232
233
234
#ifdef short
235
# undef short
236
#endif
237
238
/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
239
   <limits.h> and (if available) <stdint.h> are included
240
   so that the code can choose integer types of a good width.  */
241
242
#ifndef __PTRDIFF_MAX__
243
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
244
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
245
#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
246
#  define YY_STDINT_H
247
# endif
248
#endif
249
250
/* Narrow types that promote to a signed type and that can represent a
251
   signed or unsigned integer of at least N bits.  In tables they can
252
   save space and decrease cache pressure.  Promoting to a signed type
253
   helps avoid bugs in integer arithmetic.  */
254
255
#ifdef __INT_LEAST8_MAX__
256
typedef __INT_LEAST8_TYPE__ yytype_int8;
257
#elif defined YY_STDINT_H
258
typedef int_least8_t yytype_int8;
259
#else
260
typedef signed char yytype_int8;
261
#endif
262
263
#ifdef __INT_LEAST16_MAX__
264
typedef __INT_LEAST16_TYPE__ yytype_int16;
265
#elif defined YY_STDINT_H
266
typedef int_least16_t yytype_int16;
267
#else
268
typedef short yytype_int16;
269
#endif
270
271
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
272
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
273
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
274
       && UINT_LEAST8_MAX <= INT_MAX)
275
typedef uint_least8_t yytype_uint8;
276
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
277
typedef unsigned char yytype_uint8;
278
#else
279
typedef short yytype_uint8;
280
#endif
281
282
#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
283
typedef __UINT_LEAST16_TYPE__ yytype_uint16;
284
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
285
       && UINT_LEAST16_MAX <= INT_MAX)
286
typedef uint_least16_t yytype_uint16;
287
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
288
typedef unsigned short yytype_uint16;
289
#else
290
typedef int yytype_uint16;
291
#endif
292
293
#ifndef YYPTRDIFF_T
294
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
295
43.4k
#  define YYPTRDIFF_T __PTRDIFF_TYPE__
296
#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
297
# elif defined PTRDIFF_MAX
298
#  ifndef ptrdiff_t
299
#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
300
#  endif
301
#  define YYPTRDIFF_T ptrdiff_t
302
#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
303
# else
304
#  define YYPTRDIFF_T long
305
#  define YYPTRDIFF_MAXIMUM LONG_MAX
306
# endif
307
#endif
308
309
#ifndef YYSIZE_T
310
# ifdef __SIZE_TYPE__
311
#  define YYSIZE_T __SIZE_TYPE__
312
# elif defined size_t
313
#  define YYSIZE_T size_t
314
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
315
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
316
#  define YYSIZE_T size_t
317
# else
318
#  define YYSIZE_T unsigned
319
# endif
320
#endif
321
322
#define YYSIZE_MAXIMUM                                  \
323
1.82k
  YY_CAST (YYPTRDIFF_T,                                 \
324
           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
325
            ? YYPTRDIFF_MAXIMUM                         \
326
            : YY_CAST (YYSIZE_T, -1)))
327
328
0
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
329
330
/* Stored state numbers (used for stacks). */
331
typedef yytype_int8 yy_state_t;
332
333
/* State numbers in computations.  */
334
typedef int yy_state_fast_t;
335
336
#ifndef YY_
337
# if defined YYENABLE_NLS && YYENABLE_NLS
338
#  if ENABLE_NLS
339
#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
340
#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
341
#  endif
342
# endif
343
# ifndef YY_
344
596
#  define YY_(Msgid) Msgid
345
# endif
346
#endif
347
348
#ifndef YY_ATTRIBUTE_PURE
349
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
350
#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
351
# else
352
#  define YY_ATTRIBUTE_PURE
353
# endif
354
#endif
355
356
#ifndef YY_ATTRIBUTE_UNUSED
357
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
358
#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
359
# else
360
#  define YY_ATTRIBUTE_UNUSED
361
# endif
362
#endif
363
364
/* Suppress unused-variable warnings by "using" E.  */
365
#if ! defined lint || defined __GNUC__
366
122k
# define YYUSE(E) ((void) (E))
367
#else
368
# define YYUSE(E) /* empty */
369
#endif
370
371
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
372
/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
373
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \
374
    _Pragma ("GCC diagnostic push")                                     \
375
    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
376
    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
377
# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
378
    _Pragma ("GCC diagnostic pop")
379
#else
380
37.2k
# define YY_INITIAL_VALUE(Value) Value
381
#endif
382
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
383
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
384
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
385
#endif
386
#ifndef YY_INITIAL_VALUE
387
# define YY_INITIAL_VALUE(Value) /* Nothing. */
388
#endif
389
390
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
391
# define YY_IGNORE_USELESS_CAST_BEGIN                          \
392
    _Pragma ("GCC diagnostic push")                            \
393
    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
394
# define YY_IGNORE_USELESS_CAST_END            \
395
    _Pragma ("GCC diagnostic pop")
396
#endif
397
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
398
# define YY_IGNORE_USELESS_CAST_BEGIN
399
# define YY_IGNORE_USELESS_CAST_END
400
#endif
401
402
403
152M
#define YY_ASSERT(E) ((void) (0 && (E)))
404
405
#if ! defined yyoverflow || YYERROR_VERBOSE
406
407
/* The parser invokes alloca or malloc; define the necessary symbols.  */
408
409
# ifdef YYSTACK_USE_ALLOCA
410
#  if YYSTACK_USE_ALLOCA
411
#   ifdef __GNUC__
412
#    define YYSTACK_ALLOC __builtin_alloca
413
#   elif defined __BUILTIN_VA_ARG_INCR
414
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
415
#   elif defined _AIX
416
#    define YYSTACK_ALLOC __alloca
417
#   elif defined _MSC_VER
418
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
419
#    define alloca _alloca
420
#   else
421
#    define YYSTACK_ALLOC alloca
422
#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
423
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
424
      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
425
#     ifndef EXIT_SUCCESS
426
#      define EXIT_SUCCESS 0
427
#     endif
428
#    endif
429
#   endif
430
#  endif
431
# endif
432
433
# ifdef YYSTACK_ALLOC
434
   /* Pacify GCC's 'empty if-body' warning.  */
435
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
436
#  ifndef YYSTACK_ALLOC_MAXIMUM
437
    /* The OS might guarantee only one guard page at the bottom of the stack,
438
       and a page size can be as small as 4096 bytes.  So we cannot safely
439
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
440
       to allow for a few compiler-allocated temporary stack slots.  */
441
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
442
#  endif
443
# else
444
#  define YYSTACK_ALLOC YYMALLOC
445
0
#  define YYSTACK_FREE YYFREE
446
#  ifndef YYSTACK_ALLOC_MAXIMUM
447
1.82k
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
448
#  endif
449
#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
450
       && ! ((defined YYMALLOC || defined malloc) \
451
             && (defined YYFREE || defined free)))
452
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
453
#   ifndef EXIT_SUCCESS
454
#    define EXIT_SUCCESS 0
455
#   endif
456
#  endif
457
#  ifndef YYMALLOC
458
#   define YYMALLOC malloc
459
#   if ! defined malloc && ! defined EXIT_SUCCESS
460
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
461
#   endif
462
#  endif
463
#  ifndef YYFREE
464
0
#   define YYFREE free
465
#   if ! defined free && ! defined EXIT_SUCCESS
466
void free (void *); /* INFRINGES ON USER NAME SPACE */
467
#   endif
468
#  endif
469
# endif
470
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
471
472
473
#if (! defined yyoverflow \
474
     && (! defined __cplusplus \
475
         || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
476
             && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
477
478
/* A type that is properly aligned for any stack member.  */
479
union yyalloc
480
{
481
  yy_state_t yyss_alloc;
482
  YYSTYPE yyvs_alloc;
483
  YYLTYPE yyls_alloc;
484
};
485
486
/* The size of the maximum gap between one aligned stack and the next.  */
487
0
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
488
489
/* The size of an array large to enough to hold all stacks, each with
490
   N elements.  */
491
# define YYSTACK_BYTES(N) \
492
     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
493
             + YYSIZEOF (YYLTYPE)) \
494
      + 2 * YYSTACK_GAP_MAXIMUM)
495
496
# define YYCOPY_NEEDED 1
497
498
/* Relocate STACK from its old location to the new one.  The
499
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
500
   elements in the stack, and YYPTR gives the new location of the
501
   stack.  Advance YYPTR to a properly aligned location for the next
502
   stack.  */
503
# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
504
0
    do                                                                  \
505
0
      {                                                                 \
506
0
        YYPTRDIFF_T yynewbytes;                                         \
507
0
        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
508
0
        Stack = &yyptr->Stack_alloc;                                    \
509
0
        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
510
0
        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
511
0
      }                                                                 \
512
0
    while (0)
513
514
#endif
515
516
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
517
/* Copy COUNT objects from SRC to DST.  The source and destination do
518
   not overlap.  */
519
# ifndef YYCOPY
520
#  if defined __GNUC__ && 1 < __GNUC__
521
#   define YYCOPY(Dst, Src, Count) \
522
0
      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
523
#  else
524
#   define YYCOPY(Dst, Src, Count)              \
525
      do                                        \
526
        {                                       \
527
          YYPTRDIFF_T yyi;                      \
528
          for (yyi = 0; yyi < (Count); yyi++)   \
529
            (Dst)[yyi] = (Src)[yyi];            \
530
        }                                       \
531
      while (0)
532
#  endif
533
# endif
534
#endif /* !YYCOPY_NEEDED */
535
536
/* YYFINAL -- State number of the termination state.  */
537
152M
#define YYFINAL  6
538
/* YYLAST -- Last index in YYTABLE.  */
539
251M
#define YYLAST   10
540
541
/* YYNTOKENS -- Number of terminals.  */
542
92.6M
#define YYNTOKENS  9
543
/* YYNNTS -- Number of nonterminals.  */
544
#define YYNNTS  7
545
/* YYNRULES -- Number of rules.  */
546
#define YYNRULES  11
547
/* YYNSTATES -- Number of states.  */
548
#define YYNSTATES  15
549
550
0
#define YYUNDEFTOK  2
551
67.7M
#define YYMAXUTOK   263
552
553
554
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
555
   as returned by yylex, with out-of-bounds checking.  */
556
#define YYTRANSLATE(YYX)                                                \
557
67.7M
  (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
558
559
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
560
   as returned by yylex.  */
561
static const yytype_int8 yytranslate[] =
562
{
563
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
564
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
565
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
566
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
567
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
568
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
569
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
570
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
571
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
572
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
573
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
574
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
575
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
576
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
577
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
578
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
579
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
580
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
581
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
582
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
583
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
584
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
585
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
586
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
587
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
588
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
589
       5,     6,     7,     8
590
};
591
592
#if YYDEBUG
593
  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
594
static const yytype_uint8 yyrline[] =
595
{
596
       0,   122,   122,   124,   125,   126,   128,   130,   132,   136,
597
     139,   147
598
};
599
#endif
600
601
#if YYDEBUG || YYERROR_VERBOSE || 1
602
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
603
   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
604
static const char *const yytname[] =
605
{
606
  "\"end of file\"", "error", "$undefined", "\"string\"", "\"number\"",
607
  "\"keyword\"", "\"[\"", "\"]\"", "ERROR", "$accept", "input", "list",
608
  "keyvalue", "key", "num", "string", YY_NULLPTR
609
};
610
#endif
611
612
# ifdef YYPRINT
613
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
614
   (internal) symbol number NUM (which must be that of a token).  */
615
static const yytype_int16 yytoknum[] =
616
{
617
       0,   256,   257,   258,   259,   260,   261,   262,   263
618
};
619
# endif
620
621
152M
#define YYPACT_NINF (-4)
622
623
#define yypact_value_is_default(Yyn) \
624
152M
  ((Yyn) == YYPACT_NINF)
625
626
#define YYTABLE_NINF (-1)
627
628
#define yytable_value_is_error(Yyn) \
629
0
  0
630
631
  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
632
     STATE-NUM.  */
633
static const yytype_int8 yypact[] =
634
{
635
       1,    -4,     3,     1,    -4,    -2,    -4,    -4,    -4,    -4,
636
       1,    -4,    -4,     0,    -4
637
};
638
639
  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
640
     Performed when YYTABLE does not specify something else to do.  Zero
641
     means the default is an error.  */
642
static const yytype_int8 yydefact[] =
643
{
644
       3,     9,     0,     2,     4,     0,     1,     5,    11,    10,
645
       3,     6,     7,     0,     8
646
};
647
648
  /* YYPGOTO[NTERM-NUM].  */
649
static const yytype_int8 yypgoto[] =
650
{
651
      -4,    -4,    -1,    -3,    -4,    -4,    -4
652
};
653
654
  /* YYDEFGOTO[NTERM-NUM].  */
655
static const yytype_int8 yydefgoto[] =
656
{
657
      -1,     2,     3,     4,     5,    11,    12
658
};
659
660
  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
661
     positive, shift that token.  If negative, reduce the rule whose
662
     number is the opposite.  If YYTABLE_NINF, syntax error.  */
663
static const yytype_int8 yytable[] =
664
{
665
       7,     8,     9,     6,    10,     1,     1,    14,     0,    13,
666
       7
667
};
668
669
static const yytype_int8 yycheck[] =
670
{
671
       3,     3,     4,     0,     6,     5,     5,     7,    -1,    10,
672
      13
673
};
674
675
  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
676
     symbol of state STATE-NUM.  */
677
static const yytype_int8 yystos[] =
678
{
679
       0,     5,    10,    11,    12,    13,     0,    12,     3,     4,
680
       6,    14,    15,    11,     7
681
};
682
683
  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
684
static const yytype_int8 yyr1[] =
685
{
686
       0,     9,    10,    11,    11,    11,    12,    12,    12,    13,
687
      14,    15
688
};
689
690
  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
691
static const yytype_int8 yyr2[] =
692
{
693
       0,     2,     1,     0,     1,     2,     2,     2,     4,     1,
694
       1,     1
695
};
696
697
698
#define yyerrok         (yyerrstatus = 0)
699
#define yyclearin       (yychar = YYEMPTY)
700
128M
#define YYEMPTY         (-2)
701
67.8M
#define YYEOF           0
702
703
17.9k
#define YYACCEPT        goto yyacceptlab
704
672
#define YYABORT         goto yyabortlab
705
0
#define YYERROR         goto yyerrorlab
706
707
708
#define YYRECOVERING()  (!!yyerrstatus)
709
710
#define YYBACKUP(Token, Value)                                    \
711
  do                                                              \
712
    if (yychar == YYEMPTY)                                        \
713
      {                                                           \
714
        yychar = (Token);                                         \
715
        yylval = (Value);                                         \
716
        YYPOPSTACK (yylen);                                       \
717
        yystate = *yyssp;                                         \
718
        goto yybackup;                                            \
719
      }                                                           \
720
    else                                                          \
721
      {                                                           \
722
        yyerror (&yylloc, context, YY_("syntax error: cannot back up")); \
723
        YYERROR;                                                  \
724
      }                                                           \
725
  while (0)
726
727
/* Error token number */
728
12.5k
#define YYTERROR        1
729
#define YYERRCODE       256
730
731
732
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
733
   If N is 0, then set CURRENT to the empty location which ends
734
   the previous symbol: RHS[0] (always defined).  */
735
736
#ifndef YYLLOC_DEFAULT
737
# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
738
92.6M
    do                                                                  \
739
92.6M
      if (N)                                                            \
740
92.6M
        {                                                               \
741
85.1M
          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
742
85.1M
          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
743
85.1M
          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
744
85.1M
          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
745
85.1M
        }                                                               \
746
92.6M
      else                                                              \
747
92.6M
        {                                                               \
748
7.54M
          (Current).first_line   = (Current).last_line   =              \
749
7.54M
            YYRHSLOC (Rhs, 0).last_line;                                \
750
7.54M
          (Current).first_column = (Current).last_column =              \
751
7.54M
            YYRHSLOC (Rhs, 0).last_column;                              \
752
7.54M
        }                                                               \
753
92.6M
    while (0)
754
#endif
755
756
355M
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
757
758
759
/* Enable debugging if requested.  */
760
#if YYDEBUG
761
762
# ifndef YYFPRINTF
763
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
764
#  define YYFPRINTF fprintf
765
# endif
766
767
# define YYDPRINTF(Args)                        \
768
do {                                            \
769
  if (yydebug)                                  \
770
    YYFPRINTF Args;                             \
771
} while (0)
772
773
774
/* YY_LOCATION_PRINT -- Print the location on the stream.
775
   This macro was not mandated originally: define only if we know
776
   we won't break user code: when these are the locations we know.  */
777
778
#ifndef YY_LOCATION_PRINT
779
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
780
781
/* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
782
783
YY_ATTRIBUTE_UNUSED
784
static int
785
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
786
{
787
  int res = 0;
788
  int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
789
  if (0 <= yylocp->first_line)
790
    {
791
      res += YYFPRINTF (yyo, "%d", yylocp->first_line);
792
      if (0 <= yylocp->first_column)
793
        res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
794
    }
795
  if (0 <= yylocp->last_line)
796
    {
797
      if (yylocp->first_line < yylocp->last_line)
798
        {
799
          res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
800
          if (0 <= end_col)
801
            res += YYFPRINTF (yyo, ".%d", end_col);
802
        }
803
      else if (0 <= end_col && yylocp->first_column < end_col)
804
        res += YYFPRINTF (yyo, "-%d", end_col);
805
    }
806
  return res;
807
 }
808
809
#  define YY_LOCATION_PRINT(File, Loc)          \
810
  yy_location_print_ (File, &(Loc))
811
812
# else
813
#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
814
# endif
815
#endif
816
817
818
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
819
do {                                                                      \
820
  if (yydebug)                                                            \
821
    {                                                                     \
822
      YYFPRINTF (stderr, "%s ", Title);                                   \
823
      yy_symbol_print (stderr,                                            \
824
                  Type, Value, Location, context); \
825
      YYFPRINTF (stderr, "\n");                                           \
826
    }                                                                     \
827
} while (0)
828
829
830
/*-----------------------------------.
831
| Print this symbol's value on YYO.  |
832
`-----------------------------------*/
833
834
static void
835
yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, igraph_i_gml_parsedata_t* context)
836
{
837
  FILE *yyoutput = yyo;
838
  YYUSE (yyoutput);
839
  YYUSE (yylocationp);
840
  YYUSE (context);
841
  if (!yyvaluep)
842
    return;
843
# ifdef YYPRINT
844
  if (yytype < YYNTOKENS)
845
    YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
846
# endif
847
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
848
  YYUSE (yytype);
849
  YY_IGNORE_MAYBE_UNINITIALIZED_END
850
}
851
852
853
/*---------------------------.
854
| Print this symbol on YYO.  |
855
`---------------------------*/
856
857
static void
858
yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, igraph_i_gml_parsedata_t* context)
859
{
860
  YYFPRINTF (yyo, "%s %s (",
861
             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
862
863
  YY_LOCATION_PRINT (yyo, *yylocationp);
864
  YYFPRINTF (yyo, ": ");
865
  yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp, context);
866
  YYFPRINTF (yyo, ")");
867
}
868
869
/*------------------------------------------------------------------.
870
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
871
| TOP (included).                                                   |
872
`------------------------------------------------------------------*/
873
874
static void
875
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
876
{
877
  YYFPRINTF (stderr, "Stack now");
878
  for (; yybottom <= yytop; yybottom++)
879
    {
880
      int yybot = *yybottom;
881
      YYFPRINTF (stderr, " %d", yybot);
882
    }
883
  YYFPRINTF (stderr, "\n");
884
}
885
886
# define YY_STACK_PRINT(Bottom, Top)                            \
887
do {                                                            \
888
  if (yydebug)                                                  \
889
    yy_stack_print ((Bottom), (Top));                           \
890
} while (0)
891
892
893
/*------------------------------------------------.
894
| Report that the YYRULE is going to be reduced.  |
895
`------------------------------------------------*/
896
897
static void
898
yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, igraph_i_gml_parsedata_t* context)
899
{
900
  int yylno = yyrline[yyrule];
901
  int yynrhs = yyr2[yyrule];
902
  int yyi;
903
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
904
             yyrule - 1, yylno);
905
  /* The symbols being reduced.  */
906
  for (yyi = 0; yyi < yynrhs; yyi++)
907
    {
908
      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
909
      yy_symbol_print (stderr,
910
                       yystos[+yyssp[yyi + 1 - yynrhs]],
911
                       &yyvsp[(yyi + 1) - (yynrhs)]
912
                       , &(yylsp[(yyi + 1) - (yynrhs)])                       , context);
913
      YYFPRINTF (stderr, "\n");
914
    }
915
}
916
917
# define YY_REDUCE_PRINT(Rule)          \
918
do {                                    \
919
  if (yydebug)                          \
920
    yy_reduce_print (yyssp, yyvsp, yylsp, Rule, context); \
921
} while (0)
922
923
/* Nonzero means print parse trace.  It is left uninitialized so that
924
   multiple parsers can coexist.  */
925
int yydebug;
926
#else /* !YYDEBUG */
927
# define YYDPRINTF(Args)
928
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
929
# define YY_STACK_PRINT(Bottom, Top)
930
# define YY_REDUCE_PRINT(Rule)
931
#endif /* !YYDEBUG */
932
933
934
/* YYINITDEPTH -- initial size of the parser's stacks.  */
935
#ifndef YYINITDEPTH
936
18.6k
# define YYINITDEPTH 200
937
#endif
938
939
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
940
   if the built-in stack extension method is used).
941
942
   Do not make this value too large; the results are undefined if
943
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
944
   evaluated with infinite-precision integer arithmetic.  */
945
946
#ifndef YYMAXDEPTH
947
0
# define YYMAXDEPTH 10000
948
#endif
949
950
951
#if YYERROR_VERBOSE
952
953
# ifndef yystrlen
954
#  if defined __GLIBC__ && defined _STRING_H
955
826
#   define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
956
#  else
957
/* Return the length of YYSTR.  */
958
static YYPTRDIFF_T
959
yystrlen (const char *yystr)
960
{
961
  YYPTRDIFF_T yylen;
962
  for (yylen = 0; yystr[yylen]; yylen++)
963
    continue;
964
  return yylen;
965
}
966
#  endif
967
# endif
968
969
# ifndef yystpcpy
970
#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
971
#   define yystpcpy stpcpy
972
#  else
973
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
974
   YYDEST.  */
975
static char *
976
yystpcpy (char *yydest, const char *yysrc)
977
230
{
978
230
  char *yyd = yydest;
979
230
  const char *yys = yysrc;
980
981
1.38k
  while ((*yyd++ = *yys++) != '\0')
982
1.15k
    continue;
983
984
230
  return yyd - 1;
985
230
}
986
#  endif
987
# endif
988
989
# ifndef yytnamerr
990
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
991
   quotes and backslashes, so that it's suitable for yyerror.  The
992
   heuristic is that double-quoting is unnecessary unless the string
993
   contains an apostrophe, a comma, or backslash (other than
994
   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
995
   null, do not copy; instead, return the length of what the result
996
   would have been.  */
997
static YYPTRDIFF_T
998
yytnamerr (char *yyres, const char *yystr)
999
3.64k
{
1000
3.64k
  if (*yystr == '"')
1001
3.18k
    {
1002
3.18k
      YYPTRDIFF_T yyn = 0;
1003
3.18k
      char const *yyp = yystr;
1004
1005
3.18k
      for (;;)
1006
22.7k
        switch (*++yyp)
1007
22.7k
          {
1008
0
          case '\'':
1009
0
          case ',':
1010
0
            goto do_not_strip_quotes;
1011
1012
0
          case '\\':
1013
0
            if (*++yyp != '\\')
1014
0
              goto do_not_strip_quotes;
1015
0
            else
1016
0
              goto append;
1017
1018
0
          append:
1019
19.5k
          default:
1020
19.5k
            if (yyres)
1021
9.78k
              yyres[yyn] = *yyp;
1022
19.5k
            yyn++;
1023
19.5k
            break;
1024
1025
3.18k
          case '"':
1026
3.18k
            if (yyres)
1027
1.59k
              yyres[yyn] = '\0';
1028
3.18k
            return yyn;
1029
22.7k
          }
1030
0
    do_not_strip_quotes: ;
1031
0
    }
1032
1033
460
  if (yyres)
1034
230
    return yystpcpy (yyres, yystr) - yyres;
1035
230
  else
1036
230
    return yystrlen (yystr);
1037
460
}
1038
# endif
1039
1040
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1041
   about the unexpected token YYTOKEN for the state stack whose top is
1042
   YYSSP.
1043
1044
   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
1045
   not large enough to hold the message.  In that case, also set
1046
   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
1047
   required number of bytes is too large to store.  */
1048
static int
1049
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1050
                yy_state_t *yyssp, int yytoken)
1051
596
{
1052
596
  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1053
  /* Internationalized format string. */
1054
596
  const char *yyformat = YY_NULLPTR;
1055
  /* Arguments of yyformat: reported tokens (one for the "unexpected",
1056
     one per "expected"). */
1057
596
  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1058
  /* Actual size of YYARG. */
1059
596
  int yycount = 0;
1060
  /* Cumulated lengths of YYARG.  */
1061
596
  YYPTRDIFF_T yysize = 0;
1062
1063
  /* There are many possibilities here to consider:
1064
     - If this state is a consistent state with a default action, then
1065
       the only way this function was invoked is if the default action
1066
       is an error action.  In that case, don't check for expected
1067
       tokens because there are none.
1068
     - The only way there can be no lookahead present (in yychar) is if
1069
       this state is a consistent state with a default action.  Thus,
1070
       detecting the absence of a lookahead is sufficient to determine
1071
       that there is no unexpected or expected token to report.  In that
1072
       case, just report a simple "syntax error".
1073
     - Don't assume there isn't a lookahead just because this state is a
1074
       consistent state with a default action.  There might have been a
1075
       previous inconsistent state, consistent state with a non-default
1076
       action, or user semantic action that manipulated yychar.
1077
     - Of course, the expected token list depends on states to have
1078
       correct lookahead information, and it depends on the parser not
1079
       to perform extra reductions after fetching a lookahead from the
1080
       scanner and before detecting a syntax error.  Thus, state merging
1081
       (from LALR or IELR) and default reductions corrupt the expected
1082
       token list.  However, the list is correct for canonical LR with
1083
       one exception: it will still contain any token that will not be
1084
       accepted due to an error action in a later state.
1085
  */
1086
596
  if (yytoken != YYEMPTY)
1087
596
    {
1088
596
      int yyn = yypact[+*yyssp];
1089
596
      YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1090
596
      yysize = yysize0;
1091
596
      yyarg[yycount++] = yytname[yytoken];
1092
596
      if (!yypact_value_is_default (yyn))
1093
596
        {
1094
          /* Start YYX at -YYN if negative to avoid negative indexes in
1095
             YYCHECK.  In other words, skip the first -YYN actions for
1096
             this state because they are default actions.  */
1097
596
          int yyxbegin = yyn < 0 ? -yyn : 0;
1098
          /* Stay within bounds of both yycheck and yytname.  */
1099
596
          int yychecklim = YYLAST - yyn + 1;
1100
596
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1101
596
          int yyx;
1102
1103
5.21k
          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1104
4.61k
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1105
0
                && !yytable_value_is_error (yytable[yyx + yyn]))
1106
1.22k
              {
1107
1.22k
                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1108
0
                  {
1109
0
                    yycount = 1;
1110
0
                    yysize = yysize0;
1111
0
                    break;
1112
0
                  }
1113
1.22k
                yyarg[yycount++] = yytname[yyx];
1114
1.22k
                {
1115
1.22k
                  YYPTRDIFF_T yysize1
1116
1.22k
                    = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1117
1.22k
                  if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1118
1.22k
                    yysize = yysize1;
1119
0
                  else
1120
0
                    return 2;
1121
1.22k
                }
1122
1.22k
              }
1123
596
        }
1124
596
    }
1125
1126
596
  switch (yycount)
1127
596
    {
1128
0
# define YYCASE_(N, S)                      \
1129
596
      case N:                               \
1130
596
        yyformat = S;                       \
1131
596
      break
1132
0
    default: /* Avoid compiler warnings. */
1133
0
      YYCASE_(0, YY_("syntax error"));
1134
0
      YYCASE_(1, YY_("syntax error, unexpected %s"));
1135
227
      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1136
109
      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1137
260
      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1138
596
      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1139
596
# undef YYCASE_
1140
596
    }
1141
1142
596
  {
1143
    /* Don't count the "%s"s in the final size, but reserve room for
1144
       the terminator.  */
1145
596
    YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
1146
596
    if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1147
596
      yysize = yysize1;
1148
0
    else
1149
0
      return 2;
1150
596
  }
1151
1152
596
  if (*yymsg_alloc < yysize)
1153
0
    {
1154
0
      *yymsg_alloc = 2 * yysize;
1155
0
      if (! (yysize <= *yymsg_alloc
1156
0
             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1157
0
        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1158
0
      return 1;
1159
0
    }
1160
1161
  /* Avoid sprintf, as that infringes on the user's name space.
1162
     Don't have undefined behavior even if the translation
1163
     produced a string with the wrong number of "%s"s.  */
1164
596
  {
1165
596
    char *yyp = *yymsg;
1166
596
    int yyi = 0;
1167
26.9k
    while ((*yyp = *yyformat) != '\0')
1168
26.3k
      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1169
1.82k
        {
1170
1.82k
          yyp += yytnamerr (yyp, yyarg[yyi++]);
1171
1.82k
          yyformat += 2;
1172
1.82k
        }
1173
24.5k
      else
1174
24.5k
        {
1175
24.5k
          ++yyp;
1176
24.5k
          ++yyformat;
1177
24.5k
        }
1178
596
  }
1179
596
  return 0;
1180
596
}
1181
#endif /* YYERROR_VERBOSE */
1182
1183
/*-----------------------------------------------.
1184
| Release the memory associated to this symbol.  |
1185
`-----------------------------------------------*/
1186
1187
static void
1188
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, igraph_i_gml_parsedata_t* context)
1189
40.7k
{
1190
40.7k
  YYUSE (yyvaluep);
1191
40.7k
  YYUSE (yylocationp);
1192
40.7k
  YYUSE (context);
1193
40.7k
  if (!yymsg)
1194
0
    yymsg = "Deleting";
1195
40.7k
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1196
1197
40.7k
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1198
40.7k
  switch (yytype)
1199
40.7k
    {
1200
884
    case 11: /* list  */
1201
884
#line 118 "/src/igraph/src/io/gml-parser.y"
1202
884
            { igraph_gml_tree_destroy(((*yyvaluep).tree)); }
1203
884
#line 1204 "/src/igraph/build/src/io/parsers/gml-parser.c"
1204
884
        break;
1205
1206
0
    case 12: /* keyvalue  */
1207
0
#line 118 "/src/igraph/src/io/gml-parser.y"
1208
0
            { igraph_gml_tree_destroy(((*yyvaluep).tree)); }
1209
0
#line 1210 "/src/igraph/build/src/io/parsers/gml-parser.c"
1210
0
        break;
1211
1212
1.76k
    case 13: /* key  */
1213
1.76k
#line 117 "/src/igraph/src/io/gml-parser.y"
1214
1.76k
            { free(((*yyvaluep).str)); }
1215
1.76k
#line 1216 "/src/igraph/build/src/io/parsers/gml-parser.c"
1216
1.76k
        break;
1217
1218
0
    case 15: /* string  */
1219
0
#line 117 "/src/igraph/src/io/gml-parser.y"
1220
0
            { free(((*yyvaluep).str)); }
1221
0
#line 1222 "/src/igraph/build/src/io/parsers/gml-parser.c"
1222
0
        break;
1223
1224
38.1k
      default:
1225
38.1k
        break;
1226
40.7k
    }
1227
40.7k
  YY_IGNORE_MAYBE_UNINITIALIZED_END
1228
40.7k
}
1229
1230
1231
1232
1233
/*----------.
1234
| yyparse.  |
1235
`----------*/
1236
1237
int
1238
yyparse (igraph_i_gml_parsedata_t* context)
1239
18.6k
{
1240
/* The lookahead symbol.  */
1241
18.6k
int yychar;
1242
1243
1244
/* The semantic value of the lookahead symbol.  */
1245
/* Default value used for initialization, for pacifying older GCCs
1246
   or non-GCC compilers.  */
1247
18.6k
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1248
18.6k
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1249
1250
/* Location data for the lookahead symbol.  */
1251
18.6k
static YYLTYPE yyloc_default
1252
18.6k
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1253
18.6k
  = { 1, 1, 1, 1 }
1254
18.6k
# endif
1255
18.6k
;
1256
18.6k
YYLTYPE yylloc = yyloc_default;
1257
1258
    /* Number of syntax errors so far.  */
1259
18.6k
    int yynerrs;
1260
1261
18.6k
    yy_state_fast_t yystate;
1262
    /* Number of tokens to shift before error messages enabled.  */
1263
18.6k
    int yyerrstatus;
1264
1265
    /* The stacks and their tools:
1266
       'yyss': related to states.
1267
       'yyvs': related to semantic values.
1268
       'yyls': related to locations.
1269
1270
       Refer to the stacks through separate pointers, to allow yyoverflow
1271
       to reallocate them elsewhere.  */
1272
1273
    /* The state stack.  */
1274
18.6k
    yy_state_t yyssa[YYINITDEPTH];
1275
18.6k
    yy_state_t *yyss;
1276
18.6k
    yy_state_t *yyssp;
1277
1278
    /* The semantic value stack.  */
1279
18.6k
    YYSTYPE yyvsa[YYINITDEPTH];
1280
18.6k
    YYSTYPE *yyvs;
1281
18.6k
    YYSTYPE *yyvsp;
1282
1283
    /* The location stack.  */
1284
18.6k
    YYLTYPE yylsa[YYINITDEPTH];
1285
18.6k
    YYLTYPE *yyls;
1286
18.6k
    YYLTYPE *yylsp;
1287
1288
    /* The locations where the error started and ended.  */
1289
18.6k
    YYLTYPE yyerror_range[3];
1290
1291
18.6k
    YYPTRDIFF_T yystacksize;
1292
1293
18.6k
  int yyn;
1294
18.6k
  int yyresult;
1295
  /* Lookahead token as an internal (translated) token number.  */
1296
18.6k
  int yytoken = 0;
1297
  /* The variables used to return semantic value and location from the
1298
     action routines.  */
1299
18.6k
  YYSTYPE yyval;
1300
18.6k
  YYLTYPE yyloc;
1301
1302
18.6k
#if YYERROR_VERBOSE
1303
  /* Buffer for error messages, and its allocated size.  */
1304
18.6k
  char yymsgbuf[128];
1305
18.6k
  char *yymsg = yymsgbuf;
1306
18.6k
  YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1307
18.6k
#endif
1308
1309
92.7M
#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1310
1311
  /* The number of symbols on the RHS of the reduced rule.
1312
     Keep to zero when no symbol should be popped.  */
1313
18.6k
  int yylen = 0;
1314
1315
18.6k
  yyssp = yyss = yyssa;
1316
18.6k
  yyvsp = yyvs = yyvsa;
1317
18.6k
  yylsp = yyls = yylsa;
1318
18.6k
  yystacksize = YYINITDEPTH;
1319
1320
18.6k
  YYDPRINTF ((stderr, "Starting parse\n"));
1321
1322
18.6k
  yystate = 0;
1323
18.6k
  yyerrstatus = 0;
1324
18.6k
  yynerrs = 0;
1325
18.6k
  yychar = YYEMPTY; /* Cause a token to be read.  */
1326
18.6k
  yylsp[0] = yylloc;
1327
18.6k
  goto yysetstate;
1328
1329
1330
/*------------------------------------------------------------.
1331
| yynewstate -- push a new state, which is found in yystate.  |
1332
`------------------------------------------------------------*/
1333
152M
yynewstate:
1334
  /* In all cases, when you get here, the value and location stacks
1335
     have just been pushed.  So pushing a state here evens the stacks.  */
1336
152M
  yyssp++;
1337
1338
1339
/*--------------------------------------------------------------------.
1340
| yysetstate -- set current state (the top of the stack) to yystate.  |
1341
`--------------------------------------------------------------------*/
1342
152M
yysetstate:
1343
152M
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1344
152M
  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1345
152M
  YY_IGNORE_USELESS_CAST_BEGIN
1346
152M
  *yyssp = YY_CAST (yy_state_t, yystate);
1347
152M
  YY_IGNORE_USELESS_CAST_END
1348
1349
152M
  if (yyss + yystacksize - 1 <= yyssp)
1350
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1351
    goto yyexhaustedlab;
1352
#else
1353
0
    {
1354
      /* Get the current used size of the three stacks, in elements.  */
1355
0
      YYPTRDIFF_T yysize = yyssp - yyss + 1;
1356
1357
# if defined yyoverflow
1358
      {
1359
        /* Give user a chance to reallocate the stack.  Use copies of
1360
           these so that the &'s don't force the real ones into
1361
           memory.  */
1362
        yy_state_t *yyss1 = yyss;
1363
        YYSTYPE *yyvs1 = yyvs;
1364
        YYLTYPE *yyls1 = yyls;
1365
1366
        /* Each stack pointer address is followed by the size of the
1367
           data in use in that stack, in bytes.  This used to be a
1368
           conditional around just the two extra args, but that might
1369
           be undefined if yyoverflow is a macro.  */
1370
        yyoverflow (YY_("memory exhausted"),
1371
                    &yyss1, yysize * YYSIZEOF (*yyssp),
1372
                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
1373
                    &yyls1, yysize * YYSIZEOF (*yylsp),
1374
                    &yystacksize);
1375
        yyss = yyss1;
1376
        yyvs = yyvs1;
1377
        yyls = yyls1;
1378
      }
1379
# else /* defined YYSTACK_RELOCATE */
1380
      /* Extend the stack our own way.  */
1381
0
      if (YYMAXDEPTH <= yystacksize)
1382
0
        goto yyexhaustedlab;
1383
0
      yystacksize *= 2;
1384
0
      if (YYMAXDEPTH < yystacksize)
1385
0
        yystacksize = YYMAXDEPTH;
1386
1387
0
      {
1388
0
        yy_state_t *yyss1 = yyss;
1389
0
        union yyalloc *yyptr =
1390
0
          YY_CAST (union yyalloc *,
1391
0
                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1392
0
        if (! yyptr)
1393
0
          goto yyexhaustedlab;
1394
0
        YYSTACK_RELOCATE (yyss_alloc, yyss);
1395
0
        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1396
0
        YYSTACK_RELOCATE (yyls_alloc, yyls);
1397
0
# undef YYSTACK_RELOCATE
1398
0
        if (yyss1 != yyssa)
1399
0
          YYSTACK_FREE (yyss1);
1400
0
      }
1401
0
# endif
1402
1403
0
      yyssp = yyss + yysize - 1;
1404
0
      yyvsp = yyvs + yysize - 1;
1405
0
      yylsp = yyls + yysize - 1;
1406
1407
0
      YY_IGNORE_USELESS_CAST_BEGIN
1408
0
      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1409
0
                  YY_CAST (long, yystacksize)));
1410
0
      YY_IGNORE_USELESS_CAST_END
1411
1412
0
      if (yyss + yystacksize - 1 <= yyssp)
1413
0
        YYABORT;
1414
0
    }
1415
152M
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1416
1417
152M
  if (yystate == YYFINAL)
1418
17.9k
    YYACCEPT;
1419
1420
152M
  goto yybackup;
1421
1422
1423
/*-----------.
1424
| yybackup.  |
1425
`-----------*/
1426
152M
yybackup:
1427
  /* Do appropriate processing given the current state.  Read a
1428
     lookahead token if we need one and don't already have one.  */
1429
1430
  /* First try to decide what to do without reference to lookahead token.  */
1431
152M
  yyn = yypact[yystate];
1432
152M
  if (yypact_value_is_default (yyn))
1433
85.1M
    goto yydefault;
1434
1435
  /* Not known => get a lookahead token if don't already have one.  */
1436
1437
  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1438
67.8M
  if (yychar == YYEMPTY)
1439
60.2M
    {
1440
60.2M
      YYDPRINTF ((stderr, "Reading a token: "));
1441
60.2M
      yychar = yylex (&yylval, &yylloc, scanner);
1442
60.2M
    }
1443
1444
67.8M
  if (yychar <= YYEOF)
1445
36.3k
    {
1446
36.3k
      yychar = yytoken = YYEOF;
1447
36.3k
      YYDPRINTF ((stderr, "Now at end of input.\n"));
1448
36.3k
    }
1449
67.7M
  else
1450
67.7M
    {
1451
67.7M
      yytoken = YYTRANSLATE (yychar);
1452
67.7M
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1453
67.7M
    }
1454
1455
  /* If the proper action on seeing token YYTOKEN is to reduce or to
1456
     detect an error, take that action.  */
1457
67.8M
  yyn += yytoken;
1458
67.8M
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1459
7.56M
    goto yydefault;
1460
60.2M
  yyn = yytable[yyn];
1461
60.2M
  if (yyn <= 0)
1462
0
    {
1463
0
      if (yytable_value_is_error (yyn))
1464
0
        goto yyerrlab;
1465
0
      yyn = -yyn;
1466
0
      goto yyreduce;
1467
0
    }
1468
1469
  /* Count tokens shifted since error; after three, turn off error
1470
     status.  */
1471
60.2M
  if (yyerrstatus)
1472
0
    yyerrstatus--;
1473
1474
  /* Shift the lookahead token.  */
1475
60.2M
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1476
60.2M
  yystate = yyn;
1477
60.2M
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1478
60.2M
  *++yyvsp = yylval;
1479
60.2M
  YY_IGNORE_MAYBE_UNINITIALIZED_END
1480
60.2M
  *++yylsp = yylloc;
1481
1482
  /* Discard the shifted token.  */
1483
60.2M
  yychar = YYEMPTY;
1484
60.2M
  goto yynewstate;
1485
1486
1487
/*-----------------------------------------------------------.
1488
| yydefault -- do the default action for the current state.  |
1489
`-----------------------------------------------------------*/
1490
92.6M
yydefault:
1491
92.6M
  yyn = yydefact[yystate];
1492
92.6M
  if (yyn == 0)
1493
596
    goto yyerrlab;
1494
92.6M
  goto yyreduce;
1495
1496
1497
/*-----------------------------.
1498
| yyreduce -- do a reduction.  |
1499
`-----------------------------*/
1500
92.6M
yyreduce:
1501
  /* yyn is the number of a rule to reduce with.  */
1502
92.6M
  yylen = yyr2[yyn];
1503
1504
  /* If YYLEN is nonzero, implement the default value of the action:
1505
     '$$ = $1'.
1506
1507
     Otherwise, the following line sets YYVAL to garbage.
1508
     This behavior is undocumented and Bison
1509
     users should not rely upon it.  Assigning to YYVAL
1510
     unconditionally makes the parser a bit smaller, and it avoids a
1511
     GCC warning that YYVAL may be used uninitialized.  */
1512
92.6M
  yyval = yyvsp[1-yylen];
1513
1514
  /* Default location. */
1515
92.6M
  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1516
92.6M
  yyerror_range[1] = yyloc;
1517
92.6M
  YY_REDUCE_PRINT (yyn);
1518
92.6M
  switch (yyn)
1519
92.6M
    {
1520
18.1k
  case 2:
1521
18.1k
#line 122 "/src/igraph/src/io/gml-parser.y"
1522
18.1k
                   { context->tree=(yyvsp[0].tree); }
1523
18.1k
#line 1524 "/src/igraph/build/src/io/parsers/gml-parser.c"
1524
18.1k
    break;
1525
1526
7.54M
  case 3:
1527
7.54M
#line 124 "/src/igraph/src/io/gml-parser.y"
1528
7.54M
                      { IGRAPH_YY_CHECK(igraph_i_gml_make_empty(&(yyval.tree))); }
1529
7.54M
#line 1530 "/src/igraph/build/src/io/parsers/gml-parser.c"
1530
7.54M
    break;
1531
1532
7.54M
  case 4:
1533
4.25M
#line 125 "/src/igraph/src/io/gml-parser.y"
1534
4.25M
                      { (yyval.tree)=(yyvsp[0].tree); }
1535
4.25M
#line 1536 "/src/igraph/build/src/io/parsers/gml-parser.c"
1536
4.25M
    break;
1537
1538
19.9M
  case 5:
1539
19.9M
#line 126 "/src/igraph/src/io/gml-parser.y"
1540
19.9M
                      { IGRAPH_YY_CHECK(igraph_i_gml_merge((yyvsp[-1].tree), (yyvsp[0].tree))); (yyval.tree) = (yyvsp[-1].tree); }
1541
0
#line 1542 "/src/igraph/build/src/io/parsers/gml-parser.c"
1542
0
    break;
1543
1544
8.55M
  case 6:
1545
8.55M
#line 129 "/src/igraph/src/io/gml-parser.y"
1546
8.55M
            { IGRAPH_YY_CHECK(igraph_i_gml_make_numeric((yyvsp[-1].str), (yylsp[-1]).first_line, (yyvsp[0].real), &(yyval.tree))); }
1547
8.55M
#line 1548 "/src/igraph/build/src/io/parsers/gml-parser.c"
1548
8.55M
    break;
1549
1550
8.55M
  case 7:
1551
3.89M
#line 131 "/src/igraph/src/io/gml-parser.y"
1552
3.89M
            { IGRAPH_YY_CHECK(igraph_i_gml_make_string((yyvsp[-1].str), (yylsp[-1]).first_line, (yyvsp[0].str), &(yyval.tree))); }
1553
3.89M
#line 1554 "/src/igraph/build/src/io/parsers/gml-parser.c"
1554
3.89M
    break;
1555
1556
11.7M
  case 8:
1557
11.7M
#line 133 "/src/igraph/src/io/gml-parser.y"
1558
11.7M
            { IGRAPH_YY_CHECK(igraph_i_gml_make_list((yyvsp[-3].str), (yylsp[-3]).first_line, (yyvsp[-1].tree), &(yyval.tree))); }
1559
11.7M
#line 1560 "/src/igraph/build/src/io/parsers/gml-parser.c"
1560
11.7M
    break;
1561
1562
24.2M
  case 9:
1563
24.2M
#line 136 "/src/igraph/src/io/gml-parser.y"
1564
24.2M
             { IGRAPH_YY_CHECK(igraph_i_gml_get_keyword(igraph_gml_yyget_text(scanner),
1565
24.2M
                               igraph_gml_yyget_leng(scanner),
1566
24.2M
                               &(yyval.str))); }
1567
24.2M
#line 1568 "/src/igraph/build/src/io/parsers/gml-parser.c"
1568
24.2M
    break;
1569
1570
24.2M
  case 10:
1571
8.55M
#line 139 "/src/igraph/src/io/gml-parser.y"
1572
8.55M
          {
1573
8.55M
    igraph_real_t val;
1574
8.55M
    IGRAPH_YY_CHECK(igraph_i_parse_real(igraph_gml_yyget_text(scanner),
1575
8.55M
                                        igraph_gml_yyget_leng(scanner),
1576
8.55M
                                        &val));
1577
8.55M
    (yyval.real)=val;
1578
8.55M
}
1579
0
#line 1580 "/src/igraph/build/src/io/parsers/gml-parser.c"
1580
0
    break;
1581
1582
3.89M
  case 11:
1583
3.89M
#line 147 "/src/igraph/src/io/gml-parser.y"
1584
3.89M
               { IGRAPH_YY_CHECK(igraph_i_gml_get_string(igraph_gml_yyget_text(scanner),
1585
3.89M
                                         igraph_gml_yyget_leng(scanner),
1586
3.89M
                                         &(yyval.str))); }
1587
3.89M
#line 1588 "/src/igraph/build/src/io/parsers/gml-parser.c"
1588
3.89M
    break;
1589
1590
1591
3.89M
#line 1592 "/src/igraph/build/src/io/parsers/gml-parser.c"
1592
1593
3.89M
      default: break;
1594
92.6M
    }
1595
  /* User semantic actions sometimes alter yychar, and that requires
1596
     that yytoken be updated with the new translation.  We take the
1597
     approach of translating immediately before every use of yytoken.
1598
     One alternative is translating here after every semantic action,
1599
     but that translation would be missed if the semantic action invokes
1600
     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1601
     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1602
     incorrect destructor might then be invoked immediately.  In the
1603
     case of YYERROR or YYBACKUP, subsequent parser actions might lead
1604
     to an incorrect destructor call or verbose syntax error message
1605
     before the lookahead is translated.  */
1606
92.6M
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1607
1608
92.6M
  YYPOPSTACK (yylen);
1609
92.6M
  yylen = 0;
1610
92.6M
  YY_STACK_PRINT (yyss, yyssp);
1611
1612
92.6M
  *++yyvsp = yyval;
1613
92.6M
  *++yylsp = yyloc;
1614
1615
  /* Now 'shift' the result of the reduction.  Determine what state
1616
     that goes to, based on the state we popped back to and the rule
1617
     number reduced by.  */
1618
92.6M
  {
1619
92.6M
    const int yylhs = yyr1[yyn] - YYNTOKENS;
1620
92.6M
    const int yyi = yypgoto[yylhs] + *yyssp;
1621
92.6M
    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1622
92.6M
               ? yytable[yyi]
1623
92.6M
               : yydefgoto[yylhs]);
1624
92.6M
  }
1625
1626
92.6M
  goto yynewstate;
1627
1628
1629
/*--------------------------------------.
1630
| yyerrlab -- here on detecting error.  |
1631
`--------------------------------------*/
1632
596
yyerrlab:
1633
  /* Make sure we have latest lookahead translation.  See comments at
1634
     user semantic actions for why this is necessary.  */
1635
596
  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1636
1637
  /* If not already recovering from an error, report this error.  */
1638
596
  if (!yyerrstatus)
1639
596
    {
1640
596
      ++yynerrs;
1641
#if ! YYERROR_VERBOSE
1642
      yyerror (&yylloc, context, YY_("syntax error"));
1643
#else
1644
596
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1645
596
                                        yyssp, yytoken)
1646
596
      {
1647
596
        char const *yymsgp = YY_("syntax error");
1648
596
        int yysyntax_error_status;
1649
596
        yysyntax_error_status = YYSYNTAX_ERROR;
1650
596
        if (yysyntax_error_status == 0)
1651
596
          yymsgp = yymsg;
1652
0
        else if (yysyntax_error_status == 1)
1653
0
          {
1654
0
            if (yymsg != yymsgbuf)
1655
0
              YYSTACK_FREE (yymsg);
1656
0
            yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
1657
0
            if (!yymsg)
1658
0
              {
1659
0
                yymsg = yymsgbuf;
1660
0
                yymsg_alloc = sizeof yymsgbuf;
1661
0
                yysyntax_error_status = 2;
1662
0
              }
1663
0
            else
1664
0
              {
1665
0
                yysyntax_error_status = YYSYNTAX_ERROR;
1666
0
                yymsgp = yymsg;
1667
0
              }
1668
0
          }
1669
596
        yyerror (&yylloc, context, yymsgp);
1670
596
        if (yysyntax_error_status == 2)
1671
0
          goto yyexhaustedlab;
1672
596
      }
1673
596
# undef YYSYNTAX_ERROR
1674
596
#endif
1675
596
    }
1676
1677
596
  yyerror_range[1] = yylloc;
1678
1679
596
  if (yyerrstatus == 3)
1680
0
    {
1681
      /* If just tried and failed to reuse lookahead token after an
1682
         error, discard it.  */
1683
1684
0
      if (yychar <= YYEOF)
1685
0
        {
1686
          /* Return failure if at end of input.  */
1687
0
          if (yychar == YYEOF)
1688
0
            YYABORT;
1689
0
        }
1690
0
      else
1691
0
        {
1692
0
          yydestruct ("Error: discarding",
1693
0
                      yytoken, &yylval, &yylloc, context);
1694
0
          yychar = YYEMPTY;
1695
0
        }
1696
0
    }
1697
1698
  /* Else will try to reuse lookahead token after shifting the error
1699
     token.  */
1700
596
  goto yyerrlab1;
1701
1702
1703
/*---------------------------------------------------.
1704
| yyerrorlab -- error raised explicitly by YYERROR.  |
1705
`---------------------------------------------------*/
1706
596
yyerrorlab:
1707
  /* Pacify compilers when the user code never invokes YYERROR and the
1708
     label yyerrorlab therefore never appears in user code.  */
1709
0
  if (0)
1710
0
    YYERROR;
1711
1712
  /* Do not reclaim the symbols of the rule whose action triggered
1713
     this YYERROR.  */
1714
0
  YYPOPSTACK (yylen);
1715
0
  yylen = 0;
1716
0
  YY_STACK_PRINT (yyss, yyssp);
1717
0
  yystate = *yyssp;
1718
0
  goto yyerrlab1;
1719
1720
1721
/*-------------------------------------------------------------.
1722
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
1723
`-------------------------------------------------------------*/
1724
596
yyerrlab1:
1725
596
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1726
1727
596
  for (;;)
1728
4.03k
    {
1729
4.03k
      yyn = yypact[yystate];
1730
4.03k
      if (!yypact_value_is_default (yyn))
1731
4.03k
        {
1732
4.03k
          yyn += YYTERROR;
1733
4.03k
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1734
0
            {
1735
0
              yyn = yytable[yyn];
1736
0
              if (0 < yyn)
1737
0
                break;
1738
0
            }
1739
4.03k
        }
1740
1741
      /* Pop the current state because it cannot handle the error token.  */
1742
4.03k
      if (yyssp == yyss)
1743
596
        YYABORT;
1744
1745
3.43k
      yyerror_range[1] = *yylsp;
1746
3.43k
      yydestruct ("Error: popping",
1747
3.43k
                  yystos[yystate], yyvsp, yylsp, context);
1748
3.43k
      YYPOPSTACK (1);
1749
3.43k
      yystate = *yyssp;
1750
3.43k
      YY_STACK_PRINT (yyss, yyssp);
1751
3.43k
    }
1752
1753
0
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1754
0
  *++yyvsp = yylval;
1755
0
  YY_IGNORE_MAYBE_UNINITIALIZED_END
1756
1757
0
  yyerror_range[2] = yylloc;
1758
  /* Using YYLLOC is tempting, but would change the location of
1759
     the lookahead.  YYLOC is available though.  */
1760
0
  YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
1761
0
  *++yylsp = yyloc;
1762
1763
  /* Shift the error token.  */
1764
0
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1765
1766
0
  yystate = yyn;
1767
0
  goto yynewstate;
1768
1769
1770
/*-------------------------------------.
1771
| yyacceptlab -- YYACCEPT comes here.  |
1772
`-------------------------------------*/
1773
17.9k
yyacceptlab:
1774
17.9k
  yyresult = 0;
1775
17.9k
  goto yyreturn;
1776
1777
1778
/*-----------------------------------.
1779
| yyabortlab -- YYABORT comes here.  |
1780
`-----------------------------------*/
1781
672
yyabortlab:
1782
672
  yyresult = 1;
1783
672
  goto yyreturn;
1784
1785
1786
0
#if !defined yyoverflow || YYERROR_VERBOSE
1787
/*-------------------------------------------------.
1788
| yyexhaustedlab -- memory exhaustion comes here.  |
1789
`-------------------------------------------------*/
1790
0
yyexhaustedlab:
1791
0
  yyerror (&yylloc, context, YY_("memory exhausted"));
1792
0
  yyresult = 2;
1793
  /* Fall through.  */
1794
0
#endif
1795
1796
1797
/*-----------------------------------------------------.
1798
| yyreturn -- parsing is finished, return the result.  |
1799
`-----------------------------------------------------*/
1800
18.6k
yyreturn:
1801
18.6k
  if (yychar != YYEMPTY)
1802
596
    {
1803
      /* Make sure we have latest lookahead translation.  See comments at
1804
         user semantic actions for why this is necessary.  */
1805
596
      yytoken = YYTRANSLATE (yychar);
1806
596
      yydestruct ("Cleanup: discarding lookahead",
1807
596
                  yytoken, &yylval, &yylloc, context);
1808
596
    }
1809
  /* Do not reclaim the symbols of the rule whose action triggered
1810
     this YYABORT or YYACCEPT.  */
1811
18.6k
  YYPOPSTACK (yylen);
1812
18.6k
  YY_STACK_PRINT (yyss, yyssp);
1813
55.3k
  while (yyssp != yyss)
1814
36.7k
    {
1815
36.7k
      yydestruct ("Cleanup: popping",
1816
36.7k
                  yystos[+*yyssp], yyvsp, yylsp, context);
1817
36.7k
      YYPOPSTACK (1);
1818
36.7k
    }
1819
18.6k
#ifndef yyoverflow
1820
18.6k
  if (yyss != yyssa)
1821
0
    YYSTACK_FREE (yyss);
1822
18.6k
#endif
1823
18.6k
#if YYERROR_VERBOSE
1824
18.6k
  if (yymsg != yymsgbuf)
1825
0
    YYSTACK_FREE (yymsg);
1826
18.6k
#endif
1827
18.6k
  return yyresult;
1828
0
}
1829
#line 151 "/src/igraph/src/io/gml-parser.y"
1830
1831
1832
int igraph_gml_yyerror(YYLTYPE* locp, igraph_i_gml_parsedata_t *context,
1833
672
                       const char *s) {
1834
672
  snprintf(context->errmsg, sizeof(context->errmsg)/sizeof(char)-1,
1835
672
           "Parse error in GML file, line %i (%s)",
1836
672
           locp->first_line, s);
1837
672
  return 0;
1838
672
}
1839
1840
24.2M
static igraph_error_t igraph_i_gml_get_keyword(const char *s, size_t len, char **res) {
1841
24.2M
  *res = strndup(s, len);
1842
24.2M
  if (! *res) {
1843
0
    IGRAPH_ERROR("Cannot read GML file.", IGRAPH_ENOMEM); /* LCOV_EXCL_LINE */
1844
0
  }
1845
24.2M
  return IGRAPH_SUCCESS;
1846
24.2M
}
1847
1848
3.89M
static igraph_error_t igraph_i_gml_get_string(const char *s, size_t len, char **res) {
1849
3.89M
  *res = strndup(s+1, len-2);
1850
3.89M
  if (! *res) {
1851
0
    IGRAPH_ERROR("Cannot read GML file.", IGRAPH_ENOMEM); /* LCOV_EXCL_LINE */
1852
0
  }
1853
3.89M
  return IGRAPH_SUCCESS;
1854
3.89M
}
1855
1856
static igraph_error_t igraph_i_gml_make_numeric(const char *name,
1857
                                                int line,
1858
                                                igraph_real_t value,
1859
8.55M
                                                igraph_gml_tree_t **tree) {
1860
1861
8.55M
  igraph_gml_tree_t *t = IGRAPH_CALLOC(1, igraph_gml_tree_t);
1862
8.55M
  if (!t) {
1863
0
    IGRAPH_ERROR("Cannot build GML tree.", IGRAPH_ENOMEM); /* LCOV_EXCL_LINE */
1864
0
  }
1865
8.55M
  IGRAPH_FINALLY(igraph_free, t);
1866
1867
  /* The GML spec only requires support for 32-bit signed integers,
1868
   * but igraph tries to support the same range as igraph_int_t,
1869
   * so that it can read/write all graphs it can represent.
1870
   * We treat anything out of that range as real. These values end
1871
   * up as igraph_real_t anyway, as igraph does not currently support
1872
   * integer-typed attributes. */
1873
8.55M
  igraph_real_t trunc_value = trunc(value);
1874
8.55M
  if (value == trunc_value && igraph_i_is_real_representable_as_integer(trunc_value)) {
1875
8.44M
    IGRAPH_CHECK(igraph_gml_tree_init_integer(t, name, line, value));
1876
8.44M
  } else {
1877
113k
    IGRAPH_CHECK(igraph_gml_tree_init_real(t, name, line, value));
1878
113k
  }
1879
1880
8.55M
  *tree = t;
1881
8.55M
  IGRAPH_FINALLY_CLEAN(1); /* t */
1882
1883
8.55M
  return IGRAPH_SUCCESS;
1884
8.55M
}
1885
1886
static igraph_error_t igraph_i_gml_make_string(const char *name,
1887
                                               int line,
1888
                                               char *value,
1889
3.89M
                                               igraph_gml_tree_t **tree) {
1890
1891
3.89M
  igraph_gml_tree_t *t = IGRAPH_CALLOC(1, igraph_gml_tree_t);
1892
3.89M
  if (!t) {
1893
0
    IGRAPH_ERROR("Cannot build GML tree.", IGRAPH_ENOMEM); /* LCOV_EXCL_LINE */
1894
0
  }
1895
3.89M
  IGRAPH_FINALLY(igraph_free, t);
1896
1897
  /* if igraph_gml_tree_init_string succeeds, the newly created tree node takes
1898
   * ownership of 'value'. If it fails, we need to free 'value' ourselves in order
1899
   * not to leak memory */
1900
3.89M
  IGRAPH_FINALLY(igraph_free, value);
1901
3.89M
  IGRAPH_CHECK(igraph_gml_tree_init_string(t, name, line, value));
1902
1903
3.89M
  IGRAPH_FINALLY_CLEAN(1); /* value */
1904
1905
3.89M
  *tree = t;
1906
3.89M
  IGRAPH_FINALLY_CLEAN(1); /* t */
1907
1908
3.89M
  return IGRAPH_SUCCESS;
1909
3.89M
}
1910
1911
static igraph_error_t igraph_i_gml_make_list(const char *name,
1912
                                             int line,
1913
                                             igraph_gml_tree_t *list,
1914
11.7M
                                             igraph_gml_tree_t **tree) {
1915
1916
11.7M
  igraph_gml_tree_t *t = IGRAPH_CALLOC(1, igraph_gml_tree_t);
1917
11.7M
  if (!t) {
1918
0
    IGRAPH_ERROR("Cannot build GML tree.", IGRAPH_ENOMEM); /* LCOV_EXCL_LINE */
1919
0
  }
1920
11.7M
  IGRAPH_FINALLY(igraph_free, t);
1921
1922
11.7M
  IGRAPH_CHECK(igraph_gml_tree_init_tree(t, name, line, list));
1923
1924
11.7M
  *tree = t;
1925
11.7M
  IGRAPH_FINALLY_CLEAN(1); /* t */
1926
1927
11.7M
  return IGRAPH_SUCCESS;
1928
11.7M
}
1929
1930
7.54M
static igraph_error_t igraph_i_gml_make_empty(igraph_gml_tree_t **tree) {
1931
7.54M
    igraph_gml_tree_t *t = IGRAPH_CALLOC(1, igraph_gml_tree_t);
1932
7.54M
    if (!t) {
1933
0
      IGRAPH_ERROR("Cannot build GML tree.", IGRAPH_ENOMEM); /* LCOV_EXCL_LINE */
1934
0
    }
1935
7.54M
    IGRAPH_FINALLY(igraph_free, t);
1936
1937
7.54M
    IGRAPH_CHECK(igraph_gml_tree_init_empty(t));
1938
1939
7.54M
    *tree = t;
1940
7.54M
    IGRAPH_FINALLY_CLEAN(1); /* t */
1941
1942
7.54M
    return IGRAPH_SUCCESS;
1943
7.54M
}
1944
1945
19.9M
static igraph_error_t igraph_i_gml_merge(igraph_gml_tree_t *t1, igraph_gml_tree_t* t2) {
1946
1947
19.9M
  IGRAPH_CHECK(igraph_gml_tree_mergedest(t1, t2));
1948
19.9M
  IGRAPH_FREE(t2);
1949
1950
19.9M
  return IGRAPH_SUCCESS;
1951
19.9M
}