~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to contrib/seg/segparse.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* A Bison parser, made by GNU Bison 1.875.  */
 
2
 
 
3
/* Skeleton parser for Yacc-like parsing with Bison,
 
4
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
 
5
 
 
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)
 
9
   any later version.
 
10
 
 
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.
 
15
 
 
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.  */
 
20
 
 
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.  */
 
25
 
 
26
/* Written by Richard Stallman by simplifying the original so called
 
27
   ``semantic'' parser.  */
 
28
 
 
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.  */
 
35
 
 
36
/* Identify Bison output.  */
 
37
#define YYBISON 1
 
38
 
 
39
/* Skeleton name.  */
 
40
#define YYSKELETON_NAME "yacc.c"
 
41
 
 
42
/* Pure parsers.  */
 
43
#define YYPURE 0
 
44
 
 
45
/* Using locations.  */
 
46
#define YYLSP_NEEDED 0
 
47
 
 
48
/* If NAME_PREFIX is specified substitute the variables and functions
 
49
   names.  */
 
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
 
57
 
 
58
 
 
59
/* Tokens.  */
 
60
#ifndef YYTOKENTYPE
 
61
# define YYTOKENTYPE
 
62
   /* Put the tokens into the symbol table, so that GDB and other debuggers
 
63
      know about them.  */
 
64
   enum yytokentype {
 
65
     SEGFLOAT = 258,
 
66
     RANGE = 259,
 
67
     PLUMIN = 260,
 
68
     EXTENSION = 261
 
69
   };
 
70
#endif
 
71
#define SEGFLOAT 258
 
72
#define RANGE 259
 
73
#define PLUMIN 260
 
74
#define EXTENSION 261
 
75
 
 
76
 
 
77
 
 
78
 
 
79
/* Copy the first part of user declarations.  */
 
80
#line 1 "segparse.y"
 
81
 
 
82
#define YYPARSE_PARAM result  /* need this to pass a pointer (void *) to yyparse */
 
83
 
 
84
#include "postgres.h"
 
85
 
 
86
#include <math.h>
 
87
 
 
88
#include "fmgr.h"
 
89
#include "utils/builtins.h"
 
90
#include "segdata.h"
 
91
 
 
92
/*
 
93
 * Bison doesn't allocate anything that needs to live across parser calls,
 
94
 * so we can easily have it use palloc instead of malloc.  This prevents
 
95
 * memory leaks if we error out during parsing.  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.
 
99
 */
 
100
#define YYMALLOC palloc
 
101
#define YYFREE   pfree
 
102
 
 
103
  extern int seg_yylex(void);
 
104
 
 
105
  extern int significant_digits(char *str);             /* defined in seg.c */
 
106
 
 
107
  void seg_yyerror(const char *message);
 
108
  int seg_yyparse(void *result);
 
109
 
 
110
  static float seg_atof(char *value);
 
111
 
 
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'
 
118
  };
 
119
 
 
120
 
 
121
 
 
122
/* Enabling traces.  */
 
123
#ifndef YYDEBUG
 
124
# define YYDEBUG 0
 
125
#endif
 
126
 
 
127
/* Enabling verbose error messages.  */
 
128
#ifdef YYERROR_VERBOSE
 
129
# undef YYERROR_VERBOSE
 
130
# define YYERROR_VERBOSE 1
 
131
#else
 
132
# define YYERROR_VERBOSE 0
 
133
#endif
 
134
 
 
135
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
 
136
#line 46 "segparse.y"
 
137
typedef union YYSTYPE {
 
138
  struct BND {
 
139
    float val;
 
140
    char  ext;
 
141
    char  sigd;
 
142
  } bnd;
 
143
  char * text;
 
144
} 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
 
150
#endif
 
151
 
 
152
 
 
153
 
 
154
/* Copy the second part of user declarations.  */
 
155
 
 
156
 
 
157
/* Line 214 of yacc.c.  */
 
158
#line 158 "segparse.c"
 
159
 
 
160
#if ! defined (yyoverflow) || YYERROR_VERBOSE
 
161
 
 
162
/* The parser invokes alloca or malloc; define the necessary symbols.  */
 
163
 
 
164
# if YYSTACK_USE_ALLOCA
 
165
#  define YYSTACK_ALLOC alloca
 
166
# else
 
167
#  ifndef YYSTACK_USE_ALLOCA
 
168
#   if defined (alloca) || defined (_ALLOCA_H)
 
169
#    define YYSTACK_ALLOC alloca
 
170
#   else
 
171
#    ifdef __GNUC__
 
172
#     define YYSTACK_ALLOC __builtin_alloca
 
173
#    endif
 
174
#   endif
 
175
#  endif
 
176
# endif
 
177
 
 
178
# ifdef YYSTACK_ALLOC
 
179
   /* Pacify GCC's `empty if-body' warning. */
 
180
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
 
181
# else
 
182
#  if defined (__STDC__) || defined (__cplusplus)
 
183
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 
184
#   define YYSIZE_T size_t
 
185
#  endif
 
186
#  define YYSTACK_ALLOC malloc
 
187
#  define YYSTACK_FREE free
 
188
# endif
 
189
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
 
190
 
 
191
 
 
192
#if (! defined (yyoverflow) \
 
