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