Line data Source code
1 : /* A Bison parser, made by GNU Bison 3.7.5. */
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 <http://www.gnu.org/licenses/>. */
20 :
21 : /* As a special exception, you may create a larger work that contains
22 : part or all of the Bison parser skeleton and distribute that work
23 : under terms of your choice, so long as that work isn't itself a
24 : parser generator using the skeleton or a modified version thereof
25 : as a parser skeleton. Alternatively, if you modify or redistribute
26 : the parser skeleton itself, you may (at your option) remove this
27 : special exception, which will cause the skeleton and the resulting
28 : Bison output files to be licensed under the GNU General Public
29 : License without this special exception.
30 :
31 : This special exception was added by the Free Software Foundation in
32 : version 2.2 of Bison. */
33 :
34 : /* C LALR(1) parser skeleton written by Richard Stallman, by
35 : simplifying the original so-called "semantic" parser. */
36 :
37 : /* 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 30705
50 :
51 : /* Bison version string. */
52 : #define YYBISON_VERSION "3.7.5"
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 : #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
302 : /* Suppress an incorrect diagnostic about yylval being uninitialized. */
303 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
304 : _Pragma ("GCC diagnostic push") \
305 : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
306 : _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
307 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
308 : _Pragma ("GCC diagnostic pop")
309 : #else
310 : # define YY_INITIAL_VALUE(Value) Value
311 : #endif
312 : #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
313 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
314 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END
315 : #endif
316 : #ifndef YY_INITIAL_VALUE
317 : # define YY_INITIAL_VALUE(Value) /* Nothing. */
318 : #endif
319 :
320 : #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
321 : # define YY_IGNORE_USELESS_CAST_BEGIN \
322 : _Pragma ("GCC diagnostic push") \
323 : _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
324 : # define YY_IGNORE_USELESS_CAST_END \
325 : _Pragma ("GCC diagnostic pop")
326 : #endif
327 : #ifndef YY_IGNORE_USELESS_CAST_BEGIN
328 : # define YY_IGNORE_USELESS_CAST_BEGIN
329 : # define YY_IGNORE_USELESS_CAST_END
330 : #endif
331 :
332 :
333 : #define YY_ASSERT(E) ((void) (0 && (E)))
334 :
335 : #if !defined yyoverflow
336 :
337 : /* The parser invokes alloca or malloc; define the necessary symbols. */
338 :
339 : # ifdef YYSTACK_USE_ALLOCA
340 : # if YYSTACK_USE_ALLOCA
341 : # ifdef __GNUC__
342 : # define YYSTACK_ALLOC __builtin_alloca
343 : # elif defined __BUILTIN_VA_ARG_INCR
344 : # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
345 : # elif defined _AIX
346 : # define YYSTACK_ALLOC __alloca
347 : # elif defined _MSC_VER
348 : # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
349 : # define alloca _alloca
350 : # else
351 : # define YYSTACK_ALLOC alloca
352 : # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
353 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
354 : /* Use EXIT_SUCCESS as a witness for stdlib.h. */
355 : # ifndef EXIT_SUCCESS
356 : # define EXIT_SUCCESS 0
357 : # endif
358 : # endif
359 : # endif
360 : # endif
361 : # endif
362 :
363 : # ifdef YYSTACK_ALLOC
364 : /* Pacify GCC's 'empty if-body' warning. */
365 : # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
366 : # ifndef YYSTACK_ALLOC_MAXIMUM
367 : /* The OS might guarantee only one guard page at the bottom of the stack,
368 : and a page size can be as small as 4096 bytes. So we cannot safely
369 : invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
370 : to allow for a few compiler-allocated temporary stack slots. */
371 : # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
372 : # endif
373 : # else
374 : # define YYSTACK_ALLOC YYMALLOC
375 : # define YYSTACK_FREE YYFREE
376 : # ifndef YYSTACK_ALLOC_MAXIMUM
377 : # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
378 : # endif
379 : # if (defined __cplusplus && ! defined EXIT_SUCCESS \
380 : && ! ((defined YYMALLOC || defined malloc) \
381 : && (defined YYFREE || defined free)))
382 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
383 : # ifndef EXIT_SUCCESS
384 : # define EXIT_SUCCESS 0
385 : # endif
386 : # endif
387 : # ifndef YYMALLOC
388 : # define YYMALLOC malloc
389 : # if ! defined malloc && ! defined EXIT_SUCCESS
390 : void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
391 : # endif
392 : # endif
393 : # ifndef YYFREE
394 : # define YYFREE free
395 : # if ! defined free && ! defined EXIT_SUCCESS
396 : void free (void *); /* INFRINGES ON USER NAME SPACE */
397 : # endif
398 : # endif
399 : # endif
400 : #endif /* !defined yyoverflow */
401 :
402 : #if (! defined yyoverflow \
403 : && (! defined __cplusplus \
404 : || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
405 :
406 : /* A type that is properly aligned for any stack member. */
407 : union yyalloc
408 : {
409 : yy_state_t yyss_alloc;
410 : YYSTYPE yyvs_alloc;
411 : };
412 :
413 : /* The size of the maximum gap between one aligned stack and the next. */
414 : # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
415 :
416 : /* The size of an array large to enough to hold all stacks, each with
417 : N elements. */
418 : # define YYSTACK_BYTES(N) \
419 : ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
420 : + YYSTACK_GAP_MAXIMUM)
421 :
422 : # define YYCOPY_NEEDED 1
423 :
424 : /* Relocate STACK from its old location to the new one. The
425 : local variables YYSIZE and YYSTACKSIZE give the old and new number of
426 : elements in the stack, and YYPTR gives the new location of the
427 : stack. Advance YYPTR to a properly aligned location for the next
428 : stack. */
429 : # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
430 : do \
431 : { \
432 : YYPTRDIFF_T yynewbytes; \
433 : YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
434 : Stack = &yyptr->Stack_alloc; \
435 : yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
436 : yyptr += yynewbytes / YYSIZEOF (*yyptr); \
437 : } \
438 : while (0)
439 :
440 : #endif
441 :
442 : #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
443 : /* Copy COUNT objects from SRC to DST. The source and destination do
444 : not overlap. */
445 : # ifndef YYCOPY
446 : # if defined __GNUC__ && 1 < __GNUC__
447 : # define YYCOPY(Dst, Src, Count) \
448 : __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
449 : # else
450 : # define YYCOPY(Dst, Src, Count) \
451 : do \
452 : { \
453 : YYPTRDIFF_T yyi; \
454 : for (yyi = 0; yyi < (Count); yyi++) \
455 : (Dst)[yyi] = (Src)[yyi]; \
456 : } \
457 : while (0)
458 : # endif
459 : # endif
460 : #endif /* !YYCOPY_NEEDED */
461 :
462 : /* YYFINAL -- State number of the termination state. */
463 : #define YYFINAL 8
464 : /* YYLAST -- Last index in YYTABLE. */
465 : #define YYLAST 12
466 :
467 : /* YYNTOKENS -- Number of terminals. */
468 : #define YYNTOKENS 7
469 : /* YYNNTS -- Number of nonterminals. */
470 : #define YYNNTS 4
471 : /* YYNRULES -- Number of rules. */
472 : #define YYNRULES 9
473 : /* YYNSTATES -- Number of states. */
474 : #define YYNSTATES 14
475 :
476 : /* YYMAXUTOK -- Last valid token kind. */
477 : #define YYMAXUTOK 261
478 :
479 :
480 : /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
481 : as returned by yylex, with out-of-bounds checking. */
482 : #define YYTRANSLATE(YYX) \
483 : (0 <= (YYX) && (YYX) <= YYMAXUTOK \
484 : ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
485 : : YYSYMBOL_YYUNDEF)
486 :
487 : /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
488 : as returned by yylex. */
489 : static const yytype_int8 yytranslate[] =
490 : {
491 : 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
492 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
493 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
494 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
495 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
496 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497 : 2, 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, 1, 2, 3, 4,
517 : 5, 6
518 : };
519 :
520 : #if YYDEBUG
521 : /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
522 : static const yytype_uint8 yyrline[] =
523 : {
524 : 0, 62, 62, 78, 96, 106, 116, 124, 136, 150
525 : };
526 : #endif
527 :
528 : /** Accessing symbol of state STATE. */
529 : #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
530 :
531 : #if YYDEBUG || 0
532 : /* The user-facing name of the symbol whose (internal) number is
533 : YYSYMBOL. No bounds checking. */
534 : static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
535 :
536 : /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
537 : First, the terminals, then, starting at YYNTOKENS, nonterminals. */
538 : static const char *const yytname[] =
539 : {
540 : "\"end of file\"", "error", "\"invalid token\"", "SEGFLOAT", "RANGE",
541 : "PLUMIN", "EXTENSION", "$accept", "range", "boundary", "deviation", YY_NULLPTR
542 : };
543 :
544 : static const char *
545 : yysymbol_name (yysymbol_kind_t yysymbol)
546 : {
547 : return yytname[yysymbol];
548 : }
549 : #endif
550 :
551 : #ifdef YYPRINT
552 : /* YYTOKNUM[NUM] -- (External) token number corresponding to the
553 : (internal) symbol number NUM (which must be that of a token). */
554 : static const yytype_int16 yytoknum[] =
555 : {
556 : 0, 256, 257, 258, 259, 260, 261
557 : };
558 : #endif
559 :
560 : #define YYPACT_NINF (-3)
561 :
562 : #define yypact_value_is_default(Yyn) \
563 : ((Yyn) == YYPACT_NINF)
564 :
565 : #define YYTABLE_NINF (-1)
566 :
567 : #define yytable_value_is_error(Yyn) \
568 : 0
569 :
570 : /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
571 : STATE-NUM. */
572 : static const yytype_int8 yypact[] =
573 : {
574 : -1, -3, 3, 1, 8, 6, -3, -3, -3, 3,
575 : 9, -3, -3, -3
576 : };
577 :
578 : /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
579 : Performed when YYTABLE does not specify something else to do. Zero
580 : means the default is an error. */
581 : static const yytype_int8 yydefact[] =
582 : {
583 : 0, 7, 0, 0, 0, 6, 5, 8, 1, 4,
584 : 0, 3, 9, 2
585 : };
586 :
587 : /* YYPGOTO[NTERM-NUM]. */
588 : static const yytype_int8 yypgoto[] =
589 : {
590 : -3, -3, -2, -3
591 : };
592 :
593 : /* YYDEFGOTO[NTERM-NUM]. */
594 : static const yytype_int8 yydefgoto[] =
595 : {
596 : 0, 4, 5, 13
597 : };
598 :
599 : /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
600 : positive, shift that token. If negative, reduce the rule whose
601 : number is the opposite. If YYTABLE_NINF, syntax error. */
602 : static const yytype_int8 yytable[] =
603 : {
604 : 6, 0, 1, 2, 7, 3, 1, 11, 8, 3,
605 : 9, 10, 12
606 : };
607 :
608 : static const yytype_int8 yycheck[] =
609 : {
610 : 2, -1, 3, 4, 3, 6, 3, 9, 0, 6,
611 : 4, 5, 3
612 : };
613 :
614 : /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
615 : symbol of state STATE-NUM. */
616 : static const yytype_int8 yystos[] =
617 : {
618 : 0, 3, 4, 6, 8, 9, 9, 3, 0, 4,
619 : 5, 9, 3, 10
620 : };
621 :
622 : /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
623 : static const yytype_int8 yyr1[] =
624 : {
625 : 0, 7, 8, 8, 8, 8, 8, 9, 9, 10
626 : };
627 :
628 : /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
629 : static const yytype_int8 yyr2[] =
630 : {
631 : 0, 2, 3, 3, 2, 2, 1, 1, 2, 1
632 : };
633 :
634 :
635 : enum { YYENOMEM = -2 };
636 :
637 : #define yyerrok (yyerrstatus = 0)
638 : #define yyclearin (yychar = YYEMPTY)
639 :
640 : #define YYACCEPT goto yyacceptlab
641 : #define YYABORT goto yyabortlab
642 : #define YYERROR goto yyerrorlab
643 :
644 :
645 : #define YYRECOVERING() (!!yyerrstatus)
646 :
647 : #define YYBACKUP(Token, Value) \
648 : do \
649 : if (yychar == YYEMPTY) \
650 : { \
651 : yychar = (Token); \
652 : yylval = (Value); \
653 : YYPOPSTACK (yylen); \
654 : yystate = *yyssp; \
655 : goto yybackup; \
656 : } \
657 : else \
658 : { \
659 : yyerror (result, escontext, yyscanner, YY_("syntax error: cannot back up")); \
660 : YYERROR; \
661 : } \
662 : while (0)
663 :
664 : /* Backward compatibility with an undocumented macro.
665 : Use YYerror or YYUNDEF. */
666 : #define YYERRCODE YYUNDEF
667 :
668 :
669 : /* Enable debugging if requested. */
670 : #if YYDEBUG
671 :
672 : # ifndef YYFPRINTF
673 : # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
674 : # define YYFPRINTF fprintf
675 : # endif
676 :
677 : # define YYDPRINTF(Args) \
678 : do { \
679 : if (yydebug) \
680 : YYFPRINTF Args; \
681 : } while (0)
682 :
683 : /* This macro is provided for backward compatibility. */
684 : # ifndef YY_LOCATION_PRINT
685 : # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
686 : # endif
687 :
688 :
689 : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
690 : do { \
691 : if (yydebug) \
692 : { \
693 : YYFPRINTF (stderr, "%s ", Title); \
694 : yy_symbol_print (stderr, \
695 : Kind, Value, result, escontext, yyscanner); \
696 : YYFPRINTF (stderr, "\n"); \
697 : } \
698 : } while (0)
699 :
700 :
701 : /*-----------------------------------.
702 : | Print this symbol's value on YYO. |
703 : `-----------------------------------*/
704 :
705 : static void
706 : yy_symbol_value_print (FILE *yyo,
707 : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, SEG *result, struct Node *escontext, yyscan_t yyscanner)
708 : {
709 : FILE *yyoutput = yyo;
710 : YY_USE (yyoutput);
711 : YY_USE (result);
712 : YY_USE (escontext);
713 : YY_USE (yyscanner);
714 : if (!yyvaluep)
715 : return;
716 : # ifdef YYPRINT
717 : if (yykind < YYNTOKENS)
718 : YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
719 : # endif
720 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
721 : YY_USE (yykind);
722 : YY_IGNORE_MAYBE_UNINITIALIZED_END
723 : }
724 :
725 :
726 : /*---------------------------.
727 : | Print this symbol on YYO. |
728 : `---------------------------*/
729 :
730 : static void
731 : yy_symbol_print (FILE *yyo,
732 : yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, SEG *result, struct Node *escontext, yyscan_t yyscanner)
733 : {
734 : YYFPRINTF (yyo, "%s %s (",
735 : yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
736 :
737 : yy_symbol_value_print (yyo, yykind, yyvaluep, result, escontext, yyscanner);
738 : YYFPRINTF (yyo, ")");
739 : }
740 :
741 : /*------------------------------------------------------------------.
742 : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
743 : | TOP (included). |
744 : `------------------------------------------------------------------*/
745 :
746 : static void
747 : yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
748 : {
749 : YYFPRINTF (stderr, "Stack now");
750 : for (; yybottom <= yytop; yybottom++)
751 : {
752 : int yybot = *yybottom;
753 : YYFPRINTF (stderr, " %d", yybot);
754 : }
755 : YYFPRINTF (stderr, "\n");
756 : }
757 :
758 : # define YY_STACK_PRINT(Bottom, Top) \
759 : do { \
760 : if (yydebug) \
761 : yy_stack_print ((Bottom), (Top)); \
762 : } while (0)
763 :
764 :
765 : /*------------------------------------------------.
766 : | Report that the YYRULE is going to be reduced. |
767 : `------------------------------------------------*/
768 :
769 : static void
770 : yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
771 : int yyrule, SEG *result, struct Node *escontext, yyscan_t yyscanner)
772 : {
773 : int yylno = yyrline[yyrule];
774 : int yynrhs = yyr2[yyrule];
775 : int yyi;
776 : YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
777 : yyrule - 1, yylno);
778 : /* The symbols being reduced. */
779 : for (yyi = 0; yyi < yynrhs; yyi++)
780 : {
781 : YYFPRINTF (stderr, " $%d = ", yyi + 1);
782 : yy_symbol_print (stderr,
783 : YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
784 : &yyvsp[(yyi + 1) - (yynrhs)], result, escontext, yyscanner);
785 : YYFPRINTF (stderr, "\n");
786 : }
787 : }
788 :
789 : # define YY_REDUCE_PRINT(Rule) \
790 : do { \
791 : if (yydebug) \
792 : yy_reduce_print (yyssp, yyvsp, Rule, result, escontext, yyscanner); \
793 : } while (0)
794 :
795 : /* Nonzero means print parse trace. It is left uninitialized so that
796 : multiple parsers can coexist. */
797 : int yydebug;
798 : #else /* !YYDEBUG */
799 : # define YYDPRINTF(Args) ((void) 0)
800 : # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
801 : # define YY_STACK_PRINT(Bottom, Top)
802 : # define YY_REDUCE_PRINT(Rule)
803 : #endif /* !YYDEBUG */
804 :
805 :
806 : /* YYINITDEPTH -- initial size of the parser's stacks. */
807 : #ifndef YYINITDEPTH
808 : # define YYINITDEPTH 200
809 : #endif
810 :
811 : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
812 : if the built-in stack extension method is used).
813 :
814 : Do not make this value too large; the results are undefined if
815 : YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
816 : evaluated with infinite-precision integer arithmetic. */
817 :
818 : #ifndef YYMAXDEPTH
819 : # define YYMAXDEPTH 10000
820 : #endif
821 :
822 :
823 :
824 :
825 :
826 :
827 : /*-----------------------------------------------.
828 : | Release the memory associated to this symbol. |
829 : `-----------------------------------------------*/
830 :
831 : static void
832 11248 : yydestruct (const char *yymsg,
833 : yysymbol_kind_t yykind, YYSTYPE *yyvaluep, SEG *result, struct Node *escontext, yyscan_t yyscanner)
834 : {
835 : YY_USE (yyvaluep);
836 : YY_USE (result);
837 : YY_USE (escontext);
838 : YY_USE (yyscanner);
839 11248 : if (!yymsg)
840 0 : yymsg = "Deleting";
841 : YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
842 :
843 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
844 : YY_USE (yykind);
845 : YY_IGNORE_MAYBE_UNINITIALIZED_END
846 11248 : }
847 :
848 :
849 :
850 :
851 :
852 :
853 : /*----------.
854 : | yyparse. |
855 : `----------*/
856 :
857 : int
858 5650 : yyparse (SEG *result, struct Node *escontext, yyscan_t yyscanner)
859 : {
860 : /* Lookahead token kind. */
861 : int yychar;
862 :
863 :
864 : /* The semantic value of the lookahead symbol. */
865 : /* Default value used for initialization, for pacifying older GCCs
866 : or non-GCC compilers. */
867 : YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
868 : YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
869 :
870 : /* Number of syntax errors so far. */
871 5650 : int yynerrs = 0;
872 :
873 5650 : yy_state_fast_t yystate = 0;
874 : /* Number of tokens to shift before error messages enabled. */
875 5650 : int yyerrstatus = 0;
876 :
877 : /* Refer to the stacks through separate pointers, to allow yyoverflow
878 : to reallocate them elsewhere. */
879 :
880 : /* Their size. */
881 5650 : YYPTRDIFF_T yystacksize = YYINITDEPTH;
882 :
883 : /* The state stack: array, bottom, top. */
884 : yy_state_t yyssa[YYINITDEPTH];
885 5650 : yy_state_t *yyss = yyssa;
886 5650 : yy_state_t *yyssp = yyss;
887 :
888 : /* The semantic value stack: array, bottom, top. */
889 : YYSTYPE yyvsa[YYINITDEPTH];
890 5650 : YYSTYPE *yyvs = yyvsa;
891 5650 : YYSTYPE *yyvsp = yyvs;
892 :
893 : int yyn;
894 : /* The return value of yyparse. */
895 : int yyresult;
896 : /* Lookahead symbol kind. */
897 5650 : yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
898 : /* The variables used to return semantic value and location from the
899 : action routines. */
900 : YYSTYPE yyval;
901 :
902 :
903 :
904 : #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
905 :
906 : /* The number of symbols on the RHS of the reduced rule.
907 : Keep to zero when no symbol should be popped. */
908 5650 : int yylen = 0;
909 :
910 : YYDPRINTF ((stderr, "Starting parse\n"));
911 :
912 5650 : yychar = YYEMPTY; /* Cause a token to be read. */
913 5650 : goto yysetstate;
914 :
915 :
916 : /*------------------------------------------------------------.
917 : | yynewstate -- push a new state, which is found in yystate. |
918 : `------------------------------------------------------------*/
919 39296 : yynewstate:
920 : /* In all cases, when you get here, the value and location stacks
921 : have just been pushed. So pushing a state here evens the stacks. */
922 39296 : yyssp++;
923 :
924 :
925 : /*--------------------------------------------------------------------.
926 : | yysetstate -- set current state (the top of the stack) to yystate. |
927 : `--------------------------------------------------------------------*/
928 44946 : yysetstate:
929 : YYDPRINTF ((stderr, "Entering state %d\n", yystate));
930 : YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
931 : YY_IGNORE_USELESS_CAST_BEGIN
932 44946 : *yyssp = YY_CAST (yy_state_t, yystate);
933 : YY_IGNORE_USELESS_CAST_END
934 : YY_STACK_PRINT (yyss, yyssp);
935 :
936 44946 : if (yyss + yystacksize - 1 <= yyssp)
937 : #if !defined yyoverflow && !defined YYSTACK_RELOCATE
938 : goto yyexhaustedlab;
939 : #else
940 : {
941 : /* Get the current used size of the three stacks, in elements. */
942 0 : YYPTRDIFF_T yysize = yyssp - yyss + 1;
943 :
944 : # if defined yyoverflow
945 : {
946 : /* Give user a chance to reallocate the stack. Use copies of
947 : these so that the &'s don't force the real ones into
948 : memory. */
949 : yy_state_t *yyss1 = yyss;
950 : YYSTYPE *yyvs1 = yyvs;
951 :
952 : /* Each stack pointer address is followed by the size of the
953 : data in use in that stack, in bytes. This used to be a
954 : conditional around just the two extra args, but that might
955 : be undefined if yyoverflow is a macro. */
956 : yyoverflow (YY_("memory exhausted"),
957 : &yyss1, yysize * YYSIZEOF (*yyssp),
958 : &yyvs1, yysize * YYSIZEOF (*yyvsp),
959 : &yystacksize);
960 : yyss = yyss1;
961 : yyvs = yyvs1;
962 : }
963 : # else /* defined YYSTACK_RELOCATE */
964 : /* Extend the stack our own way. */
965 0 : if (YYMAXDEPTH <= yystacksize)
966 0 : goto yyexhaustedlab;
967 0 : yystacksize *= 2;
968 0 : if (YYMAXDEPTH < yystacksize)
969 0 : yystacksize = YYMAXDEPTH;
970 :
971 : {
972 0 : yy_state_t *yyss1 = yyss;
973 : union yyalloc *yyptr =
974 0 : YY_CAST (union yyalloc *,
975 : YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
976 0 : if (! yyptr)
977 0 : goto yyexhaustedlab;
978 0 : YYSTACK_RELOCATE (yyss_alloc, yyss);
979 0 : YYSTACK_RELOCATE (yyvs_alloc, yyvs);
980 : # undef YYSTACK_RELOCATE
981 0 : if (yyss1 != yyssa)
982 0 : YYSTACK_FREE (yyss1);
983 : }
984 : # endif
985 :
986 0 : yyssp = yyss + yysize - 1;
987 0 : yyvsp = yyvs + yysize - 1;
988 :
989 : YY_IGNORE_USELESS_CAST_BEGIN
990 : YYDPRINTF ((stderr, "Stack size increased to %ld\n",
991 : YY_CAST (long, yystacksize)));
992 : YY_IGNORE_USELESS_CAST_END
993 :
994 0 : if (yyss + yystacksize - 1 <= yyssp)
995 0 : YYABORT;
996 : }
997 : #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
998 :
999 44946 : if (yystate == YYFINAL)
1000 5616 : YYACCEPT;
1001 :
1002 39330 : goto yybackup;
1003 :
1004 :
1005 : /*-----------.
1006 : | yybackup. |
1007 : `-----------*/
1008 39330 : yybackup:
1009 : /* Do appropriate processing given the current state. Read a
1010 : lookahead token if we need one and don't already have one. */
1011 :
1012 : /* First try to decide what to do without reference to lookahead token. */
1013 39330 : yyn = yypact[yystate];
1014 39330 : if (yypact_value_is_default (yyn))
1015 15174 : goto yydefault;
1016 :
1017 : /* Not known => get a lookahead token if don't already have one. */
1018 :
1019 : /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1020 24156 : if (yychar == YYEMPTY)
1021 : {
1022 : YYDPRINTF ((stderr, "Reading a token\n"));
1023 23344 : yychar = yylex (&yylval, yyscanner);
1024 : }
1025 :
1026 24156 : if (yychar <= YYEOF)
1027 : {
1028 6422 : yychar = YYEOF;
1029 6422 : yytoken = YYSYMBOL_YYEOF;
1030 : YYDPRINTF ((stderr, "Now at end of input.\n"));
1031 : }
1032 17734 : else if (yychar == YYerror)
1033 : {
1034 : /* The scanner already issued an error message, process directly
1035 : to error recovery. But do not keep the error token as
1036 : lookahead, it is too special and may lead us to an endless
1037 : loop in error recovery. */
1038 0 : yychar = YYUNDEF;
1039 0 : yytoken = YYSYMBOL_YYerror;
1040 0 : goto yyerrlab1;
1041 : }
1042 : else
1043 : {
1044 17734 : yytoken = YYTRANSLATE (yychar);
1045 : YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1046 : }
1047 :
1048 : /* If the proper action on seeing token YYTOKEN is to reduce or to
1049 : detect an error, take that action. */
1050 24156 : yyn += yytoken;
1051 24156 : if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1052 840 : goto yydefault;
1053 23316 : yyn = yytable[yyn];
1054 23316 : if (yyn <= 0)
1055 : {
1056 : if (yytable_value_is_error (yyn))
1057 : goto yyerrlab;
1058 0 : yyn = -yyn;
1059 0 : goto yyreduce;
1060 : }
1061 :
1062 : /* Count tokens shifted since error; after three, turn off error
1063 : status. */
1064 23316 : if (yyerrstatus)
1065 0 : yyerrstatus--;
1066 :
1067 : /* Shift the lookahead token. */
1068 : YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1069 23316 : yystate = yyn;
1070 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1071 23316 : *++yyvsp = yylval;
1072 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1073 :
1074 : /* Discard the shifted token. */
1075 23316 : yychar = YYEMPTY;
1076 23316 : goto yynewstate;
1077 :
1078 :
1079 : /*-----------------------------------------------------------.
1080 : | yydefault -- do the default action for the current state. |
1081 : `-----------------------------------------------------------*/
1082 16014 : yydefault:
1083 16014 : yyn = yydefact[yystate];
1084 16014 : if (yyn == 0)
1085 28 : goto yyerrlab;
1086 15986 : goto yyreduce;
1087 :
1088 :
1089 : /*-----------------------------.
1090 : | yyreduce -- do a reduction. |
1091 : `-----------------------------*/
1092 15986 : yyreduce:
1093 : /* yyn is the number of a rule to reduce with. */
1094 15986 : yylen = yyr2[yyn];
1095 :
1096 : /* If YYLEN is nonzero, implement the default value of the action:
1097 : '$$ = $1'.
1098 :
1099 : Otherwise, the following line sets YYVAL to garbage.
1100 : This behavior is undocumented and Bison
1101 : users should not rely upon it. Assigning to YYVAL
1102 : unconditionally makes the parser a bit smaller, and it avoids a
1103 : GCC warning that YYVAL may be used uninitialized. */
1104 15986 : yyval = yyvsp[1-yylen];
1105 :
1106 :
1107 : YY_REDUCE_PRINT (yyn);
1108 15986 : switch (yyn)
1109 : {
1110 14 : case 2: /* range: boundary PLUMIN deviation */
1111 : #line 63 "segparse.y"
1112 : {
1113 : char strbuf[25];
1114 :
1115 : result->lower = (yyvsp[-2].bnd).val - (yyvsp[0].bnd).val;
1116 : result->upper = (yyvsp[-2].bnd).val + (yyvsp[0].bnd).val;
1117 : snprintf(strbuf, sizeof(strbuf), "%g", result->lower);
1118 : result->l_sigd = Max(sig_digits(strbuf), Max((yyvsp[-2].bnd).sigd, (yyvsp[0].bnd).sigd));
1119 : snprintf(strbuf, sizeof(strbuf), "%g", result->upper);
1120 : result->u_sigd = Max(sig_digits(strbuf), Max((yyvsp[-2].bnd).sigd, (yyvsp[0].bnd).sigd));
1121 : result->l_ext = '\0';
1122 : result->u_ext = '\0';
1123 :
1124 : (void) yynerrs; /* suppress compiler warning */
1125 : }
1126 : #line 1127 "segparse.c"
1127 14 : break;
1128 :
1129 4706 : case 3: /* range: boundary RANGE boundary */
1130 : #line 79 "segparse.y"
1131 : {
1132 : result->lower = (yyvsp[-2].bnd).val;
1133 : result->upper = (yyvsp[0].bnd).val;
1134 : if ( result->lower > result->upper ) {
1135 : errsave(escontext,
1136 : (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1137 : errmsg("swapped boundaries: %g is greater than %g",
1138 : result->lower, result->upper)));
1139 :
1140 : YYERROR;
1141 : }
1142 : result->l_sigd = (yyvsp[-2].bnd).sigd;
1143 : result->u_sigd = (yyvsp[0].bnd).sigd;
1144 : result->l_ext = ( (yyvsp[-2].bnd).ext ? (yyvsp[-2].bnd).ext : '\0' );
1145 : result->u_ext = ( (yyvsp[0].bnd).ext ? (yyvsp[0].bnd).ext : '\0' );
1146 : }
1147 : #line 1148 "segparse.c"
1148 4706 : break;
1149 :
1150 92 : case 4: /* range: boundary RANGE */
1151 : #line 97 "segparse.y"
1152 : {
1153 : result->lower = (yyvsp[-1].bnd).val;
1154 : result->upper = HUGE_VAL;
1155 : result->l_sigd = (yyvsp[-1].bnd).sigd;
1156 : result->u_sigd = 0;
1157 : result->l_ext = ( (yyvsp[-1].bnd).ext ? (yyvsp[-1].bnd).ext : '\0' );
1158 : result->u_ext = '-';
1159 : }
1160 : #line 1161 "segparse.c"
1161 92 : break;
1162 :
1163 98 : case 5: /* range: RANGE boundary */
1164 : #line 107 "segparse.y"
1165 : {
1166 : result->lower = -HUGE_VAL;
1167 : result->upper = (yyvsp[0].bnd).val;
1168 : result->l_sigd = 0;
1169 : result->u_sigd = (yyvsp[0].bnd).sigd;
1170 : result->l_ext = '-';
1171 : result->u_ext = ( (yyvsp[0].bnd).ext ? (yyvsp[0].bnd).ext : '\0' );
1172 : }
1173 : #line 1174 "segparse.c"
1174 98 : break;
1175 :
1176 720 : case 6: /* range: boundary */
1177 : #line 117 "segparse.y"
1178 : {
1179 : result->lower = result->upper = (yyvsp[0].bnd).val;
1180 : result->l_sigd = result->u_sigd = (yyvsp[0].bnd).sigd;
1181 : result->l_ext = result->u_ext = ( (yyvsp[0].bnd).ext ? (yyvsp[0].bnd).ext : '\0' );
1182 : }
1183 : #line 1184 "segparse.c"
1184 720 : break;
1185 :
1186 7908 : case 7: /* boundary: SEGFLOAT */
1187 : #line 125 "segparse.y"
1188 : {
1189 : /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
1190 : float val;
1191 :
1192 : if (!seg_atof((yyvsp[0].text), &val, escontext))
1193 : YYABORT;
1194 :
1195 : (yyval.bnd).ext = '\0';
1196 : (yyval.bnd).sigd = sig_digits((yyvsp[0].text));
1197 : (yyval.bnd).val = val;
1198 : }
1199 : #line 1200 "segparse.c"
1200 7902 : break;
1201 :
1202 2434 : case 8: /* boundary: EXTENSION SEGFLOAT */
1203 : #line 137 "segparse.y"
1204 : {
1205 : /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
1206 : float val;
1207 :
1208 : if (!seg_atof((yyvsp[0].text), &val, escontext))
1209 : YYABORT;
1210 :
1211 : (yyval.bnd).ext = (yyvsp[-1].text)[0];
1212 : (yyval.bnd).sigd = sig_digits((yyvsp[0].text));
1213 : (yyval.bnd).val = val;
1214 : }
1215 : #line 1216 "segparse.c"
1216 2434 : break;
1217 :
1218 14 : case 9: /* deviation: SEGFLOAT */
1219 : #line 151 "segparse.y"
1220 : {
1221 : /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
1222 : float val;
1223 :
1224 : if (!seg_atof((yyvsp[0].text), &val, escontext))
1225 : YYABORT;
1226 :
1227 : (yyval.bnd).ext = '\0';
1228 : (yyval.bnd).sigd = sig_digits((yyvsp[0].text));
1229 : (yyval.bnd).val = val;
1230 : }
1231 : #line 1232 "segparse.c"
1232 14 : break;
1233 :
1234 :
1235 : #line 1236 "segparse.c"
1236 :
1237 0 : default: break;
1238 : }
1239 : /* User semantic actions sometimes alter yychar, and that requires
1240 : that yytoken be updated with the new translation. We take the
1241 : approach of translating immediately before every use of yytoken.
1242 : One alternative is translating here after every semantic action,
1243 : but that translation would be missed if the semantic action invokes
1244 : YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1245 : if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1246 : incorrect destructor might then be invoked immediately. In the
1247 : case of YYERROR or YYBACKUP, subsequent parser actions might lead
1248 : to an incorrect destructor call or verbose syntax error message
1249 : before the lookahead is translated. */
1250 : YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1251 :
1252 15980 : YYPOPSTACK (yylen);
1253 15980 : yylen = 0;
1254 :
1255 15980 : *++yyvsp = yyval;
1256 :
1257 : /* Now 'shift' the result of the reduction. Determine what state
1258 : that goes to, based on the state we popped back to and the rule
1259 : number reduced by. */
1260 : {
1261 15980 : const int yylhs = yyr1[yyn] - YYNTOKENS;
1262 15980 : const int yyi = yypgoto[yylhs] + *yyssp;
1263 4818 : yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1264 4804 : ? yytable[yyi]
1265 20798 : : yydefgoto[yylhs]);
1266 : }
1267 :
1268 15980 : goto yynewstate;
1269 :
1270 :
1271 : /*--------------------------------------.
1272 : | yyerrlab -- here on detecting error. |
1273 : `--------------------------------------*/
1274 28 : yyerrlab:
1275 : /* Make sure we have latest lookahead translation. See comments at
1276 : user semantic actions for why this is necessary. */
1277 28 : yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1278 : /* If not already recovering from an error, report this error. */
1279 28 : if (!yyerrstatus)
1280 : {
1281 28 : ++yynerrs;
1282 28 : yyerror (result, escontext, yyscanner, YY_("syntax error"));
1283 : }
1284 :
1285 12 : if (yyerrstatus == 3)
1286 : {
1287 : /* If just tried and failed to reuse lookahead token after an
1288 : error, discard it. */
1289 :
1290 0 : if (yychar <= YYEOF)
1291 : {
1292 : /* Return failure if at end of input. */
1293 0 : if (yychar == YYEOF)
1294 0 : YYABORT;
1295 : }
1296 : else
1297 : {
1298 0 : yydestruct ("Error: discarding",
1299 : yytoken, &yylval, result, escontext, yyscanner);
1300 0 : yychar = YYEMPTY;
1301 : }
1302 : }
1303 :
1304 : /* Else will try to reuse lookahead token after shifting the error
1305 : token. */
1306 12 : goto yyerrlab1;
1307 :
1308 :
1309 : /*---------------------------------------------------.
1310 : | yyerrorlab -- error raised explicitly by YYERROR. |
1311 : `---------------------------------------------------*/
1312 0 : yyerrorlab:
1313 : /* Pacify compilers when the user code never invokes YYERROR and the
1314 : label yyerrorlab therefore never appears in user code. */
1315 : if (0)
1316 : YYERROR;
1317 :
1318 : /* Do not reclaim the symbols of the rule whose action triggered
1319 : this YYERROR. */
1320 0 : YYPOPSTACK (yylen);
1321 0 : yylen = 0;
1322 : YY_STACK_PRINT (yyss, yyssp);
1323 0 : yystate = *yyssp;
1324 0 : goto yyerrlab1;
1325 :
1326 :
1327 : /*-------------------------------------------------------------.
1328 : | yyerrlab1 -- common code for both syntax error and YYERROR. |
1329 : `-------------------------------------------------------------*/
1330 12 : yyerrlab1:
1331 12 : yyerrstatus = 3; /* Each real token shifted decrements this. */
1332 :
1333 : /* Pop stack until we find a state that shifts the error token. */
1334 : for (;;)
1335 : {
1336 16 : yyn = yypact[yystate];
1337 16 : if (!yypact_value_is_default (yyn))
1338 : {
1339 16 : yyn += YYSYMBOL_YYerror;
1340 16 : if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1341 : {
1342 0 : yyn = yytable[yyn];
1343 0 : if (0 < yyn)
1344 0 : break;
1345 : }
1346 : }
1347 :
1348 : /* Pop the current state because it cannot handle the error token. */
1349 16 : if (yyssp == yyss)
1350 12 : YYABORT;
1351 :
1352 :
1353 4 : yydestruct ("Error: popping",
1354 4 : YY_ACCESSING_SYMBOL (yystate), yyvsp, result, escontext, yyscanner);
1355 4 : YYPOPSTACK (1);
1356 4 : yystate = *yyssp;
1357 : YY_STACK_PRINT (yyss, yyssp);
1358 : }
1359 :
1360 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1361 0 : *++yyvsp = yylval;
1362 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1363 :
1364 :
1365 : /* Shift the error token. */
1366 : YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1367 :
1368 0 : yystate = yyn;
1369 0 : goto yynewstate;
1370 :
1371 :
1372 : /*-------------------------------------.
1373 : | yyacceptlab -- YYACCEPT comes here. |
1374 : `-------------------------------------*/
1375 5616 : yyacceptlab:
1376 5616 : yyresult = 0;
1377 5616 : goto yyreturn;
1378 :
1379 :
1380 : /*-----------------------------------.
1381 : | yyabortlab -- YYABORT comes here. |
1382 : `-----------------------------------*/
1383 16 : yyabortlab:
1384 16 : yyresult = 1;
1385 16 : goto yyreturn;
1386 :
1387 :
1388 : #if !defined yyoverflow
1389 : /*-------------------------------------------------.
1390 : | yyexhaustedlab -- memory exhaustion comes here. |
1391 : `-------------------------------------------------*/
1392 0 : yyexhaustedlab:
1393 0 : yyerror (result, escontext, yyscanner, YY_("memory exhausted"));
1394 0 : yyresult = 2;
1395 0 : goto yyreturn;
1396 : #endif
1397 :
1398 :
1399 : /*-------------------------------------------------------.
1400 : | yyreturn -- parsing is finished, clean up and return. |
1401 : `-------------------------------------------------------*/
1402 5632 : yyreturn:
1403 5632 : if (yychar != YYEMPTY)
1404 : {
1405 : /* Make sure we have latest lookahead translation. See comments at
1406 : user semantic actions for why this is necessary. */
1407 12 : yytoken = YYTRANSLATE (yychar);
1408 12 : yydestruct ("Cleanup: discarding lookahead",
1409 : yytoken, &yylval, result, escontext, yyscanner);
1410 : }
1411 : /* Do not reclaim the symbols of the rule whose action triggered
1412 : this YYABORT or YYACCEPT. */
1413 5632 : YYPOPSTACK (yylen);
1414 : YY_STACK_PRINT (yyss, yyssp);
1415 16864 : while (yyssp != yyss)
1416 : {
1417 11232 : yydestruct ("Cleanup: popping",
1418 11232 : YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, result, escontext, yyscanner);
1419 11232 : YYPOPSTACK (1);
1420 : }
1421 : #ifndef yyoverflow
1422 5632 : if (yyss != yyssa)
1423 0 : YYSTACK_FREE (yyss);
1424 : #endif
1425 :
1426 5632 : return yyresult;
1427 : }
1428 :
1429 : #line 164 "segparse.y"
1430 :
1431 :
1432 :
1433 : static bool
1434 : seg_atof(char *value, float *result, struct Node *escontext)
1435 : {
1436 : *result = float4in_internal(value, NULL, "seg", value, escontext);
1437 : if (SOFT_ERROR_OCCURRED(escontext))
1438 : return false;
1439 : return true;
1440 : }
1441 :
1442 : static int
1443 : sig_digits(const char *value)
1444 : {
1445 : int n = significant_digits(value);
1446 :
1447 : /* Clamp, to ensure value will fit in sigd fields */
1448 : return Min(n, FLT_DIG);
1449 : }
|