193
     && (! defined (__cplusplus) \
 
194
         || (YYSTYPE_IS_TRIVIAL)))
 
195
 
 
196
/* A type that is properly aligned for any stack member.  */
 
197
union yyalloc
 
198
{
 
199
  short yyss;
 
200
  YYSTYPE yyvs;
 
201
  };
 
202
 
 
203
/* The size of the maximum gap between one aligned stack and the next.  */
 
204
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
 
205
 
 
206
/* The size of an array large to enough to hold all stacks, each with
 
207
   N elements.  */
 
208
# define YYSTACK_BYTES(N) \
 
209
     ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
 
210
      + YYSTACK_GAP_MAXIMUM)
 
211
 
 
212
/* Copy COUNT objects from FROM to TO.  The source and destination do
 
213
   not overlap.  */
 
214
# ifndef YYCOPY
 
215
#  if 1 < __GNUC__
 
216
#   define YYCOPY(To, From, Count) \
 
217
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
 
218
#  else
 
219
#   define YYCOPY(To, From, Count)              \
 
220
      do                                        \
 
221
        {                                       \
 
222
          register YYSIZE_T yyi;                \
 
223
          for (yyi = 0; yyi < (Count); yyi++)   \
 
224
            (To)[yyi] = (From)[yyi];            \
 
225
        }                                       \
 
226
      while (0)
 
227
#  endif
 
228
# endif
 
229
 
 
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
 
234
   stack.  */
 
235
# define YYSTACK_RELOCATE(Stack)                                        \
 
236
    do                                                                  \
 
237
      {                                                                 \
 
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);                          \
 
243
      }                                                                 \
 
244
    while (0)
 
245
 
 
246
#endif
 
247
 
 
248
#if defined (__STDC__) || defined (__cplusplus)
 
249
   typedef signed char yysigned_char;
 
250
#else
 
251
   typedef short yysigned_char;
 
252
#endif
 
253
 
 
254
/* YYFINAL -- State number of the termination state. */
 
255
#define YYFINAL  8
 
256
/* YYLAST -- Last index in YYTABLE.  */
 
257
#define YYLAST   12
 
258
 
 
259
/* YYNTOKENS -- Number of terminals. */
 
260
#define YYNTOKENS  7
 
261
/* YYNNTS -- Number of nonterminals. */
 
262
#define YYNNTS  4
 
263
/* YYNRULES -- Number of rules. */
 
264
#define YYNRULES  9
 
265
/* YYNRULES -- Number of states. */
 
266
#define YYNSTATES  14
 
267
 
 
268
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 
269
#define YYUNDEFTOK  2
 
270
#define YYMAXUTOK   261
 
271
 
 
272
#define YYTRANSLATE(YYX)                                                \
 
273
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
274
 
 
275
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
 
276
static const unsigned char yytranslate[] =
 
277
{
 
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,
 
304
       5,     6
 
305
};
 
306
 
 
307
#if YYDEBUG
 
308
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
 
309
   YYRHS.  */
 
310
static const unsigned char yyprhs[] =
 
311
{
 
312
       0,     0,     3,     7,    11,    14,    17,    19,    21,    24
 
313
};
 
314
 
 
315
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
 
316
static const yysigned_char yyrhs[] =
 
317
{
 
318
       8,     0,    -1,     9,     5,    10,    -1,     9,     4,     9,
 
319
      -1,     9,     4,    -1,     4,     9,    -1,     9,    -1,     3,
 
320
      -1,     6,     3,    -1,     3,    -1
 
321
};
 
322
 
 
323
/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 
324
static const unsigned char yyrline[] =
 
325
{
 
326
       0,    67,    67,    78,    95,   104,   113,   121,   130,   141
 
327
};
 
328
#endif
 
329
 
 
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[] =
 
334
{
 
335
  "$end", "error", "$undefined", "SEGFLOAT", "RANGE", "PLUMIN", "EXTENSION", 
 
336
  "$accept", "range", "boundary", "deviation", 0
 
337
};
 
338
#endif
 
339
 
 
340
# ifdef YYPRINT
 
341
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
 
342
   token YYLEX-NUM.  */
 
343
static const unsigned short yytoknum[] =
 
344
{
 
345
       0,   256,   257,   258,   259,   260,   261
 
346
};
 
347
# endif
 
348
 
 
349
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 
350
static const unsigned char yyr1[] =
 
351
{
 
352
       0,     7,     8,     8,     8,     8,     8,     9,     9,    10
 
353
};
 
354
 
 
355
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 
356
static const unsigned char yyr2[] =
 
357
{
 
358
       0,     2,     3,     3,     2,     2,     1,     1,     2,     1
 
359
};
 
360
 
 
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[] =
 
365
{
 
366
       0,     7,     0,     0,     0,     6,     5,     8,     1,     4,
 
367
       0,     3,     9,     2
 
368
};
 
369
 
 
370
/* YYDEFGOTO[NTERM-NUM]. */
 
371
static const yysigned_char yydefgoto[] =
 
372
{
 
373
      -1,     4,     5,    13
 
374
};
 
375
 
 
376
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
 
377
   STATE-NUM.  */
 
378
#define YYPACT_NINF -3
 
379
static const yysigned_char yypact[] =
 
