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