1
/* A Bison parser, made by GNU Bison 1.875. */
3
/* Skeleton parser for Yacc-like parsing with Bison,
4
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 59 Temple Place - Suite 330,
19
Boston, MA 02111-1307, USA. */
21
/* As a special exception, when this file is copied by Bison into a
22
Bison output file, you may use that output file without restriction.
23
This special exception was added by the Free Software Foundation
24
in version 1.24 of Bison. */
26
/* Written by Richard Stallman by simplifying the original so called
27
``semantic'' parser. */
29
/* All symbols defined below should begin with yy or YY, to avoid
30
infringing on user name space. This should be done even for local
31
variables, as they might otherwise be expanded by user macros.
32
There are some unavoidable exceptions within include files to
33
define necessary library symbols; they are noted "INFRINGES ON
34
USER NAME SPACE" below. */
36
/* Identify Bison output. */
40
#define YYSKELETON_NAME "yacc.c"
45
/* Using locations. */
46
#define YYLSP_NEEDED 0
48
/* If NAME_PREFIX is specified substitute the variables and functions
50
#define yyparse seg_yyparse
51
#define yylex seg_yylex
52
#define yyerror seg_yyerror
53
#define yylval seg_yylval
54
#define yychar seg_yychar
55
#define yydebug seg_yydebug
56
#define yynerrs seg_yynerrs
62
/* Put the tokens into the symbol table, so that GDB and other debuggers
79
/* Copy the first part of user declarations. */
82
#define YYPARSE_PARAM result /* need this to pass a pointer (void *) to yyparse */
89
#include "utils/builtins.h"
93
* Bison doesn't allocate anything that needs to live across parser calls,
94
* so we can easily have it use palloc instead of malloc. This prevents
95
* memory leaks if we error out during parsing. Note this only works with
96
* bison >= 2.0. However, in bison 1.875 the default is to use alloca()
97
* if possible, so there's not really much problem anyhow, at least if
98
* you're building with gcc.
100
#define YYMALLOC palloc
103
extern int seg_yylex(void);
105
extern int significant_digits(char *str); /* defined in seg.c */
107
void seg_yyerror(const char *message);
108
int seg_yyparse(void *result);
110
static float seg_atof(char *value);
112
static char strbuf[25] = {
113
'0', '0', '0', '0', '0',
114
'0', '0', '0', '0', '0',
115
'0', '0', '0', '0', '0',
116
'0', '0', '0', '0', '0',
117
'0', '0', '0', '0', '\0'
122
/* Enabling traces. */
127
/* Enabling verbose error messages. */
128
#ifdef YYERROR_VERBOSE
129
# undef YYERROR_VERBOSE
130
# define YYERROR_VERBOSE 1
132
# define YYERROR_VERBOSE 0
135
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
136
#line 46 "segparse.y"
137
typedef union YYSTYPE {
145
/* Line 186 of yacc.c. */
146
#line 146 "segparse.c"
147
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
148
# define YYSTYPE_IS_DECLARED 1
149
# define YYSTYPE_IS_TRIVIAL 1
154
/* Copy the second part of user declarations. */
157
/* Line 214 of yacc.c. */
158
#line 158 "segparse.c"
160
#if ! defined (yyoverflow) || YYERROR_VERBOSE
162
/* The parser invokes alloca or malloc; define the necessary symbols. */
164
# if YYSTACK_USE_ALLOCA
165
# define YYSTACK_ALLOC alloca
167
# ifndef YYSTACK_USE_ALLOCA
168
# if defined (alloca) || defined (_ALLOCA_H)
169
# define YYSTACK_ALLOC alloca
172
# define YYSTACK_ALLOC __builtin_alloca
178
# ifdef YYSTACK_ALLOC
179
/* Pacify GCC's `empty if-body' warning. */
180
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
182
# if defined (__STDC__) || defined (__cplusplus)
183
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
184
# define YYSIZE_T size_t
186
# define YYSTACK_ALLOC malloc
187
# define YYSTACK_FREE free
189
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
192
#if (! defined (yyoverflow) \
193
&& (! defined (__cplusplus) \
194
|| (YYSTYPE_IS_TRIVIAL)))
196
/* A type that is properly aligned for any stack member. */
203
/* The size of the maximum gap between one aligned stack and the next. */
204
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
206
/* The size of an array large to enough to hold all stacks, each with
208
# define YYSTACK_BYTES(N) \
209
((N) * (sizeof (short) + sizeof (YYSTYPE)) \
210
+ YYSTACK_GAP_MAXIMUM)
212
/* Copy COUNT objects from FROM to TO. The source and destination do
216
# define YYCOPY(To, From, Count) \
217
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
219
# define YYCOPY(To, From, Count) \
222
register YYSIZE_T yyi; \
223
for (yyi = 0; yyi < (Count); yyi++) \
224
(To)[yyi] = (From)[yyi]; \
230
/* Relocate STACK from its old location to the new one. The
231
local variables YYSIZE and YYSTACKSIZE give the old and new number of
232
elements in the stack, and YYPTR gives the new location of the
233
stack. Advance YYPTR to a properly aligned location for the next
235
# define YYSTACK_RELOCATE(Stack) \
238
YYSIZE_T yynewbytes; \
239
YYCOPY (&yyptr->Stack, Stack, yysize); \
240
Stack = &yyptr->Stack; \
241
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
242
yyptr += yynewbytes / sizeof (*yyptr); \
248
#if defined (__STDC__) || defined (__cplusplus)
249
typedef signed char yysigned_char;
251
typedef short yysigned_char;
254
/* YYFINAL -- State number of the termination state. */
256
/* YYLAST -- Last index in YYTABLE. */
259
/* YYNTOKENS -- Number of terminals. */
261
/* YYNNTS -- Number of nonterminals. */
263
/* YYNRULES -- Number of rules. */
265
/* YYNRULES -- Number of states. */
268
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
270
#define YYMAXUTOK 261
272
#define YYTRANSLATE(YYX) \
273
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
275
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
276
static const unsigned char yytranslate[] =
278
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
279
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
280
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
281
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
282
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
283
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
284
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
285
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
286
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
287
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
288
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
289
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
290
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
291
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
292
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
293
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
294
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
295
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
296
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
297
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
298
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
299
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
300
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
301
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
302
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
303
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
308
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
310
static const unsigned char yyprhs[] =
312
0, 0, 3, 7, 11, 14, 17, 19, 21, 24
315
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
316
static const yysigned_char yyrhs[] =
318
8, 0, -1, 9, 5, 10, -1, 9, 4, 9,
319
-1, 9, 4, -1, 4, 9, -1, 9, -1, 3,
323
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
324
static const unsigned char yyrline[] =
326
0, 67, 67, 78, 95, 104, 113, 121, 130, 141
330
#if YYDEBUG || YYERROR_VERBOSE
331
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
332
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
333
static const char *const yytname[] =
335
"$end", "error", "$undefined", "SEGFLOAT", "RANGE", "PLUMIN", "EXTENSION",
336
"$accept", "range", "boundary", "deviation", 0
341
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
343
static const unsigned short yytoknum[] =
345
0, 256, 257, 258, 259, 260, 261
349
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
350
static const unsigned char yyr1[] =
352
0, 7, 8, 8, 8, 8, 8, 9, 9, 10
355
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
356
static const unsigned char yyr2[] =
358
0, 2, 3, 3, 2, 2, 1, 1, 2, 1
361
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
362
STATE-NUM when YYTABLE doesn't specify something else to do. Zero
363
means the default is an error. */
364
static const unsigned char yydefact[] =
366
0, 7, 0, 0, 0, 6, 5, 8, 1, 4,
370
/* YYDEFGOTO[NTERM-NUM]. */
371
static const yysigned_char yydefgoto[] =
376
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
378
#define YYPACT_NINF -3
379
static const yysigned_char yypact[] =
381
-1, -3, 3, 1, 8, 6, -3, -3, -3, 3,
385
/* YYPGOTO[NTERM-NUM]. */
386
static const yysigned_char yypgoto[] =
391
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
392
positive, shift that token. If negative, reduce the rule which
393
number is the opposite. If zero, do what YYDEFACT says.
394
If YYTABLE_NINF, syntax error. */
395
#define YYTABLE_NINF -1
396
static const unsigned char yytable[] =
398
6, 0, 1, 2, 7, 3, 1, 11, 8, 3,
402
static const yysigned_char yycheck[] =
404
2, -1, 3, 4, 3, 6, 3, 9, 0, 6,
408
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
409
symbol of state STATE-NUM. */
410
static const unsigned char yystos[] =
412
0, 3, 4, 6, 8, 9, 9, 3, 0, 4,
416
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
417
# define YYSIZE_T __SIZE_TYPE__
419
#if ! defined (YYSIZE_T) && defined (size_t)
420
# define YYSIZE_T size_t
422
#if ! defined (YYSIZE_T)
423
# if defined (__STDC__) || defined (__cplusplus)
424
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
425
# define YYSIZE_T size_t
428
#if ! defined (YYSIZE_T)
429
# define YYSIZE_T unsigned int
432
#define yyerrok (yyerrstatus = 0)
433
#define yyclearin (yychar = YYEMPTY)
437
#define YYACCEPT goto yyacceptlab
438
#define YYABORT goto yyabortlab
439
#define YYERROR goto yyerrlab1
441
/* Like YYERROR except do call yyerror. This remains here temporarily
442
to ease the transition to the new meaning of YYERROR, for GCC.
443
Once GCC version 2 has supplanted version 1, this can go. */
445
#define YYFAIL goto yyerrlab
447
#define YYRECOVERING() (!!yyerrstatus)
449
#define YYBACKUP(Token, Value) \
451
if (yychar == YYEMPTY && yylen == 1) \
455
yytoken = YYTRANSLATE (yychar); \
461
yyerror ("syntax error: cannot back up");\
467
#define YYERRCODE 256
469
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
472
#ifndef YYLLOC_DEFAULT
473
# define YYLLOC_DEFAULT(Current, Rhs, N) \
474
Current.first_line = Rhs[1].first_line; \
475
Current.first_column = Rhs[1].first_column; \
476
Current.last_line = Rhs[N].last_line; \
477
Current.last_column = Rhs[N].last_column;
480
/* YYLEX -- calling `yylex' with the right arguments. */
483
# define YYLEX yylex (YYLEX_PARAM)
485
# define YYLEX yylex ()
488
/* Enable debugging if requested. */
492
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
493
# define YYFPRINTF fprintf
496
# define YYDPRINTF(Args) \
502
# define YYDSYMPRINT(Args) \
508
# define YYDSYMPRINTF(Title, Token, Value, Location) \
512
YYFPRINTF (stderr, "%s ", Title); \
513
yysymprint (stderr, \
515
YYFPRINTF (stderr, "\n"); \
519
/*------------------------------------------------------------------.
520
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
522
`------------------------------------------------------------------*/
524
#if defined (__STDC__) || defined (__cplusplus)
526
yy_stack_print (short *bottom, short *top)
529
yy_stack_print (bottom, top)
534
YYFPRINTF (stderr, "Stack now");
535
for (/* Nothing. */; bottom <= top; ++bottom)
536
YYFPRINTF (stderr, " %d", *bottom);
537
YYFPRINTF (stderr, "\n");
540
# define YY_STACK_PRINT(Bottom, Top) \
543
yy_stack_print ((Bottom), (Top)); \
547
/*------------------------------------------------.
548
| Report that the YYRULE is going to be reduced. |
549
`------------------------------------------------*/
551
#if defined (__STDC__) || defined (__cplusplus)
553
yy_reduce_print (int yyrule)
556
yy_reduce_print (yyrule)
561
unsigned int yylineno = yyrline[yyrule];
562
YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
563
yyrule - 1, yylineno);
564
/* Print the symbols being reduced, and their result. */
565
for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
566
YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
567
YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
570
# define YY_REDUCE_PRINT(Rule) \
573
yy_reduce_print (Rule); \
576
/* Nonzero means print parse trace. It is left uninitialized so that
577
multiple parsers can coexist. */
580
# define YYDPRINTF(Args)
581
# define YYDSYMPRINT(Args)
582
# define YYDSYMPRINTF(Title, Token, Value, Location)
583
# define YY_STACK_PRINT(Bottom, Top)
584
# define YY_REDUCE_PRINT(Rule)
585
#endif /* !YYDEBUG */
588
/* YYINITDEPTH -- initial size of the parser's stacks. */
590
# define YYINITDEPTH 200
593
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
594
if the built-in stack extension method is used).
596
Do not make this value too large; the results are undefined if
597
SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
598
evaluated with infinite-precision integer arithmetic. */
605
# define YYMAXDEPTH 10000
613
# if defined (__GLIBC__) && defined (_STRING_H)
614
# define yystrlen strlen
616
/* Return the length of YYSTR. */
618
# if defined (__STDC__) || defined (__cplusplus)
619
yystrlen (const char *yystr)
625
register const char *yys = yystr;
627
while (*yys++ != '\0')
630
return yys - yystr - 1;
636
# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
637
# define yystpcpy stpcpy
639
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
642
# if defined (__STDC__) || defined (__cplusplus)
643
yystpcpy (char *yydest, const char *yysrc)
645
yystpcpy (yydest, yysrc)
650
register char *yyd = yydest;
651
register const char *yys = yysrc;
653
while ((*yyd++ = *yys++) != '\0')
661
#endif /* !YYERROR_VERBOSE */
666
/*--------------------------------.
667
| Print this symbol on YYOUTPUT. |
668
`--------------------------------*/
670
#if defined (__STDC__) || defined (__cplusplus)
672
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
675
yysymprint (yyoutput, yytype, yyvaluep)
681
/* Pacify ``unused variable'' warnings. */
684
if (yytype < YYNTOKENS)
686
YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
688
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
692
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
699
YYFPRINTF (yyoutput, ")");
702
#endif /* ! YYDEBUG */
703
/*-----------------------------------------------.
704
| Release the memory associated to this symbol. |
705
`-----------------------------------------------*/
707
#if defined (__STDC__) || defined (__cplusplus)
709
yydestruct (int yytype, YYSTYPE *yyvaluep)
712
yydestruct (yytype, yyvaluep)
717
/* Pacify ``unused variable'' warnings. */
729
/* Prevent warnings from -Wmissing-prototypes. */
732
# if defined (__STDC__) || defined (__cplusplus)
733
int yyparse (void *YYPARSE_PARAM);
737
#else /* ! YYPARSE_PARAM */
738
#if defined (__STDC__) || defined (__cplusplus)
743
#endif /* ! YYPARSE_PARAM */
747
/* The lookahead symbol. */
750
/* The semantic value of the lookahead symbol. */
753
/* Number of syntax errors so far. */
763
# if defined (__STDC__) || defined (__cplusplus)
764
int yyparse (void *YYPARSE_PARAM)
766
int yyparse (YYPARSE_PARAM)
769
#else /* ! YYPARSE_PARAM */
770
#if defined (__STDC__) || defined (__cplusplus)
781
register int yystate;
784
/* Number of tokens to shift before error messages enabled. */
786
/* Lookahead token as an internal (translated) token number. */
789
/* Three stacks and their tools:
790
`yyss': related to states,
791
`yyvs': related to semantic values,
792
`yyls': related to locations.
794
Refer to the stacks thru separate pointers, to allow yyoverflow
795
to reallocate them elsewhere. */
797
/* The state stack. */
798
short yyssa[YYINITDEPTH];
800
register short *yyssp;
802
/* The semantic value stack. */
803
YYSTYPE yyvsa[YYINITDEPTH];
804
YYSTYPE *yyvs = yyvsa;
805
register YYSTYPE *yyvsp;
809
#define YYPOPSTACK (yyvsp--, yyssp--)
811
YYSIZE_T yystacksize = YYINITDEPTH;
813
/* The variables used to return semantic value and location from the
818
/* When reducing, the number of symbols on the RHS of the reduced
822
YYDPRINTF ((stderr, "Starting parse\n"));
827
yychar = YYEMPTY; /* Cause a token to be read. */
829
/* Initialize stack pointers.
830
Waste one element of value and location stack
831
so that they stay on the same level as the state stack.
832
The wasted elements are never initialized. */
839
/*------------------------------------------------------------.
840
| yynewstate -- Push a new state, which is found in yystate. |
841
`------------------------------------------------------------*/
843
/* In all cases, when you get here, the value and location stacks
844
have just been pushed. so pushing a state here evens the stacks.
851
if (yyss + yystacksize - 1 <= yyssp)
853
/* Get the current used size of the three stacks, in elements. */
854
YYSIZE_T yysize = yyssp - yyss + 1;
858
/* Give user a chance to reallocate the stack. Use copies of
859
these so that the &'s don't force the real ones into
861
YYSTYPE *yyvs1 = yyvs;
865
/* Each stack pointer address is followed by the size of the
866
data in use in that stack, in bytes. This used to be a
867
conditional around just the two extra args, but that might
868
be undefined if yyoverflow is a macro. */
869
yyoverflow ("parser stack overflow",
870
&yyss1, yysize * sizeof (*yyssp),
871
&yyvs1, yysize * sizeof (*yyvsp),
878
#else /* no yyoverflow */
879
# ifndef YYSTACK_RELOCATE
882
/* Extend the stack our own way. */
883
if (YYMAXDEPTH <= yystacksize)
886
if (YYMAXDEPTH < yystacksize)
887
yystacksize = YYMAXDEPTH;
891
union yyalloc *yyptr =
892
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
895
YYSTACK_RELOCATE (yyss);
896
YYSTACK_RELOCATE (yyvs);
898
# undef YYSTACK_RELOCATE
900
YYSTACK_FREE (yyss1);
903
#endif /* no yyoverflow */
905
yyssp = yyss + yysize - 1;
906
yyvsp = yyvs + yysize - 1;
909
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
910
(unsigned long int) yystacksize));
912
if (yyss + yystacksize - 1 <= yyssp)
916
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
925
/* Do appropriate processing given the current state. */
926
/* Read a lookahead token if we need one and don't already have one. */
929
/* First try to decide what to do without reference to lookahead token. */
931
yyn = yypact[yystate];
932
if (yyn == YYPACT_NINF)
935
/* Not known => get a lookahead token if don't already have one. */
937
/* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
938
if (yychar == YYEMPTY)
940
YYDPRINTF ((stderr, "Reading a token: "));
946
yychar = yytoken = YYEOF;
947
YYDPRINTF ((stderr, "Now at end of input.\n"));
951
yytoken = YYTRANSLATE (yychar);
952
YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
955
/* If the proper action on seeing token YYTOKEN is to reduce or to
956
detect an error, take that action. */
958
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
963
if (yyn == 0 || yyn == YYTABLE_NINF)
972
/* Shift the lookahead token. */
973
YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
975
/* Discard the token being shifted unless it is eof. */
982
/* Count tokens shifted since error; after three, turn off error
991
/*-----------------------------------------------------------.
992
| yydefault -- do the default action for the current state. |
993
`-----------------------------------------------------------*/
995
yyn = yydefact[yystate];
1001
/*-----------------------------.
1002
| yyreduce -- Do a reduction. |
1003
`-----------------------------*/
1005
/* yyn is the number of a rule to reduce with. */
1008
/* If YYLEN is nonzero, implement the default value of the action:
1011
Otherwise, the following line sets YYVAL to garbage.
1012
This behavior is undocumented and Bison
1013
users should not rely upon it. Assigning to YYVAL
1014
unconditionally makes the parser a bit smaller, and it avoids a
1015
GCC warning that YYVAL may be used uninitialized. */
1016
yyval = yyvsp[1-yylen];
1019
YY_REDUCE_PRINT (yyn);
1023
#line 67 "segparse.y"
1025
((SEG *)result)->lower = yyvsp[-2].bnd.val - yyvsp[0].bnd.val;
1026
((SEG *)result)->upper = yyvsp[-2].bnd.val + yyvsp[0].bnd.val;
1027
sprintf(strbuf, "%g", ((SEG *)result)->lower);
1028
((SEG *)result)->l_sigd = Max(Min(6, significant_digits(strbuf)), Max(yyvsp[-2].bnd.sigd, yyvsp[0].bnd.sigd));
1029
sprintf(strbuf, "%g", ((SEG *)result)->upper);
1030
((SEG *)result)->u_sigd = Max(Min(6, significant_digits(strbuf)), Max(yyvsp[-2].bnd.sigd, yyvsp[0].bnd.sigd));
1031
((SEG *)result)->l_ext = '\0';
1032
((SEG *)result)->u_ext = '\0';
1037
#line 78 "segparse.y"
1039
((SEG *)result)->lower = yyvsp[-2].bnd.val;
1040
((SEG *)result)->upper = yyvsp[0].bnd.val;
1041
if ( ((SEG *)result)->lower > ((SEG *)result)->upper ) {
1043
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1044
errmsg("swapped boundaries: %g is greater than %g",
1045
((SEG *)result)->lower, ((SEG *)result)->upper)));
1049
((SEG *)result)->l_sigd = yyvsp[-2].bnd.sigd;
1050
((SEG *)result)->u_sigd = yyvsp[0].bnd.sigd;
1051
((SEG *)result)->l_ext = ( yyvsp[-2].bnd.ext ? yyvsp[-2].bnd.ext : '\0' );
1052
((SEG *)result)->u_ext = ( yyvsp[0].bnd.ext ? yyvsp[0].bnd.ext : '\0' );
1057
#line 95 "segparse.y"
1059
((SEG *)result)->lower = yyvsp[-1].bnd.val;
1060
((SEG *)result)->upper = HUGE_VAL;
1061
((SEG *)result)->l_sigd = yyvsp[-1].bnd.sigd;
1062
((SEG *)result)->u_sigd = 0;
1063
((SEG *)result)->l_ext = ( yyvsp[-1].bnd.ext ? yyvsp[-1].bnd.ext : '\0' );
1064
((SEG *)result)->u_ext = '-';
1069
#line 104 "segparse.y"
1071
((SEG *)result)->lower = -HUGE_VAL;
1072
((SEG *)result)->upper = yyvsp[0].bnd.val;
1073
((SEG *)result)->l_sigd = 0;
1074
((SEG *)result)->u_sigd = yyvsp[0].bnd.sigd;
1075
((SEG *)result)->l_ext = '-';
1076
((SEG *)result)->u_ext = ( yyvsp[0].bnd.ext ? yyvsp[0].bnd.ext : '\0' );
1081
#line 113 "segparse.y"
1083
((SEG *)result)->lower = ((SEG *)result)->upper = yyvsp[0].bnd.val;
1084
((SEG *)result)->l_sigd = ((SEG *)result)->u_sigd = yyvsp[0].bnd.sigd;
1085
((SEG *)result)->l_ext = ((SEG *)result)->u_ext = ( yyvsp[0].bnd.ext ? yyvsp[0].bnd.ext : '\0' );
1090
#line 121 "segparse.y"
1092
/* temp variable avoids a gcc 3.3.x bug on Sparc64 */
1093
float val = seg_atof(yyvsp[0].text);
1095
yyval.bnd.ext = '\0';
1096
yyval.bnd.sigd = significant_digits(yyvsp[0].text);
1097
yyval.bnd.val = val;
1102
#line 130 "segparse.y"
1104
/* temp variable avoids a gcc 3.3.x bug on Sparc64 */
1105
float val = seg_atof(yyvsp[0].text);
1107
yyval.bnd.ext = yyvsp[-1].text[0];
1108
yyval.bnd.sigd = significant_digits(yyvsp[0].text);
1109
yyval.bnd.val = val;
1114
#line 141 "segparse.y"
1116
/* temp variable avoids a gcc 3.3.x bug on Sparc64 */
1117
float val = seg_atof(yyvsp[0].text);
1119
yyval.bnd.ext = '\0';
1120
yyval.bnd.sigd = significant_digits(yyvsp[0].text);
1121
yyval.bnd.val = val;
1128
/* Line 991 of yacc.c. */
1129
#line 1129 "segparse.c"
1135
YY_STACK_PRINT (yyss, yyssp);
1140
/* Now `shift' the result of the reduction. Determine what state
1141
that goes to, based on the state we popped back to and the rule
1142
number reduced by. */
1146
yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1147
if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1148
yystate = yytable[yystate];
1150
yystate = yydefgoto[yyn - YYNTOKENS];
1155
/*------------------------------------.
1156
| yyerrlab -- here on detecting error |
1157
`------------------------------------*/
1159
/* If not already recovering from an error, report this error. */
1164
yyn = yypact[yystate];
1166
if (YYPACT_NINF < yyn && yyn < YYLAST)
1168
YYSIZE_T yysize = 0;
1169
int yytype = YYTRANSLATE (yychar);
1174
/* Start YYX at -YYN if negative to avoid negative indexes in
1176
for (yyx = yyn < 0 ? -yyn : 0;
1177
yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1178
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1179
yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1180
yysize += yystrlen ("syntax error, unexpected ") + 1;
1181
yysize += yystrlen (yytname[yytype]);
1182
yymsg = (char *) YYSTACK_ALLOC (yysize);
1185
char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1186
yyp = yystpcpy (yyp, yytname[yytype]);
1191
for (yyx = yyn < 0 ? -yyn : 0;
1192
yyx < (int) (sizeof (yytname) / sizeof (char *));
1194
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1196
const char *yyq = ! yycount ? ", expecting " : " or ";
1197
yyp = yystpcpy (yyp, yyq);
1198
yyp = yystpcpy (yyp, yytname[yyx]);
1203
YYSTACK_FREE (yymsg);
1206
yyerror ("syntax error; also virtual memory exhausted");
1209
#endif /* YYERROR_VERBOSE */
1210
yyerror ("syntax error");
1215
if (yyerrstatus == 3)
1217
/* If just tried and failed to reuse lookahead token after an
1218
error, discard it. */
1220
/* Return failure if at end of input. */
1221
if (yychar == YYEOF)
1223
/* Pop the error token. */
1225
/* Pop the rest of the stack. */
1226
while (yyss < yyssp)
1228
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1229
yydestruct (yystos[*yyssp], yyvsp);
1235
YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1236
yydestruct (yytoken, &yylval);
1241
/* Else will try to reuse lookahead token after shifting the error
1246
/*----------------------------------------------------.
1247
| yyerrlab1 -- error raised explicitly by an action. |
1248
`----------------------------------------------------*/
1251
/* Suppress GCC warning that yyerrlab1 is unused when no action
1253
#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
1254
__attribute__ ((__unused__))
1261
/*---------------------------------------------------------------.
1262
| yyerrlab2 -- pop states until the error token can be shifted. |
1263
`---------------------------------------------------------------*/
1265
yyerrstatus = 3; /* Each real token shifted decrements this. */
1269
yyn = yypact[yystate];
1270
if (yyn != YYPACT_NINF)
1273
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1281
/* Pop the current state because it cannot handle the error token. */
1285
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1286
yydestruct (yystos[yystate], yyvsp);
1290
YY_STACK_PRINT (yyss, yyssp);
1296
YYDPRINTF ((stderr, "Shifting error token, "));
1305
/*-------------------------------------.
1306
| yyacceptlab -- YYACCEPT comes here. |
1307
`-------------------------------------*/
1312
/*-----------------------------------.
1313
| yyabortlab -- YYABORT comes here. |
1314
`-----------------------------------*/
1320
/*----------------------------------------------.
1321
| yyoverflowlab -- parser overflow comes here. |
1322
`----------------------------------------------*/
1324
yyerror ("parser stack overflow");
1332
YYSTACK_FREE (yyss);
1338
#line 151 "segparse.y"
1343
seg_atof(char *value)
1347
datum = DirectFunctionCall1(float4in, CStringGetDatum(value));
1348
return DatumGetFloat4(datum);
1352
#include "segscan.c"