380
{
 
381
      -1,    -3,     3,     1,     8,     6,    -3,    -3,    -3,     3,
 
382
       9,    -3,    -3,    -3
 
383
};
 
384
 
 
385
/* YYPGOTO[NTERM-NUM].  */
 
386
static const yysigned_char yypgoto[] =
 
387
{
 
388
      -3,    -3,    -2,    -3
 
389
};
 
390
 
 
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[] =
 
397
{
 
398
       6,     0,     1,     2,     7,     3,     1,    11,     8,     3,
 
399
       9,    10,    12
 
400
};
 
401
 
 
402
static const yysigned_char yycheck[] =
 
403
{
 
404
       2,    -1,     3,     4,     3,     6,     3,     9,     0,     6,
 
405
       4,     5,     3
 
406
};
 
407
 
 
408
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
 
409
   symbol of state STATE-NUM.  */
 
410
static const unsigned char yystos[] =
 
411
{
 
412
       0,     3,     4,     6,     8,     9,     9,     3,     0,     4,
 
413
       5,     9,     3,    10
 
414
};
 
415
 
 
416
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
 
417
# define YYSIZE_T __SIZE_TYPE__
 
418
#endif
 
419
#if ! defined (YYSIZE_T) && defined (size_t)
 
420
# define YYSIZE_T size_t
 
421
#endif
 
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
 
426
# endif
 
427
#endif
 
428
#if ! defined (YYSIZE_T)
 
429
# define YYSIZE_T unsigned int
 
430
#endif
 
431
 
 
432
#define yyerrok         (yyerrstatus = 0)
 
433
#define yyclearin       (yychar = YYEMPTY)
 
434
#define YYEMPTY         (-2)
 
435
#define YYEOF           0
 
436
 
 
437
#define YYACCEPT        goto yyacceptlab
 
438
#define YYABORT         goto yyabortlab
 
439
#define YYERROR         goto yyerrlab1
 
440
 
 
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.  */
 
444
 
 
445
#define YYFAIL          goto yyerrlab
 
446
 
 
447
#define YYRECOVERING()  (!!yyerrstatus)
 
448
 
 
449
#define YYBACKUP(Token, Value)                                  \
 
450
do                                                              \
 
451
  if (yychar == YYEMPTY && yylen == 1)                          \
 
452
    {                                                           \
 
453
      yychar = (Token);                                         \
 
454
      yylval = (Value);                                         \
 
455
      yytoken = YYTRANSLATE (yychar);                           \
 
456
      YYPOPSTACK;                                               \
 
457
      goto yybackup;                                            \
 
458
    }                                                           \
 
459
  else                                                          \
 
460
    {                                                           \
 
461
      yyerror ("syntax error: cannot back up");\
 
462
      YYERROR;                                                  \
 
463
    }                                                           \
 
464
while (0)
 
465
 
 
466
#define YYTERROR        1
 
467
#define YYERRCODE       256
 
468
 
 
469
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
 
470
   are run).  */
 
471
 
 
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;
 
478
#endif
 
479
 
 
480
/* YYLEX -- calling `yylex' with the right arguments.  */
 
481
 
 
482
#ifdef YYLEX_PARAM
 
483
# define YYLEX yylex (YYLEX_PARAM)
 
484
#else
 
485
# define YYLEX yylex ()
 
486
#endif
 
487
 
 
488
/* Enable debugging if requested.  */
 
489
#if YYDEBUG
 
490
 
 
491
# ifndef YYFPRINTF
 
492
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
 
493
#  define YYFPRINTF fprintf
 
494
# endif
 
495
 
 
496
# define YYDPRINTF(Args)                        \
 
497
do {                                            \
 
498
  if (yydebug)                                  \
 
499
    YYFPRINTF Args;                             \
 
500
} while (0)
 
501
 
 
502
# define YYDSYMPRINT(Args)                      \
 
503
do {                                            \
 
504
  if (yydebug)                                  \
 
505
    yysymprint Args;                            \
 
506
} while (0)
 
507
 
 
508
# define YYDSYMPRINTF(Title, Token, Value, Location)            \
 
509
do {                                                            \
 
510
  if (yydebug)                                                  \
 
511
    {                                                           \
 
512
      YYFPRINTF (stderr, "%s ", Title);                         \
 
513
      yysymprint (stderr,                                       \
 
514
                  Token, Value);        \
 
515
      YYFPRINTF (stderr, "\n");                                 \
 
516
    }                                                           \
 
517
} while (0)
 
518
 
 
519
/*------------------------------------------------------------------.
 
520
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
 
521
| TOP (cinluded).                                                   |
 
522
`------------------------------------------------------------------*/
 
523
 
 
524
#if defined (__STDC__) || defined (__cplusplus)
 
525
static void
 
526
yy_stack_print (short *bottom, short *top)
 
527
#else
 
528
static void
 
529
yy_stack_print (bottom, top)
 
530
    short *bottom;
 
531
    short *top;
 
532
#endif
 
533
{
 
534
  YYFPRINTF (stderr, "Stack now");
 
535
  for (/* Nothing. */; bottom <= top; ++bottom)
 
536
    YYFPRINTF (stderr, " %d", *bottom);
 
537
  YYFPRINTF (stderr, "\n");
 
538
}
 
