My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
parse_csv.cpp
Go to the documentation of this file.
1 
2 /* A Bison parser, made by GNU Bison 2.4.1. */
3 
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
5 
6  Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7  Free Software Foundation, Inc.
8 
9  This program is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 
22 /* As a special exception, you may create a larger work that contains
23  part or all of the Bison parser skeleton and distribute that work
24  under terms of your choice, so long as that work isn't itself a
25  parser generator using the skeleton or a modified version thereof
26  as a parser skeleton. Alternatively, if you modify or redistribute
27  the parser skeleton itself, you may (at your option) remove this
28  special exception, which will cause the skeleton and the resulting
29  Bison output files to be licensed under the GNU General Public
30  License without this special exception.
31 
32  This special exception was added by the Free Software Foundation in
33  version 2.2 of Bison. */
34 
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36  simplifying the original so-called "semantic" parser. */
37 
38 /* All symbols defined below should begin with yy or YY, to avoid
39  infringing on user name space. This should be done even for local
40  variables, as they might otherwise be expanded by user macros.
41  There are some unavoidable exceptions within include files to
42  define necessary library symbols; they are noted "INFRINGES ON
43  USER NAME SPACE" below. */
44 
45 /* Identify Bison output. */
46 #define YYBISON 1
47 
48 /* Bison version. */
49 #define YYBISON_VERSION "2.4.1"
50 
51 /* Skeleton name. */
52 #define YYSKELETON_NAME "yacc.c"
53 
54 /* Pure parsers. */
55 #define YYPURE 0
56 
57 /* Push parsers. */
58 #define YYPUSH 0
59 
60 /* Pull parsers. */
61 #define YYPULL 1
62 
63 /* Using locations. */
64 #define YYLSP_NEEDED 0
65 
66 /* Substitute the variable and function names. */
67 #define yyparse csv_parse
68 #define yylex csv_lex
69 #define yyerror csv_error
70 #define yylval csv_lval
71 #define yychar csv_char
72 #define yydebug csv_debug
73 #define yynerrs csv_nerrs
74 
75 
76 /* Copy the first part of user declarations. */
77 
78 /* Line 189 of yacc.c */
79 #line 3 "parse_csv.y"
80 
81 /*
82  * parse_csv.y - parser for CSV files
83  *
84  * Copyright (C) 2007 Stefan Jahn <stefan@lkcc.org>
85  *
86  * This is free software; you can redistribute it and/or modify
87  * it under the terms of the GNU General Public License as published by
88  * the Free Software Foundation; either version 2, or (at your option)
89  * any later version.
90  *
91  * This software is distributed in the hope that it will be useful,
92  * but WITHOUT ANY WARRANTY; without even the implied warranty of
93  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
94  * GNU General Public License for more details.
95  *
96  * You should have received a copy of the GNU General Public License
97  * along with this package; see the file COPYING. If not, write to
98  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
99  * Boston, MA 02110-1301, USA.
100  *
101  * $Id: parse_csv.y 1825 2011-03-11 20:42:14Z ela $
102  *
103  */
104 
105 #if HAVE_CONFIG_H
106 # include <config.h>
107 #endif
108 
109 #include <stdio.h>
110 #include <stdlib.h>
111 #include <string.h>
112 
113 #define YYERROR_VERBOSE 42
114 #define YYDEBUG 1
115 #define YYMAXDEPTH 1000000
116 
117 #include "logging.h"
118 #include "complex.h"
119 #include "object.h"
120 #include "vector.h"
121 #include "dataset.h"
122 #include "strlist.h"
123 #include "check_csv.h"
124 
125 
126 
127 /* Line 189 of yacc.c */
128 #line 129 "parse_csv.cpp"
129 
130 /* Enabling traces. */
131 #ifndef YYDEBUG
132 # define YYDEBUG 0
133 #endif
134 
135 /* Enabling verbose error messages. */
136 #ifdef YYERROR_VERBOSE
137 # undef YYERROR_VERBOSE
138 # define YYERROR_VERBOSE 1
139 #else
140 # define YYERROR_VERBOSE 0
141 #endif
142 
143 /* Enabling the token table. */
144 #ifndef YYTOKEN_TABLE
145 # define YYTOKEN_TABLE 0
146 #endif
147 
148 
149 /* Tokens. */
150 #ifndef YYTOKENTYPE
151 # define YYTOKENTYPE
152  /* Put the tokens into the symbol table, so that GDB and other debuggers
153  know about them. */
154  enum yytokentype {
156  Float = 259,
157  Identifier = 260,
158  Eol = 261
159  };
160 #endif
161 /* Tokens. */
162 #define InvalidCharacter 258
163 #define Float 259
164 #define Identifier 260
165 #define Eol 261
166 
167 
168 
169 
170 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
171 typedef union YYSTYPE
172 {
173 
174 /* Line 214 of yacc.c */
175 #line 57 "parse_csv.y"
176 
177  char * ident;
178  double f;
179  vector * v;
181 
182 
183 
184 /* Line 214 of yacc.c */
185 #line 186 "parse_csv.cpp"
186 } YYSTYPE;
187 # define YYSTYPE_IS_TRIVIAL 1
188 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
189 # define YYSTYPE_IS_DECLARED 1
190 #endif
191 
192 
193 /* Copy the second part of user declarations. */
194 
195 
196 /* Line 264 of yacc.c */
197 #line 198 "parse_csv.cpp"
198 
199 #ifdef short
200 # undef short
201 #endif
202 
203 #ifdef YYTYPE_UINT8
204 typedef YYTYPE_UINT8 yytype_uint8;
205 #else
206 typedef unsigned char yytype_uint8;
207 #endif
208 
209 #ifdef YYTYPE_INT8
210 typedef YYTYPE_INT8 yytype_int8;
211 #elif (defined __STDC__ || defined __C99__FUNC__ \
212  || defined __cplusplus || defined _MSC_VER)
213 typedef signed char yytype_int8;
214 #else
215 typedef short int yytype_int8;
216 #endif
217 
218 #ifdef YYTYPE_UINT16
219 typedef YYTYPE_UINT16 yytype_uint16;
220 #else
221 typedef unsigned short int yytype_uint16;
222 #endif
223 
224 #ifdef YYTYPE_INT16
225 typedef YYTYPE_INT16 yytype_int16;
226 #else
227 typedef short int yytype_int16;
228 #endif
229 
230 #ifndef YYSIZE_T
231 # ifdef __SIZE_TYPE__
232 # define YYSIZE_T __SIZE_TYPE__
233 # elif defined size_t
234 # define YYSIZE_T size_t
235 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
236  || defined __cplusplus || defined _MSC_VER)
237 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
238 # define YYSIZE_T size_t
239 # else
240 # define YYSIZE_T unsigned int
241 # endif
242 #endif
243 
244 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
245 
246 #ifndef YY_
247 # if YYENABLE_NLS
248 # if ENABLE_NLS
249 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
250 # define YY_(msgid) dgettext ("bison-runtime", msgid)
251 # endif
252 # endif
253 # ifndef YY_
254 # define YY_(msgid) msgid
255 # endif
256 #endif
257 
258 /* Suppress unused-variable warnings by "using" E. */
259 #if ! defined lint || defined __GNUC__
260 # define YYUSE(e) ((void) (e))
261 #else
262 # define YYUSE(e) /* empty */
263 #endif
264 
265 /* Identity function, used to suppress warnings about constant conditions. */
266 #ifndef lint
267 # define YYID(n) (n)
268 #else
269 #if (defined __STDC__ || defined __C99__FUNC__ \
270  || defined __cplusplus || defined _MSC_VER)
271 static int
272 YYID (int yyi)
273 #else
274 static int
275 YYID (yyi)
276  int yyi;
277 #endif
278 {
279  return yyi;
280 }
281 #endif
282 
283 #if ! defined yyoverflow || YYERROR_VERBOSE
284 
285 /* The parser invokes alloca or malloc; define the necessary symbols. */
286 
287 # ifdef YYSTACK_USE_ALLOCA
288 # if YYSTACK_USE_ALLOCA
289 # ifdef __GNUC__
290 # define YYSTACK_ALLOC __builtin_alloca
291 # elif defined __BUILTIN_VA_ARG_INCR
292 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
293 # elif defined _AIX
294 # define YYSTACK_ALLOC __alloca
295 # elif defined _MSC_VER
296 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
297 # define alloca _alloca
298 # else
299 # define YYSTACK_ALLOC alloca
300 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
301  || defined __cplusplus || defined _MSC_VER)
302 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
303 # ifndef _STDLIB_H
304 # define _STDLIB_H 1
305 # endif
306 # endif
307 # endif
308 # endif
309 # endif
310 
311 # ifdef YYSTACK_ALLOC
312  /* Pacify GCC's `empty if-body' warning. */
313 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
314 # ifndef YYSTACK_ALLOC_MAXIMUM
315  /* The OS might guarantee only one guard page at the bottom of the stack,
316  and a page size can be as small as 4096 bytes. So we cannot safely
317  invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
318  to allow for a few compiler-allocated temporary stack slots. */
319 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
320 # endif
321 # else
322 # define YYSTACK_ALLOC YYMALLOC
323 # define YYSTACK_FREE YYFREE
324 # ifndef YYSTACK_ALLOC_MAXIMUM
325 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
326 # endif
327 # if (defined __cplusplus && ! defined _STDLIB_H \
328  && ! ((defined YYMALLOC || defined malloc) \
329  && (defined YYFREE || defined free)))
330 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
331 # ifndef _STDLIB_H
332 # define _STDLIB_H 1
333 # endif
334 # endif
335 # ifndef YYMALLOC
336 # define YYMALLOC malloc
337 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
338  || defined __cplusplus || defined _MSC_VER)
339 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
340 # endif
341 # endif
342 # ifndef YYFREE
343 # define YYFREE free
344 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
345  || defined __cplusplus || defined _MSC_VER)
346 void free (void *); /* INFRINGES ON USER NAME SPACE */
347 # endif
348 # endif
349 # endif
350 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
351 
352 
353 #if (! defined yyoverflow \
354  && (! defined __cplusplus \
355  || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
356 
357 /* A type that is properly aligned for any stack member. */
358 union yyalloc
359 {
362 };
363 
364 /* The size of the maximum gap between one aligned stack and the next. */
365 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
366 
367 /* The size of an array large to enough to hold all stacks, each with
368  N elements. */
369 # define YYSTACK_BYTES(N) \
370  ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
371  + YYSTACK_GAP_MAXIMUM)
372 
373 /* Copy COUNT objects from FROM to TO. The source and destination do
374  not overlap. */
375 # ifndef YYCOPY
376 # if defined __GNUC__ && 1 < __GNUC__
377 # define YYCOPY(To, From, Count) \
378  __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
379 # else
380 # define YYCOPY(To, From, Count) \
381  do \
382  { \
383  YYSIZE_T yyi; \
384  for (yyi = 0; yyi < (Count); yyi++) \
385  (To)[yyi] = (From)[yyi]; \
386  } \
387  while (YYID (0))
388 # endif
389 # endif
390 
391 /* Relocate STACK from its old location to the new one. The
392  local variables YYSIZE and YYSTACKSIZE give the old and new number of
393  elements in the stack, and YYPTR gives the new location of the
394  stack. Advance YYPTR to a properly aligned location for the next
395  stack. */
396 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
397  do \
398  { \
399  YYSIZE_T yynewbytes; \
400  YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
401  Stack = &yyptr->Stack_alloc; \
402  yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
403  yyptr += yynewbytes / sizeof (*yyptr); \
404  } \
405  while (YYID (0))
406 
407 #endif
408 
409 /* YYFINAL -- State number of the termination state. */
410 #define YYFINAL 16
411 /* YYLAST -- Last index in YYTABLE. */
412 #define YYLAST 21
413 
414 /* YYNTOKENS -- Number of terminals. */
415 #define YYNTOKENS 8
416 /* YYNNTS -- Number of nonterminals. */
417 #define YYNNTS 8
418 /* YYNRULES -- Number of rules. */
419 #define YYNRULES 16
420 /* YYNRULES -- Number of states. */
421 #define YYNSTATES 24
422 
423 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
424 #define YYUNDEFTOK 2
425 #define YYMAXUTOK 261
426 
427 #define YYTRANSLATE(YYX) \
428  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
429 
430 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
431 static const yytype_uint8 yytranslate[] =
432 {
433  0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436  2, 2, 2, 2, 7, 2, 2, 2, 2, 2,
437  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457  2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458  2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
459  5, 6
460 };
461 
462 #if YYDEBUG
463 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
464  YYRHS. */
465 static const yytype_uint8 yyprhs[] =
466 {
467  0, 0, 3, 6, 8, 12, 14, 15, 18, 21,
468  24, 25, 29, 31, 34, 36, 37
469 };
470 
471 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
472 static const yytype_int8 yyrhs[] =
473 {
474  9, 0, -1, 12, 13, -1, 13, -1, 7, 5,
475  7, -1, 5, -1, -1, 10, 11, -1, 11, 6,
476  -1, 6, 12, -1, -1, 14, 6, 13, -1, 14,
477  -1, 6, 13, -1, 15, -1, -1, 4, 15, -1
478 };
479 
480 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
481 static const yytype_uint8 yyrline[] =
482 {
483  0, 72, 72, 76, 82, 85, 90, 91, 100, 103,
484  108, 109, 113, 116, 121, 124, 125
485 };
486 #endif
487 
488 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
489 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
490  First, the terminals, then, starting at YYNTOKENS, nonterminals. */
491 static const char *const yytname[] =
492 {
493  "$end", "error", "$undefined", "InvalidCharacter", "Float",
494  "Identifier", "Eol", "'\"'", "$accept", "Input", "Header", "HeaderList",
495  "HeaderLine", "DataSet", "DataLine", "DataList", 0
496 };
497 #endif
498 
499 # ifdef YYPRINT
500 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
501  token YYLEX-NUM. */
502 static const yytype_uint16 yytoknum[] =
503 {
504  0, 256, 257, 258, 259, 260, 261, 34
505 };
506 # endif
507 
508 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
509 static const yytype_uint8 yyr1[] =
510 {
511  0, 8, 9, 9, 10, 10, 11, 11, 12, 12,
512  13, 13, 13, 13, 14, 15, 15
513 };
514 
515 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
516 static const yytype_uint8 yyr2[] =
517 {
518  0, 2, 2, 1, 3, 1, 0, 2, 2, 2,
519  0, 3, 1, 2, 1, 0, 2
520 };
521 
522 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
523  STATE-NUM when YYTABLE doesn't specify something else to do. Zero
524  means the default is an error. */
525 static const yytype_uint8 yydefact[] =
526 {
527  10, 15, 5, 10, 0, 0, 6, 0, 10, 3,
528  12, 14, 16, 9, 13, 0, 1, 7, 8, 10,
529  2, 10, 4, 11
530 };
531 
532 /* YYDEFGOTO[NTERM-NUM]. */
533 static const yytype_int8 yydefgoto[] =
534 {
535  -1, 5, 6, 7, 8, 14, 10, 11
536 };
537 
538 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
539  STATE-NUM. */
540 #define YYPACT_NINF -4
541 static const yytype_int8 yypact[] =
542 {
543  -3, 1, -4, -3, 8, 11, 2, 9, 6, -4,
544  10, -4, -4, -4, -4, -1, -4, -4, -4, 6,
545  -4, 6, -4, -4
546 };
547 
548 /* YYPGOTO[NTERM-NUM]. */
549 static const yytype_int8 yypgoto[] =
550 {
551  -4, -4, -4, 12, 14, 0, -4, 13
552 };
553 
554 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
555  positive, shift that token. If negative, reduce the rule which
556  number is the opposite. If zero, do what YYDEFACT says.
557  If YYTABLE_NINF, syntax error. */
558 #define YYTABLE_NINF -1
559 static const yytype_uint8 yytable[] =
560 {
561  9, 1, 2, 3, 4, 1, 22, 2, 20, 4,
562  1, 16, 19, 15, 12, 18, 21, 13, 17, 0,
563  0, 23
564 };
565 
566 static const yytype_int8 yycheck[] =
567 {
568  0, 4, 5, 6, 7, 4, 7, 5, 8, 7,
569  4, 0, 6, 5, 1, 6, 6, 3, 6, -1,
570  -1, 21
571 };
572 
573 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
574  symbol of state STATE-NUM. */
575 static const yytype_uint8 yystos[] =
576 {
577  0, 4, 5, 6, 7, 9, 10, 11, 12, 13,
578  14, 15, 15, 12, 13, 5, 0, 11, 6, 6,
579  13, 6, 7, 13
580 };
581 
582 #define yyerrok (yyerrstatus = 0)
583 #define yyclearin (yychar = YYEMPTY)
584 #define YYEMPTY (-2)
585 #define YYEOF 0
586 
587 #define YYACCEPT goto yyacceptlab
588 #define YYABORT goto yyabortlab
589 #define YYERROR goto yyerrorlab
590 
591 
592 /* Like YYERROR except do call yyerror. This remains here temporarily
593  to ease the transition to the new meaning of YYERROR, for GCC.
594  Once GCC version 2 has supplanted version 1, this can go. */
595 
596 #define YYFAIL goto yyerrlab
597 
598 #define YYRECOVERING() (!!yyerrstatus)
599 
600 #define YYBACKUP(Token, Value) \
601 do \
602  if (yychar == YYEMPTY && yylen == 1) \
603  { \
604  yychar = (Token); \
605  yylval = (Value); \
606  yytoken = YYTRANSLATE (yychar); \
607  YYPOPSTACK (1); \
608  goto yybackup; \
609  } \
610  else \
611  { \
612  yyerror (YY_("syntax error: cannot back up")); \
613  YYERROR; \
614  } \
615 while (YYID (0))
616 
617 
618 #define YYTERROR 1
619 #define YYERRCODE 256
620 
621 
622 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
623  If N is 0, then set CURRENT to the empty location which ends
624  the previous symbol: RHS[0] (always defined). */
625 
626 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
627 #ifndef YYLLOC_DEFAULT
628 # define YYLLOC_DEFAULT(Current, Rhs, N) \
629  do \
630  if (YYID (N)) \
631  { \
632  (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
633  (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
634  (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
635  (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
636  } \
637  else \
638  { \
639  (Current).first_line = (Current).last_line = \
640  YYRHSLOC (Rhs, 0).last_line; \
641  (Current).first_column = (Current).last_column = \
642  YYRHSLOC (Rhs, 0).last_column; \
643  } \
644  while (YYID (0))
645 #endif
646 
647 
648 /* YY_LOCATION_PRINT -- Print the location on the stream.
649  This macro was not mandated originally: define only if we know
650  we won't break user code: when these are the locations we know. */
651 
652 #ifndef YY_LOCATION_PRINT
653 # if YYLTYPE_IS_TRIVIAL
654 # define YY_LOCATION_PRINT(File, Loc) \
655  fprintf (File, "%d.%d-%d.%d", \
656  (Loc).first_line, (Loc).first_column, \
657  (Loc).last_line, (Loc).last_column)
658 # else
659 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
660 # endif
661 #endif
662 
663 
664 /* YYLEX -- calling `yylex' with the right arguments. */
665 
666 #ifdef YYLEX_PARAM
667 # define YYLEX yylex (YYLEX_PARAM)
668 #else
669 # define YYLEX yylex ()
670 #endif
671 
672 /* Enable debugging if requested. */
673 #if YYDEBUG
674 
675 # ifndef YYFPRINTF
676 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
677 # define YYFPRINTF fprintf
678 # endif
679 
680 # define YYDPRINTF(Args) \
681 do { \
682  if (yydebug) \
683  YYFPRINTF Args; \
684 } while (YYID (0))
685 
686 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
687 do { \
688  if (yydebug) \
689  { \
690  YYFPRINTF (stderr, "%s ", Title); \
691  yy_symbol_print (stderr, \
692  Type, Value); \
693  YYFPRINTF (stderr, "\n"); \
694  } \
695 } while (YYID (0))
696 
697 
698 /*--------------------------------.
699 | Print this symbol on YYOUTPUT. |
700 `--------------------------------*/
701 
702 /*ARGSUSED*/
703 #if (defined __STDC__ || defined __C99__FUNC__ \
704  || defined __cplusplus || defined _MSC_VER)
705 static void
706 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
707 #else
708 static void
709 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
710  FILE *yyoutput;
711  int yytype;
712  YYSTYPE const * const yyvaluep;
713 #endif
714 {
715  if (!yyvaluep)
716  return;
717 # ifdef YYPRINT
718  if (yytype < YYNTOKENS)
719  YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
720 # else
721  YYUSE (yyoutput);
722 # endif
723  switch (yytype)
724  {
725  default:
726  break;
727  }
728 }
729 
730 
731 /*--------------------------------.
732 | Print this symbol on YYOUTPUT. |
733 `--------------------------------*/
734 
735 #if (defined __STDC__ || defined __C99__FUNC__ \
736  || defined __cplusplus || defined _MSC_VER)
737 static void
738 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
739 #else
740 static void
741 yy_symbol_print (yyoutput, yytype, yyvaluep)
742  FILE *yyoutput;
743  int yytype;
744  YYSTYPE const * const yyvaluep;
745 #endif
746 {
747  if (yytype < YYNTOKENS)
748  YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
749  else
750  YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
751 
752  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
753  YYFPRINTF (yyoutput, ")");
754 }
755 
756 /*------------------------------------------------------------------.
757 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
758 | TOP (included). |
759 `------------------------------------------------------------------*/
760 
761 #if (defined __STDC__ || defined __C99__FUNC__ \
762  || defined __cplusplus || defined _MSC_VER)
763 static void
764 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
765 #else
766 static void
767 yy_stack_print (yybottom, yytop)
768  yytype_int16 *yybottom;
769  yytype_int16 *yytop;
770 #endif
771 {
772  YYFPRINTF (stderr, "Stack now");
773  for (; yybottom <= yytop; yybottom++)
774  {
775  int yybot = *yybottom;
776  YYFPRINTF (stderr, " %d", yybot);
777  }
778  YYFPRINTF (stderr, "\n");
779 }
780 
781 # define YY_STACK_PRINT(Bottom, Top) \
782 do { \
783  if (yydebug) \
784  yy_stack_print ((Bottom), (Top)); \
785 } while (YYID (0))
786 
787 
788 /*------------------------------------------------.
789 | Report that the YYRULE is going to be reduced. |
790 `------------------------------------------------*/
791 
792 #if (defined __STDC__ || defined __C99__FUNC__ \
793  || defined __cplusplus || defined _MSC_VER)
794 static void
795 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
796 #else
797 static void
798 yy_reduce_print (yyvsp, yyrule)
799  YYSTYPE *yyvsp;
800  int yyrule;
801 #endif
802 {
803  int yynrhs = yyr2[yyrule];
804  int yyi;
805  unsigned long int yylno = yyrline[yyrule];
806  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
807  yyrule - 1, yylno);
808  /* The symbols being reduced. */
809  for (yyi = 0; yyi < yynrhs; yyi++)
810  {
811  YYFPRINTF (stderr, " $%d = ", yyi + 1);
812  yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
813  &(yyvsp[(yyi + 1) - (yynrhs)])
814  );
815  YYFPRINTF (stderr, "\n");
816  }
817 }
818 
819 # define YY_REDUCE_PRINT(Rule) \
820 do { \
821  if (yydebug) \
822  yy_reduce_print (yyvsp, Rule); \
823 } while (YYID (0))
824 
825 /* Nonzero means print parse trace. It is left uninitialized so that
826  multiple parsers can coexist. */
828 #else /* !YYDEBUG */
829 # define YYDPRINTF(Args)
830 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
831 # define YY_STACK_PRINT(Bottom, Top)
832 # define YY_REDUCE_PRINT(Rule)
833 #endif /* !YYDEBUG */
834 
835 
836 /* YYINITDEPTH -- initial size of the parser's stacks. */
837 #ifndef YYINITDEPTH
838 # define YYINITDEPTH 200
839 #endif
840 
841 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
842  if the built-in stack extension method is used).
843 
844  Do not make this value too large; the results are undefined if
845  YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
846  evaluated with infinite-precision integer arithmetic. */
847 
848 #ifndef YYMAXDEPTH
849 # define YYMAXDEPTH 10000
850 #endif
851 
852 
853 
854 #if YYERROR_VERBOSE
855 
856 # ifndef yystrlen
857 # if defined __GLIBC__ && defined _STRING_H
858 # define yystrlen strlen
859 # else
860 /* Return the length of YYSTR. */
861 #if (defined __STDC__ || defined __C99__FUNC__ \
862  || defined __cplusplus || defined _MSC_VER)
863 static YYSIZE_T
864 yystrlen (const char *yystr)
865 #else
866 static YYSIZE_T
867 yystrlen (yystr)
868  const char *yystr;
869 #endif
870 {
871  YYSIZE_T yylen;
872  for (yylen = 0; yystr[yylen]; yylen++)
873  continue;
874  return yylen;
875 }
876 # endif
877 # endif
878 
879 # ifndef yystpcpy
880 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
881 # define yystpcpy stpcpy
882 # else
883 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
884  YYDEST. */
885 #if (defined __STDC__ || defined __C99__FUNC__ \
886  || defined __cplusplus || defined _MSC_VER)
887 static char *
888 yystpcpy (char *yydest, const char *yysrc)
889 #else
890 static char *
891 yystpcpy (yydest, yysrc)
892  char *yydest;
893  const char *yysrc;
894 #endif
895 {
896  char *yyd = yydest;
897  const char *yys = yysrc;
898 
899  while ((*yyd++ = *yys++) != '\0')
900  continue;
901 
902  return yyd - 1;
903 }
904 # endif
905 # endif
906 
907 # ifndef yytnamerr
908 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
909  quotes and backslashes, so that it's suitable for yyerror. The
910  heuristic is that double-quoting is unnecessary unless the string
911  contains an apostrophe, a comma, or backslash (other than
912  backslash-backslash). YYSTR is taken from yytname. If YYRES is
913  null, do not copy; instead, return the length of what the result
914  would have been. */
915 static YYSIZE_T
916 yytnamerr (char *yyres, const char *yystr)
917 {
918  if (*yystr == '"')
919  {
920  YYSIZE_T yyn = 0;
921  char const *yyp = yystr;
922 
923  for (;;)
924  switch (*++yyp)
925  {
926  case '\'':
927  case ',':
928  goto do_not_strip_quotes;
929 
930  case '\\':
931  if (*++yyp != '\\')
932  goto do_not_strip_quotes;
933  /* Fall through. */
934  default:
935  if (yyres)
936  yyres[yyn] = *yyp;
937  yyn++;
938  break;
939 
940  case '"':
941  if (yyres)
942  yyres[yyn] = '\0';
943  return yyn;
944  }
945  do_not_strip_quotes: ;
946  }
947 
948  if (! yyres)
949  return yystrlen (yystr);
950 
951  return yystpcpy (yyres, yystr) - yyres;
952 }
953 # endif
954 
955 /* Copy into YYRESULT an error message about the unexpected token
956  YYCHAR while in state YYSTATE. Return the number of bytes copied,
957  including the terminating null byte. If YYRESULT is null, do not
958  copy anything; just return the number of bytes that would be
959  copied. As a special case, return 0 if an ordinary "syntax error"
960  message will do. Return YYSIZE_MAXIMUM if overflow occurs during
961  size calculation. */
962 static YYSIZE_T
963 yysyntax_error (char *yyresult, int yystate, int yychar)
964 {
965  int yyn = yypact[yystate];
966 
967  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
968  return 0;
969  else
970  {
971  int yytype = YYTRANSLATE (yychar);
972  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
973  YYSIZE_T yysize = yysize0;
974  YYSIZE_T yysize1;
975  int yysize_overflow = 0;
976  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
977  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
978  int yyx;
979 
980 # if 0
981  /* This is so xgettext sees the translatable formats that are
982  constructed on the fly. */
983  YY_("syntax error, unexpected %s");
984  YY_("syntax error, unexpected %s, expecting %s");
985  YY_("syntax error, unexpected %s, expecting %s or %s");
986  YY_("syntax error, unexpected %s, expecting %s or %s or %s");
987  YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
988 # endif
989  char *yyfmt;
990  char const *yyf;
991  static char const yyunexpected[] = "syntax error, unexpected %s";
992  static char const yyexpecting[] = ", expecting %s";
993  static char const yyor[] = " or %s";
994  char yyformat[sizeof yyunexpected
995  + sizeof yyexpecting - 1
996  + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
997  * (sizeof yyor - 1))];
998  char const *yyprefix = yyexpecting;
999 
1000  /* Start YYX at -YYN if negative to avoid negative indexes in
1001  YYCHECK. */
1002  int yyxbegin = yyn < 0 ? -yyn : 0;
1003 
1004  /* Stay within bounds of both yycheck and yytname. */
1005  int yychecklim = YYLAST - yyn + 1;
1006  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1007  int yycount = 1;
1008 
1009  yyarg[0] = yytname[yytype];
1010  yyfmt = yystpcpy (yyformat, yyunexpected);
1011 
1012  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1013  if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1014  {
1015  if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1016  {
1017  yycount = 1;
1018  yysize = yysize0;
1019  yyformat[sizeof yyunexpected - 1] = '\0';
1020  break;
1021  }
1022  yyarg[yycount++] = yytname[yyx];
1023  yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1024  yysize_overflow |= (yysize1 < yysize);
1025  yysize = yysize1;
1026  yyfmt = yystpcpy (yyfmt, yyprefix);
1027  yyprefix = yyor;
1028  }
1029 
1030  yyf = YY_(yyformat);
1031  yysize1 = yysize + yystrlen (yyf);
1032  yysize_overflow |= (yysize1 < yysize);
1033  yysize = yysize1;
1034 
1035  if (yysize_overflow)
1036  return YYSIZE_MAXIMUM;
1037 
1038  if (yyresult)
1039  {
1040  /* Avoid sprintf, as that infringes on the user's name space.
1041  Don't have undefined behavior even if the translation
1042  produced a string with the wrong number of "%s"s. */
1043  char *yyp = yyresult;
1044  int yyi = 0;
1045  while ((*yyp = *yyf) != '\0')
1046  {
1047  if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1048  {
1049  yyp += yytnamerr (yyp, yyarg[yyi++]);
1050  yyf += 2;
1051  }
1052  else
1053  {
1054  yyp++;
1055  yyf++;
1056  }
1057  }
1058  }
1059  return yysize;
1060  }
1061 }
1062 #endif /* YYERROR_VERBOSE */
1063 
1064 
1065 /*-----------------------------------------------.
1066 | Release the memory associated to this symbol. |
1067 `-----------------------------------------------*/
1068 
1069 /*ARGSUSED*/
1070 #if (defined __STDC__ || defined __C99__FUNC__ \
1071  || defined __cplusplus || defined _MSC_VER)
1072 static void
1073 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1074 #else
1075 static void
1076 yydestruct (yymsg, yytype, yyvaluep)
1077  const char *yymsg;
1078  int yytype;
1079  YYSTYPE *yyvaluep;
1080 #endif
1081 {
1082  YYUSE (yyvaluep);
1083 
1084  if (!yymsg)
1085  yymsg = "Deleting";
1086  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1087 
1088  switch (yytype)
1089  {
1090 
1091  default:
1092  break;
1093  }
1094 }
1095 
1096 /* Prevent warnings from -Wmissing-prototypes. */
1097 #ifdef YYPARSE_PARAM
1098 #if defined __STDC__ || defined __cplusplus
1099 int yyparse (void *YYPARSE_PARAM);
1100 #else
1101 int yyparse ();
1102 #endif
1103 #else /* ! YYPARSE_PARAM */
1104 #if defined __STDC__ || defined __cplusplus
1105 int yyparse (void);
1106 #else
1107 int yyparse ();
1108 #endif
1109 #endif /* ! YYPARSE_PARAM */
1110 
1111 
1112 /* The lookahead symbol. */
1114 
1115 /* The semantic value of the lookahead symbol. */
1117 
1118 /* Number of syntax errors so far. */
1120 
1121 
1122 
1123 /*-------------------------.
1124 | yyparse or yypush_parse. |
1125 `-------------------------*/
1126 
1127 #ifdef YYPARSE_PARAM
1128 #if (defined __STDC__ || defined __C99__FUNC__ \
1129  || defined __cplusplus || defined _MSC_VER)
1130 int
1131 yyparse (void *YYPARSE_PARAM)
1132 #else
1133 int
1134 yyparse (YYPARSE_PARAM)
1135  void *YYPARSE_PARAM;
1136 #endif
1137 #else /* ! YYPARSE_PARAM */
1138 #if (defined __STDC__ || defined __C99__FUNC__ \
1139  || defined __cplusplus || defined _MSC_VER)
1140 int
1141 yyparse (void)
1142 #else
1143 int
1144 yyparse ()
1145 
1146 #endif
1147 #endif
1148 {
1149 
1150 
1151  int yystate;
1152  /* Number of tokens to shift before error messages enabled. */
1153  int yyerrstatus;
1154 
1155  /* The stacks and their tools:
1156  `yyss': related to states.
1157  `yyvs': related to semantic values.
1158 
1159  Refer to the stacks thru separate pointers, to allow yyoverflow
1160  to reallocate them elsewhere. */
1161 
1162  /* The state stack. */
1163  yytype_int16 yyssa[YYINITDEPTH];
1164  yytype_int16 *yyss;
1165  yytype_int16 *yyssp;
1166 
1167  /* The semantic value stack. */
1168  YYSTYPE yyvsa[YYINITDEPTH];
1169  YYSTYPE *yyvs;
1170  YYSTYPE *yyvsp;
1171 
1172  YYSIZE_T yystacksize;
1173 
1174  int yyn;
1175  int yyresult;
1176  /* Lookahead token as an internal (translated) token number. */
1177  int yytoken;
1178  /* The variables used to return semantic value and location from the
1179  action routines. */
1180  YYSTYPE yyval;
1181 
1182 #if YYERROR_VERBOSE
1183  /* Buffer for error messages, and its allocated size. */
1184  char yymsgbuf[128];
1185  char *yymsg = yymsgbuf;
1186  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1187 #endif
1188 
1189 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1190 
1191  /* The number of symbols on the RHS of the reduced rule.
1192  Keep to zero when no symbol should be popped. */
1193  int yylen = 0;
1194 
1195  yytoken = 0;
1196  yyss = yyssa;
1197  yyvs = yyvsa;
1198  yystacksize = YYINITDEPTH;
1199 
1200  YYDPRINTF ((stderr, "Starting parse\n"));
1201 
1202  yystate = 0;
1203  yyerrstatus = 0;
1204  yynerrs = 0;
1205  yychar = YYEMPTY; /* Cause a token to be read. */
1206 
1207  /* Initialize stack pointers.
1208  Waste one element of value and location stack
1209  so that they stay on the same level as the state stack.
1210  The wasted elements are never initialized. */
1211  yyssp = yyss;
1212  yyvsp = yyvs;
1213 
1214  goto yysetstate;
1215 
1216 /*------------------------------------------------------------.
1217 | yynewstate -- Push a new state, which is found in yystate. |
1218 `------------------------------------------------------------*/
1219  yynewstate:
1220  /* In all cases, when you get here, the value and location stacks
1221  have just been pushed. So pushing a state here evens the stacks. */
1222  yyssp++;
1223 
1224  yysetstate:
1225  *yyssp = yystate;
1226 
1227  if (yyss + yystacksize - 1 <= yyssp)
1228  {
1229  /* Get the current used size of the three stacks, in elements. */
1230  YYSIZE_T yysize = yyssp - yyss + 1;
1231 
1232 #ifdef yyoverflow
1233  {
1234  /* Give user a chance to reallocate the stack. Use copies of
1235  these so that the &'s don't force the real ones into
1236  memory. */
1237  YYSTYPE *yyvs1 = yyvs;
1238  yytype_int16 *yyss1 = yyss;
1239 
1240  /* Each stack pointer address is followed by the size of the
1241  data in use in that stack, in bytes. This used to be a
1242  conditional around just the two extra args, but that might
1243  be undefined if yyoverflow is a macro. */
1244  yyoverflow (YY_("memory exhausted"),
1245  &yyss1, yysize * sizeof (*yyssp),
1246  &yyvs1, yysize * sizeof (*yyvsp),
1247  &yystacksize);
1248 
1249  yyss = yyss1;
1250  yyvs = yyvs1;
1251  }
1252 #else /* no yyoverflow */
1253 # ifndef YYSTACK_RELOCATE
1254  goto yyexhaustedlab;
1255 # else
1256  /* Extend the stack our own way. */
1257  if (YYMAXDEPTH <= yystacksize)
1258  goto yyexhaustedlab;
1259  yystacksize *= 2;
1260  if (YYMAXDEPTH < yystacksize)
1261  yystacksize = YYMAXDEPTH;
1262 
1263  {
1264  yytype_int16 *yyss1 = yyss;
1265  union yyalloc *yyptr =
1266  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1267  if (! yyptr)
1268  goto yyexhaustedlab;
1269  YYSTACK_RELOCATE (yyss_alloc, yyss);
1270  YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1271 # undef YYSTACK_RELOCATE
1272  if (yyss1 != yyssa)
1273  YYSTACK_FREE (yyss1);
1274  }
1275 # endif
1276 #endif /* no yyoverflow */
1277 
1278  yyssp = yyss + yysize - 1;
1279  yyvsp = yyvs + yysize - 1;
1280 
1281  YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1282  (unsigned long int) yystacksize));
1283 
1284  if (yyss + yystacksize - 1 <= yyssp)
1285  YYABORT;
1286  }
1287 
1288  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1289 
1290  if (yystate == YYFINAL)
1291  YYACCEPT;
1292 
1293  goto yybackup;
1294 
1295 /*-----------.
1296 | yybackup. |
1297 `-----------*/
1298 yybackup:
1299 
1300  /* Do appropriate processing given the current state. Read a
1301  lookahead token if we need one and don't already have one. */
1302 
1303  /* First try to decide what to do without reference to lookahead token. */
1304  yyn = yypact[yystate];
1305  if (yyn == YYPACT_NINF)
1306  goto yydefault;
1307 
1308  /* Not known => get a lookahead token if don't already have one. */
1309 
1310  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1311  if (yychar == YYEMPTY)
1312  {
1313  YYDPRINTF ((stderr, "Reading a token: "));
1314  yychar = YYLEX;
1315  }
1316 
1317  if (yychar <= YYEOF)
1318  {
1319  yychar = yytoken = YYEOF;
1320  YYDPRINTF ((stderr, "Now at end of input.\n"));
1321  }
1322  else
1323  {
1324  yytoken = YYTRANSLATE (yychar);
1325  YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1326  }
1327 
1328  /* If the proper action on seeing token YYTOKEN is to reduce or to
1329  detect an error, take that action. */
1330  yyn += yytoken;
1331  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1332  goto yydefault;
1333  yyn = yytable[yyn];
1334  if (yyn <= 0)
1335  {
1336  if (yyn == 0 || yyn == YYTABLE_NINF)
1337  goto yyerrlab;
1338  yyn = -yyn;
1339  goto yyreduce;
1340  }
1341 
1342  /* Count tokens shifted since error; after three, turn off error
1343  status. */
1344  if (yyerrstatus)
1345  yyerrstatus--;
1346 
1347  /* Shift the lookahead token. */
1348  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1349 
1350  /* Discard the shifted token. */
1351  yychar = YYEMPTY;
1352 
1353  yystate = yyn;
1354  *++yyvsp = yylval;
1355 
1356  goto yynewstate;
1357 
1358 
1359 /*-----------------------------------------------------------.
1360 | yydefault -- do the default action for the current state. |
1361 `-----------------------------------------------------------*/
1362 yydefault:
1363  yyn = yydefact[yystate];
1364  if (yyn == 0)
1365  goto yyerrlab;
1366  goto yyreduce;
1367 
1368 
1369 /*-----------------------------.
1370 | yyreduce -- Do a reduction. |
1371 `-----------------------------*/
1372 yyreduce:
1373  /* yyn is the number of a rule to reduce with. */
1374  yylen = yyr2[yyn];
1375 
1376  /* If YYLEN is nonzero, implement the default value of the action:
1377  `$$ = $1'.
1378 
1379  Otherwise, the following line sets YYVAL to garbage.
1380  This behavior is undocumented and Bison
1381  users should not rely upon it. Assigning to YYVAL
1382  unconditionally makes the parser a bit smaller, and it avoids a
1383  GCC warning that YYVAL may be used uninitialized. */
1384  yyval = yyvsp[1-yylen];
1385 
1386 
1387  YY_REDUCE_PRINT (yyn);
1388  switch (yyn)
1389  {
1390  case 2:
1391 
1392 /* Line 1455 of yacc.c */
1393 #line 72 "parse_csv.y"
1394  { /* describes a valid csv */
1395  csv_header = (yyvsp[(1) - (2)].list);
1396  csv_vector = (yyvsp[(2) - (2)].v);
1397  }
1398  break;
1399 
1400  case 3:
1401 
1402 /* Line 1455 of yacc.c */
1403 #line 76 "parse_csv.y"
1404  {
1405  csv_vector = (yyvsp[(1) - (1)].v);
1406  }
1407  break;
1408 
1409  case 4:
1410 
1411 /* Line 1455 of yacc.c */
1412 #line 82 "parse_csv.y"
1413  {
1414  (yyval.ident) = strdup ((yyvsp[(2) - (3)].ident));
1415  }
1416  break;
1417 
1418  case 5:
1419 
1420 /* Line 1455 of yacc.c */
1421 #line 85 "parse_csv.y"
1422  {
1423  (yyval.ident) = strdup ((yyvsp[(1) - (1)].ident));
1424  }
1425  break;
1426 
1427  case 6:
1428 
1429 /* Line 1455 of yacc.c */
1430 #line 90 "parse_csv.y"
1431  { (yyval.list) = NULL; }
1432  break;
1433 
1434  case 7:
1435 
1436 /* Line 1455 of yacc.c */
1437 #line 91 "parse_csv.y"
1438  {
1439  if ((yyvsp[(2) - (2)].list) == NULL) (yyvsp[(2) - (2)].list) = new strlist ();
1440  (yyvsp[(2) - (2)].list)->add ((yyvsp[(1) - (2)].ident));
1441  (yyval.list) = (yyvsp[(2) - (2)].list);
1442  free ((yyvsp[(1) - (2)].ident));
1443  }
1444  break;
1445 
1446  case 8:
1447 
1448 /* Line 1455 of yacc.c */
1449 #line 100 "parse_csv.y"
1450  {
1451  (yyval.list) = (yyvsp[(1) - (2)].list);
1452  }
1453  break;
1454 
1455  case 9:
1456 
1457 /* Line 1455 of yacc.c */
1458 #line 103 "parse_csv.y"
1459  { /* skip this line */
1460  (yyval.list) = (yyvsp[(2) - (2)].list);
1461  }
1462  break;
1463 
1464  case 10:
1465 
1466 /* Line 1455 of yacc.c */
1467 #line 108 "parse_csv.y"
1468  { (yyval.v) = NULL; }
1469  break;
1470 
1471  case 11:
1472 
1473 /* Line 1455 of yacc.c */
1474 #line 109 "parse_csv.y"
1475  { /* append vector lines */
1476  (yyvsp[(1) - (3)].v)->setNext ((yyvsp[(3) - (3)].v));
1477  (yyval.v) = (yyvsp[(1) - (3)].v);
1478  }
1479  break;
1480 
1481  case 12:
1482 
1483 /* Line 1455 of yacc.c */
1484 #line 113 "parse_csv.y"
1485  { /* last line, no trailing end-of-line */
1486  (yyval.v) = (yyvsp[(1) - (1)].v);
1487  }
1488  break;
1489 
1490  case 13:
1491 
1492 /* Line 1455 of yacc.c */
1493 #line 116 "parse_csv.y"
1494  { /* skip this line */
1495  (yyval.v) = (yyvsp[(2) - (2)].v);
1496  }
1497  break;
1498 
1499  case 15:
1500 
1501 /* Line 1455 of yacc.c */
1502 #line 124 "parse_csv.y"
1503  { (yyval.v) = NULL; }
1504  break;
1505 
1506  case 16:
1507 
1508 /* Line 1455 of yacc.c */
1509 #line 125 "parse_csv.y"
1510  {
1511  if ((yyvsp[(2) - (2)].v) == NULL) (yyvsp[(2) - (2)].v) = new vector ();
1512  (yyvsp[(2) - (2)].v)->add ((yyvsp[(1) - (2)].f));
1513  (yyval.v) = (yyvsp[(2) - (2)].v);
1514  }
1515  break;
1516 
1517 
1518 
1519 /* Line 1455 of yacc.c */
1520 #line 1521 "parse_csv.cpp"
1521  default: break;
1522  }
1523  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1524 
1525  YYPOPSTACK (yylen);
1526  yylen = 0;
1527  YY_STACK_PRINT (yyss, yyssp);
1528 
1529  *++yyvsp = yyval;
1530 
1531  /* Now `shift' the result of the reduction. Determine what state
1532  that goes to, based on the state we popped back to and the rule
1533  number reduced by. */
1534 
1535  yyn = yyr1[yyn];
1536 
1537  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1538  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1539  yystate = yytable[yystate];
1540  else
1541  yystate = yydefgoto[yyn - YYNTOKENS];
1542 
1543  goto yynewstate;
1544 
1545 
1546 /*------------------------------------.
1547 | yyerrlab -- here on detecting error |
1548 `------------------------------------*/
1549 yyerrlab:
1550  /* If not already recovering from an error, report this error. */
1551  if (!yyerrstatus)
1552  {
1553  ++yynerrs;
1554 #if ! YYERROR_VERBOSE
1555  yyerror (YY_("syntax error"));
1556 #else
1557  {
1558  YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1559  if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1560  {
1561  YYSIZE_T yyalloc = 2 * yysize;
1562  if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1563  yyalloc = YYSTACK_ALLOC_MAXIMUM;
1564  if (yymsg != yymsgbuf)
1565  YYSTACK_FREE (yymsg);
1566  yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1567  if (yymsg)
1568  yymsg_alloc = yyalloc;
1569  else
1570  {
1571  yymsg = yymsgbuf;
1572  yymsg_alloc = sizeof yymsgbuf;
1573  }
1574  }
1575 
1576  if (0 < yysize && yysize <= yymsg_alloc)
1577  {
1578  (void) yysyntax_error (yymsg, yystate, yychar);
1579  yyerror (yymsg);
1580  }
1581  else
1582  {
1583  yyerror (YY_("syntax error"));
1584  if (yysize != 0)
1585  goto yyexhaustedlab;
1586  }
1587  }
1588 #endif
1589  }
1590 
1591 
1592 
1593  if (yyerrstatus == 3)
1594  {
1595  /* If just tried and failed to reuse lookahead token after an
1596  error, discard it. */
1597 
1598  if (yychar <= YYEOF)
1599  {
1600  /* Return failure if at end of input. */
1601  if (yychar == YYEOF)
1602  YYABORT;
1603  }
1604  else
1605  {
1606  yydestruct ("Error: discarding",
1607  yytoken, &yylval);
1608  yychar = YYEMPTY;
1609  }
1610  }
1611 
1612  /* Else will try to reuse lookahead token after shifting the error
1613  token. */
1614  goto yyerrlab1;
1615 
1616 
1617 /*---------------------------------------------------.
1618 | yyerrorlab -- error raised explicitly by YYERROR. |
1619 `---------------------------------------------------*/
1620 yyerrorlab:
1621 
1622  /* Pacify compilers like GCC when the user code never invokes
1623  YYERROR and the label yyerrorlab therefore never appears in user
1624  code. */
1625  if (/*CONSTCOND*/ 0)
1626  goto yyerrorlab;
1627 
1628  /* Do not reclaim the symbols of the rule which action triggered
1629  this YYERROR. */
1630  YYPOPSTACK (yylen);
1631  yylen = 0;
1632  YY_STACK_PRINT (yyss, yyssp);
1633  yystate = *yyssp;
1634  goto yyerrlab1;
1635 
1636 
1637 /*-------------------------------------------------------------.
1638 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1639 `-------------------------------------------------------------*/
1640 yyerrlab1:
1641  yyerrstatus = 3; /* Each real token shifted decrements this. */
1642 
1643  for (;;)
1644  {
1645  yyn = yypact[yystate];
1646  if (yyn != YYPACT_NINF)
1647  {
1648  yyn += YYTERROR;
1649  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1650  {
1651  yyn = yytable[yyn];
1652  if (0 < yyn)
1653  break;
1654  }
1655  }
1656 
1657  /* Pop the current state because it cannot handle the error token. */
1658  if (yyssp == yyss)
1659  YYABORT;
1660 
1661 
1662  yydestruct ("Error: popping",
1663  yystos[yystate], yyvsp);
1664  YYPOPSTACK (1);
1665  yystate = *yyssp;
1666  YY_STACK_PRINT (yyss, yyssp);
1667  }
1668 
1669  *++yyvsp = yylval;
1670 
1671 
1672  /* Shift the error token. */
1673  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1674 
1675  yystate = yyn;
1676  goto yynewstate;
1677 
1678 
1679 /*-------------------------------------.
1680 | yyacceptlab -- YYACCEPT comes here. |
1681 `-------------------------------------*/
1682 yyacceptlab:
1683  yyresult = 0;
1684  goto yyreturn;
1685 
1686 /*-----------------------------------.
1687 | yyabortlab -- YYABORT comes here. |
1688 `-----------------------------------*/
1689 yyabortlab:
1690  yyresult = 1;
1691  goto yyreturn;
1692 
1693 #if !defined(yyoverflow) || YYERROR_VERBOSE
1694 /*-------------------------------------------------.
1695 | yyexhaustedlab -- memory exhaustion comes here. |
1696 `-------------------------------------------------*/
1697 yyexhaustedlab:
1698  yyerror (YY_("memory exhausted"));
1699  yyresult = 2;
1700  /* Fall through. */
1701 #endif
1702 
1703 yyreturn:
1704  if (yychar != YYEMPTY)
1705  yydestruct ("Cleanup: discarding lookahead",
1706  yytoken, &yylval);
1707  /* Do not reclaim the symbols of the rule which action triggered
1708  this YYABORT or YYACCEPT. */
1709  YYPOPSTACK (yylen);
1710  YY_STACK_PRINT (yyss, yyssp);
1711  while (yyssp != yyss)
1712  {
1713  yydestruct ("Cleanup: popping",
1714  yystos[*yyssp], yyvsp);
1715  YYPOPSTACK (1);
1716  }
1717 #ifndef yyoverflow
1718  if (yyss != yyssa)
1719  YYSTACK_FREE (yyss);
1720 #endif
1721 #if YYERROR_VERBOSE
1722  if (yymsg != yymsgbuf)
1723  YYSTACK_FREE (yymsg);
1724 #endif
1725  /* Make sure YYID is used. */
1726  return YYID (yyresult);
1727 }
1728 
1729 
1730 
1731 /* Line 1675 of yacc.c */
1732 #line 132 "parse_csv.y"
1733 
1734 
1735 int csv_error (char * error) {
1736  logprint (LOG_ERROR, "line %d: %s\n", csv_lineno, error);
1737  return 0;
1738 }
1739