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