539
 
 
540
# define YY_STACK_PRINT(Bottom, Top)                            \
 
541
do {                                                            \
 
542
  if (yydebug)                                                  \
 
543
    yy_stack_print ((Bottom), (Top));                           \
 
544
} while (0)
 
545
 
 
546
 
 
547
/*------------------------------------------------.
 
548
| Report that the YYRULE is going to be reduced.  |
 
549
`------------------------------------------------*/
 
550
 
 
551
#if defined (__STDC__) || defined (__cplusplus)
 
552
static void
 
553
yy_reduce_print (int yyrule)
 
554
#else
 
555
static void
 
556
yy_reduce_print (yyrule)
 
557
    int yyrule;
 
558
#endif
 
559
{
 
560
  int yyi;
 
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]]);
 
568
}
 
569
 
 
570
# define YY_REDUCE_PRINT(Rule)          \
 
571
do {                                    \
 
572
  if (yydebug)                          \
 
573
    yy_reduce_print (Rule);             \
 
574
} while (0)
 
575
 
 
576
/* Nonzero means print parse trace.  It is left uninitialized so that
 
577
   multiple parsers can coexist.  */
 
578
int yydebug;
 
579
#else /* !YYDEBUG */
 
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 */
 
586
 
 
587
 
 
588
/* YYINITDEPTH -- initial size of the parser's stacks.  */
 
589
#ifndef YYINITDEPTH
 
590
# define YYINITDEPTH 200
 
591
#endif
 
592
 
 
593
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
 
594
   if the built-in stack extension method is used).
 
595
 
 
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.  */
 
599
 
 
600
#if YYMAXDEPTH == 0
 
601
# undef YYMAXDEPTH
 
602
#endif
 
603
 
 
604
#ifndef YYMAXDEPTH
 
605
# define YYMAXDEPTH 10000
 
606
#endif
 
607
 
 
608
 
 
609
 
 
610
#if YYERROR_VERBOSE
 
611
 
 
612
# ifndef yystrlen
 
613
#  if defined (__GLIBC__) && defined (_STRING_H)
 
614
#   define yystrlen strlen
 
615
#  else
 
616
/* Return the length of YYSTR.  */
 
617
static YYSIZE_T
 
618
#   if defined (__STDC__) || defined (__cplusplus)
 
619
yystrlen (const char *yystr)
 
620
#   else
 
621
yystrlen (yystr)
 
622
     const char *yystr;
 
623
#   endif
 
624
{
 
625
  register const char *yys = yystr;
 
626
 
 
627
  while (*yys++ != '\0')
 
628
    continue;
 
629
 
 
630
  return yys - yystr - 1;
 
631
}
 
632
#  endif
 
633
# endif
 
634
 
 
635
# ifndef yystpcpy
 
636
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
 
637
#   define yystpcpy stpcpy
 
638
#  else
 
639
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
 
640
   YYDEST.  */
 
641
static char *
 
642
#   if defined (__STDC__) || defined (__cplusplus)
 
643
yystpcpy (char *yydest, const char *yysrc)
 
644
#   else
 
645
yystpcpy (yydest, yysrc)
 
646
     char *yydest;
 
647
     const char *yysrc;
 
648
#   endif
 
649
{
 
650
  register char *yyd = yydest;
 
651
  register const char *yys = yysrc;
 
652
 
 
653
  while ((*yyd++ = *yys++) != '\0')
 
654
    continue;
 
655
 
 
656
  return yyd - 1;
 
657
}
 
658
#  endif
 
659
# endif
 
660
 
 
661
#endif /* !YYERROR_VERBOSE */
 
662
 
 
663
 
 
664
 
 
665
#if YYDEBUG
 
666
/*--------------------------------.
 
667
| Print this symbol on YYOUTPUT.  |
 
668
`--------------------------------*/
 
669
 
 
670
#if defined (__STDC__) || defined (__cplusplus)
 
671
static void
 
672
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
 
673
#else
 
674
static void
 
675
yysymprint (yyoutput, yytype, yyvaluep)
 
676
    FILE *yyoutput;
 
677
    int yytype;
 
678
    YYSTYPE *yyvaluep;
 
679
#endif
 
680
{
 
681
  /* Pacify ``unused variable'' warnings.  */
 
682
  (void) yyvaluep;
 
683
 
 
684
  if (yytype < YYNTOKENS)
 
685
    {
 
686
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
 
687
# ifdef YYPRINT
 
688
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
 
689
# endif
 
690
    }
 
691
  else
 
692
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
 
693
 
 
694
  switch (yytype)
 
695
    {
 
696
      default:
 
697
        break;
 
698
    }
 
699
  YYFPRINTF (yyoutput, ")");
 
700
}
 
701
 
 
702
#endif /* ! YYDEBUG */
 
703
/*-----------------------------------------------.
 
704
| Release the memory associated to this symbol.  |
 
705
`-----------------------------------------------*/
 
706
 
 
707
#if defined (__STDC__) || defined (__cplusplus)
 
708
static void
 
709
yydestruct (int yytype, YYSTYPE *yyvaluep)
 
710
#else
 
711
static void
 
712
yydestruct (yytype, yyvaluep)
 
713
    int yytype;
 
714
    YYSTYPE *yyvaluep;
 
