Branch data Line data Source code
1 : : /* A Bison parser, made by GNU Bison 3.8.2. */
2 : :
3 : : /* Bison implementation for Yacc-like parsers in C
4 : :
5 : : Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 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 <https://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 : : /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 : : especially those whose name start with YY_ or yy_. They are
39 : : private implementation details that can be changed or removed. */
40 : :
41 : : /* All symbols defined below should begin with yy or YY, to avoid
42 : : infringing on user name space. This should be done even for local
43 : : variables, as they might otherwise be expanded by user macros.
44 : : There are some unavoidable exceptions within include files to
45 : : define necessary library symbols; they are noted "INFRINGES ON
46 : : USER NAME SPACE" below. */
47 : :
48 : : /* Identify Bison output, and Bison version. */
49 : : #define YYBISON 30802
50 : :
51 : : /* Bison version string. */
52 : : #define YYBISON_VERSION "3.8.2"
53 : :
54 : : /* Skeleton name. */
55 : : #define YYSKELETON_NAME "yacc.c"
56 : :
57 : : /* Pure parsers. */
58 : : #define YYPURE 1
59 : :
60 : : /* Push parsers. */
61 : : #define YYPUSH 0
62 : :
63 : : /* Pull parsers. */
64 : : #define YYPULL 1
65 : :
66 : :
67 : : /* Substitute the variable and function names. */
68 : : #define yyparse seg_yyparse
69 : : #define yylex seg_yylex
70 : : #define yyerror seg_yyerror
71 : : #define yydebug seg_yydebug
72 : : #define yynerrs seg_yynerrs
73 : :
74 : : /* First part of user prologue. */
75 : : #line 1 "segparse.y"
76 : :
77 : : /* contrib/seg/segparse.y */
78 : :
79 : : #include "postgres.h"
80 : :
81 : : #include <float.h>
82 : : #include <math.h>
83 : :
84 : : #include "fmgr.h"
85 : : #include "nodes/miscnodes.h"
86 : : #include "utils/builtins.h"
87 : : #include "utils/float.h"
88 : :
89 : : #include "segdata.h"
90 : : #include "segparse.h"
91 : :
92 : : /*
93 : : * Bison doesn't allocate anything that needs to live across parser calls,
94 : : * so we can easily have it use palloc instead of malloc. This prevents
95 : : * memory leaks if we error out during parsing.
96 : : */
97 : : #define YYMALLOC palloc
98 : : #define YYFREE pfree
99 : :
100 : : static bool seg_atof(char *value, float *result, struct Node *escontext);
101 : :
102 : : static int sig_digits(const char *value);
103 : :
104 : :
105 : : #line 106 "segparse.c"
106 : :
107 : : # ifndef YY_CAST
108 : : # ifdef __cplusplus
109 : : # define YY_CAST(Type, Val) static_cast<Type> (Val)
110 : : # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
111 : : # else
112 : : # define YY_CAST(Type, Val) ((Type) (Val))
113 : : # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
114 : : # endif
115 : : # endif
116 : : # ifndef YY_NULLPTR
117 : : # if defined __cplusplus
118 : : # if 201103L <= __cplusplus
119 : : # define YY_NULLPTR nullptr
120 : : # else
121 : : # define YY_NULLPTR 0
122 : : # endif
123 : : # else
124 : : # define YY_NULLPTR ((void*)0)
125 : : # endif
126 : : # endif
127 : :
128 : : #include "segparse.h"
129 : : /* Symbol kind. */
130 : : enum yysymbol_kind_t
131 : : {
132 : : YYSYMBOL_YYEMPTY = -2,
133 : : YYSYMBOL_YYEOF = 0, /* "end of file" */
134 : : YYSYMBOL_YYerror = 1, /* error */
135 : : YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
136 : : YYSYMBOL_SEGFLOAT = 3, /* SEGFLOAT */
137 : : YYSYMBOL_RANGE = 4, /* RANGE */
138 : : YYSYMBOL_PLUMIN = 5, /* PLUMIN */
139 : : YYSYMBOL_EXTENSION = 6, /* EXTENSION */
140 : : YYSYMBOL_YYACCEPT = 7, /* $accept */
141 : : YYSYMBOL_range = 8, /* range */
142 : : YYSYMBOL_boundary = 9, /* boundary */
143 : : YYSYMBOL_deviation = 10 /* deviation */
144 : : };
145 : : typedef enum yysymbol_kind_t yysymbol_kind_t;
146 : :
147 : :
148 : :
149 : :
150 : : #ifdef short
151 : : # undef short
152 : : #endif
153 : :
154 : : /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
155 : : <limits.h> and (if available) <stdint.h> are included
156 : : so that the code can choose integer types of a good width. */
157 : :
158 : : #ifndef __PTRDIFF_MAX__
159 : : # include <limits.h> /* INFRINGES ON USER NAME SPACE */
160 : : # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
161 : : # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
162 : : # define YY_STDINT_H
163 : : # endif
164 : : #endif
165 : :
166 : : /* Narrow types that promote to a signed type and that can represent a
167 : : signed or unsigned integer of at least N bits. In tables they can
168 : : save space and decrease cache pressure. Promoting to a signed type
169 : : helps avoid bugs in integer arithmetic. */
170 : :
171 : : #ifdef __INT_LEAST8_MAX__
172 : : typedef __INT_LEAST8_TYPE__ yytype_int8;
173 : : #elif defined YY_STDINT_H
174 : : typedef int_least8_t yytype_int8;
175 : : #else
176 : : typedef signed char yytype_int8;
177 : : #endif
178 : :
179 : : #ifdef __INT_LEAST16_MAX__
180 : : typedef __INT_LEAST16_TYPE__ yytype_int16;
181 : : #elif defined YY_STDINT_H
182 : : typedef int_least16_t yytype_int16;
183 : : #else
184 : : typedef short yytype_int16;
185 : : #endif
186 : :
187 : : /* Work around bug in HP-UX 11.23, which defines these macros
188 : : incorrectly for preprocessor constants. This workaround can likely
189 : : be removed in 2023, as HPE has promised support for HP-UX 11.23
190 : : (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
191 : : <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
192 : : #ifdef __hpux
193 : : # undef UINT_LEAST8_MAX
194 : : # undef UINT_LEAST16_MAX
195 : : # define UINT_LEAST8_MAX 255
196 : : # define UINT_LEAST16_MAX 65535
197 : : #endif
198 : :
199 : : #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
200 : : typedef __UINT_LEAST8_TYPE__ yytype_uint8;
201 : : #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
202 : : && UINT_LEAST8_MAX <= INT_MAX)
203 : : typedef uint_least8_t yytype_uint8;
204 : : #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
205 : : typedef unsigned char yytype_uint8;
206 : : #else
207 : : typedef short yytype_uint8;
208 : : #endif
209 : :
210 : : #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
211 : : typedef __UINT_LEAST16_TYPE__ yytype_uint16;
212 : : #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
213 : : && UINT_LEAST16_MAX <= INT_MAX)
214 : : typedef uint_least16_t yytype_uint16;
215 : : #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
216 : : typedef unsigned short yytype_uint16;
217 : : #else
218 : : typedef int yytype_uint16;
219 : : #endif
220 : :
221 : : #ifndef YYPTRDIFF_T
222 : : # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
223 : : # define YYPTRDIFF_T __PTRDIFF_TYPE__
224 : : # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
225 : : # elif defined PTRDIFF_MAX
226 : : # ifndef ptrdiff_t
227 : : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
228 : : # endif
229 : : # define YYPTRDIFF_T ptrdiff_t
230 : : # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
231 : : # else
232 : : # define YYPTRDIFF_T long
233 : : # define YYPTRDIFF_MAXIMUM LONG_MAX
234 : : # endif
235 : : #endif
236 : :
237 : : #ifndef YYSIZE_T
238 : : # ifdef __SIZE_TYPE__
239 : : # define YYSIZE_T __SIZE_TYPE__
240 : : # elif defined size_t
241 : : # define YYSIZE_T size_t
242 : : # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
243 : : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
244 : : # define YYSIZE_T size_t
245 : : # else
246 : : # define YYSIZE_T unsigned
247 : : # endif
248 : : #endif
249 : :
250 : : #define YYSIZE_MAXIMUM \
251 : : YY_CAST (YYPTRDIFF_T, \
252 : : (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
253 : : ? YYPTRDIFF_MAXIMUM \
254 : : : YY_CAST (YYSIZE_T, -1)))
255 : :
256 : : #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
257 : :
258 : :
259 : : /* Stored state numbers (used for stacks). */
260 : : typedef yytype_int8 yy_state_t;
261 : :
262 : : /* State numbers in computations. */
263 : : typedef int yy_state_fast_t;
264 : :
265 : : #ifndef YY_
266 : : # if defined YYENABLE_NLS && YYENABLE_NLS
267 : : # if ENABLE_NLS
268 : : # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
269 : : # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
270 : : # endif
271 : : # endif
272 : : # ifndef YY_
273 : : # define YY_(Msgid) Msgid
274 : : # endif
275 : : #endif
276 : :
277 : :
278 : : #ifndef YY_ATTRIBUTE_PURE
279 : : # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
280 : : # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
281 : : # else
282 : : # define YY_ATTRIBUTE_PURE
283 : : # endif
284 : : #endif
285 : :
286 : : #ifndef YY_ATTRIBUTE_UNUSED
287 : : # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
288 : : # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
289 : : # else
290 : : # define YY_ATTRIBUTE_UNUSED
291 : : # endif
292 : : #endif
293 : :
294 : : /* Suppress unused-variable warnings by "using" E. */
295 : : #if ! defined lint || defined __GNUC__
296 : : # define YY_USE(E) ((void) (E))
297 : : #else
298 : : # define YY_USE(E) /* empty */
299 : : #endif
300 : :
301 : : /* Suppress an incorrect diagnostic about yylval being uninitialized. */
302 : : #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
303 : : # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
304 : : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
305 : : _Pragma ("GCC diagnostic push") \
306 : : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
307 : : # else
308 : : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
309 : : _Pragma ("GCC diagnostic push") \
310 : : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
311 : : _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
312 : : # endif
313 : : # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
314 : : _Pragma ("GCC diagnostic pop")
315 : : #else
316 : : # define YY_INITIAL_VALUE(Value) Value
317 : : #endif
318 : : #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
319 : : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
320 : : # define YY_IGNORE_MAYBE_UNINITIALIZED_END
321 : : #endif
322 : : #ifndef YY_INITIAL_VALUE
323 : : # define YY_INITIAL_VALUE(Value) /* Nothing. */
324 : : #endif
325 : :
326 : : #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
327 : : # define YY_IGNORE_USELESS_CAST_BEGIN \
328 : : _Pragma ("GCC diagnostic push") \
329 : : _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
330 : : # define YY_IGNORE_USELESS_CAST_END \
331 : : _Pragma ("GCC diagnostic pop")
332 : : #endif
333 : : #ifndef YY_IGNORE_USELESS_CAST_BEGIN
334 : : # define YY_IGNORE_USELESS_CAST_BEGIN
335 : : # define YY_IGNORE_USELESS_CAST_END
336 : : #endif
337 : :
338 : :
339 : : #define YY_ASSERT(E) ((void) (0 && (E)))
340 : :
341 : : #if !defined yyoverflow
342 : :
343 : : /* The parser invokes alloca or malloc; define the necessary symbols. */
344 : :
345 : : # ifdef YYSTACK_USE_ALLOCA
346 : : # if YYSTACK_USE_ALLOCA
347 : : # ifdef __GNUC__
348 : : # define YYSTACK_ALLOC __builtin_alloca
349 : : # elif defined __BUILTIN_VA_ARG_INCR
350 : : # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
351 : : # elif defined _AIX
352 : : # define YYSTACK_ALLOC __alloca
353 : : # elif defined _MSC_VER
354 : : # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
355 : : # define alloca _alloca
356 : : # else
357 : : # define YYSTACK_ALLOC alloca
358 : : # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
359 : : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
360 : : /* Use EXIT_SUCCESS as a witness for stdlib.h. */
361 : : # ifndef EXIT_SUCCESS
362 : : # define EXIT_SUCCESS 0
363 : : # endif
364 : : # endif
365 : : # endif
366 : : # endif
367 : : # endif
368 : :
369 : : # ifdef YYSTACK_ALLOC
370 : : /* Pacify GCC's 'empty if-body' warning. */
371 : : # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
372 : : # ifndef YYSTACK_ALLOC_MAXIMUM
373 : : /* The OS might guarantee only one guard page at the bottom of the stack,
374 : : and a page size can be as small as 4096 bytes. So we cannot safely
375 : : invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
376 : : to allow for a few compiler-allocated temporary stack slots. */
377 : : # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
378 : : # endif
379 : : # else
380 : : # define YYSTACK_ALLOC YYMALLOC
381 : : # define YYSTACK_FREE YYFREE
382 : : # ifndef YYSTACK_ALLOC_MAXIMUM
383 : : # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
384 : : # endif
385 : : # if (defined __cplusplus && ! defined EXIT_SUCCESS \
386 : : && ! ((defined YYMALLOC || defined malloc) \
387 : : && (defined YYFREE || defined free)))
388 : : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
389 : : # ifndef EXIT_SUCCESS
390 : : # define EXIT_SUCCESS 0
391 : : # endif
392 : : # endif
393 : : # ifndef YYMALLOC
394 : : # define YYMALLOC malloc
395 : : # if ! defined malloc && ! defined EXIT_SUCCESS
396 : : void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
397 : : # endif
398 : : # endif
399 : : # ifndef YYFREE
400 : : # define YYFREE free
401 : : # if ! defined free && ! defined EXIT_SUCCESS
402 : : void free (void *); /* INFRINGES ON USER NAME SPACE */
403 : : # endif
404 : : # endif
405 : : # endif
406 : : #endif /* !defined yyoverflow */
407 : :
408 : : #if (! defined yyoverflow \
409 : : && (! defined __cplusplus \
410 : : || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
411 : :
412 : : /* A type that is properly aligned for any stack member. */
413 : : union yyalloc
414 : : {
415 : : yy_state_t yyss_alloc;
416 : : YYSTYPE yyvs_alloc;
417 : : };
418 : :
419 : : /* The size of the maximum gap between one aligned stack and the next. */
420 : : # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
421 : :
422 : : /* The size of an array large to enough to hold all stacks, each with
423 : : N elements. */
424 : : # define YYSTACK_BYTES(N) \
425 : : ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
426 : : + YYSTACK_GAP_MAXIMUM)
427 : :
428 : : # define YYCOPY_NEEDED 1
429 : :
430 : : /* Relocate STACK from its old location to the new one. The
431 : : local variables YYSIZE and YYSTACKSIZE give the old and new number of
432 : : elements in the stack, and YYPTR gives the new location of the
433 : : stack. Advance YYPTR to a properly aligned location for the next
434 : : stack. */
435 : : # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
436 : : do \
437 : : { \
438 : : YYPTRDIFF_T yynewbytes; \
439 : : YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
440 : : Stack = &yyptr->Stack_alloc; \
441 : : yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
442 : : yyptr += yynewbytes / YYSIZEOF (*yyptr); \
443 : : } \
444 : : while (0)
445 : :
446 : : #endif
447 : :
448 : : #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
449 : : /* Copy COUNT objects from SRC to DST. The source and destination do
450 : : not overlap. */
451 : : # ifndef YYCOPY
452 : : # if defined __GNUC__ && 1 < __GNUC__
453 : : # define YYCOPY(Dst, Src, Count) \
454 : : __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
455 : : # else
456 : : # define YYCOPY(Dst, Src, Count) \
457 : : do \
458 : : { \
459 : : YYPTRDIFF_T yyi; \
460 : : for (yyi = 0; yyi < (Count); yyi++) \
461 : : (Dst)[yyi] = (Src)[yyi]; \
462 : : } \
463 : : while (0)
464 : : # endif
465 : : # endif
466 : : #endif /* !YYCOPY_NEEDED */
467 : :
468 : : /* YYFINAL -- State number of the termination state. */
469 : : #define YYFINAL 8
470 : : /* YYLAST -- Last index in YYTABLE. */
471 : : #define YYLAST 12
472 : :
473 : : /* YYNTOKENS -- Number of terminals. */
474 : : #define YYNTOKENS 7
475 : : /* YYNNTS -- Number of nonterminals. */
476 : : #define YYNNTS 4
477 : : /* YYNRULES -- Number of rules. */
478 : : #define YYNRULES 9
479 : : /* YYNSTATES -- Number of states. */
480 : : #define YYNSTATES 14
481 : :
482 : : /* YYMAXUTOK -- Last valid token kind. */
483 : : #define YYMAXUTOK 261
484 : :
485 : :
486 : : /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
487 : : as returned by yylex, with out-of-bounds checking. */
488 : : #define YYTRANSLATE(YYX) \
489 : : (0 <= (YYX) && (YYX) <= YYMAXUTOK \
490 : : ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
491 : : : YYSYMBOL_YYUNDEF)
492 : :
493 : : /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
494 : : as returned by yylex. */
495 : : static const yytype_int8 yytranslate[] =
496 : : {
497 : : 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
498 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
499 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
500 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
505 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
506 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
507 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
508 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
509 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
510 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
511 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
512 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
513 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
514 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
515 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
516 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
517 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
518 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
519 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
520 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521 : : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
522 : : 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
523 : : 5, 6
524 : : };
525 : :
526 : : #if YYDEBUG
527 : : /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
528 : : static const yytype_uint8 yyrline[] =
529 : : {
530 : : 0, 62, 62, 78, 96, 106, 116, 124, 136, 150
531 : : };
532 : : #endif
533 : :
534 : : /** Accessing symbol of state STATE. */
535 : : #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
536 : :
537 : : #if YYDEBUG || 0
538 : : /* The user-facing name of the symbol whose (internal) number is
539 : : YYSYMBOL. No bounds checking. */
540 : : static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
541 : :
542 : : /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
543 : : First, the terminals, then, starting at YYNTOKENS, nonterminals. */
544 : : static const char *const yytname[] =
545 : : {
546 : : "\"end of file\"", "error", "\"invalid token\"", "SEGFLOAT", "RANGE",
547 : : "PLUMIN", "EXTENSION", "$accept", "range", "boundary", "deviation", YY_NULLPTR
548 : : };
549 : :
550 : : static const char *
551 : : yysymbol_name (yysymbol_kind_t yysymbol)
552 : : {
553 : : return yytname[yysymbol];
554 : : }
555 : : #endif
556 : :
557 : : #define YYPACT_NINF (-3)
558 : :
559 : : #define yypact_value_is_default(Yyn) \
560 : : ((Yyn) == YYPACT_NINF)
561 : :
562 : : #define YYTABLE_NINF (-1)
563 : :
564 : : #define yytable_value_is_error(Yyn) \
565 : : 0
566 : :
567 : : /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
568 : : STATE-NUM. */
569 : : static const yytype_int8 yypact[] =
570 : : {
571 : : -1, -3, 3, 1, 8, 6, -3, -3, -3, 3,
572 : : 9, -3, -3, -3
573 : : };
574 : :
575 : : /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
576 : : Performed when YYTABLE does not specify something else to do. Zero
577 : : means the default is an error. */
578 : : static const yytype_int8 yydefact[] =
579 : : {
580 : : 0, 7, 0, 0, 0, 6, 5, 8, 1, 4,
581 : : 0, 3, 9, 2
582 : : };
583 : :
584 : : /* YYPGOTO[NTERM-NUM]. */
585 : : static const yytype_int8 yypgoto[] =
586 : : {
587 : : -3, -3, -2, -3
588 : : };
589 : :
590 : : /* YYDEFGOTO[NTERM-NUM]. */
591 : : static const yytype_int8 yydefgoto[] =
592 : : {
593 : : 0, 4, 5, 13
594 : : };
595 : :
596 : : /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
597 : : positive, shift that token. If negative, reduce the rule whose
598 : : number is the opposite. If YYTABLE_NINF, syntax error. */
599 : : static const yytype_int8 yytable[] =
600 : : {
601 : : 6, 0, 1, 2, 7, 3, 1, 11, 8, 3,
602 : : 9, 10, 12
603 : : };
604 : :
605 : : static const yytype_int8 yycheck[] =
606 : : {
607 : : 2, -1, 3, 4, 3, 6, 3, 9, 0, 6,
608 : : 4, 5, 3
609 : : };
610 : :
611 : : /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
612 : : state STATE-NUM. */
613 : : static const yytype_int8 yystos[] =
614 : : {
615 : : 0, 3, 4, 6, 8, 9, 9, 3, 0, 4,
616 : : 5, 9, 3, 10
617 : : };
618 : :
619 : : /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
620 : : static const yytype_int8 yyr1[] =
621 : : {
622 : : 0, 7, 8, 8, 8, 8, 8, 9, 9, 10
623 : : };
624 : :
625 : : /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
626 : : static const yytype_int8 yyr2[] =
627 : : {
628 : : 0, 2, 3, 3, 2, 2, 1, 1, 2, 1
629 : : };
630 : :
631 : :
632 : : enum { YYENOMEM = -2 };
633 : :
634 : : #define yyerrok (yyerrstatus = 0)
635 : : #define yyclearin (yychar = YYEMPTY)
636 : :
637 : : #define YYACCEPT goto yyacceptlab
638 : : #define YYABORT goto yyabortlab
639 : : #define YYERROR goto yyerrorlab
640 : : #define YYNOMEM goto yyexhaustedlab
641 : :
642 : :
643 : : #define YYRECOVERING() (!!yyerrstatus)
644 : :
645 : : #define YYBACKUP(Token, Value) \
646 : : do \
647 : : if (yychar == YYEMPTY) \
648 : : { \
649 : : yychar = (Token); \
650 : : yylval = (Value); \
651 : : YYPOPSTACK (yylen); \
652 : : yystate = *yyssp; \
653 : : goto yybackup; \
654 : : } \
655 : : else \
656 : : { \
657 : : yyerror (result, escontext, yyscanner, YY_("syntax error: cannot back up")); \
658 : : YYERROR; \
659 : : } \
660 : : while (0)
661 : :
662 : : /* Backward compatibility with an undocumented macro.
663 : : Use YYerror or YYUNDEF. */
664 : : #define YYERRCODE YYUNDEF
665 : :
666 : :
667 : : /* Enable debugging if requested. */
668 : : #if YYDEBUG
669 : :
670 : : # ifndef YYFPRINTF
671 : : # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
672 : : # define YYFPRINTF fprintf
673 : : # endif
674 : :
675 : : # define YYDPRINTF(Args) \
676 : : do { \
677 : : if (yydebug) \
678 : : YYFPRINTF Args; \
679 : : } while (0)
680 : :
681 : :
682 : :
683 : :
684 : : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
685 : : do { \
686 : : if (yydebug) \
687 : : { \
688 : : YYFPRINTF (stderr, "%s ", Title); \
689 : : yy_symbol_print (stderr, \
690 : : Kind, Value, result, escontext, yyscanner); \
691 : : YYFPRINTF (stderr, "\n"); \
692 : : } \
693 : : } while (0)
694 : :
695 : :
696 : : /*-----------------------------------.
697 : : | Print this symbol's value on YYO. |
698 : : `-----------------------------------*/
699 : :
700 : : static void
701 : : yy_symbol_value_print (FILE *yyo,
702 : : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, SEG *result, struct Node *escontext, yyscan_t yyscanner)
703 : : {
704 : : FILE *yyoutput = yyo;
705 : : YY_USE (yyoutput);
706 : : YY_USE (result);
707 : : YY_USE (escontext);
708 : : YY_USE (yyscanner);
709 : : if (!yyvaluep)
710 : : return;
711 : : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
712 : : YY_USE (yykind);
713 : : YY_IGNORE_MAYBE_UNINITIALIZED_END
714 : : }
715 : :
716 : :
717 : : /*---------------------------.
718 : : | Print this symbol on YYO. |
719 : : `---------------------------*/
720 : :
721 : : static void
722 : : yy_symbol_print (FILE *yyo,
723 : : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, SEG *result, struct Node *escontext, yyscan_t yyscanner)
724 : : {
725 : : YYFPRINTF (yyo, "%s %s (",
726 : : yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
727 : :
728 : : yy_symbol_value_print (yyo, yykind, yyvaluep, result, escontext, yyscanner);
729 : : YYFPRINTF (yyo, ")");
730 : : }
731 : :
732 : : /*------------------------------------------------------------------.
733 : : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
734 : : | TOP (included). |
735 : : `------------------------------------------------------------------*/
736 : :
737 : : static void
738 : : yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
739 : : {
740 : : YYFPRINTF (stderr, "Stack now");
741 : : for (; yybottom <= yytop; yybottom++)
742 : : {
743 : : int yybot = *yybottom;
744 : : YYFPRINTF (stderr, " %d", yybot);
745 : : }
746 : : YYFPRINTF (stderr, "\n");
747 : : }
748 : :
749 : : # define YY_STACK_PRINT(Bottom, Top) \
750 : : do { \
751 : : if (yydebug) \
752 : : yy_stack_print ((Bottom), (Top)); \
753 : : } while (0)
754 : :
755 : :
756 : : /*------------------------------------------------.
757 : : | Report that the YYRULE is going to be reduced. |
758 : : `------------------------------------------------*/
759 : :
760 : : static void
761 : : yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
762 : : int yyrule, SEG *result, struct Node *escontext, yyscan_t yyscanner)
763 : : {
764 : : int yylno = yyrline[yyrule];
765 : : int yynrhs = yyr2[yyrule];
766 : : int yyi;
767 : : YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
768 : : yyrule - 1, yylno);
769 : : /* The symbols being reduced. */
770 : : for (yyi = 0; yyi < yynrhs; yyi++)
771 : : {
772 : : YYFPRINTF (stderr, " $%d = ", yyi + 1);
773 : : yy_symbol_print (stderr,
774 : : YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
775 : : &yyvsp[(yyi + 1) - (yynrhs)], result, escontext, yyscanner);
776 : : YYFPRINTF (stderr, "\n");
777 : : }
778 : : }
779 : :
780 : : # define YY_REDUCE_PRINT(Rule) \
781 : : do { \
782 : : if (yydebug) \
783 : : yy_reduce_print (yyssp, yyvsp, Rule, result, escontext, yyscanner); \
784 : : } while (0)
785 : :
786 : : /* Nonzero means print parse trace. It is left uninitialized so that
787 : : multiple parsers can coexist. */
788 : : int yydebug;
789 : : #else /* !YYDEBUG */
790 : : # define YYDPRINTF(Args) ((void) 0)
791 : : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
792 : : # define YY_STACK_PRINT(Bottom, Top)
793 : : # define YY_REDUCE_PRINT(Rule)
794 : : #endif /* !YYDEBUG */
795 : :
796 : :
797 : : /* YYINITDEPTH -- initial size of the parser's stacks. */
798 : : #ifndef YYINITDEPTH
799 : : # define YYINITDEPTH 200
800 : : #endif
801 : :
802 : : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
803 : : if the built-in stack extension method is used).
804 : :
805 : : Do not make this value too large; the results are undefined if
806 : : YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
807 : : evaluated with infinite-precision integer arithmetic. */
808 : :
809 : : #ifndef YYMAXDEPTH
810 : : # define YYMAXDEPTH 10000
811 : : #endif
812 : :
813 : :
814 : :
815 : :
816 : :
817 : :
818 : : /*-----------------------------------------------.
819 : : | Release the memory associated to this symbol. |
820 : : `-----------------------------------------------*/
821 : :
822 : : static void
823 : 5638 : yydestruct (const char *yymsg,
824 : : yysymbol_kind_t yykind, YYSTYPE *yyvaluep, SEG *result, struct Node *escontext, yyscan_t yyscanner)
825 : : {
826 : : YY_USE (yyvaluep);
827 : : YY_USE (result);
828 : : YY_USE (escontext);
829 : : YY_USE (yyscanner);
830 [ - + ]: 5638 : if (!yymsg)
831 : 0 : yymsg = "Deleting";
832 : : YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
833 : :
834 : : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
835 : : YY_USE (yykind);
836 : : YY_IGNORE_MAYBE_UNINITIALIZED_END
837 : 5638 : }
838 : :
839 : :
840 : :
841 : :
842 : :
843 : :
844 : : /*----------.
845 : : | yyparse. |
846 : : `----------*/
847 : :
848 : : int
849 : 2832 : yyparse (SEG *result, struct Node *escontext, yyscan_t yyscanner)
850 : : {
851 : : /* Lookahead token kind. */
852 : : int yychar;
853 : :
854 : :
855 : : /* The semantic value of the lookahead symbol. */
856 : : /* Default value used for initialization, for pacifying older GCCs
857 : : or non-GCC compilers. */
858 : : YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
859 : : YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
860 : :
861 : : /* Number of syntax errors so far. */
862 : 2832 : int yynerrs = 0;
863 : :
864 : 2832 : yy_state_fast_t yystate = 0;
865 : : /* Number of tokens to shift before error messages enabled. */
866 : 2832 : int yyerrstatus = 0;
867 : :
868 : : /* Refer to the stacks through separate pointers, to allow yyoverflow
869 : : to reallocate them elsewhere. */
870 : :
871 : : /* Their size. */
872 : 2832 : YYPTRDIFF_T yystacksize = YYINITDEPTH;
873 : :
874 : : /* The state stack: array, bottom, top. */
875 : : yy_state_t yyssa[YYINITDEPTH];
876 : 2832 : yy_state_t *yyss = yyssa;
877 : 2832 : yy_state_t *yyssp = yyss;
878 : :
879 : : /* The semantic value stack: array, bottom, top. */
880 : : YYSTYPE yyvsa[YYINITDEPTH];
881 : 2832 : YYSTYPE *yyvs = yyvsa;
882 : 2832 : YYSTYPE *yyvsp = yyvs;
883 : :
884 : : int yyn;
885 : : /* The return value of yyparse. */
886 : : int yyresult;
887 : : /* Lookahead symbol kind. */
888 : 2832 : yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
889 : : /* The variables used to return semantic value and location from the
890 : : action routines. */
891 : : YYSTYPE yyval;
892 : :
893 : :
894 : :
895 : : #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
896 : :
897 : : /* The number of symbols on the RHS of the reduced rule.
898 : : Keep to zero when no symbol should be popped. */
899 : 2832 : int yylen = 0;
900 : :
901 : : YYDPRINTF ((stderr, "Starting parse\n"));
902 : :
903 : 2832 : yychar = YYEMPTY; /* Cause a token to be read. */
904 : :
905 : 2832 : goto yysetstate;
906 : :
907 : :
908 : : /*------------------------------------------------------------.
909 : : | yynewstate -- push a new state, which is found in yystate. |
910 : : `------------------------------------------------------------*/
911 : 19705 : yynewstate:
912 : : /* In all cases, when you get here, the value and location stacks
913 : : have just been pushed. So pushing a state here evens the stacks. */
914 : 19705 : yyssp++;
915 : :
916 : :
917 : : /*--------------------------------------------------------------------.
918 : : | yysetstate -- set current state (the top of the stack) to yystate. |
919 : : `--------------------------------------------------------------------*/
920 : 22537 : yysetstate:
921 : : YYDPRINTF ((stderr, "Entering state %d\n", yystate));
922 : : YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
923 : : YY_IGNORE_USELESS_CAST_BEGIN
924 : 22537 : *yyssp = YY_CAST (yy_state_t, yystate);
925 : : YY_IGNORE_USELESS_CAST_END
926 : : YY_STACK_PRINT (yyss, yyssp);
927 : :
928 [ - + ]: 22537 : if (yyss + yystacksize - 1 <= yyssp)
929 : : #if !defined yyoverflow && !defined YYSTACK_RELOCATE
930 : : YYNOMEM;
931 : : #else
932 : : {
933 : : /* Get the current used size of the three stacks, in elements. */
934 : 0 : YYPTRDIFF_T yysize = yyssp - yyss + 1;
935 : :
936 : : # if defined yyoverflow
937 : : {
938 : : /* Give user a chance to reallocate the stack. Use copies of
939 : : these so that the &'s don't force the real ones into
940 : : memory. */
941 : : yy_state_t *yyss1 = yyss;
942 : : YYSTYPE *yyvs1 = yyvs;
943 : :
944 : : /* Each stack pointer address is followed by the size of the
945 : : data in use in that stack, in bytes. This used to be a
946 : : conditional around just the two extra args, but that might
947 : : be undefined if yyoverflow is a macro. */
948 : : yyoverflow (YY_("memory exhausted"),
949 : : &yyss1, yysize * YYSIZEOF (*yyssp),
950 : : &yyvs1, yysize * YYSIZEOF (*yyvsp),
951 : : &yystacksize);
952 : : yyss = yyss1;
953 : : yyvs = yyvs1;
954 : : }
955 : : # else /* defined YYSTACK_RELOCATE */
956 : : /* Extend the stack our own way. */
957 [ # # ]: 0 : if (YYMAXDEPTH <= yystacksize)
958 : 0 : YYNOMEM;
959 : 0 : yystacksize *= 2;
960 [ # # ]: 0 : if (YYMAXDEPTH < yystacksize)
961 : 0 : yystacksize = YYMAXDEPTH;
962 : :
963 : : {
964 : 0 : yy_state_t *yyss1 = yyss;
965 : : union yyalloc *yyptr =
966 : 0 : YY_CAST (union yyalloc *,
967 : : YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
968 [ # # ]: 0 : if (! yyptr)
969 : 0 : YYNOMEM;
970 : 0 : YYSTACK_RELOCATE (yyss_alloc, yyss);
971 : 0 : YYSTACK_RELOCATE (yyvs_alloc, yyvs);
972 : : # undef YYSTACK_RELOCATE
973 [ # # ]: 0 : if (yyss1 != yyssa)
974 : 0 : YYSTACK_FREE (yyss1);
975 : : }
976 : : # endif
977 : :
978 : 0 : yyssp = yyss + yysize - 1;
979 : 0 : yyvsp = yyvs + yysize - 1;
980 : :
981 : : YY_IGNORE_USELESS_CAST_BEGIN
982 : : YYDPRINTF ((stderr, "Stack size increased to %ld\n",
983 : : YY_CAST (long, yystacksize)));
984 : : YY_IGNORE_USELESS_CAST_END
985 : :
986 [ # # ]: 0 : if (yyss + yystacksize - 1 <= yyssp)
987 : 0 : YYABORT;
988 : : }
989 : : #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
990 : :
991 : :
992 [ + + ]: 22537 : if (yystate == YYFINAL)
993 : 2815 : YYACCEPT;
994 : :
995 : 19722 : goto yybackup;
996 : :
997 : :
998 : : /*-----------.
999 : : | yybackup. |
1000 : : `-----------*/
1001 : 19722 : yybackup:
1002 : : /* Do appropriate processing given the current state. Read a
1003 : : lookahead token if we need one and don't already have one. */
1004 : :
1005 : : /* First try to decide what to do without reference to lookahead token. */
1006 : 19722 : yyn = yypact[yystate];
1007 [ + + ]: 19722 : if (yypact_value_is_default (yyn))
1008 : 7608 : goto yydefault;
1009 : :
1010 : : /* Not known => get a lookahead token if don't already have one. */
1011 : :
1012 : : /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1013 [ + + ]: 12114 : if (yychar == YYEMPTY)
1014 : : {
1015 : : YYDPRINTF ((stderr, "Reading a token\n"));
1016 : 11708 : yychar = yylex (&yylval, yyscanner);
1017 : : }
1018 : :
1019 [ + + ]: 12114 : if (yychar <= YYEOF)
1020 : : {
1021 : 3218 : yychar = YYEOF;
1022 : 3218 : yytoken = YYSYMBOL_YYEOF;
1023 : : YYDPRINTF ((stderr, "Now at end of input.\n"));
1024 : : }
1025 [ - + ]: 8896 : else if (yychar == YYerror)
1026 : : {
1027 : : /* The scanner already issued an error message, process directly
1028 : : to error recovery. But do not keep the error token as
1029 : : lookahead, it is too special and may lead us to an endless
1030 : : loop in error recovery. */
1031 : 0 : yychar = YYUNDEF;
1032 : 0 : yytoken = YYSYMBOL_YYerror;
1033 : 0 : goto yyerrlab1;
1034 : : }
1035 : : else
1036 : : {
1037 [ + - + - ]: 8896 : yytoken = YYTRANSLATE (yychar);
1038 : : YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1039 : : }
1040 : :
1041 : : /* If the proper action on seeing token YYTOKEN is to reduce or to
1042 : : detect an error, take that action. */
1043 : 12114 : yyn += yytoken;
1044 [ + + + - : 12114 : if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ + ]
1045 : 420 : goto yydefault;
1046 : 11694 : yyn = yytable[yyn];
1047 [ - + ]: 11694 : if (yyn <= 0)
1048 : : {
1049 : : if (yytable_value_is_error (yyn))
1050 : : goto yyerrlab;
1051 : 0 : yyn = -yyn;
1052 : 0 : goto yyreduce;
1053 : : }
1054 : :
1055 : : /* Count tokens shifted since error; after three, turn off error
1056 : : status. */
1057 [ - + ]: 11694 : if (yyerrstatus)
1058 : 0 : yyerrstatus--;
1059 : :
1060 : : /* Shift the lookahead token. */
1061 : : YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1062 : 11694 : yystate = yyn;
1063 : : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1064 : 11694 : *++yyvsp = yylval;
1065 : : YY_IGNORE_MAYBE_UNINITIALIZED_END
1066 : :
1067 : : /* Discard the shifted token. */
1068 : 11694 : yychar = YYEMPTY;
1069 : 11694 : goto yynewstate;
1070 : :
1071 : :
1072 : : /*-----------------------------------------------------------.
1073 : : | yydefault -- do the default action for the current state. |
1074 : : `-----------------------------------------------------------*/
1075 : 8028 : yydefault:
1076 : 8028 : yyn = yydefact[yystate];
1077 [ + + ]: 8028 : if (yyn == 0)
1078 : 14 : goto yyerrlab;
1079 : 8014 : goto yyreduce;
1080 : :
1081 : :
1082 : : /*-----------------------------.
1083 : : | yyreduce -- do a reduction. |
1084 : : `-----------------------------*/
1085 : 8014 : yyreduce:
1086 : : /* yyn is the number of a rule to reduce with. */
1087 : 8014 : yylen = yyr2[yyn];
1088 : :
1089 : : /* If YYLEN is nonzero, implement the default value of the action:
1090 : : '$$ = $1'.
1091 : :
1092 : : Otherwise, the following line sets YYVAL to garbage.
1093 : : This behavior is undocumented and Bison
1094 : : users should not rely upon it. Assigning to YYVAL
1095 : : unconditionally makes the parser a bit smaller, and it avoids a
1096 : : GCC warning that YYVAL may be used uninitialized. */
1097 : 8014 : yyval = yyvsp[1-yylen];
1098 : :
1099 : :
1100 : : YY_REDUCE_PRINT (yyn);
1101 [ + + + + : 8014 : switch (yyn)
+ + + +
- ]
1102 : : {
1103 : 7 : case 2: /* range: boundary PLUMIN deviation */
1104 : : #line 63 "segparse.y"
1105 : : {
1106 : : char strbuf[25];
1107 : :
1108 : : result->lower = (yyvsp[-2].bnd).val - (yyvsp[0].bnd).val;
1109 : : result->upper = (yyvsp[-2].bnd).val + (yyvsp[0].bnd).val;
1110 : : snprintf(strbuf, sizeof(strbuf), "%g", result->lower);
1111 : : result->l_sigd = Max(sig_digits(strbuf), Max((yyvsp[-2].bnd).sigd, (yyvsp[0].bnd).sigd));
1112 : : snprintf(strbuf, sizeof(strbuf), "%g", result->upper);
1113 : : result->u_sigd = Max(sig_digits(strbuf), Max((yyvsp[-2].bnd).sigd, (yyvsp[0].bnd).sigd));
1114 : : result->l_ext = '\0';
1115 : : result->u_ext = '\0';
1116 : :
1117 : : (void) yynerrs; /* suppress compiler warning */
1118 : : }
1119 : : #line 1120 "segparse.c"
1120 : 7 : break;
1121 : :
1122 [ - + ]: 2360 : case 3: /* range: boundary RANGE boundary */
1123 : : #line 79 "segparse.y"
1124 : : {
1125 : : result->lower = (yyvsp[-2].bnd).val;
1126 : : result->upper = (yyvsp[0].bnd).val;
1127 : : if ( result->lower > result->upper ) {
1128 : : errsave(escontext,
1129 : : (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1130 : : errmsg("swapped boundaries: %g is greater than %g",
1131 : : result->lower, result->upper)));
1132 : :
1133 : : YYERROR;
1134 : : }
1135 : : result->l_sigd = (yyvsp[-2].bnd).sigd;
1136 : : result->u_sigd = (yyvsp[0].bnd).sigd;
1137 : : result->l_ext = ( (yyvsp[-2].bnd).ext ? (yyvsp[-2].bnd).ext : '\0' );
1138 : : result->u_ext = ( (yyvsp[0].bnd).ext ? (yyvsp[0].bnd).ext : '\0' );
1139 : : }
1140 : : #line 1141 "segparse.c"
1141 : 2360 : break;
1142 : :
1143 : 46 : case 4: /* range: boundary RANGE */
1144 : : #line 97 "segparse.y"
1145 : : {
1146 : : result->lower = (yyvsp[-1].bnd).val;
1147 : : result->upper = HUGE_VAL;
1148 : : result->l_sigd = (yyvsp[-1].bnd).sigd;
1149 : : result->u_sigd = 0;
1150 : : result->l_ext = ( (yyvsp[-1].bnd).ext ? (yyvsp[-1].bnd).ext : '\0' );
1151 : : result->u_ext = '-';
1152 : : }
1153 : : #line 1154 "segparse.c"
1154 : 46 : break;
1155 : :
1156 : 49 : case 5: /* range: RANGE boundary */
1157 : : #line 107 "segparse.y"
1158 : : {
1159 : : result->lower = -HUGE_VAL;
1160 : : result->upper = (yyvsp[0].bnd).val;
1161 : : result->l_sigd = 0;
1162 : : result->u_sigd = (yyvsp[0].bnd).sigd;
1163 : : result->l_ext = '-';
1164 : : result->u_ext = ( (yyvsp[0].bnd).ext ? (yyvsp[0].bnd).ext : '\0' );
1165 : : }
1166 : : #line 1167 "segparse.c"
1167 : 49 : break;
1168 : :
1169 : 360 : case 6: /* range: boundary */
1170 : : #line 117 "segparse.y"
1171 : : {
1172 : : result->lower = result->upper = (yyvsp[0].bnd).val;
1173 : : result->l_sigd = result->u_sigd = (yyvsp[0].bnd).sigd;
1174 : : result->l_ext = result->u_ext = ( (yyvsp[0].bnd).ext ? (yyvsp[0].bnd).ext : '\0' );
1175 : : }
1176 : : #line 1177 "segparse.c"
1177 : 360 : break;
1178 : :
1179 : 3960 : case 7: /* boundary: SEGFLOAT */
1180 : : #line 125 "segparse.y"
1181 : : {
1182 : : /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
1183 : : float val;
1184 : :
1185 : : if (!seg_atof((yyvsp[0].text), &val, escontext))
1186 : : YYABORT;
1187 : :
1188 : : (yyval.bnd).ext = '\0';
1189 : : (yyval.bnd).sigd = sig_digits((yyvsp[0].text));
1190 : : (yyval.bnd).val = val;
1191 : : }
1192 : : #line 1193 "segparse.c"
1193 : 3957 : break;
1194 : :
1195 : 1225 : case 8: /* boundary: EXTENSION SEGFLOAT */
1196 : : #line 137 "segparse.y"
1197 : : {
1198 : : /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
1199 : : float val;
1200 : :
1201 : : if (!seg_atof((yyvsp[0].text), &val, escontext))
1202 : : YYABORT;
1203 : :
1204 : : (yyval.bnd).ext = (yyvsp[-1].text)[0];
1205 : : (yyval.bnd).sigd = sig_digits((yyvsp[0].text));
1206 : : (yyval.bnd).val = val;
1207 : : }
1208 : : #line 1209 "segparse.c"
1209 : 1225 : break;
1210 : :
1211 : 7 : case 9: /* deviation: SEGFLOAT */
1212 : : #line 151 "segparse.y"
1213 : : {
1214 : : /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
1215 : : float val;
1216 : :
1217 : : if (!seg_atof((yyvsp[0].text), &val, escontext))
1218 : : YYABORT;
1219 : :
1220 : : (yyval.bnd).ext = '\0';
1221 : : (yyval.bnd).sigd = sig_digits((yyvsp[0].text));
1222 : : (yyval.bnd).val = val;
1223 : : }
1224 : : #line 1225 "segparse.c"
1225 : 7 : break;
1226 : :
1227 : :
1228 : : #line 1229 "segparse.c"
1229 : :
1230 : 0 : default: break;
1231 : : }
1232 : : /* User semantic actions sometimes alter yychar, and that requires
1233 : : that yytoken be updated with the new translation. We take the
1234 : : approach of translating immediately before every use of yytoken.
1235 : : One alternative is translating here after every semantic action,
1236 : : but that translation would be missed if the semantic action invokes
1237 : : YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1238 : : if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1239 : : incorrect destructor might then be invoked immediately. In the
1240 : : case of YYERROR or YYBACKUP, subsequent parser actions might lead
1241 : : to an incorrect destructor call or verbose syntax error message
1242 : : before the lookahead is translated. */
1243 : : YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1244 : :
1245 : 8011 : YYPOPSTACK (yylen);
1246 : 8011 : yylen = 0;
1247 : :
1248 : 8011 : *++yyvsp = yyval;
1249 : :
1250 : : /* Now 'shift' the result of the reduction. Determine what state
1251 : : that goes to, based on the state we popped back to and the rule
1252 : : number reduced by. */
1253 : : {
1254 : 8011 : const int yylhs = yyr1[yyn] - YYNTOKENS;
1255 : 8011 : const int yyi = yypgoto[yylhs] + *yyssp;
1256 [ + - + + ]: 2416 : yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1257 : 2409 : ? yytable[yyi]
1258 [ + + ]: 10427 : : yydefgoto[yylhs]);
1259 : : }
1260 : :
1261 : 8011 : goto yynewstate;
1262 : :
1263 : :
1264 : : /*--------------------------------------.
1265 : : | yyerrlab -- here on detecting error. |
1266 : : `--------------------------------------*/
1267 : 14 : yyerrlab:
1268 : : /* Make sure we have latest lookahead translation. See comments at
1269 : : user semantic actions for why this is necessary. */
1270 [ + - + - : 14 : yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
+ - ]
1271 : : /* If not already recovering from an error, report this error. */
1272 [ + - ]: 14 : if (!yyerrstatus)
1273 : : {
1274 : 14 : ++yynerrs;
1275 : 14 : yyerror (result, escontext, yyscanner, YY_("syntax error"));
1276 : : }
1277 : :
1278 [ - + ]: 6 : if (yyerrstatus == 3)
1279 : : {
1280 : : /* If just tried and failed to reuse lookahead token after an
1281 : : error, discard it. */
1282 : :
1283 [ # # ]: 0 : if (yychar <= YYEOF)
1284 : : {
1285 : : /* Return failure if at end of input. */
1286 [ # # ]: 0 : if (yychar == YYEOF)
1287 : 0 : YYABORT;
1288 : : }
1289 : : else
1290 : : {
1291 : 0 : yydestruct ("Error: discarding",
1292 : : yytoken, &yylval, result, escontext, yyscanner);
1293 : 0 : yychar = YYEMPTY;
1294 : : }
1295 : : }
1296 : :
1297 : : /* Else will try to reuse lookahead token after shifting the error
1298 : : token. */
1299 : 6 : goto yyerrlab1;
1300 : :
1301 : :
1302 : : /*---------------------------------------------------.
1303 : : | yyerrorlab -- error raised explicitly by YYERROR. |
1304 : : `---------------------------------------------------*/
1305 : 0 : yyerrorlab:
1306 : : /* Pacify compilers when the user code never invokes YYERROR and the
1307 : : label yyerrorlab therefore never appears in user code. */
1308 : : if (0)
1309 : : YYERROR;
1310 : 0 : ++yynerrs;
1311 : :
1312 : : /* Do not reclaim the symbols of the rule whose action triggered
1313 : : this YYERROR. */
1314 : 0 : YYPOPSTACK (yylen);
1315 : 0 : yylen = 0;
1316 : : YY_STACK_PRINT (yyss, yyssp);
1317 : 0 : yystate = *yyssp;
1318 : 0 : goto yyerrlab1;
1319 : :
1320 : :
1321 : : /*-------------------------------------------------------------.
1322 : : | yyerrlab1 -- common code for both syntax error and YYERROR. |
1323 : : `-------------------------------------------------------------*/
1324 : 6 : yyerrlab1:
1325 : 6 : yyerrstatus = 3; /* Each real token shifted decrements this. */
1326 : :
1327 : : /* Pop stack until we find a state that shifts the error token. */
1328 : : for (;;)
1329 : : {
1330 : 8 : yyn = yypact[yystate];
1331 [ + - ]: 8 : if (!yypact_value_is_default (yyn))
1332 : : {
1333 : 8 : yyn += YYSYMBOL_YYerror;
1334 [ + - + - : 8 : if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
- + ]
1335 : : {
1336 : 0 : yyn = yytable[yyn];
1337 [ # # ]: 0 : if (0 < yyn)
1338 : 0 : break;
1339 : : }
1340 : : }
1341 : :
1342 : : /* Pop the current state because it cannot handle the error token. */
1343 [ + + ]: 8 : if (yyssp == yyss)
1344 : 6 : YYABORT;
1345 : :
1346 : :
1347 : 2 : yydestruct ("Error: popping",
1348 : 2 : YY_ACCESSING_SYMBOL (yystate), yyvsp, result, escontext, yyscanner);
1349 : 2 : YYPOPSTACK (1);
1350 : 2 : yystate = *yyssp;
1351 : : YY_STACK_PRINT (yyss, yyssp);
1352 : : }
1353 : :
1354 : : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1355 : 0 : *++yyvsp = yylval;
1356 : : YY_IGNORE_MAYBE_UNINITIALIZED_END
1357 : :
1358 : :
1359 : : /* Shift the error token. */
1360 : : YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1361 : :
1362 : 0 : yystate = yyn;
1363 : 0 : goto yynewstate;
1364 : :
1365 : :
1366 : : /*-------------------------------------.
1367 : : | yyacceptlab -- YYACCEPT comes here. |
1368 : : `-------------------------------------*/
1369 : 2815 : yyacceptlab:
1370 : 2815 : yyresult = 0;
1371 : 2815 : goto yyreturnlab;
1372 : :
1373 : :
1374 : : /*-----------------------------------.
1375 : : | yyabortlab -- YYABORT comes here. |
1376 : : `-----------------------------------*/
1377 : 8 : yyabortlab:
1378 : 8 : yyresult = 1;
1379 : 8 : goto yyreturnlab;
1380 : :
1381 : :
1382 : : /*-----------------------------------------------------------.
1383 : : | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1384 : : `-----------------------------------------------------------*/
1385 : 0 : yyexhaustedlab:
1386 : 0 : yyerror (result, escontext, yyscanner, YY_("memory exhausted"));
1387 : 0 : yyresult = 2;
1388 : 0 : goto yyreturnlab;
1389 : :
1390 : :
1391 : : /*----------------------------------------------------------.
1392 : : | yyreturnlab -- parsing is finished, clean up and return. |
1393 : : `----------------------------------------------------------*/
1394 : 2823 : yyreturnlab:
1395 [ + + ]: 2823 : if (yychar != YYEMPTY)
1396 : : {
1397 : : /* Make sure we have latest lookahead translation. See comments at
1398 : : user semantic actions for why this is necessary. */
1399 [ + - + - ]: 6 : yytoken = YYTRANSLATE (yychar);
1400 : 6 : yydestruct ("Cleanup: discarding lookahead",
1401 : : yytoken, &yylval, result, escontext, yyscanner);
1402 : : }
1403 : : /* Do not reclaim the symbols of the rule whose action triggered
1404 : : this YYABORT or YYACCEPT. */
1405 : 2823 : YYPOPSTACK (yylen);
1406 : : YY_STACK_PRINT (yyss, yyssp);
1407 [ + + ]: 8453 : while (yyssp != yyss)
1408 : : {
1409 : 5630 : yydestruct ("Cleanup: popping",
1410 : 5630 : YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, result, escontext, yyscanner);
1411 : 5630 : YYPOPSTACK (1);
1412 : : }
1413 : : #ifndef yyoverflow
1414 [ - + ]: 2823 : if (yyss != yyssa)
1415 : 0 : YYSTACK_FREE (yyss);
1416 : : #endif
1417 : :
1418 : 2823 : return yyresult;
1419 : : }
1420 : :
1421 : : #line 164 "segparse.y"
1422 : :
1423 : :
1424 : :
1425 : : static bool
1426 : : seg_atof(char *value, float *result, struct Node *escontext)
1427 : : {
1428 : : *result = float4in_internal(value, NULL, "seg", value, escontext);
1429 : : if (SOFT_ERROR_OCCURRED(escontext))
1430 : : return false;
1431 : : return true;
1432 : : }
1433 : :
1434 : : static int
1435 : : sig_digits(const char *value)
1436 : : {
1437 : : int n = significant_digits(value);
1438 : :
1439 : : /* Clamp, to ensure value will fit in sigd fields */
1440 : : return Min(n, FLT_DIG);
1441 : : }
|