1
/* A Bison parser, made by GNU Bison 2.5. */
3
/* Bison implementation for Yacc-like parsers in C
5
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
7
This program is free software: you can redistribute it and/or modify
1
/* A Bison parser, made by GNU Bison 2.3. */
3
/* Skeleton implementation for Bison's Yacc-like parsers in C
5
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6
Free Software Foundation, Inc.
8
This program is free software; you can redistribute it and/or modify
8
9
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
10
the Free Software Foundation; either version 2, or (at your option)
12
13
This program is distributed in the hope that it will be useful,
13
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
16
GNU General Public License for more details.
17
18
You should have received a copy of the GNU General Public License
18
along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
Boston, MA 02110-1301, USA. */
20
23
/* As a special exception, you may create a larger work that contains
21
24
part or all of the Bison parser skeleton and distribute that work
52
55
/* Pure parsers. */
61
58
/* Using locations. */
62
59
#define YYLSP_NEEDED 1
64
61
/* Substitute the variable and function names. */
65
#define yyparse igraph_pajek_yyparse
66
#define yylex igraph_pajek_yylex
67
#define yyerror igraph_pajek_yyerror
68
#define yylval igraph_pajek_yylval
69
#define yychar igraph_pajek_yychar
70
#define yydebug igraph_pajek_yydebug
71
#define yynerrs igraph_pajek_yynerrs
72
#define yylloc igraph_pajek_yylloc
74
/* Copy the first part of user declarations. */
76
/* Line 268 of yacc.c */
77
#line 23 "foreign-pajek-parser.y"
82
Copyright (C) 2006-2012 Gabor Csardi <csardi.gabor@gmail.com>
83
334 Harvard st, Cambridge, MA, 02138 USA
85
This program is free software; you can redistribute it and/or modify
86
it under the terms of the GNU General Public License as published by
87
the Free Software Foundation; either version 2 of the License, or
88
(at your option) any later version.
90
This program is distributed in the hope that it will be useful,
91
but WITHOUT ANY WARRANTY; without even the implied warranty of
92
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
93
GNU General Public License for more details.
95
You should have received a copy of the GNU General Public License
96
along with this program; if not, write to the Free Software
97
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
104
#include "igraph_hacks_internal.h"
105
#include "igraph_types.h"
106
#include "igraph_types_internal.h"
107
#include "igraph_memory.h"
108
#include "igraph_error.h"
109
#include "igraph_attributes.h"
111
#include "igraph_math.h"
113
#include "foreign-pajek-header.h"
114
#include "foreign-pajek-parser.h"
116
#define yyscan_t void*
118
int igraph_pajek_yylex(YYSTYPE* lvalp, YYLTYPE* llocp,
120
int igraph_pajek_yyerror(YYLTYPE* locp,
121
igraph_i_pajek_parsedata_t *context,
123
char *igraph_pajek_yyget_text (yyscan_t yyscanner );
124
int igraph_pajek_yyget_leng (yyscan_t yyscanner );
126
int igraph_i_pajek_add_string_vertex_attribute(const char *name,
129
igraph_i_pajek_parsedata_t *context);
130
int igraph_i_pajek_add_string_edge_attribute(const char *name,
133
igraph_i_pajek_parsedata_t *context);
134
int igraph_i_pajek_add_numeric_vertex_attribute(const char *name,
136
igraph_i_pajek_parsedata_t *context);
137
int igraph_i_pajek_add_numeric_edge_attribute(const char *name,
139
igraph_i_pajek_parsedata_t *context);
140
int igraph_i_pajek_add_numeric_attribute(igraph_trie_t *names,
141
igraph_vector_ptr_t *attrs,
143
const char *attrname,
144
igraph_integer_t vid,
145
igraph_real_t number);
146
int igraph_i_pajek_add_string_attribute(igraph_trie_t *names,
147
igraph_vector_ptr_t *attrs,
149
const char *attrname,
150
igraph_integer_t vid,
153
int igraph_i_pajek_add_bipartite_type(igraph_i_pajek_parsedata_t *context);
154
int igraph_i_pajek_check_bipartite(igraph_i_pajek_parsedata_t *context);
156
extern igraph_real_t igraph_pajek_get_number(const char *str, long int len);
157
extern long int igraph_i_pajek_actvertex;
158
extern long int igraph_i_pajek_actedge;
160
#define scanner context->scanner
164
/* Line 268 of yacc.c */
165
#line 166 "foreign-pajek-parser.c"
167
/* Enabling traces. */
172
/* Enabling verbose error messages. */
173
#ifdef YYERROR_VERBOSE
174
# undef YYERROR_VERBOSE
175
# define YYERROR_VERBOSE 1
177
# define YYERROR_VERBOSE 1
180
/* Enabling the token table. */
181
#ifndef YYTOKEN_TABLE
182
# define YYTOKEN_TABLE 0
62
#define yyparse igraph_pajek_yyparse
63
#define yylex igraph_pajek_yylex
64
#define yyerror igraph_pajek_yyerror
65
#define yylval igraph_pajek_yylval
66
#define yychar igraph_pajek_yychar
67
#define yydebug igraph_pajek_yydebug
68
#define yynerrs igraph_pajek_yynerrs
69
#define yylloc igraph_pajek_yylloc
187
72
#ifndef YYTOKENTYPE
180
/* Copy the first part of user declarations. */
181
#line 23 "foreign-pajek-parser.y"
186
Copyright (C) 2006-2012 Gabor Csardi <csardi.gabor@gmail.com>
187
334 Harvard st, Cambridge, MA, 02138 USA
189
This program is free software; you can redistribute it and/or modify
190
it under the terms of the GNU General Public License as published by
191
the Free Software Foundation; either version 2 of the License, or
192
(at your option) any later version.
194
This program is distributed in the hope that it will be useful,
195
but WITHOUT ANY WARRANTY; without even the implied warranty of
196
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
197
GNU General Public License for more details.
199
You should have received a copy of the GNU General Public License
200
along with this program; if not, write to the Free Software
201
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
207
#pragma clang diagnostic ignored "-Wconversion"
208
#pragma clang diagnostic ignored "-Wsign-conversion"
213
#include "igraph_hacks_internal.h"
214
#include "igraph_types.h"
215
#include "igraph_types_internal.h"
216
#include "igraph_memory.h"
217
#include "igraph_error.h"
218
#include "igraph_attributes.h"
220
#include "igraph_math.h"
222
#include "foreign-pajek-header.h"
223
#include "foreign-pajek-parser.h"
225
#define yyscan_t void*
227
int igraph_pajek_yylex(YYSTYPE* lvalp, YYLTYPE* llocp,
229
int igraph_pajek_yyerror(YYLTYPE* locp,
230
igraph_i_pajek_parsedata_t *context,
232
char *igraph_pajek_yyget_text (yyscan_t yyscanner );
233
int igraph_pajek_yyget_leng (yyscan_t yyscanner );
235
int igraph_i_pajek_add_string_vertex_attribute(const char *name,
238
igraph_i_pajek_parsedata_t *context);
239
int igraph_i_pajek_add_string_edge_attribute(const char *name,
242
igraph_i_pajek_parsedata_t *context);
243
int igraph_i_pajek_add_numeric_vertex_attribute(const char *name,
245
igraph_i_pajek_parsedata_t *context);
246
int igraph_i_pajek_add_numeric_edge_attribute(const char *name,
248
igraph_i_pajek_parsedata_t *context);
249
int igraph_i_pajek_add_numeric_attribute(igraph_trie_t *names,
250
igraph_vector_ptr_t *attrs,
252
const char *attrname,
253
igraph_integer_t vid,
254
igraph_real_t number);
255
int igraph_i_pajek_add_string_attribute(igraph_trie_t *names,
256
igraph_vector_ptr_t *attrs,
258
const char *attrname,
259
igraph_integer_t vid,
262
int igraph_i_pajek_add_bipartite_type(igraph_i_pajek_parsedata_t *context);
263
int igraph_i_pajek_check_bipartite(igraph_i_pajek_parsedata_t *context);
265
extern igraph_real_t igraph_pajek_get_number(const char *str, long int len);
266
extern long int igraph_i_pajek_actvertex;
267
extern long int igraph_i_pajek_actedge;
269
#define scanner context->scanner
273
/* Enabling traces. */
278
/* Enabling verbose error messages. */
279
#ifdef YYERROR_VERBOSE
280
# undef YYERROR_VERBOSE
281
# define YYERROR_VERBOSE 1
283
# define YYERROR_VERBOSE 1
286
/* Enabling the token table. */
287
#ifndef YYTOKEN_TABLE
288
# define YYTOKEN_TABLE 0
295
291
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
296
292
typedef union YYSTYPE
293
#line 123 "foreign-pajek-parser.y"
299
/* Line 293 of yacc.c */
300
#line 118 "foreign-pajek-parser.y"
311
/* Line 293 of yacc.c */
312
#line 313 "foreign-pajek-parser.c"
314
# define YYSTYPE_IS_TRIVIAL 1
302
/* Line 193 of yacc.c. */
303
#line 304 "foreign-pajek-parser.c"
315
305
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
316
306
# define YYSTYPE_IS_DECLARED 1
307
# define YYSTYPE_IS_TRIVIAL 1
319
310
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
668
655
102, 103, -1, 3, -1, 105, 104, 3, -1, -1,
669
656
104, 106, -1, 113, -1, 113, -1, 108, 3, 109,
670
657
-1, 14, -1, -1, 109, 110, -1, 111, 3, -1,
671
-1, 112, 111, -1, 113, -1, 4, -1, 4, -1,
658
-1, 112, 111, -1, 114, -1, 4, -1, 4, -1,
672
659
-1, 115, 116, -1, 5, -1, 4, -1, 6, -1
675
662
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
676
663
static const yytype_uint16 yyrline[] =
678
0, 191, 191, 195, 195, 197, 199, 203, 209, 209,
679
211, 212, 213, 213, 216, 218, 222, 223, 227, 233,
680
233, 237, 237, 240, 241, 244, 247, 252, 257, 262,
681
265, 268, 271, 274, 277, 280, 283, 286, 291, 291,
682
295, 295, 299, 299, 303, 303, 308, 308, 315, 317,
683
317, 317, 317, 317, 317, 319, 320, 322, 322, 324,
684
325, 325, 331, 333, 335, 336, 338, 338, 340, 341,
685
341, 347, 349, 351, 351, 355, 355, 358, 359, 364,
686
367, 370, 373, 376, 379, 382, 385, 388, 391, 394,
687
397, 400, 403, 406, 411, 411, 415, 415, 419, 419,
688
423, 423, 427, 427, 433, 435, 437, 437, 439, 439,
689
441, 441, 443, 445, 450, 452, 452, 454, 454, 456,
690
456, 458, 460, 467, 469, 471, 471, 473, 475, 475,
691
477, 487, 490, 493, 493, 495, 497, 499
665
0, 196, 196, 200, 200, 202, 204, 208, 214, 214,
666
216, 217, 218, 218, 221, 223, 227, 228, 232, 238,
667
238, 242, 242, 245, 246, 249, 252, 257, 262, 267,
668
270, 273, 276, 279, 282, 285, 288, 291, 296, 296,
669
300, 300, 304, 304, 308, 308, 313, 313, 320, 322,
670
322, 322, 322, 322, 322, 324, 325, 327, 327, 329,
671
330, 330, 336, 338, 340, 341, 343, 343, 345, 346,
672
346, 352, 354, 356, 356, 360, 360, 363, 364, 369,
673
372, 375, 378, 381, 384, 387, 390, 393, 396, 399,
674
402, 405, 408, 411, 416, 416, 420, 420, 424, 424,
675
428, 428, 432, 432, 438, 440, 442, 442, 444, 444,
676
446, 446, 448, 450, 455, 457, 457, 459, 459, 461,
677
461, 463, 465, 472, 474, 479, 479, 481, 483, 483,
678
485, 505, 508, 511, 511, 513, 515, 517
705
692
"EP_C", "EP_S", "EP_A", "EP_W", "EP_H1", "EP_H2", "EP_A1", "EP_A2",
706
693
"EP_K1", "EP_K2", "EP_AP", "EP_P", "EP_L", "EP_LP", "EP_LR", "EP_LPHI",
707
694
"EP_LC", "EP_LA", "EP_SIZE", "EP_FOS", "$accept", "input", "nethead",
708
"vertices", "verticeshead", "vertdefs", "vertexline", "$@1", "vertex",
709
"vertexid", "vertexcoords", "shape", "params", "param", "vpword", "$@2",
710
"$@3", "$@4", "$@5", "$@6", "vpwordpar", "edgeblock", "arcs", "arcsdefs",
711
"arcsline", "$@7", "arcfrom", "arcto", "edges", "edgesdefs", "edgesline",
712
"$@8", "edgefrom", "edgeto", "weight", "edgeparams", "edgeparam",
713
"epword", "$@9", "$@10", "$@11", "$@12", "$@13", "epwordpar", "arcslist",
695
"vertices", "verticeshead", "vertdefs", "vertexline", "@1", "vertex",
696
"vertexid", "vertexcoords", "shape", "params", "param", "vpword", "@2",
697
"@3", "@4", "@5", "@6", "vpwordpar", "edgeblock", "arcs", "arcsdefs",
698
"arcsline", "@7", "arcfrom", "arcto", "edges", "edgesdefs", "edgesline",
699
"@8", "edgefrom", "edgeto", "weight", "edgeparams", "edgeparam",
700
"epword", "@9", "@10", "@11", "@12", "@13", "epwordpar", "arcslist",
714
701
"arcslistlines", "arclistline", "arctolist", "arclistfrom", "arclistto",
715
702
"edgeslist", "edgelistlines", "edgelistline", "edgetolist",
716
703
"edgelistfrom", "edgelistto", "adjmatrix", "matrixline",
816
803
#define YYPACT_NINF -167
817
804
static const yytype_int16 yypact[] =
819
-4, -167, 7, 36, 22, -167, 48, -167, 51, -167,
820
-167, -167, -167, -167, -167, 48, 10, -167, -167, 12,
821
27, 56, 58, -167, -167, -167, -167, -167, -167, 59,
822
29, -167, -167, 60, -167, 61, -167, -167, -167, -167,
823
-167, 62, -167, 31, -167, 33, -167, 35, 37, 39,
824
-167, 5, -167, -167, 48, -167, 31, -167, -167, 48,
806
-4, -167, 7, 36, 22, -167, 44, -167, 49, -167,
807
-167, -167, -167, -167, -167, 44, 10, -167, -167, 12,
808
27, 51, 56, -167, -167, -167, -167, -167, -167, 58,
809
29, -167, -167, 59, -167, 60, -167, -167, -167, -167,
810
-167, 61, -167, 31, -167, 33, -167, 35, 37, 39,
811
-167, 5, -167, -167, 44, -167, 31, -167, -167, 44,
825
812
-167, 33, -167, -167, -167, -167, -167, -167, -167, -167,
826
-167, 64, 48, -167, 65, -167, -167, -167, -167, -167,
813
-167, 62, 65, -167, 65, -167, -167, -167, -167, -167,
827
814
47, 53, -167, -167, 5, 65, 65, 65, -167, -167,
828
815
-167, -167, -167, -167, -167, -167, 65, -167, -167, -167,
829
816
220, -167, 151, 172, -167, 65, 65, 65, 65, 65,
845
832
-167, -167, -167, -167, -167, -167, -167, -167, -167, -167,
846
833
-167, -167, -167, -167, -167, -167, -167, -167, -167, -167,
847
-145, -167, -167, 24, -167, -167, -167, -167, -167, 26,
848
-167, -167, -167, -167, -17, -26, -167, -167, -167, -167,
834
-145, -167, -167, 26, -167, -167, -167, -167, -167, 25,
835
-167, -167, -167, -167, -15, -26, -167, -167, -167, -167,
849
836
-167, -167, -167, -166, -167, -167, -167, -167, -167, -167,
850
837
-167, -167, -167, -167, -167, -167, -167, -167, -167, -167,
851
838
2, -167, -1, -19, -167, -2
861
849
11, 12, 200, 201, 18, 31, 32, 202, 194, 195,
862
850
19, 20, 21, 22, 23, 9, 10, 11, 12, 42,
863
851
34, 32, 39, 14, 52, 14, 57, 14, 62, 14,
864
66, 14, -128, 14, 60, 6, 65, 69, 73, 75,
865
88, 14, 14, 77, 17, 85, 91, 14, 79, 36,
866
60, 37, 38, 44, 46, 50, 96, 82, 56, 32,
867
99, 73, 61, 103, 83, 0, 0, 101, 0, 90,
852
66, 14, -128, 32, 60, 6, 65, 69, 14, 75,
853
88, 14, 17, 77, 36, 85, 91, 14, 79, 37,
854
60, 38, 44, 46, 50, 82, 96, 98, 98, 32,
855
56, 61, 99, 103, 83, 0, 0, 101, 0, 90,
868
856
93, 0, 95, 0, 0, 0, 147, 148, 150, 152,
869
857
154, 155, 156, 157, 158, 159, 160, 161, 162, 0,
870
858
0, 165, 0, 0, 0, 167, 168, 0, 170, 171,
888
#define yypact_value_is_default(yystate) \
889
((yystate) == (-167))
891
#define yytable_value_is_error(yytable_value) \
894
876
static const yytype_int16 yycheck[] =
896
878
19, 20, 4, 169, 8, 6, 151, 0, 153, 4,
897
879
5, 6, 178, 179, 15, 3, 4, 183, 163, 164,
898
880
10, 11, 12, 13, 14, 3, 4, 5, 6, 30,
899
881
3, 4, 3, 4, 3, 4, 3, 4, 3, 4,
900
3, 4, 3, 4, 45, 9, 47, 48, 49, 51,
901
3, 4, 4, 54, 3, 74, 3, 4, 59, 3,
902
61, 3, 3, 3, 3, 3, 85, 3, 44, 4,
903
87, 72, 46, 99, 72, -1, -1, 96, -1, 80,
882
3, 4, 3, 4, 45, 9, 47, 48, 4, 51,
883
3, 4, 3, 54, 3, 74, 3, 4, 59, 3,
884
61, 3, 3, 3, 3, 3, 85, 86, 87, 4,
885
44, 46, 87, 99, 72, -1, -1, 96, -1, 80,
904
886
81, -1, 84, -1, -1, -1, 105, 106, 107, 108,
905
887
109, 110, 111, 112, 113, 114, 115, 116, 117, -1,
906
888
-1, 120, -1, -1, -1, 124, 125, -1, 127, 128,
932
914
57, 59, 113, 74, 3, 80, 3, 96, 102, 109,
933
915
3, 58, 3, 75, 77, 113, 74, 3, 81, 83,
934
916
113, 80, 3, 97, 99, 113, 3, 103, 105, 113,
935
110, 111, 112, 113, 60, 116, 78, 113, 84, 113,
917
110, 111, 112, 114, 60, 116, 78, 113, 84, 113,
936
918
98, 104, 3, 111, 61, 114, 76, 82, 3, 100,
937
919
113, 3, 106, 113, 62, 116, 114, 85, 114, 85,
938
920
63, 114, 86, 86, 3, 15, 16, 17, 18, 19,
1341
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1342
about the unexpected token YYTOKEN for the state stack whose top is
1345
Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1346
not large enough to hold the message. In that case, also set
1347
*YYMSG_ALLOC to the required number of bytes. Return 2 if the
1348
required number of bytes is too large to store. */
1350
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1351
yytype_int16 *yyssp, int yytoken)
1313
/* Copy into YYRESULT an error message about the unexpected token
1314
YYCHAR while in state YYSTATE. Return the number of bytes copied,
1315
including the terminating null byte. If YYRESULT is null, do not
1316
copy anything; just return the number of bytes that would be
1317
copied. As a special case, return 0 if an ordinary "syntax error"
1318
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1319
size calculation. */
1321
yysyntax_error (char *yyresult, int yystate, int yychar)
1353
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1354
YYSIZE_T yysize = yysize0;
1356
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1357
/* Internationalized format string. */
1358
const char *yyformat = 0;
1359
/* Arguments of yyformat. */
1360
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1361
/* Number of reported tokens (one for the "unexpected", one per
1365
/* There are many possibilities here to consider:
1366
- Assume YYFAIL is not used. It's too flawed to consider. See
1367
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1368
for details. YYERROR is fine as it does not invoke this
1370
- If this state is a consistent state with a default action, then
1371
the only way this function was invoked is if the default action
1372
is an error action. In that case, don't check for expected
1373
tokens because there are none.
1374
- The only way there can be no lookahead present (in yychar) is if
1375
this state is a consistent state with a default action. Thus,
1376
detecting the absence of a lookahead is sufficient to determine
1377
that there is no unexpected or expected token to report. In that
1378
case, just report a simple "syntax error".
1379
- Don't assume there isn't a lookahead just because this state is a
1380
consistent state with a default action. There might have been a
1381
previous inconsistent state, consistent state with a non-default
1382
action, or user semantic action that manipulated yychar.
1383
- Of course, the expected token list depends on states to have
1384
correct lookahead information, and it depends on the parser not
1385
to perform extra reductions after fetching a lookahead from the
1386
scanner and before detecting a syntax error. Thus, state merging
1387
(from LALR or IELR) and default reductions corrupt the expected
1388
token list. However, the list is correct for canonical LR with
1389
one exception: it will still contain any token that will not be
1390
accepted due to an error action in a later state.
1392
if (yytoken != YYEMPTY)
1394
int yyn = yypact[*yyssp];
1395
yyarg[yycount++] = yytname[yytoken];
1396
if (!yypact_value_is_default (yyn))
1398
/* Start YYX at -YYN if negative to avoid negative indexes in
1399
YYCHECK. In other words, skip the first -YYN actions for
1400
this state because they are default actions. */
1401
int yyxbegin = yyn < 0 ? -yyn : 0;
1402
/* Stay within bounds of both yycheck and yytname. */
1403
int yychecklim = YYLAST - yyn + 1;
1404
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1407
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1408
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1409
&& !yytable_value_is_error (yytable[yyx + yyn]))
1411
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1417
yyarg[yycount++] = yytname[yyx];
1418
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1419
if (! (yysize <= yysize1
1420
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1429
# define YYCASE_(N, S) \
1433
YYCASE_(0, YY_("syntax error"));
1434
YYCASE_(1, YY_("syntax error, unexpected %s"));
1435
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1436
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1437
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1438
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1442
yysize1 = yysize + yystrlen (yyformat);
1443
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1447
if (*yymsg_alloc < yysize)
1449
*yymsg_alloc = 2 * yysize;
1450
if (! (yysize <= *yymsg_alloc
1451
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1452
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1456
/* Avoid sprintf, as that infringes on the user's name space.
1457
Don't have undefined behavior even if the translation
1458
produced a string with the wrong number of "%s"s. */
1462
while ((*yyp = *yyformat) != '\0')
1463
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1465
yyp += yytnamerr (yyp, yyarg[yyi++]);
1323
int yyn = yypact[yystate];
1325
if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1329
int yytype = YYTRANSLATE (yychar);
1330
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1331
YYSIZE_T yysize = yysize0;
1333
int yysize_overflow = 0;
1334
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1335
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1339
/* This is so xgettext sees the translatable formats that are
1340
constructed on the fly. */
1341
YY_("syntax error, unexpected %s");
1342
YY_("syntax error, unexpected %s, expecting %s");
1343
YY_("syntax error, unexpected %s, expecting %s or %s");
1344
YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1345
YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1349
static char const yyunexpected[] = "syntax error, unexpected %s";
1350
static char const yyexpecting[] = ", expecting %s";
1351
static char const yyor[] = " or %s";
1352
char yyformat[sizeof yyunexpected
1353
+ sizeof yyexpecting - 1
1354
+ ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1355
* (sizeof yyor - 1))];
1356
char const *yyprefix = yyexpecting;
1358
/* Start YYX at -YYN if negative to avoid negative indexes in
1360
int yyxbegin = yyn < 0 ? -yyn : 0;
1362
/* Stay within bounds of both yycheck and yytname. */
1363
int yychecklim = YYLAST - yyn + 1;
1364
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1367
yyarg[0] = yytname[yytype];
1368
yyfmt = yystpcpy (yyformat, yyunexpected);
1370
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1371
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1373
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1377
yyformat[sizeof yyunexpected - 1] = '\0';
1380
yyarg[yycount++] = yytname[yyx];
1381
yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1382
yysize_overflow |= (yysize1 < yysize);
1384
yyfmt = yystpcpy (yyfmt, yyprefix);
1388
yyf = YY_(yyformat);
1389
yysize1 = yysize + yystrlen (yyf);
1390
yysize_overflow |= (yysize1 < yysize);
1393
if (yysize_overflow)
1394
return YYSIZE_MAXIMUM;
1398
/* Avoid sprintf, as that infringes on the user's name space.
1399
Don't have undefined behavior even if the translation
1400
produced a string with the wrong number of "%s"s. */
1401
char *yyp = yyresult;
1403
while ((*yyp = *yyf) != '\0')
1405
if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1407
yyp += yytnamerr (yyp, yyarg[yyi++]);
1476
1420
#endif /* YYERROR_VERBOSE */
1478
1423
/*-----------------------------------------------.
1479
1424
| Release the memory associated to this symbol. |
1613
1528
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1531
/* Three stacks and their tools:
1532
`yyss': related to states,
1533
`yyvs': related to semantic values,
1534
`yyls': related to locations.
1536
Refer to the stacks thru separate pointers, to allow yyoverflow
1537
to reallocate them elsewhere. */
1539
/* The state stack. */
1540
yytype_int16 yyssa[YYINITDEPTH];
1541
yytype_int16 *yyss = yyssa;
1542
yytype_int16 *yyssp;
1544
/* The semantic value stack. */
1545
YYSTYPE yyvsa[YYINITDEPTH];
1546
YYSTYPE *yyvs = yyvsa;
1549
/* The location stack. */
1550
YYLTYPE yylsa[YYINITDEPTH];
1551
YYLTYPE *yyls = yylsa;
1553
/* The locations where the error started and ended. */
1554
YYLTYPE yyerror_range[2];
1616
1556
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1558
YYSIZE_T yystacksize = YYINITDEPTH;
1560
/* The variables used to return semantic value and location from the
1618
1565
/* The number of symbols on the RHS of the reduced rule.
1619
1566
Keep to zero when no symbol should be popped. */
1626
yystacksize = YYINITDEPTH;
1628
1569
YYDPRINTF ((stderr, "Starting parse\n"));
1631
1572
yyerrstatus = 0;
1633
yychar = YYEMPTY; /* Cause a token to be read. */
1574
yychar = YYEMPTY; /* Cause a token to be read. */
1635
1576
/* Initialize stack pointers.
1636
1577
Waste one element of value and location stack
1637
1578
so that they stay on the same level as the state stack.
1638
1579
The wasted elements are never initialized. */
1643
1584
#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1644
1585
/* Initialize the default location before parsing starts. */
1645
1586
yylloc.first_line = yylloc.last_line = 1;
1646
yylloc.first_column = yylloc.last_column = 1;
1587
yylloc.first_column = yylloc.last_column = 0;
1649
1590
goto yysetstate;
1974
/* Line 1806 of yacc.c */
1975
#line 262 "foreign-pajek-parser.y"
1884
#line 267 "foreign-pajek-parser.y"
1977
1886
igraph_i_pajek_add_numeric_vertex_attribute("labeldist", (yyvsp[(2) - (2)].realnum), context);
1983
/* Line 1806 of yacc.c */
1984
#line 265 "foreign-pajek-parser.y"
1891
#line 270 "foreign-pajek-parser.y"
1986
1893
igraph_i_pajek_add_numeric_vertex_attribute("labeldegree2", (yyvsp[(2) - (2)].realnum), context);
1992
/* Line 1806 of yacc.c */
1993
#line 268 "foreign-pajek-parser.y"
1898
#line 273 "foreign-pajek-parser.y"
1995
1900
igraph_i_pajek_add_numeric_vertex_attribute("framewidth", (yyvsp[(2) - (2)].realnum), context);
2001
/* Line 1806 of yacc.c */
2002
#line 271 "foreign-pajek-parser.y"
1905
#line 276 "foreign-pajek-parser.y"
2004
1907
igraph_i_pajek_add_numeric_vertex_attribute("fontsize", (yyvsp[(2) - (2)].realnum), context);
2010
/* Line 1806 of yacc.c */
2011
#line 274 "foreign-pajek-parser.y"
1912
#line 279 "foreign-pajek-parser.y"
2013
1914
igraph_i_pajek_add_numeric_vertex_attribute("rotation", (yyvsp[(2) - (2)].realnum), context);
2019
/* Line 1806 of yacc.c */
2020
#line 277 "foreign-pajek-parser.y"
1919
#line 282 "foreign-pajek-parser.y"
2022
1921
igraph_i_pajek_add_numeric_vertex_attribute("radius", (yyvsp[(2) - (2)].realnum), context);
2028
/* Line 1806 of yacc.c */
2029
#line 280 "foreign-pajek-parser.y"
1926
#line 285 "foreign-pajek-parser.y"
2031
1928
igraph_i_pajek_add_numeric_vertex_attribute("diamondratio", (yyvsp[(2) - (2)].realnum), context);
2037
/* Line 1806 of yacc.c */
2038
#line 283 "foreign-pajek-parser.y"
1933
#line 288 "foreign-pajek-parser.y"
2040
1935
igraph_i_pajek_add_numeric_vertex_attribute("labeldegree", (yyvsp[(2) - (2)].realnum), context);
2046
/* Line 1806 of yacc.c */
2047
#line 286 "foreign-pajek-parser.y"
1940
#line 291 "foreign-pajek-parser.y"
2049
1942
igraph_i_pajek_add_numeric_vertex_attribute("vertexsize", (yyvsp[(2) - (2)].realnum), context);
2055
/* Line 1806 of yacc.c */
2056
#line 291 "foreign-pajek-parser.y"
1947
#line 296 "foreign-pajek-parser.y"
2057
1948
{ context->mode=3; }
2062
/* Line 1806 of yacc.c */
2063
#line 291 "foreign-pajek-parser.y"
1952
#line 296 "foreign-pajek-parser.y"
2065
1954
context->mode=1;
2066
1955
igraph_i_pajek_add_string_vertex_attribute("font", (yyvsp[(3) - (3)].string).str, (yyvsp[(3) - (3)].string).len, context);
2142
/* Line 1806 of yacc.c */
2143
#line 315 "foreign-pajek-parser.y"
2014
#line 320 "foreign-pajek-parser.y"
2144
2015
{ (yyval.string)=(yyvsp[(1) - (1)].string); }
2149
/* Line 1806 of yacc.c */
2150
#line 319 "foreign-pajek-parser.y"
2019
#line 324 "foreign-pajek-parser.y"
2151
2020
{ context->directed=1; }
2156
/* Line 1806 of yacc.c */
2157
#line 320 "foreign-pajek-parser.y"
2024
#line 325 "foreign-pajek-parser.y"
2158
2025
{ context->directed=1; }
2163
/* Line 1806 of yacc.c */
2164
#line 325 "foreign-pajek-parser.y"
2029
#line 330 "foreign-pajek-parser.y"
2165
2030
{ context->actedge++;
2166
2031
context->mode=2; }
2171
/* Line 1806 of yacc.c */
2172
#line 326 "foreign-pajek-parser.y"
2035
#line 331 "foreign-pajek-parser.y"
2174
2037
igraph_vector_push_back(context->vector, (yyvsp[(1) - (6)].intnum)-1);
2175
2038
igraph_vector_push_back(context->vector, (yyvsp[(2) - (6)].intnum)-1); }
2180
/* Line 1806 of yacc.c */
2181
#line 335 "foreign-pajek-parser.y"
2042
#line 340 "foreign-pajek-parser.y"
2182
2043
{ context->directed=0; }
2187
/* Line 1806 of yacc.c */
2188
#line 336 "foreign-pajek-parser.y"
2047
#line 341 "foreign-pajek-parser.y"
2189
2048
{ context->directed=0; }
2194
/* Line 1806 of yacc.c */
2195
#line 341 "foreign-pajek-parser.y"
2052
#line 346 "foreign-pajek-parser.y"
2196
2053
{ context->actedge++;
2197
2054
context->mode=2; }
2202
/* Line 1806 of yacc.c */
2203
#line 342 "foreign-pajek-parser.y"
2058
#line 347 "foreign-pajek-parser.y"
2205
2060
igraph_vector_push_back(context->vector, (yyvsp[(1) - (6)].intnum)-1);
2206
2061
igraph_vector_push_back(context->vector, (yyvsp[(2) - (6)].intnum)-1); }
2211
/* Line 1806 of yacc.c */
2212
#line 351 "foreign-pajek-parser.y"
2065
#line 356 "foreign-pajek-parser.y"
2214
2067
igraph_i_pajek_add_numeric_edge_attribute("weight", (yyvsp[(1) - (1)].realnum), context);
2220
/* Line 1806 of yacc.c */
2221
#line 359 "foreign-pajek-parser.y"
2072
#line 364 "foreign-pajek-parser.y"
2223
2074
igraph_i_pajek_add_numeric_edge_attribute("color-red", (yyvsp[(2) - (4)].realnum), context);
2224
2075
igraph_i_pajek_add_numeric_edge_attribute("color-green", (yyvsp[(3) - (4)].realnum), context);
2231
/* Line 1806 of yacc.c */
2232
#line 364 "foreign-pajek-parser.y"
2081
#line 369 "foreign-pajek-parser.y"
2234
2083
igraph_i_pajek_add_numeric_edge_attribute("arrowsize", (yyvsp[(2) - (2)].realnum), context);
2240
/* Line 1806 of yacc.c */
2241
#line 367 "foreign-pajek-parser.y"
2088
#line 372 "foreign-pajek-parser.y"
2243
2090
igraph_i_pajek_add_numeric_edge_attribute("edgewidth", (yyvsp[(2) - (2)].realnum), context);
2249
/* Line 1806 of yacc.c */
2250
#line 370 "foreign-pajek-parser.y"
2095
#line 375 "foreign-pajek-parser.y"
2252
2097
igraph_i_pajek_add_numeric_edge_attribute("hook1", (yyvsp[(2) - (2)].realnum), context);
2258
/* Line 1806 of yacc.c */
2259
#line 373 "foreign-pajek-parser.y"
2102
#line 378 "foreign-pajek-parser.y"
2261
2104
igraph_i_pajek_add_numeric_edge_attribute("hook2", (yyvsp[(2) - (2)].realnum), context);
2267
/* Line 1806 of yacc.c */
2268
#line 376 "foreign-pajek-parser.y"
2109
#line 381 "foreign-pajek-parser.y"
2270
2111
igraph_i_pajek_add_numeric_edge_attribute("angle1", (yyvsp[(2) - (2)].realnum), context);
2276
/* Line 1806 of yacc.c */
2277
#line 379 "foreign-pajek-parser.y"
2116
#line 384 "foreign-pajek-parser.y"
2279
2118
igraph_i_pajek_add_numeric_edge_attribute("angle2", (yyvsp[(2) - (2)].realnum), context);
2285
/* Line 1806 of yacc.c */
2286
#line 382 "foreign-pajek-parser.y"
2123
#line 387 "foreign-pajek-parser.y"
2288
2125
igraph_i_pajek_add_numeric_edge_attribute("velocity1", (yyvsp[(2) - (2)].realnum), context);
2294
/* Line 1806 of yacc.c */
2295
#line 385 "foreign-pajek-parser.y"
2130
#line 390 "foreign-pajek-parser.y"
2297
2132
igraph_i_pajek_add_numeric_edge_attribute("velocity2", (yyvsp[(2) - (2)].realnum), context);
2303
/* Line 1806 of yacc.c */
2304
#line 388 "foreign-pajek-parser.y"
2137
#line 393 "foreign-pajek-parser.y"
2306
2139
igraph_i_pajek_add_numeric_edge_attribute("arrowpos", (yyvsp[(2) - (2)].realnum), context);
2312
/* Line 1806 of yacc.c */
2313
#line 391 "foreign-pajek-parser.y"
2144
#line 396 "foreign-pajek-parser.y"
2315
2146
igraph_i_pajek_add_numeric_edge_attribute("labelpos", (yyvsp[(2) - (2)].realnum), context);
2321
/* Line 1806 of yacc.c */
2322
#line 394 "foreign-pajek-parser.y"
2151
#line 399 "foreign-pajek-parser.y"
2324
2153
igraph_i_pajek_add_numeric_edge_attribute("labelangle", (yyvsp[(2) - (2)].realnum), context);
2330
/* Line 1806 of yacc.c */
2331
#line 397 "foreign-pajek-parser.y"
2158
#line 402 "foreign-pajek-parser.y"
2333
2160
igraph_i_pajek_add_numeric_edge_attribute("labelangle2", (yyvsp[(2) - (2)].realnum), context);
2339
/* Line 1806 of yacc.c */
2340
#line 400 "foreign-pajek-parser.y"
2165
#line 405 "foreign-pajek-parser.y"
2342
2167
igraph_i_pajek_add_numeric_edge_attribute("labeldegree", (yyvsp[(2) - (2)].realnum), context);
2348
/* Line 1806 of yacc.c */
2349
#line 403 "foreign-pajek-parser.y"
2172
#line 408 "foreign-pajek-parser.y"
2350
2173
{ /* what is this??? */
2351
2174
igraph_i_pajek_add_numeric_edge_attribute("arrowsize", (yyvsp[(2) - (2)].realnum), context);
2357
/* Line 1806 of yacc.c */
2358
#line 406 "foreign-pajek-parser.y"
2179
#line 411 "foreign-pajek-parser.y"
2360
2181
igraph_i_pajek_add_numeric_edge_attribute("fontsize", (yyvsp[(2) - (2)].realnum), context);
2366
/* Line 1806 of yacc.c */
2367
#line 411 "foreign-pajek-parser.y"
2186
#line 416 "foreign-pajek-parser.y"
2368
2187
{ context->mode=4; }
2373
/* Line 1806 of yacc.c */
2374
#line 411 "foreign-pajek-parser.y"
2191
#line 416 "foreign-pajek-parser.y"
2376
2193
context->mode=2;
2377
2194
igraph_i_pajek_add_string_edge_attribute("arrowtype", (yyvsp[(3) - (3)].string).str, (yyvsp[(3) - (3)].string).len, context);
2506
/* Line 1806 of yacc.c */
2507
#line 469 "foreign-pajek-parser.y"
2508
{ context->actfrom=0; context->actto=0; }
2292
#line 474 "foreign-pajek-parser.y"
2293
{ context->actfrom=0;
2295
context->directed=(context->vcount2==0);
2513
/* Line 1806 of yacc.c */
2514
#line 473 "foreign-pajek-parser.y"
2300
#line 481 "foreign-pajek-parser.y"
2515
2301
{ context->actfrom++; context->actto=0; }
2520
/* Line 1806 of yacc.c */
2521
#line 477 "foreign-pajek-parser.y"
2305
#line 485 "foreign-pajek-parser.y"
2523
if ((yyvsp[(1) - (1)].intnum)>0) {
2524
igraph_vector_push_back(context->vector, context->actfrom);
2525
igraph_vector_push_back(context->vector, context->actto);
2307
if ((yyvsp[(1) - (1)].realnum) != 0) {
2308
if (context->vcount2==0) {
2310
igraph_i_pajek_add_numeric_edge_attribute("weight", (yyvsp[(1) - (1)].realnum), context);
2311
igraph_vector_push_back(context->vector, context->actfrom);
2312
igraph_vector_push_back(context->vector, context->actto);
2313
} else if (context->vcount2 + context->actto < context->vcount) {
2315
igraph_i_pajek_add_numeric_edge_attribute("weight", (yyvsp[(1) - (1)].realnum), context);
2316
igraph_vector_push_back(context->vector, context->actfrom);
2317
igraph_vector_push_back(context->vector,
2318
context->vcount2+context->actto);
2527
2321
context->actto++;
2533
/* Line 1806 of yacc.c */
2534
#line 487 "foreign-pajek-parser.y"
2326
#line 505 "foreign-pajek-parser.y"
2535
2327
{ (yyval.intnum)=igraph_pajek_get_number(igraph_pajek_yyget_text(scanner),
2536
2328
igraph_pajek_yyget_leng(scanner)); }
2541
/* Line 1806 of yacc.c */
2542
#line 490 "foreign-pajek-parser.y"
2332
#line 508 "foreign-pajek-parser.y"
2543
2333
{ (yyval.realnum)=igraph_pajek_get_number(igraph_pajek_yyget_text(scanner),
2544
2334
igraph_pajek_yyget_leng(scanner)); }
2549
/* Line 1806 of yacc.c */
2550
#line 495 "foreign-pajek-parser.y"
2338
#line 513 "foreign-pajek-parser.y"
2551
2339
{ (yyval.string).str=igraph_pajek_yyget_text(scanner);
2552
2340
(yyval.string).len=igraph_pajek_yyget_leng(scanner); }
2557
/* Line 1806 of yacc.c */
2558
#line 497 "foreign-pajek-parser.y"
2344
#line 515 "foreign-pajek-parser.y"
2559
2345
{ (yyval.string).str=igraph_pajek_yyget_text(scanner);
2560
2346
(yyval.string).len=igraph_pajek_yyget_leng(scanner); }
2565
/* Line 1806 of yacc.c */
2566
#line 499 "foreign-pajek-parser.y"
2350
#line 517 "foreign-pajek-parser.y"
2567
2351
{ (yyval.string).str=igraph_pajek_yyget_text(scanner)+1;
2568
2352
(yyval.string).len=igraph_pajek_yyget_leng(scanner)-2; }
2573
/* Line 1806 of yacc.c */
2574
#line 2575 "foreign-pajek-parser.c"
2356
/* Line 1267 of yacc.c. */
2357
#line 2358 "foreign-pajek-parser.c"
2575
2358
default: break;
2577
/* User semantic actions sometimes alter yychar, and that requires
2578
that yytoken be updated with the new translation. We take the
2579
approach of translating immediately before every use of yytoken.
2580
One alternative is translating here after every semantic action,
2581
but that translation would be missed if the semantic action invokes
2582
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2583
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2584
incorrect destructor might then be invoked immediately. In the
2585
case of YYERROR or YYBACKUP, subsequent parser actions might lead
2586
to an incorrect destructor call or verbose syntax error message
2587
before the lookahead is translated. */
2588
2360
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2590
2362
YYPOPSTACK (yylen);
2624
2392
#if ! YYERROR_VERBOSE
2625
2393
yyerror (&yylloc, context, YY_("syntax error"));
2627
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2630
char const *yymsgp = YY_("syntax error");
2631
int yysyntax_error_status;
2632
yysyntax_error_status = YYSYNTAX_ERROR;
2633
if (yysyntax_error_status == 0)
2635
else if (yysyntax_error_status == 1)
2637
if (yymsg != yymsgbuf)
2638
YYSTACK_FREE (yymsg);
2639
yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2643
yymsg_alloc = sizeof yymsgbuf;
2644
yysyntax_error_status = 2;
2648
yysyntax_error_status = YYSYNTAX_ERROR;
2652
yyerror (&yylloc, context, yymsgp);
2653
if (yysyntax_error_status == 2)
2654
goto yyexhaustedlab;
2396
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2397
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2399
YYSIZE_T yyalloc = 2 * yysize;
2400
if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2401
yyalloc = YYSTACK_ALLOC_MAXIMUM;
2402
if (yymsg != yymsgbuf)
2403
YYSTACK_FREE (yymsg);
2404
yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2406
yymsg_alloc = yyalloc;
2410
yymsg_alloc = sizeof yymsgbuf;
2414
if (0 < yysize && yysize <= yymsg_alloc)
2416
(void) yysyntax_error (yymsg, yystate, yychar);
2417
yyerror (&yylloc, context, yymsg);
2421
yyerror (&yylloc, context, YY_("syntax error"));
2423
goto yyexhaustedlab;
2656
# undef YYSYNTAX_ERROR
2660
yyerror_range[1] = yylloc;
2429
yyerror_range[0] = yylloc;
2662
2431
if (yyerrstatus == 3)
2664
/* If just tried and failed to reuse lookahead token after an
2433
/* If just tried and failed to reuse look-ahead token after an
2665
2434
error, discard it. */
2667
2436
if (yychar <= YYEOF)