715
#endif
 
716
{
 
717
  /* Pacify ``unused variable'' warnings.  */
 
718
  (void) yyvaluep;
 
719
 
 
720
  switch (yytype)
 
721
    {
 
722
 
 
723
      default:
 
724
        break;
 
725
    }
 
726
}
 
727
 
 
728
 
 
729
/* Prevent warnings from -Wmissing-prototypes.  */
 
730
 
 
731
#ifdef YYPARSE_PARAM
 
732
# if defined (__STDC__) || defined (__cplusplus)
 
733
int yyparse (void *YYPARSE_PARAM);
 
734
# else
 
735
int yyparse ();
 
736
# endif
 
737
#else /* ! YYPARSE_PARAM */
 
738
#if defined (__STDC__) || defined (__cplusplus)
 
739
int yyparse (void);
 
740
#else
 
741
int yyparse ();
 
742
#endif
 
743
#endif /* ! YYPARSE_PARAM */
 
744
 
 
745
 
 
746
 
 
747
/* The lookahead symbol.  */
 
748
int yychar;
 
749
 
 
750
/* The semantic value of the lookahead symbol.  */
 
751
YYSTYPE yylval;
 
752
 
 
753
/* Number of syntax errors so far.  */
 
754
int yynerrs;
 
755
 
 
756
 
 
757
 
 
758
/*----------.
 
759
| yyparse.  |
 
760
`----------*/
 
761
 
 
762
#ifdef YYPARSE_PARAM
 
763
# if defined (__STDC__) || defined (__cplusplus)
 
764
int yyparse (void *YYPARSE_PARAM)
 
765
# else
 
766
int yyparse (YYPARSE_PARAM)
 
767
  void *YYPARSE_PARAM;
 
768
# endif
 
769
#else /* ! YYPARSE_PARAM */
 
770
#if defined (__STDC__) || defined (__cplusplus)
 
771
int
 
772
yyparse (void)
 
773
#else
 
774
int
 
775
yyparse ()
 
776
 
 
777
#endif
 
778
#endif
 
779
{
 
780
  
 
781
  register int yystate;
 
782
  register int yyn;
 
783
  int yyresult;
 
784
  /* Number of tokens to shift before error messages enabled.  */
 
785
  int yyerrstatus;
 
786
  /* Lookahead token as an internal (translated) token number.  */
 
787
  int yytoken = 0;
 
788
 
 
789
  /* Three stacks and their tools:
 
790
     `yyss': related to states,
 
791
     `yyvs': related to semantic values,
 
792
     `yyls': related to locations.
 
793
 
 
794
     Refer to the stacks thru separate pointers, to allow yyoverflow
 
795
     to reallocate them elsewhere.  */
 
796
 
 
797
  /* The state stack.  */
 
798
  short yyssa[YYINITDEPTH];
 
799
  short *yyss = yyssa;
 
800
  register short *yyssp;
 
801
 
 
802
  /* The semantic value stack.  */
 
803
  YYSTYPE yyvsa[YYINITDEPTH];
 
804
  YYSTYPE *yyvs = yyvsa;
 
805
  register YYSTYPE *yyvsp;
 
806
 
 
807
 
 
808
 
 
809
#define YYPOPSTACK   (yyvsp--, yyssp--)
 
810
 
 
811
  YYSIZE_T yystacksize = YYINITDEPTH;
 
812
 
 
813
  /* The variables used to return semantic value and location from the
 
814
     action routines.  */
 
815
  YYSTYPE yyval;
 
816
 
 
817
 
 
818
  /* When reducing, the number of symbols on the RHS of the reduced
 
819
     rule.  */
 
820
  int yylen;
 
821
 
 
822
  YYDPRINTF ((stderr, "Starting parse\n"));
 
823
 
 
824
  yystate = 0;
 
825
  yyerrstatus = 0;
 
826
  yynerrs = 0;
 
827
  yychar = YYEMPTY;             /* Cause a token to be read.  */
 
828
 
 
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.  */
 
833
 
 
834
  yyssp = yyss;
 
835
  yyvsp = yyvs;
 
836
 
 
837
  goto yysetstate;
 
838
 
 
839
/*------------------------------------------------------------.
 
840
| yynewstate -- Push a new state, which is found in yystate.  |
 
841
`------------------------------------------------------------*/
 
842
 yynewstate:
 
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.
 
845
     */
 
846
  yyssp++;
 
847
 
 
848
 yysetstate:
 
849
  *yyssp = yystate;
 
850
 
 
851
  if (yyss + yystacksize - 1 <= yyssp)
 
852
    {
 
853
      /* Get the current used size of the three stacks, in elements.  */
 
854
      YYSIZE_T yysize = yyssp - yyss + 1;
 
855
 
 
856
#ifdef yyoverflow
 
857
      {
 
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
 
860
           memory.  */
 
861
        YYSTYPE *yyvs1 = yyvs;
 
862
        short *yyss1 = yyss;
 
863
 
 
864
 
 
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),
 
872
 
 
873
                    &yystacksize);
 
874
 
 
875
        yyss = yyss1;
 
876
        yyvs = yyvs1;
 
877
      }
 
878
#else /* no yyoverflow */
 
879
# ifndef YYSTACK_RELOCATE
 
880
      goto yyoverflowlab;
 
881
# else
 
882
      /* Extend the stack our own way.  */
 
883
      if (YYMAXDEPTH <= yystacksize)
 
884
        goto yyoverflowlab;
 
885
      yystacksize *= 2;
 
886
      if (YYMAXDEPTH < yystacksize)
 
887
        yystacksize = YYMAXDEPTH;
 
888
 
 
889
      {
 
890
        short *yyss1 = yyss;
 
891
        union yyalloc *yyptr =
 
892
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
 
893
        if (! yyptr)
 
894
          goto yyoverflowlab;
 
895
        YYSTACK_RELOCATE (yyss);
 
896
        YYSTACK_RELOCATE (yyvs);
 
897
 
 
898
#  undef YYSTACK_RELOCATE
 
899
        if (yyss1 != yyssa)
 
900
          YYSTACK_FREE (yyss1);
 
901
      }
 
902
# endif
 
903
#endif /* no yyoverflow */
 
904
 
 
905
      yyssp = yyss + yysize - 1;
 
906
      yyvsp = yyvs + yysize - 1;
 
907
 
 
908
 
 
909
      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
 
910
                  (unsigned long int) yystacksize));
 
911
 
 
912
      if (yyss + yystacksize - 1 <= yyssp)
 
913
        YYABORT;
 
914
    }
 
915
 
 
916
  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
917
 
 
918
  goto yybackup;
 
919
 
 
920
/*-----------.
 
921
| yybackup.  |
 
922
`-----------*/
 
923
yybackup:
 
924
 
 
925
/* Do appropriate processing given the current state.  */
 
926
/* Read a lookahead token if we need one and don't already have one.  */
 
927
/* yyresume: */
 
928
 
 
929
  /* First try to decide what to do without reference to lookahead token.  */
 
930
 
 
931
  yyn = yypact[yystate];
 
932
  if (yyn == YYPACT_NINF)
 
933
    goto yydefault;
 
934
 
 
935
  /* Not known => get a lookahead token if don't already have one.  */
 
936
 
 
937
  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
 
938
  if (yychar == YYEMPTY)
 
939
    {
 
940
      YYDPRINTF ((stderr, "Reading a token: "));
 
941
      yychar = YYLEX;
 
942
    }
 
943
 
 
944
  if (yychar <= YYEOF)
 
945
    {
 
946
      yychar = yytoken = YYEOF;
 
947
      YYDPRINTF ((stderr, "Now at end of input.\n"));
 
948
    }
 
949
  else
 
950
    {
 
951
      yytoken = YYTRANSLATE (yychar);
 
952
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
 
953
    }
 
954
 
 
955
  /* If the proper action on seeing token YYTOKEN is to reduce or to
 
956
     detect an error, take that action.  */
 
957
  yyn += yytoken;
 
958
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
 
959
    goto yydefault;
 
960
  yyn = yytable[yyn];
 
961
  if (yyn <= 0)
 
962
    {
 
963
      if (yyn == 0 || yyn == YYTABLE_NINF)
 
964
        goto yyerrlab;
 
965
      yyn = -yyn;
 
966
      goto yyreduce;
 
967
    }
 
968
 
 
969
  if (yyn == YYFINAL)
 
970
    YYACCEPT;
 
971
 
 
972
  /* Shift the lookahead token.  */
 
973
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
 
974
 
 
975
  /* Discard the token being shifted unless it is eof.  */
 
976
  if (yychar != YYEOF)
 
977
    yychar = YYEMPTY;
 
978
 
 
979
  *++yyvsp = yylval;
 
980
 
 
981
 
 
982
  /* Count tokens shifted since error; after three, turn off error
 
983
     status.  */
 
984
  if (yyerrstatus)
 
985
    yyerrstatus--;
 
986
 
 
987
  yystate = yyn;
 
988
  goto yynewstate;
 
989
 
 
990
 
 
991
/*-----------------------------------------------------------.
 
992
| yydefault -- do the default action for the current state.  |
 
993
`-----------------------------------------------------------*/
 
994
yydefault:
 
995
  yyn = yydefact[yystate];
 
996
  if (yyn == 0)
 
997
    goto yyerrlab;
 
998
  goto yyreduce;
 
999
 
 
1000
 
 
1001
/*-----------------------------.
 
1002
| yyreduce -- Do a reduction.  |
 
1003
`-----------------------------*/
 
1004
yyreduce:
 
1005
  /* yyn is the number of a rule to reduce with.  */
 
1006
  yylen = yyr2[yyn];
 
1007
 
 
1008
  /* If YYLEN is nonzero, implement the default value of the action:
 
1009
     `$$ = $1'.
 
1010
 
 
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];
 
1017
 
 
1018
 
 
1019
  YY_REDUCE_PRINT (yyn);
 
1020
  switch (yyn)
 
1021
    {
 
1022
        case 2:
 
1023
#line 67 "segparse.y"
 
1024
    {
 
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';
 
1033
          ;}
 
1034
    break;
 
1035
 
 
1036
  case 3:
 
1037
#line 78 "segparse.y"
 
1038
    {
 
1039
            ((SEG *)result)->lower = yyvsp[-2].bnd.val;
 
1040
            ((SEG *)result)->upper = yyvsp[0].bnd.val;
 
1041
            if ( ((SEG *)result)->lower > ((SEG *)result)->upper ) {
 
1042
              ereport(ERROR,
 
1043
                                  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 
1044
                                   errmsg("swapped boundaries: %g is greater than %g",
 
1045
                                                  ((SEG *)result)->lower, ((SEG *)result)->upper)));
 
1046
 
 
1047
              YYERROR;
 
1048
            }
 
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' );
 
1053
          ;}
 
1054
    break;
 
1055
 
 
1056
  case 4:
 
1057
#line 95 "segparse.y"
 
1058
    {
 
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 = '-';
 
1065
          ;}
 
1066
    break;
 
1067
 
 
1068
  case 5:
 
1069
#line 104 "segparse.y"
 
1070
    {
 
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' );
 
1077
          ;}
 
1078
    break;
 
1079
 
 
1080
  case 6:
 
1081
#line 113 "segparse.y"
 
1082
    {
 
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' );
 
1086
          ;}
 
1087
    break;
 
1088
 
 
1089
  case 7:
 
1090
#line 121 "segparse.y"
 
1091
    {
 
1092
                        /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
 
1093
                        float val = seg_atof(yyvsp[0].text);
 
1094
 
 
1095
                        yyval.bnd.ext = '\0';
 
1096
                        yyval.bnd.sigd = significant_digits(yyvsp[0].text);
 
1097
                        yyval.bnd.val = val;
 
1098
          ;}
 
1099
    break;
 
1100
 
 
1101
  case 8:
 
1102
#line 130 "segparse.y"
 
1103
    {
 
1104
                        /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
 
1105
                        float val = seg_atof(yyvsp[0].text);
 
1106
 
 
1107
                        yyval.bnd.ext = yyvsp[-1].text[0];
 
1108
                        yyval.bnd.sigd = significant_digits(yyvsp[0].text);
 
1109
                        yyval.bnd.val = val;
 
1110
          ;}
 
1111
    break;
 
1112
 
 
1113
  case 9:
 
1114
#line 141 "segparse.y"
 
1115
    {
 
1116
                        /* temp variable avoids a gcc 3.3.x bug on Sparc64 */
 
1117
                        float val = seg_atof(yyvsp[0].text);
 
1118
 
 
1119
                        yyval.bnd.ext = '\0';
 
1120
                        yyval.bnd.sigd = significant_digits(yyvsp[0].text);
 
1121
                        yyval.bnd.val = val;
 
1122
          ;}
 
1123
    break;
 
1124
 
 
1125
 
 
1126
    }
 
1127
 
 
1128
/* Line 991 of yacc.c.  */
 
1129
#line 1129 "segparse.c"
 
1130
 
 
1131
  yyvsp -= yylen;
 
1132
  yyssp -= yylen;
 
1133
 
 
1134
 
 
1135
  YY_STACK_PRINT (yyss, yyssp);
 
1136
 
 
1137
  *++yyvsp = yyval;
 
1138
 
 
1139
 
 
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.  */
 
1143
 
 
1144
  yyn = yyr1[yyn];
 
1145
 
 
1146
  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
 
1147
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
 
1148
    yystate = yytable[yystate];
 
1149
  else
 
1150
    yystate = yydefgoto[yyn - YYNTOKENS];
 
1151
 
 
1152
  goto yynewstate;
 
1153
 
 
1154
 
 
1155
/*------------------------------------.
 
1156
| yyerrlab -- here on detecting error |
 
1157
`------------------------------------*/
 
1158
yyerrlab:
 
1159
  /* If not already recovering from an error, report this error.  */
 
1160
  if (!yyerrstatus)
 
1161
    {
 
1162
      ++yynerrs;
 
1163
#if YYERROR_VERBOSE
 
1164
      yyn = yypact[yystate];
 
1165
 
 
1166
      if (YYPACT_NINF < yyn && yyn < YYLAST)
 
1167
        {
 
1168
          YYSIZE_T yysize = 0;
 
1169
          int yytype = YYTRANSLATE (yychar);
 
1170
          char *yymsg;
 
1171
          int yyx, yycount;
 
1172
 
 
1173
          yycount = 0;
 
1174
          /* Start YYX at -YYN if negative to avoid negative indexes in
 
1175
             YYCHECK.  */
 
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);
 
1183
          if (yymsg != 0)
 
1184
            {
 
1185
              char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
 
1186
              yyp = yystpcpy (yyp, yytname[yytype]);
 
1187
 
 
1188
              if (yycount < 5)
 
1189
                {
 
1190
                  yycount = 0;
 
1191
                  for (yyx = yyn < 0 ? -yyn : 0;
 
1192
                       yyx < (int) (sizeof (yytname) / sizeof (char *));
 
1193
                       yyx++)
 
1194
                    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
 
1195
                      {
 
1196
                        const char *yyq = ! yycount ? ", expecting " : " or ";
 
1197
                        yyp = yystpcpy (yyp, yyq);
 
1198
                        yyp = yystpcpy (yyp, yytname[yyx]);
 
1199
                        yycount++;
 
1200
                      }
 
1201
                }
 
1202
              yyerror (yymsg);
 
1203
              YYSTACK_FREE (yymsg);
 
1204
            }
 
1205
          else
 
1206
            yyerror ("syntax error; also virtual memory exhausted");
 
1207
        }
 
1208
      else
 
1209
#endif /* YYERROR_VERBOSE */
 
1210
        yyerror ("syntax error");
 
1211
    }
 
1212
 
 
1213
 
 
1214
 
 
1215
  if (yyerrstatus == 3)
 
1216
    {
 
1217
      /* If just tried and failed to reuse lookahead token after an
 
1218
         error, discard it.  */
 
1219
 
 
1220
      /* Return failure if at end of input.  */
 
1221
      if (yychar == YYEOF)
 
1222
        {
 
1223
          /* Pop the error token.  */
 
1224
          YYPOPSTACK;
 
1225
          /* Pop the rest of the stack.  */
 
1226
          while (yyss < yyssp)
 
1227
            {
 
1228
              YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
 
1229
              yydestruct (yystos[*yyssp], yyvsp);
 
1230
              YYPOPSTACK;
 
1231
            }
 
1232
          YYABORT;
 
1233
        }
 
1234
 
 
1235
      YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
 
1236
      yydestruct (yytoken, &yylval);
 
1237
      yychar = YYEMPTY;
 
1238
 
 
1239
    }
 
1240
 
 
1241
  /* Else will try to reuse lookahead token after shifting the error
 
1242
     token.  */
 
1243
  goto yyerrlab2;
 
1244
 
 
1245
 
 
1246
/*----------------------------------------------------.
 
1247
| yyerrlab1 -- error raised explicitly by an action.  |
 
1248
`----------------------------------------------------*/
 
1249
yyerrlab1:
 
1250
 
 
1251
  /* Suppress GCC warning that yyerrlab1 is unused when no action
 
1252
     invokes YYERROR.  */
 
1253
#if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 + __GNUC_MINOR__)
 
1254
  __attribute__ ((__unused__))
 
1255
#endif
 
1256
 
 
1257
 
 
1258
  goto yyerrlab2;
 
1259
 
 
1260
 
 
1261
/*---------------------------------------------------------------.
 
1262
| yyerrlab2 -- pop states until the error token can be shifted.  |
 
1263
`---------------------------------------------------------------*/
 
1264
yyerrlab2:
 
1265
  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 
1266
 
 
1267
  for (;;)
 
1268
    {
 
1269
      yyn = yypact[yystate];
 
1270
      if (yyn != YYPACT_NINF)
 
1271
        {
 
1272
          yyn += YYTERROR;
 
1273
          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
 
1274
            {
 
1275
              yyn = yytable[yyn];
 
1276
              if (0 < yyn)
 
1277
                break;
 
1278
            }
 
1279
        }
 
1280
 
 
1281
      /* Pop the current state because it cannot handle the error token.  */
 
1282
      if (yyssp == yyss)
 
1283
        YYABORT;
 
1284
 
 
1285
      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
 
1286
      yydestruct (yystos[yystate], yyvsp);
 
1287
      yyvsp--;
 
1288
      yystate = *--yyssp;
 
1289
 
 
1290
      YY_STACK_PRINT (yyss, yyssp);
 
1291
    }
 
1292
 
 
1293
  if (yyn == YYFINAL)
 
1294
    YYACCEPT;
 
1295
 
 
1296
  YYDPRINTF ((stderr, "Shifting error token, "));
 
1297
 
 
1298
  *++yyvsp = yylval;
 
1299
 
 
1300
 
 
1301
  yystate = yyn;
 
1302
  goto yynewstate;
 
1303
 
 
1304
 
 
1305
/*-------------------------------------.
 
1306
| yyacceptlab -- YYACCEPT comes here.  |
 
1307
`-------------------------------------*/
 
1308
yyacceptlab:
 
1309
  yyresult = 0;
 
1310
  goto yyreturn;
 
1311
 
 
1312
/*-----------------------------------.
 
1313
| yyabortlab -- YYABORT comes here.  |
 
1314
`-----------------------------------*/
 
1315
yyabortlab:
 
1316
  yyresult = 1;
 
1317
  goto yyreturn;
 
1318
 
 
1319
#ifndef yyoverflow
 
1320
/*----------------------------------------------.
 
1321
| yyoverflowlab -- parser overflow comes here.  |
 
1322
`----------------------------------------------*/
 
1323
yyoverflowlab:
 
1324
  yyerror ("parser stack overflow");
 
1325
  yyresult = 2;
 
1326
  /* Fall through.  */
 
1327
#endif
 
1328
 
 
1329
yyreturn:
 
1330
#ifndef yyoverflow
 
1331
  if (yyss != yyssa)
 
1332
    YYSTACK_FREE (yyss);
 
1333
#endif
 
1334
  return yyresult;
 
1335
}
 
1336
 
 
1337
 
 
1338
#line 151 "segparse.y"
 
1339
 
 
1340
 
 
1341
 
 
1342
static float
 
1343
seg_atof(char *value)
 
1344
{
 
1345
        Datum datum;
 
1346
 
 
1347
        datum = DirectFunctionCall1(float4in, CStringGetDatum(value));
 
1348
        return DatumGetFloat4(datum);
 
1349
}
 
1350
 
 
1351
 
 
1352
#include "segscan.c"
 
1353
 
 
1354