1 /* A Bison parser, made by GNU Bison 3.0.4.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
6 
7    This program is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation, either version 3 of the License, or
10    (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19 
20 /* As a special exception, you may create a larger work that contains
21    part or all of the Bison parser skeleton and distribute that work
22    under terms of your choice, so long as that work isn't itself a
23    parser generator using the skeleton or a modified version thereof
24    as a parser skeleton.  Alternatively, if you modify or redistribute
25    the parser skeleton itself, you may (at your option) remove this
26    special exception, which will cause the skeleton and the resulting
27    Bison output files to be licensed under the GNU General Public
28    License without this special exception.
29 
30    This special exception was added by the Free Software Foundation in
31    version 2.2 of Bison.  */
32 
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34    simplifying the original so-called "semantic" parser.  */
35 
36 /* All symbols defined below should begin with yy or YY, to avoid
37    infringing on user name space.  This should be done even for local
38    variables, as they might otherwise be expanded by user macros.
39    There are some unavoidable exceptions within include files to
40    define necessary library symbols; they are noted "INFRINGES ON
41    USER NAME SPACE" below.  */
42 
43 /* Identify Bison output.  */
44 #define YYBISON 1
45 
46 /* Bison version.  */
47 #define YYBISON_VERSION "3.0.4"
48 
49 /* Skeleton name.  */
50 #define YYSKELETON_NAME "yacc.c"
51 
52 /* Pure parsers.  */
53 #define YYPURE 1
54 
55 /* Push parsers.  */
56 #define YYPUSH 0
57 
58 /* Pull parsers.  */
59 #define YYPULL 1
60 
61 
62 
63 
64 /* Copy the first part of user declarations.  */
65 #line 5 "mapparser.y" /* yacc.c:339  */
66 
67 /* C declarations */
68 #include <stdio.h>
69 #include <stdlib.h>
70 #include <string.h>
71 #include <math.h>
72 #include <time.h>
73 
74 #include "mapserver.h" /* for TRUE/FALSE and REGEX includes */
75 #include "maptime.h" /* for time comparison routines */
76 #include "mapprimitive.h" /* for shapeObj */
77 
78 #include "mapparser.h" /* for YYSTYPE in the function prototype for yylex() */
79 
80 int yylex(YYSTYPE *, parseObj *); /* prototype functions, defined after the grammar */
81 int yyerror(parseObj *, const char *);
82 
83 #line 84 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:339  */
84 
85 # ifndef YY_NULLPTR
86 #  if defined __cplusplus && 201103L <= __cplusplus
87 #   define YY_NULLPTR nullptr
88 #  else
89 #   define YY_NULLPTR 0
90 #  endif
91 # endif
92 
93 /* Enabling verbose error messages.  */
94 #ifdef YYERROR_VERBOSE
95 # undef YYERROR_VERBOSE
96 # define YYERROR_VERBOSE 1
97 #else
98 # define YYERROR_VERBOSE 0
99 #endif
100 
101 /* In a future release of Bison, this section will be replaced
102    by #include "mapparser.h".  */
103 #ifndef YY_YY_HOME_EVEN_MAPSERVER_MAPSERVER_MAPPARSER_H_INCLUDED
104 # define YY_YY_HOME_EVEN_MAPSERVER_MAPSERVER_MAPPARSER_H_INCLUDED
105 /* Debug traces.  */
106 #ifndef YYDEBUG
107 # define YYDEBUG 0
108 #endif
109 #if YYDEBUG
110 extern int yydebug;
111 #endif
112 
113 /* Token type.  */
114 #ifndef YYTOKENTYPE
115 # define YYTOKENTYPE
116   enum yytokentype
117   {
118     BOOLEAN = 258,
119     NUMBER = 259,
120     STRING = 260,
121     TIME = 261,
122     SHAPE = 262,
123     OR = 263,
124     AND = 264,
125     NOT = 265,
126     RE = 266,
127     EQ = 267,
128     NE = 268,
129     LT = 269,
130     GT = 270,
131     LE = 271,
132     GE = 272,
133     IN = 273,
134     IEQ = 274,
135     IRE = 275,
136     INTERSECTS = 276,
137     DISJOINT = 277,
138     TOUCHES = 278,
139     OVERLAPS = 279,
140     CROSSES = 280,
141     WITHIN = 281,
142     CONTAINS = 282,
143     EQUALS = 283,
144     BEYOND = 284,
145     DWITHIN = 285,
146     AREA = 286,
147     LENGTH = 287,
148     COMMIFY = 288,
149     ROUND = 289,
150     UPPER = 290,
151     LOWER = 291,
152     INITCAP = 292,
153     FIRSTCAP = 293,
154     TOSTRING = 294,
155     YYBUFFER = 295,
156     DIFFERENCE = 296,
157     SIMPLIFY = 297,
158     SIMPLIFYPT = 298,
159     GENERALIZE = 299,
160     SMOOTHSIA = 300,
161     JAVASCRIPT = 301,
162     NEG = 302
163   };
164 #endif
165 /* Tokens.  */
166 #define BOOLEAN 258
167 #define NUMBER 259
168 #define STRING 260
169 #define TIME 261
170 #define SHAPE 262
171 #define OR 263
172 #define AND 264
173 #define NOT 265
174 #define RE 266
175 #define EQ 267
176 #define NE 268
177 #define LT 269
178 #define GT 270
179 #define LE 271
180 #define GE 272
181 #define IN 273
182 #define IEQ 274
183 #define IRE 275
184 #define INTERSECTS 276
185 #define DISJOINT 277
186 #define TOUCHES 278
187 #define OVERLAPS 279
188 #define CROSSES 280
189 #define WITHIN 281
190 #define CONTAINS 282
191 #define EQUALS 283
192 #define BEYOND 284
193 #define DWITHIN 285
194 #define AREA 286
195 #define LENGTH 287
196 #define COMMIFY 288
197 #define ROUND 289
198 #define UPPER 290
199 #define LOWER 291
200 #define INITCAP 292
201 #define FIRSTCAP 293
202 #define TOSTRING 294
203 #define YYBUFFER 295
204 #define DIFFERENCE 296
205 #define SIMPLIFY 297
206 #define SIMPLIFYPT 298
207 #define GENERALIZE 299
208 #define SMOOTHSIA 300
209 #define JAVASCRIPT 301
210 #define NEG 302
211 
212 /* Value type.  */
213 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
214 
215 union YYSTYPE
216 {
217 #line 30 "mapparser.y" /* yacc.c:355  */
218 
219   double dblval;
220   int intval;
221   char *strval;
222   struct tm tmval;
223   shapeObj *shpval;
224 
225 #line 226 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:355  */
226 };
227 
228 typedef union YYSTYPE YYSTYPE;
229 # define YYSTYPE_IS_TRIVIAL 1
230 # define YYSTYPE_IS_DECLARED 1
231 #endif
232 
233 
234 
235 int yyparse (parseObj *p);
236 
237 #endif /* !YY_YY_HOME_EVEN_MAPSERVER_MAPSERVER_MAPPARSER_H_INCLUDED  */
238 
239 /* Copy the second part of user declarations.  */
240 
241 #line 242 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:358  */
242 
243 #ifdef short
244 # undef short
245 #endif
246 
247 #ifdef YYTYPE_UINT8
248 typedef YYTYPE_UINT8 yytype_uint8;
249 #else
250 typedef unsigned char yytype_uint8;
251 #endif
252 
253 #ifdef YYTYPE_INT8
254 typedef YYTYPE_INT8 yytype_int8;
255 #else
256 typedef signed char yytype_int8;
257 #endif
258 
259 #ifdef YYTYPE_UINT16
260 typedef YYTYPE_UINT16 yytype_uint16;
261 #else
262 typedef unsigned short int yytype_uint16;
263 #endif
264 
265 #ifdef YYTYPE_INT16
266 typedef YYTYPE_INT16 yytype_int16;
267 #else
268 typedef short int yytype_int16;
269 #endif
270 
271 #ifndef YYSIZE_T
272 # ifdef __SIZE_TYPE__
273 #  define YYSIZE_T __SIZE_TYPE__
274 # elif defined size_t
275 #  define YYSIZE_T size_t
276 # elif ! defined YYSIZE_T
277 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
278 #  define YYSIZE_T size_t
279 # else
280 #  define YYSIZE_T unsigned int
281 # endif
282 #endif
283 
284 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
285 
286 #ifndef YY_
287 # if defined YYENABLE_NLS && YYENABLE_NLS
288 #  if ENABLE_NLS
289 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
290 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
291 #  endif
292 # endif
293 # ifndef YY_
294 #  define YY_(Msgid) Msgid
295 # endif
296 #endif
297 
298 #ifndef YY_ATTRIBUTE
299 # if (defined __GNUC__                                               \
300       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
301      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
302 #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
303 # else
304 #  define YY_ATTRIBUTE(Spec) /* empty */
305 # endif
306 #endif
307 
308 #ifndef YY_ATTRIBUTE_PURE
309 # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
310 #endif
311 
312 #ifndef YY_ATTRIBUTE_UNUSED
313 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
314 #endif
315 
316 #if !defined _Noreturn \
317      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
318 # if defined _MSC_VER && 1200 <= _MSC_VER
319 #  define _Noreturn __declspec (noreturn)
320 # else
321 #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
322 # endif
323 #endif
324 
325 /* Suppress unused-variable warnings by "using" E.  */
326 #if ! defined lint || defined __GNUC__
327 # define YYUSE(E) ((void) (E))
328 #else
329 # define YYUSE(E) /* empty */
330 #endif
331 
332 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
333 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
334 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
335     _Pragma ("GCC diagnostic push") \
336     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
337     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
338 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
339     _Pragma ("GCC diagnostic pop")
340 #else
341 # define YY_INITIAL_VALUE(Value) Value
342 #endif
343 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
344 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
345 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
346 #endif
347 #ifndef YY_INITIAL_VALUE
348 # define YY_INITIAL_VALUE(Value) /* Nothing. */
349 #endif
350 
351 
352 #if ! defined yyoverflow || YYERROR_VERBOSE
353 
354 /* The parser invokes alloca or malloc; define the necessary symbols.  */
355 
356 # ifdef YYSTACK_USE_ALLOCA
357 #  if YYSTACK_USE_ALLOCA
358 #   ifdef __GNUC__
359 #    define YYSTACK_ALLOC __builtin_alloca
360 #   elif defined __BUILTIN_VA_ARG_INCR
361 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
362 #   elif defined _AIX
363 #    define YYSTACK_ALLOC __alloca
364 #   elif defined _MSC_VER
365 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
366 #    define alloca _alloca
367 #   else
368 #    define YYSTACK_ALLOC alloca
369 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
370 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
371       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
372 #     ifndef EXIT_SUCCESS
373 #      define EXIT_SUCCESS 0
374 #     endif
375 #    endif
376 #   endif
377 #  endif
378 # endif
379 
380 # ifdef YYSTACK_ALLOC
381    /* Pacify GCC's 'empty if-body' warning.  */
382 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
383 #  ifndef YYSTACK_ALLOC_MAXIMUM
384     /* The OS might guarantee only one guard page at the bottom of the stack,
385        and a page size can be as small as 4096 bytes.  So we cannot safely
386        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
387        to allow for a few compiler-allocated temporary stack slots.  */
388 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
389 #  endif
390 # else
391 #  define YYSTACK_ALLOC YYMALLOC
392 #  define YYSTACK_FREE YYFREE
393 #  ifndef YYSTACK_ALLOC_MAXIMUM
394 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
395 #  endif
396 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
397        && ! ((defined YYMALLOC || defined malloc) \
398              && (defined YYFREE || defined free)))
399 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
400 #   ifndef EXIT_SUCCESS
401 #    define EXIT_SUCCESS 0
402 #   endif
403 #  endif
404 #  ifndef YYMALLOC
405 #   define YYMALLOC malloc
406 #   if ! defined malloc && ! defined EXIT_SUCCESS
407 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
408 #   endif
409 #  endif
410 #  ifndef YYFREE
411 #   define YYFREE free
412 #   if ! defined free && ! defined EXIT_SUCCESS
413 void free (void *); /* INFRINGES ON USER NAME SPACE */
414 #   endif
415 #  endif
416 # endif
417 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
418 
419 
420 #if (! defined yyoverflow \
421      && (! defined __cplusplus \
422          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
423 
424 /* A type that is properly aligned for any stack member.  */
425 union yyalloc
426 {
427   yytype_int16 yyss_alloc;
428   YYSTYPE yyvs_alloc;
429 };
430 
431 /* The size of the maximum gap between one aligned stack and the next.  */
432 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
433 
434 /* The size of an array large to enough to hold all stacks, each with
435    N elements.  */
436 # define YYSTACK_BYTES(N) \
437      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
438       + YYSTACK_GAP_MAXIMUM)
439 
440 # define YYCOPY_NEEDED 1
441 
442 /* Relocate STACK from its old location to the new one.  The
443    local variables YYSIZE and YYSTACKSIZE give the old and new number of
444    elements in the stack, and YYPTR gives the new location of the
445    stack.  Advance YYPTR to a properly aligned location for the next
446    stack.  */
447 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
448     do                                                                  \
449       {                                                                 \
450         YYSIZE_T yynewbytes;                                            \
451         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
452         Stack = &yyptr->Stack_alloc;                                    \
453         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
454         yyptr += yynewbytes / sizeof (*yyptr);                          \
455       }                                                                 \
456     while (0)
457 
458 #endif
459 
460 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
461 /* Copy COUNT objects from SRC to DST.  The source and destination do
462    not overlap.  */
463 # ifndef YYCOPY
464 #  if defined __GNUC__ && 1 < __GNUC__
465 #   define YYCOPY(Dst, Src, Count) \
466       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
467 #  else
468 #   define YYCOPY(Dst, Src, Count)              \
469       do                                        \
470         {                                       \
471           YYSIZE_T yyi;                         \
472           for (yyi = 0; yyi < (Count); yyi++)   \
473             (Dst)[yyi] = (Src)[yyi];            \
474         }                                       \
475       while (0)
476 #  endif
477 # endif
478 #endif /* !YYCOPY_NEEDED */
479 
480 /* YYFINAL -- State number of the termination state.  */
481 #define YYFINAL  78
482 /* YYLAST -- Last index in YYTABLE.  */
483 #define YYLAST   510
484 
485 /* YYNTOKENS -- Number of terminals.  */
486 #define YYNTOKENS  57
487 /* YYNNTS -- Number of nonterminals.  */
488 #define YYNNTS  7
489 /* YYNRULES -- Number of rules.  */
490 #define YYNRULES  97
491 /* YYNSTATES -- Number of states.  */
492 #define YYNSTATES  287
493 
494 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
495    by yylex, with out-of-bounds checking.  */
496 #define YYUNDEFTOK  2
497 #define YYMAXUTOK   302
498 
499 #define YYTRANSLATE(YYX)                                                \
500   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
501 
502 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
503    as returned by yylex, without out-of-bounds checking.  */
504 static const yytype_uint8 yytranslate[] =
505 {
506        0,     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,    51,     2,     2,
510       54,    55,    49,    47,    56,    48,     2,    50,     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,    53,     2,     2,     2,     2,     2,
516        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
517        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
518        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
519        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
520        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
521        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
522        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
523        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
524        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
525        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
526        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
527        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
528        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
529        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
530        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
531        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
532        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
533       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
534       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
535       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
536       45,    46,    52
537 };
538 
539 #if YYDEBUG
540   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
541 static const yytype_uint16 yyrline[] =
542 {
543        0,    68,    68,    69,    82,    96,   109,   119,   120,   121,
544      125,   133,   142,   150,   159,   167,   176,   184,   193,   194,
545      195,   215,   235,   241,   247,   253,   259,   265,   271,   279,
546      287,   295,   303,   311,   319,   325,   331,   337,   343,   349,
547      355,   376,   396,   402,   410,   416,   427,   438,   449,   460,
548      471,   482,   493,   504,   515,   526,   537,   548,   559,   570,
549      581,   592,   602,   614,   615,   616,   617,   618,   619,   620,
550      627,   628,   629,   630,   638,   641,   642,   643,   653,   663,
551      673,   683,   693,   703,   713,   723,   734,   752,   753,   754,
552      758,   763,   767,   771,   775,   779,   785,   786
553 };
554 #endif
555 
556 #if YYDEBUG || YYERROR_VERBOSE || 0
557 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
558    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
559 static const char *const yytname[] =
560 {
561   "$end", "error", "$undefined", "BOOLEAN", "NUMBER", "STRING", "TIME",
562   "SHAPE", "OR", "AND", "NOT", "RE", "EQ", "NE", "LT", "GT", "LE", "GE",
563   "IN", "IEQ", "IRE", "INTERSECTS", "DISJOINT", "TOUCHES", "OVERLAPS",
564   "CROSSES", "WITHIN", "CONTAINS", "EQUALS", "BEYOND", "DWITHIN", "AREA",
565   "LENGTH", "COMMIFY", "ROUND", "UPPER", "LOWER", "INITCAP", "FIRSTCAP",
566   "TOSTRING", "YYBUFFER", "DIFFERENCE", "SIMPLIFY", "SIMPLIFYPT",
567   "GENERALIZE", "SMOOTHSIA", "JAVASCRIPT", "'+'", "'-'", "'*'", "'/'",
568   "'%'", "NEG", "'^'", "'('", "')'", "','", "$accept", "input",
569   "logical_exp", "math_exp", "shape_exp", "string_exp", "time_exp", YY_NULLPTR
570 };
571 #endif
572 
573 # ifdef YYPRINT
574 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
575    (internal) symbol number NUM (which must be that of a token).  */
576 static const yytype_uint16 yytoknum[] =
577 {
578        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
579      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
580      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
581      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
582      295,   296,   297,   298,   299,   300,   301,    43,    45,    42,
583       47,    37,   302,    94,    40,    41,    44
584 };
585 # endif
586 
587 #define YYPACT_NINF -44
588 
589 #define yypact_value_is_default(Yystate) \
590   (!!((Yystate) == (-44)))
591 
592 #define YYTABLE_NINF -1
593 
594 #define yytable_value_is_error(Yytable_value) \
595   0
596 
597   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
598      STATE-NUM.  */
599 static const yytype_int16 yypact[] =
600 {
601      275,   -44,   -44,   -44,   -44,   -44,   275,    -3,    -2,     1,
602       12,    19,    32,    33,    34,    35,    37,    47,    48,    49,
603       50,    51,    64,    65,    66,    67,    69,    81,    83,   110,
604      120,   123,   125,    -1,   275,    45,     6,   324,    58,   247,
605      193,    42,   387,    58,   247,   117,   117,   117,   117,   117,
606      117,   117,   117,   117,   117,   117,     4,     4,    -1,     4,
607        4,     4,     4,    -1,   117,   117,   117,   117,   117,   117,
608      117,    -1,    79,     8,   173,   219,   378,     9,   -44,   275,
609      275,   275,   275,   275,    -1,    -1,    -1,    -1,    -1,    -1,
610        4,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   117,   117,
611      117,   117,   117,   117,   117,   117,     4,     4,     4,     4,
612        4,     4,     4,     4,     4,     4,     4,    -4,    -4,    -4,
613       -4,    -4,    -4,    -4,   117,    16,   124,   137,   155,   176,
614      199,   200,   201,   214,   215,   179,     4,   -28,   -11,   119,
615       -9,   118,   129,   178,   360,   216,   230,   231,   232,   234,
616       -7,   266,   371,   -44,   -44,   -44,   -44,   -44,    23,   335,
617       42,   387,   -44,   324,    23,   335,    42,   387,   457,   457,
618      457,   457,   457,   457,   189,   457,    18,    18,    79,    79,
619       79,    79,   -44,   -44,   -44,   -44,   -44,   -44,   -44,   -44,
620      189,   189,   189,   189,   189,   189,   189,   189,   189,   189,
621      -44,    -4,   -44,   -44,   -44,   -44,   -44,   -44,   -44,   184,
622      117,   117,   117,   117,   117,   117,   117,   117,   117,   117,
623      -44,   180,   -44,   -44,    -1,   -44,   -44,   -44,   -44,     4,
624       -1,   117,    -1,    -1,    -1,   -44,    -1,     4,   220,   269,
625      272,   273,   276,   279,   290,   291,   300,   274,   301,   394,
626      183,   403,   303,   412,   421,   430,   -43,   221,   -44,   -44,
627      -44,   -44,   -44,   -44,   -44,   -44,    -1,    -1,   -44,   -44,
628      -44,   -44,   -44,   -44,   -44,   -44,    -1,   -44,   439,   448,
629       78,   -44,   -44,   -44,     4,   222,   -44
630 };
631 
632   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
633      Performed when YYTABLE does not specify something else to do.  Zero
634      means the default is an error.  */
635 static const yytype_uint8 yydefact[] =
636 {
637        2,     7,    63,    87,    96,    75,     0,     0,     0,     0,
638        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
639        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
640        0,     0,     0,     0,     0,     0,     3,     4,     6,     5,
641        0,    18,    19,     0,     0,     0,     0,     0,     0,     0,
642        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
643        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
644        0,     0,    70,     0,     0,     0,     0,     0,     1,     0,
645        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
646        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
647        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
648        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
649        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
650        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
651        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
652        0,     0,     0,     8,    64,    76,    88,    97,    10,    12,
653       11,    13,     9,     0,    14,    16,    15,    17,    22,    23,
654       25,    24,    27,    26,    41,    42,    65,    66,    67,    69,
655       68,    71,    45,    48,    50,    52,    54,    56,    58,    60,
656       20,    28,    29,    31,    30,    33,    32,    40,    43,    21,
657       89,     0,    34,    35,    37,    36,    39,    38,    44,     0,
658        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
659       73,     0,    72,    91,     0,    92,    93,    94,    95,     0,
660        0,     0,     0,     0,     0,    82,     0,     0,     0,     0,
661        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
662        0,     0,     0,     0,     0,     0,     0,     0,    47,    49,
663       51,    53,    55,    57,    59,    46,     0,     0,    74,    90,
664       77,    78,    79,    80,    81,    83,     0,    86,     0,     0,
665        0,    62,    61,    84,     0,     0,    85
666 };
667 
668   /* YYPGOTO[NTERM-NUM].  */
669 static const yytype_int16 yypgoto[] =
670 {
671      -44,   -44,    -5,    59,   149,     0,   -23
672 };
673 
674   /* YYDEFGOTO[NTERM-NUM].  */
675 static const yytype_int8 yydefgoto[] =
676 {
677       -1,    35,    36,    37,    43,    44,    40
678 };
679 
680   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
681      positive, shift that token.  If negative, reduce the rule whose
682      number is the opposite.  If YYTABLE_NINF, syntax error.  */
683 static const yytype_uint16 yytable[] =
684 {
685       39,    41,     4,     2,    92,    93,    94,    95,    96,     3,
686       97,    77,   275,   276,    79,    80,    79,    80,    81,   116,
687       81,   117,   118,   119,   120,   121,   122,   222,   123,    73,
688       17,    18,    80,    20,    76,    81,   116,    19,   116,    21,
689       22,    23,    24,    25,   223,    78,   225,    33,   235,   236,
690      201,    45,    46,    71,    81,    47,   137,   138,   136,   140,
691      141,   142,   143,   153,   157,    42,    48,    94,    95,    96,
692       98,    97,   210,    49,   158,   160,   162,   164,   166,    99,
693      100,   101,   102,   103,   104,   105,    50,    51,    52,    53,
694      174,    54,    72,    74,   202,   203,   204,   205,   206,   207,
695      208,    55,    56,    57,    58,    59,   190,   191,   192,   193,
696      194,   195,   196,   197,   198,   199,   200,   139,    60,    61,
697       62,    63,   144,    64,     5,    92,    93,    94,    95,    96,
698      152,    97,    97,   283,   284,    65,   221,    66,   159,   161,
699      163,   165,   167,   168,   169,   170,   171,   172,   173,    38,
700      175,   176,   177,   178,   179,   180,   181,    26,    27,    28,
701       29,    30,    31,    32,    67,   116,    92,    93,    94,    95,
702       96,   124,    97,   226,    68,   224,   116,    69,   238,    70,
703      211,    82,    83,    75,   227,    84,    85,    86,    87,    88,
704       89,    90,    91,   212,   125,   126,   127,   128,   129,   130,
705      131,   132,   133,   134,   135,   117,   118,   119,   120,   121,
706      122,   213,   123,   145,   146,   147,   148,   149,   150,   151,
707       92,    93,    94,    95,    96,   116,    97,   116,   154,   250,
708      116,    98,   214,   228,   220,   156,   116,   257,   269,   155,
709       99,   100,   101,   102,   103,   104,   105,   182,   183,   184,
710      185,   186,   187,   188,   189,   215,   216,   217,   106,   107,
711      108,   109,   110,   111,   112,   113,   114,   115,   116,   116,
712      218,   219,   230,   209,   155,   157,   277,   286,     1,     2,
713        3,     4,     5,   249,   285,     6,   231,   232,   233,   251,
714      234,   253,   254,   255,   116,   256,     7,     8,     9,    10,
715       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
716       21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
717       31,    32,   237,    33,   258,   278,   279,   259,   260,    34,
718      266,   261,    82,    83,   262,   280,    84,    85,    86,    87,
719       88,    89,    90,    91,    83,   263,   264,    84,    85,    86,
720       87,    88,    89,    90,    91,   265,     0,   267,   271,   239,
721      240,   241,   242,   243,   244,   245,   246,   247,   248,     0,
722        0,    92,    93,    94,    95,    96,     0,    97,     0,     0,
723      252,     0,    92,    93,    94,    95,    96,     0,    97,   106,
724      107,   108,   109,   110,   111,   112,   113,   114,   115,    84,
725       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
726       95,    96,     0,    97,     0,     0,   229,     0,    92,    93,
727       94,    95,    96,     0,    97,   116,   154,     0,     0,     0,
728        0,     0,     0,   156,    92,    93,    94,    95,    96,     0,
729       97,    92,    93,    94,    95,    96,     0,    97,     0,   268,
730       92,    93,    94,    95,    96,     0,    97,     0,   270,    92,
731       93,    94,    95,    96,     0,    97,     0,   272,    92,    93,
732       94,    95,    96,     0,    97,     0,   273,    92,    93,    94,
733       95,    96,     0,    97,     0,   274,    92,    93,    94,    95,
734       96,     0,    97,     0,   281,    92,    93,    94,    95,    96,
735        0,    97,     0,   282,    92,    93,    94,    95,    96,     0,
736       97
737 };
738 
739 static const yytype_int16 yycheck[] =
740 {
741        0,     6,     6,     4,    47,    48,    49,    50,    51,     5,
742       53,    34,    55,    56,     8,     9,     8,     9,    12,    47,
743       12,    12,    13,    14,    15,    16,    17,    55,    19,    34,
744       31,    32,     9,    34,    34,    12,    47,    33,    47,    35,
745       36,    37,    38,    39,    55,     0,    55,    48,    55,    56,
746       54,    54,    54,    54,    12,    54,    56,    57,    54,    59,
747       60,    61,    62,    55,    55,     6,    54,    49,    50,    51,
748       12,    53,    56,    54,    79,    80,    81,    82,    83,    21,
749       22,    23,    24,    25,    26,    27,    54,    54,    54,    54,
750       90,    54,    33,    34,   117,   118,   119,   120,   121,   122,
751      123,    54,    54,    54,    54,    54,   106,   107,   108,   109,
752      110,   111,   112,   113,   114,   115,   116,    58,    54,    54,
753       54,    54,    63,    54,     7,    47,    48,    49,    50,    51,
754       71,    53,    53,    55,    56,    54,   136,    54,    79,    80,
755       81,    82,    83,    84,    85,    86,    87,    88,    89,     0,
756       91,    92,    93,    94,    95,    96,    97,    40,    41,    42,
757       43,    44,    45,    46,    54,    47,    47,    48,    49,    50,
758       51,    54,    53,    55,    54,    56,    47,    54,   201,    54,
759       56,     8,     9,    34,    55,    12,    13,    14,    15,    16,
760       17,    18,    19,    56,    45,    46,    47,    48,    49,    50,
761       51,    52,    53,    54,    55,    12,    13,    14,    15,    16,
762       17,    56,    19,    64,    65,    66,    67,    68,    69,    70,
763       47,    48,    49,    50,    51,    47,    53,    47,    55,   229,
764       47,    12,    56,    55,    55,    55,    47,   237,    55,    55,
765       21,    22,    23,    24,    25,    26,    27,    98,    99,   100,
766      101,   102,   103,   104,   105,    56,    56,    56,    11,    12,
767       13,    14,    15,    16,    17,    18,    19,    20,    47,    47,
768       56,    56,    56,   124,    55,    55,    55,    55,     3,     4,
769        5,     6,     7,   224,   284,    10,    56,    56,    56,   230,
770       56,   232,   233,   234,    47,   236,    21,    22,    23,    24,
771       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
772       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
773       45,    46,    56,    48,    55,   266,   267,    55,    55,    54,
774       56,    55,     8,     9,    55,   276,    12,    13,    14,    15,
775       16,    17,    18,    19,     9,    55,    55,    12,    13,    14,
776       15,    16,    17,    18,    19,    55,    -1,    56,    55,   210,
777      211,   212,   213,   214,   215,   216,   217,   218,   219,    -1,
778       -1,    47,    48,    49,    50,    51,    -1,    53,    -1,    -1,
779      231,    -1,    47,    48,    49,    50,    51,    -1,    53,    11,
780       12,    13,    14,    15,    16,    17,    18,    19,    20,    12,
781       13,    14,    15,    16,    17,    18,    19,    47,    48,    49,
782       50,    51,    -1,    53,    -1,    -1,    56,    -1,    47,    48,
783       49,    50,    51,    -1,    53,    47,    55,    -1,    -1,    -1,
784       -1,    -1,    -1,    55,    47,    48,    49,    50,    51,    -1,
785       53,    47,    48,    49,    50,    51,    -1,    53,    -1,    55,
786       47,    48,    49,    50,    51,    -1,    53,    -1,    55,    47,
787       48,    49,    50,    51,    -1,    53,    -1,    55,    47,    48,
788       49,    50,    51,    -1,    53,    -1,    55,    47,    48,    49,
789       50,    51,    -1,    53,    -1,    55,    47,    48,    49,    50,
790       51,    -1,    53,    -1,    55,    47,    48,    49,    50,    51,
791       -1,    53,    -1,    55,    47,    48,    49,    50,    51,    -1,
792       53
793 };
794 
795   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
796      symbol of state STATE-NUM.  */
797 static const yytype_uint8 yystos[] =
798 {
799        0,     3,     4,     5,     6,     7,    10,    21,    22,    23,
800       24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
801       34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
802       44,    45,    46,    48,    54,    58,    59,    60,    61,    62,
803       63,    59,    60,    61,    62,    54,    54,    54,    54,    54,
804       54,    54,    54,    54,    54,    54,    54,    54,    54,    54,
805       54,    54,    54,    54,    54,    54,    54,    54,    54,    54,
806       54,    54,    60,    59,    60,    61,    62,    63,     0,     8,
807        9,    12,     8,     9,    12,    13,    14,    15,    16,    17,
808       18,    19,    47,    48,    49,    50,    51,    53,    12,    21,
809       22,    23,    24,    25,    26,    27,    11,    12,    13,    14,
810       15,    16,    17,    18,    19,    20,    47,    12,    13,    14,
811       15,    16,    17,    19,    54,    61,    61,    61,    61,    61,
812       61,    61,    61,    61,    61,    61,    54,    62,    62,    60,
813       62,    62,    62,    62,    60,    61,    61,    61,    61,    61,
814       61,    61,    60,    55,    55,    55,    55,    55,    59,    60,
815       59,    60,    59,    60,    59,    60,    59,    60,    60,    60,
816       60,    60,    60,    60,    62,    60,    60,    60,    60,    60,
817       60,    60,    61,    61,    61,    61,    61,    61,    61,    61,
818       62,    62,    62,    62,    62,    62,    62,    62,    62,    62,
819       62,    54,    63,    63,    63,    63,    63,    63,    63,    61,
820       56,    56,    56,    56,    56,    56,    56,    56,    56,    56,
821       55,    62,    55,    55,    56,    55,    55,    55,    55,    56,
822       56,    56,    56,    56,    56,    55,    56,    56,    63,    61,
823       61,    61,    61,    61,    61,    61,    61,    61,    61,    60,
824       62,    60,    61,    60,    60,    60,    60,    62,    55,    55,
825       55,    55,    55,    55,    55,    55,    56,    56,    55,    55,
826       55,    55,    55,    55,    55,    55,    56,    55,    60,    60,
827       60,    55,    55,    55,    56,    62,    55
828 };
829 
830   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
831 static const yytype_uint8 yyr1[] =
832 {
833        0,    57,    58,    58,    58,    58,    58,    59,    59,    59,
834       59,    59,    59,    59,    59,    59,    59,    59,    59,    59,
835       59,    59,    59,    59,    59,    59,    59,    59,    59,    59,
836       59,    59,    59,    59,    59,    59,    59,    59,    59,    59,
837       59,    59,    59,    59,    59,    59,    59,    59,    59,    59,
838       59,    59,    59,    59,    59,    59,    59,    59,    59,    59,
839       59,    59,    59,    60,    60,    60,    60,    60,    60,    60,
840       60,    60,    60,    60,    60,    61,    61,    61,    61,    61,
841       61,    61,    61,    61,    61,    61,    61,    62,    62,    62,
842       62,    62,    62,    62,    62,    62,    63,    63
843 };
844 
845   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
846 static const yytype_uint8 yyr2[] =
847 {
848        0,     2,     0,     1,     1,     1,     1,     1,     3,     3,
849        3,     3,     3,     3,     3,     3,     3,     3,     2,     2,
850        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
851        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
852        3,     3,     3,     3,     3,     3,     6,     6,     3,     6,
853        3,     6,     3,     6,     3,     6,     3,     6,     3,     6,
854        3,     8,     8,     1,     3,     3,     3,     3,     3,     3,
855        2,     3,     4,     4,     6,     1,     3,     6,     6,     6,
856        6,     6,     4,     6,     8,    10,     6,     1,     3,     3,
857        6,     4,     4,     4,     4,     4,     1,     3
858 };
859 
860 
861 #define yyerrok         (yyerrstatus = 0)
862 #define yyclearin       (yychar = YYEMPTY)
863 #define YYEMPTY         (-2)
864 #define YYEOF           0
865 
866 #define YYACCEPT        goto yyacceptlab
867 #define YYABORT         goto yyabortlab
868 #define YYERROR         goto yyerrorlab
869 
870 
871 #define YYRECOVERING()  (!!yyerrstatus)
872 
873 #define YYBACKUP(Token, Value)                                  \
874 do                                                              \
875   if (yychar == YYEMPTY)                                        \
876     {                                                           \
877       yychar = (Token);                                         \
878       yylval = (Value);                                         \
879       YYPOPSTACK (yylen);                                       \
880       yystate = *yyssp;                                         \
881       goto yybackup;                                            \
882     }                                                           \
883   else                                                          \
884     {                                                           \
885       yyerror (p, YY_("syntax error: cannot back up")); \
886       YYERROR;                                                  \
887     }                                                           \
888 while (0)
889 
890 /* Error token number */
891 #define YYTERROR        1
892 #define YYERRCODE       256
893 
894 
895 
896 /* Enable debugging if requested.  */
897 #if YYDEBUG
898 
899 # ifndef YYFPRINTF
900 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
901 #  define YYFPRINTF fprintf
902 # endif
903 
904 # define YYDPRINTF(Args)                        \
905 do {                                            \
906   if (yydebug)                                  \
907     YYFPRINTF Args;                             \
908 } while (0)
909 
910 /* This macro is provided for backward compatibility. */
911 #ifndef YY_LOCATION_PRINT
912 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
913 #endif
914 
915 
916 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
917 do {                                                                      \
918   if (yydebug)                                                            \
919     {                                                                     \
920       YYFPRINTF (stderr, "%s ", Title);                                   \
921       yy_symbol_print (stderr,                                            \
922                   Type, Value, p); \
923       YYFPRINTF (stderr, "\n");                                           \
924     }                                                                     \
925 } while (0)
926 
927 
928 /*----------------------------------------.
929 | Print this symbol's value on YYOUTPUT.  |
930 `----------------------------------------*/
931 
932 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep,parseObj * p)933 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parseObj *p)
934 {
935   FILE *yyo = yyoutput;
936   YYUSE (yyo);
937   YYUSE (p);
938   if (!yyvaluep)
939     return;
940 # ifdef YYPRINT
941   if (yytype < YYNTOKENS)
942     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
943 # endif
944   YYUSE (yytype);
945 }
946 
947 
948 /*--------------------------------.
949 | Print this symbol on YYOUTPUT.  |
950 `--------------------------------*/
951 
952 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep,parseObj * p)953 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, parseObj *p)
954 {
955   YYFPRINTF (yyoutput, "%s %s (",
956              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
957 
958   yy_symbol_value_print (yyoutput, yytype, yyvaluep, p);
959   YYFPRINTF (yyoutput, ")");
960 }
961 
962 /*------------------------------------------------------------------.
963 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
964 | TOP (included).                                                   |
965 `------------------------------------------------------------------*/
966 
967 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)968 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
969 {
970   YYFPRINTF (stderr, "Stack now");
971   for (; yybottom <= yytop; yybottom++)
972     {
973       int yybot = *yybottom;
974       YYFPRINTF (stderr, " %d", yybot);
975     }
976   YYFPRINTF (stderr, "\n");
977 }
978 
979 # define YY_STACK_PRINT(Bottom, Top)                            \
980 do {                                                            \
981   if (yydebug)                                                  \
982     yy_stack_print ((Bottom), (Top));                           \
983 } while (0)
984 
985 
986 /*------------------------------------------------.
987 | Report that the YYRULE is going to be reduced.  |
988 `------------------------------------------------*/
989 
990 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule,parseObj * p)991 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, parseObj *p)
992 {
993   unsigned long int yylno = yyrline[yyrule];
994   int yynrhs = yyr2[yyrule];
995   int yyi;
996   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
997              yyrule - 1, yylno);
998   /* The symbols being reduced.  */
999   for (yyi = 0; yyi < yynrhs; yyi++)
1000     {
1001       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
1002       yy_symbol_print (stderr,
1003                        yystos[yyssp[yyi + 1 - yynrhs]],
1004                        &(yyvsp[(yyi + 1) - (yynrhs)])
1005                                               , p);
1006       YYFPRINTF (stderr, "\n");
1007     }
1008 }
1009 
1010 # define YY_REDUCE_PRINT(Rule)          \
1011 do {                                    \
1012   if (yydebug)                          \
1013     yy_reduce_print (yyssp, yyvsp, Rule, p); \
1014 } while (0)
1015 
1016 /* Nonzero means print parse trace.  It is left uninitialized so that
1017    multiple parsers can coexist.  */
1018 int yydebug;
1019 #else /* !YYDEBUG */
1020 # define YYDPRINTF(Args)
1021 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1022 # define YY_STACK_PRINT(Bottom, Top)
1023 # define YY_REDUCE_PRINT(Rule)
1024 #endif /* !YYDEBUG */
1025 
1026 
1027 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1028 #ifndef YYINITDEPTH
1029 # define YYINITDEPTH 200
1030 #endif
1031 
1032 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1033    if the built-in stack extension method is used).
1034 
1035    Do not make this value too large; the results are undefined if
1036    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1037    evaluated with infinite-precision integer arithmetic.  */
1038 
1039 #ifndef YYMAXDEPTH
1040 # define YYMAXDEPTH 10000
1041 #endif
1042 
1043 
1044 #if YYERROR_VERBOSE
1045 
1046 # ifndef yystrlen
1047 #  if defined __GLIBC__ && defined _STRING_H
1048 #   define yystrlen strlen
1049 #  else
1050 /* Return the length of YYSTR.  */
1051 static YYSIZE_T
yystrlen(const char * yystr)1052 yystrlen (const char *yystr)
1053 {
1054   YYSIZE_T yylen;
1055   for (yylen = 0; yystr[yylen]; yylen++)
1056     continue;
1057   return yylen;
1058 }
1059 #  endif
1060 # endif
1061 
1062 # ifndef yystpcpy
1063 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1064 #   define yystpcpy stpcpy
1065 #  else
1066 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1067    YYDEST.  */
1068 static char *
yystpcpy(char * yydest,const char * yysrc)1069 yystpcpy (char *yydest, const char *yysrc)
1070 {
1071   char *yyd = yydest;
1072   const char *yys = yysrc;
1073 
1074   while ((*yyd++ = *yys++) != '\0')
1075     continue;
1076 
1077   return yyd - 1;
1078 }
1079 #  endif
1080 # endif
1081 
1082 # ifndef yytnamerr
1083 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1084    quotes and backslashes, so that it's suitable for yyerror.  The
1085    heuristic is that double-quoting is unnecessary unless the string
1086    contains an apostrophe, a comma, or backslash (other than
1087    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1088    null, do not copy; instead, return the length of what the result
1089    would have been.  */
1090 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)1091 yytnamerr (char *yyres, const char *yystr)
1092 {
1093   if (*yystr == '"')
1094     {
1095       YYSIZE_T yyn = 0;
1096       char const *yyp = yystr;
1097 
1098       for (;;)
1099         switch (*++yyp)
1100           {
1101           case '\'':
1102           case ',':
1103             goto do_not_strip_quotes;
1104 
1105           case '\\':
1106             if (*++yyp != '\\')
1107               goto do_not_strip_quotes;
1108             /* Fall through.  */
1109           default:
1110             if (yyres)
1111               yyres[yyn] = *yyp;
1112             yyn++;
1113             break;
1114 
1115           case '"':
1116             if (yyres)
1117               yyres[yyn] = '\0';
1118             return yyn;
1119           }
1120     do_not_strip_quotes: ;
1121     }
1122 
1123   if (! yyres)
1124     return yystrlen (yystr);
1125 
1126   return yystpcpy (yyres, yystr) - yyres;
1127 }
1128 # endif
1129 
1130 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1131    about the unexpected token YYTOKEN for the state stack whose top is
1132    YYSSP.
1133 
1134    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
1135    not large enough to hold the message.  In that case, also set
1136    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
1137    required number of bytes is too large to store.  */
1138 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)1139 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1140                 yytype_int16 *yyssp, int yytoken)
1141 {
1142   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1143   YYSIZE_T yysize = yysize0;
1144   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1145   /* Internationalized format string. */
1146   const char *yyformat = YY_NULLPTR;
1147   /* Arguments of yyformat. */
1148   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1149   /* Number of reported tokens (one for the "unexpected", one per
1150      "expected"). */
1151   int yycount = 0;
1152 
1153   /* There are many possibilities here to consider:
1154      - If this state is a consistent state with a default action, then
1155        the only way this function was invoked is if the default action
1156        is an error action.  In that case, don't check for expected
1157        tokens because there are none.
1158      - The only way there can be no lookahead present (in yychar) is if
1159        this state is a consistent state with a default action.  Thus,
1160        detecting the absence of a lookahead is sufficient to determine
1161        that there is no unexpected or expected token to report.  In that
1162        case, just report a simple "syntax error".
1163      - Don't assume there isn't a lookahead just because this state is a
1164        consistent state with a default action.  There might have been a
1165        previous inconsistent state, consistent state with a non-default
1166        action, or user semantic action that manipulated yychar.
1167      - Of course, the expected token list depends on states to have
1168        correct lookahead information, and it depends on the parser not
1169        to perform extra reductions after fetching a lookahead from the
1170        scanner and before detecting a syntax error.  Thus, state merging
1171        (from LALR or IELR) and default reductions corrupt the expected
1172        token list.  However, the list is correct for canonical LR with
1173        one exception: it will still contain any token that will not be
1174        accepted due to an error action in a later state.
1175   */
1176   if (yytoken != YYEMPTY)
1177     {
1178       int yyn = yypact[*yyssp];
1179       yyarg[yycount++] = yytname[yytoken];
1180       if (!yypact_value_is_default (yyn))
1181         {
1182           /* Start YYX at -YYN if negative to avoid negative indexes in
1183              YYCHECK.  In other words, skip the first -YYN actions for
1184              this state because they are default actions.  */
1185           int yyxbegin = yyn < 0 ? -yyn : 0;
1186           /* Stay within bounds of both yycheck and yytname.  */
1187           int yychecklim = YYLAST - yyn + 1;
1188           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1189           int yyx;
1190 
1191           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1192             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1193                 && !yytable_value_is_error (yytable[yyx + yyn]))
1194               {
1195                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1196                   {
1197                     yycount = 1;
1198                     yysize = yysize0;
1199                     break;
1200                   }
1201                 yyarg[yycount++] = yytname[yyx];
1202                 {
1203                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1204                   if (! (yysize <= yysize1
1205                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1206                     return 2;
1207                   yysize = yysize1;
1208                 }
1209               }
1210         }
1211     }
1212 
1213   switch (yycount)
1214     {
1215 # define YYCASE_(N, S)                      \
1216       case N:                               \
1217         yyformat = S;                       \
1218       break
1219       YYCASE_(0, YY_("syntax error"));
1220       YYCASE_(1, YY_("syntax error, unexpected %s"));
1221       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1222       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1223       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1224       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1225 # undef YYCASE_
1226     }
1227 
1228   {
1229     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1230     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1231       return 2;
1232     yysize = yysize1;
1233   }
1234 
1235   if (*yymsg_alloc < yysize)
1236     {
1237       *yymsg_alloc = 2 * yysize;
1238       if (! (yysize <= *yymsg_alloc
1239              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1240         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1241       return 1;
1242     }
1243 
1244   /* Avoid sprintf, as that infringes on the user's name space.
1245      Don't have undefined behavior even if the translation
1246      produced a string with the wrong number of "%s"s.  */
1247   {
1248     char *yyp = *yymsg;
1249     int yyi = 0;
1250     while ((*yyp = *yyformat) != '\0')
1251       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1252         {
1253           yyp += yytnamerr (yyp, yyarg[yyi++]);
1254           yyformat += 2;
1255         }
1256       else
1257         {
1258           yyp++;
1259           yyformat++;
1260         }
1261   }
1262   return 0;
1263 }
1264 #endif /* YYERROR_VERBOSE */
1265 
1266 /*-----------------------------------------------.
1267 | Release the memory associated to this symbol.  |
1268 `-----------------------------------------------*/
1269 
1270 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep,parseObj * p)1271 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, parseObj *p)
1272 {
1273   YYUSE (yyvaluep);
1274   YYUSE (p);
1275   if (!yymsg)
1276     yymsg = "Deleting";
1277   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1278 
1279   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1280   YYUSE (yytype);
1281   YY_IGNORE_MAYBE_UNINITIALIZED_END
1282 }
1283 
1284 
1285 
1286 
1287 /*----------.
1288 | yyparse.  |
1289 `----------*/
1290 
1291 int
yyparse(parseObj * p)1292 yyparse (parseObj *p)
1293 {
1294 /* The lookahead symbol.  */
1295 int yychar;
1296 
1297 
1298 /* The semantic value of the lookahead symbol.  */
1299 /* Default value used for initialization, for pacifying older GCCs
1300    or non-GCC compilers.  */
1301 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1302 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1303 
1304     /* Number of syntax errors so far.  */
1305     int yynerrs;
1306 
1307     int yystate;
1308     /* Number of tokens to shift before error messages enabled.  */
1309     int yyerrstatus;
1310 
1311     /* The stacks and their tools:
1312        'yyss': related to states.
1313        'yyvs': related to semantic values.
1314 
1315        Refer to the stacks through separate pointers, to allow yyoverflow
1316        to reallocate them elsewhere.  */
1317 
1318     /* The state stack.  */
1319     yytype_int16 yyssa[YYINITDEPTH];
1320     yytype_int16 *yyss;
1321     yytype_int16 *yyssp;
1322 
1323     /* The semantic value stack.  */
1324     YYSTYPE yyvsa[YYINITDEPTH];
1325     YYSTYPE *yyvs;
1326     YYSTYPE *yyvsp;
1327 
1328     YYSIZE_T yystacksize;
1329 
1330   int yyn;
1331   int yyresult;
1332   /* Lookahead token as an internal (translated) token number.  */
1333   int yytoken = 0;
1334   /* The variables used to return semantic value and location from the
1335      action routines.  */
1336   YYSTYPE yyval;
1337 
1338 #if YYERROR_VERBOSE
1339   /* Buffer for error messages, and its allocated size.  */
1340   char yymsgbuf[128];
1341   char *yymsg = yymsgbuf;
1342   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1343 #endif
1344 
1345 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1346 
1347   /* The number of symbols on the RHS of the reduced rule.
1348      Keep to zero when no symbol should be popped.  */
1349   int yylen = 0;
1350 
1351   yyssp = yyss = yyssa;
1352   yyvsp = yyvs = yyvsa;
1353   yystacksize = YYINITDEPTH;
1354 
1355   YYDPRINTF ((stderr, "Starting parse\n"));
1356 
1357   yystate = 0;
1358   yyerrstatus = 0;
1359   yynerrs = 0;
1360   yychar = YYEMPTY; /* Cause a token to be read.  */
1361   goto yysetstate;
1362 
1363 /*------------------------------------------------------------.
1364 | yynewstate -- Push a new state, which is found in yystate.  |
1365 `------------------------------------------------------------*/
1366  yynewstate:
1367   /* In all cases, when you get here, the value and location stacks
1368      have just been pushed.  So pushing a state here evens the stacks.  */
1369   yyssp++;
1370 
1371  yysetstate:
1372   *yyssp = yystate;
1373 
1374   if (yyss + yystacksize - 1 <= yyssp)
1375     {
1376       /* Get the current used size of the three stacks, in elements.  */
1377       YYSIZE_T yysize = yyssp - yyss + 1;
1378 
1379 #ifdef yyoverflow
1380       {
1381         /* Give user a chance to reallocate the stack.  Use copies of
1382            these so that the &'s don't force the real ones into
1383            memory.  */
1384         YYSTYPE *yyvs1 = yyvs;
1385         yytype_int16 *yyss1 = yyss;
1386 
1387         /* Each stack pointer address is followed by the size of the
1388            data in use in that stack, in bytes.  This used to be a
1389            conditional around just the two extra args, but that might
1390            be undefined if yyoverflow is a macro.  */
1391         yyoverflow (YY_("memory exhausted"),
1392                     &yyss1, yysize * sizeof (*yyssp),
1393                     &yyvs1, yysize * sizeof (*yyvsp),
1394                     &yystacksize);
1395 
1396         yyss = yyss1;
1397         yyvs = yyvs1;
1398       }
1399 #else /* no yyoverflow */
1400 # ifndef YYSTACK_RELOCATE
1401       goto yyexhaustedlab;
1402 # else
1403       /* Extend the stack our own way.  */
1404       if (YYMAXDEPTH <= yystacksize)
1405         goto yyexhaustedlab;
1406       yystacksize *= 2;
1407       if (YYMAXDEPTH < yystacksize)
1408         yystacksize = YYMAXDEPTH;
1409 
1410       {
1411         yytype_int16 *yyss1 = yyss;
1412         union yyalloc *yyptr =
1413           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1414         if (! yyptr)
1415           goto yyexhaustedlab;
1416         YYSTACK_RELOCATE (yyss_alloc, yyss);
1417         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1418 #  undef YYSTACK_RELOCATE
1419         if (yyss1 != yyssa)
1420           YYSTACK_FREE (yyss1);
1421       }
1422 # endif
1423 #endif /* no yyoverflow */
1424 
1425       yyssp = yyss + yysize - 1;
1426       yyvsp = yyvs + yysize - 1;
1427 
1428       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1429                   (unsigned long int) yystacksize));
1430 
1431       if (yyss + yystacksize - 1 <= yyssp)
1432         YYABORT;
1433     }
1434 
1435   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1436 
1437   if (yystate == YYFINAL)
1438     YYACCEPT;
1439 
1440   goto yybackup;
1441 
1442 /*-----------.
1443 | yybackup.  |
1444 `-----------*/
1445 yybackup:
1446 
1447   /* Do appropriate processing given the current state.  Read a
1448      lookahead token if we need one and don't already have one.  */
1449 
1450   /* First try to decide what to do without reference to lookahead token.  */
1451   yyn = yypact[yystate];
1452   if (yypact_value_is_default (yyn))
1453     goto yydefault;
1454 
1455   /* Not known => get a lookahead token if don't already have one.  */
1456 
1457   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1458   if (yychar == YYEMPTY)
1459     {
1460       YYDPRINTF ((stderr, "Reading a token: "));
1461       yychar = yylex (&yylval, p);
1462     }
1463 
1464   if (yychar <= YYEOF)
1465     {
1466       yychar = yytoken = YYEOF;
1467       YYDPRINTF ((stderr, "Now at end of input.\n"));
1468     }
1469   else
1470     {
1471       yytoken = YYTRANSLATE (yychar);
1472       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1473     }
1474 
1475   /* If the proper action on seeing token YYTOKEN is to reduce or to
1476      detect an error, take that action.  */
1477   yyn += yytoken;
1478   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1479     goto yydefault;
1480   yyn = yytable[yyn];
1481   if (yyn <= 0)
1482     {
1483       if (yytable_value_is_error (yyn))
1484         goto yyerrlab;
1485       yyn = -yyn;
1486       goto yyreduce;
1487     }
1488 
1489   /* Count tokens shifted since error; after three, turn off error
1490      status.  */
1491   if (yyerrstatus)
1492     yyerrstatus--;
1493 
1494   /* Shift the lookahead token.  */
1495   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1496 
1497   /* Discard the shifted token.  */
1498   yychar = YYEMPTY;
1499 
1500   yystate = yyn;
1501   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1502   *++yyvsp = yylval;
1503   YY_IGNORE_MAYBE_UNINITIALIZED_END
1504 
1505   goto yynewstate;
1506 
1507 
1508 /*-----------------------------------------------------------.
1509 | yydefault -- do the default action for the current state.  |
1510 `-----------------------------------------------------------*/
1511 yydefault:
1512   yyn = yydefact[yystate];
1513   if (yyn == 0)
1514     goto yyerrlab;
1515   goto yyreduce;
1516 
1517 
1518 /*-----------------------------.
1519 | yyreduce -- Do a reduction.  |
1520 `-----------------------------*/
1521 yyreduce:
1522   /* yyn is the number of a rule to reduce with.  */
1523   yylen = yyr2[yyn];
1524 
1525   /* If YYLEN is nonzero, implement the default value of the action:
1526      '$$ = $1'.
1527 
1528      Otherwise, the following line sets YYVAL to garbage.
1529      This behavior is undocumented and Bison
1530      users should not rely upon it.  Assigning to YYVAL
1531      unconditionally makes the parser a bit smaller, and it avoids a
1532      GCC warning that YYVAL may be used uninitialized.  */
1533   yyval = yyvsp[1-yylen];
1534 
1535 
1536   YY_REDUCE_PRINT (yyn);
1537   switch (yyn)
1538     {
1539         case 3:
1540 #line 69 "mapparser.y" /* yacc.c:1646  */
1541     {
1542     switch(p->type) {
1543     case(MS_PARSE_TYPE_BOOLEAN):
1544       p->result.intval = (yyvsp[0].intval);
1545       break;
1546     case(MS_PARSE_TYPE_STRING):
1547       if((yyvsp[0].intval))
1548         p->result.strval = msStrdup("true");
1549       else
1550         p->result.strval = msStrdup("false");
1551       break;
1552     }
1553   }
1554 #line 1555 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1555     break;
1556 
1557   case 4:
1558 #line 82 "mapparser.y" /* yacc.c:1646  */
1559     {
1560     switch(p->type) {
1561     case(MS_PARSE_TYPE_BOOLEAN):
1562       if((yyvsp[0].dblval) != 0)
1563         p->result.intval = MS_TRUE;
1564       else
1565         p->result.intval = MS_FALSE;
1566       break;
1567     case(MS_PARSE_TYPE_STRING):
1568       p->result.strval = (char *)malloc(64); /* large enough for a double */
1569       snprintf(p->result.strval, 64, "%g", (yyvsp[0].dblval));
1570       break;
1571     }
1572   }
1573 #line 1574 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1574     break;
1575 
1576   case 5:
1577 #line 96 "mapparser.y" /* yacc.c:1646  */
1578     {
1579     switch(p->type) {
1580     case(MS_PARSE_TYPE_BOOLEAN):
1581       if((yyvsp[0].strval)) /* string is not NULL */
1582         p->result.intval = MS_TRUE;
1583       else
1584         p->result.intval = MS_FALSE;
1585       break;
1586     case(MS_PARSE_TYPE_STRING):
1587       p->result.strval = (yyvsp[0].strval); // msStrdup($1);
1588       break;
1589     }
1590   }
1591 #line 1592 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1592     break;
1593 
1594   case 6:
1595 #line 109 "mapparser.y" /* yacc.c:1646  */
1596     {
1597     switch(p->type) {
1598     case(MS_PARSE_TYPE_SHAPE):
1599       p->result.shpval = (yyvsp[0].shpval);
1600       p->result.shpval->scratch = MS_FALSE;
1601       break;
1602     }
1603   }
1604 #line 1605 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1605     break;
1606 
1607   case 8:
1608 #line 120 "mapparser.y" /* yacc.c:1646  */
1609     { (yyval.intval) = (yyvsp[-1].intval); }
1610 #line 1611 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1611     break;
1612 
1613   case 9:
1614 #line 121 "mapparser.y" /* yacc.c:1646  */
1615     {
1616     (yyval.intval) = MS_FALSE;
1617     if((yyvsp[-2].intval) == (yyvsp[0].intval)) (yyval.intval) = MS_TRUE;
1618   }
1619 #line 1620 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1620     break;
1621 
1622   case 10:
1623 #line 125 "mapparser.y" /* yacc.c:1646  */
1624     {
1625     if((yyvsp[-2].intval) == MS_TRUE)
1626       (yyval.intval) = MS_TRUE;
1627     else if((yyvsp[0].intval) == MS_TRUE)
1628       (yyval.intval) = MS_TRUE;
1629     else
1630       (yyval.intval) = MS_FALSE;
1631   }
1632 #line 1633 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1633     break;
1634 
1635   case 11:
1636 #line 133 "mapparser.y" /* yacc.c:1646  */
1637     {
1638     if((yyvsp[-2].intval) == MS_TRUE) {
1639       if((yyvsp[0].intval) == MS_TRUE)
1640         (yyval.intval) = MS_TRUE;
1641       else
1642         (yyval.intval) = MS_FALSE;
1643     } else
1644       (yyval.intval) = MS_FALSE;
1645   }
1646 #line 1647 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1647     break;
1648 
1649   case 12:
1650 #line 142 "mapparser.y" /* yacc.c:1646  */
1651     {
1652     if((yyvsp[-2].intval) == MS_TRUE)
1653       (yyval.intval) = MS_TRUE;
1654     else if((yyvsp[0].dblval) != 0)
1655       (yyval.intval) = MS_TRUE;
1656     else
1657       (yyval.intval) = MS_FALSE;
1658   }
1659 #line 1660 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1660     break;
1661 
1662   case 13:
1663 #line 150 "mapparser.y" /* yacc.c:1646  */
1664     {
1665     if((yyvsp[-2].intval) == MS_TRUE) {
1666       if((yyvsp[0].dblval) != 0)
1667         (yyval.intval) = MS_TRUE;
1668       else
1669         (yyval.intval) = MS_FALSE;
1670     } else
1671       (yyval.intval) = MS_FALSE;
1672   }
1673 #line 1674 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1674     break;
1675 
1676   case 14:
1677 #line 159 "mapparser.y" /* yacc.c:1646  */
1678     {
1679     if((yyvsp[-2].dblval) != 0)
1680       (yyval.intval) = MS_TRUE;
1681     else if((yyvsp[0].intval) == MS_TRUE)
1682       (yyval.intval) = MS_TRUE;
1683     else
1684       (yyval.intval) = MS_FALSE;
1685   }
1686 #line 1687 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1687     break;
1688 
1689   case 15:
1690 #line 167 "mapparser.y" /* yacc.c:1646  */
1691     {
1692     if((yyvsp[-2].dblval) != 0) {
1693       if((yyvsp[0].intval) == MS_TRUE)
1694         (yyval.intval) = MS_TRUE;
1695       else
1696         (yyval.intval) = MS_FALSE;
1697     } else
1698       (yyval.intval) = MS_FALSE;
1699   }
1700 #line 1701 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1701     break;
1702 
1703   case 16:
1704 #line 176 "mapparser.y" /* yacc.c:1646  */
1705     {
1706     if((yyvsp[-2].dblval) != 0)
1707       (yyval.intval) = MS_TRUE;
1708     else if((yyvsp[0].dblval) != 0)
1709       (yyval.intval) = MS_TRUE;
1710     else
1711       (yyval.intval) = MS_FALSE;
1712   }
1713 #line 1714 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1714     break;
1715 
1716   case 17:
1717 #line 184 "mapparser.y" /* yacc.c:1646  */
1718     {
1719     if((yyvsp[-2].dblval) != 0) {
1720       if((yyvsp[0].dblval) != 0)
1721         (yyval.intval) = MS_TRUE;
1722       else
1723 	(yyval.intval) = MS_FALSE;
1724     } else
1725       (yyval.intval) = MS_FALSE;
1726   }
1727 #line 1728 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1728     break;
1729 
1730   case 18:
1731 #line 193 "mapparser.y" /* yacc.c:1646  */
1732     { (yyval.intval) = !(yyvsp[0].intval); }
1733 #line 1734 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1734     break;
1735 
1736   case 19:
1737 #line 194 "mapparser.y" /* yacc.c:1646  */
1738     { (yyval.intval) = !(yyvsp[0].dblval); }
1739 #line 1740 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1740     break;
1741 
1742   case 20:
1743 #line 195 "mapparser.y" /* yacc.c:1646  */
1744     {
1745     ms_regex_t re;
1746 
1747     if(MS_STRING_IS_NULL_OR_EMPTY((yyvsp[-2].strval)) == MS_TRUE) {
1748       (yyval.intval) = MS_FALSE;
1749     } else {
1750       if(ms_regcomp(&re, (yyvsp[0].strval), MS_REG_EXTENDED|MS_REG_NOSUB) != 0) {
1751         (yyval.intval) = MS_FALSE;
1752       } else {
1753         if(ms_regexec(&re, (yyvsp[-2].strval), 0, NULL, 0) == 0)
1754           (yyval.intval) = MS_TRUE;
1755         else
1756           (yyval.intval) = MS_FALSE;
1757         ms_regfree(&re);
1758       }
1759     }
1760 
1761     free((yyvsp[-2].strval));
1762     free((yyvsp[0].strval));
1763   }
1764 #line 1765 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1765     break;
1766 
1767   case 21:
1768 #line 215 "mapparser.y" /* yacc.c:1646  */
1769     {
1770     ms_regex_t re;
1771 
1772     if(MS_STRING_IS_NULL_OR_EMPTY((yyvsp[-2].strval)) == MS_TRUE) {
1773       (yyval.intval) = MS_FALSE;
1774     } else {
1775       if(ms_regcomp(&re, (yyvsp[0].strval), MS_REG_EXTENDED|MS_REG_NOSUB|MS_REG_ICASE) != 0) {
1776         (yyval.intval) = MS_FALSE;
1777       } else {
1778         if(ms_regexec(&re, (yyvsp[-2].strval), 0, NULL, 0) == 0)
1779           (yyval.intval) = MS_TRUE;
1780         else
1781           (yyval.intval) = MS_FALSE;
1782         ms_regfree(&re);
1783       }
1784     }
1785 
1786     free((yyvsp[-2].strval));
1787     free((yyvsp[0].strval));
1788   }
1789 #line 1790 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1790     break;
1791 
1792   case 22:
1793 #line 235 "mapparser.y" /* yacc.c:1646  */
1794     {
1795     if((yyvsp[-2].dblval) == (yyvsp[0].dblval))
1796       (yyval.intval) = MS_TRUE;
1797     else
1798       (yyval.intval) = MS_FALSE;
1799   }
1800 #line 1801 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1801     break;
1802 
1803   case 23:
1804 #line 241 "mapparser.y" /* yacc.c:1646  */
1805     {
1806     if((yyvsp[-2].dblval) != (yyvsp[0].dblval))
1807       (yyval.intval) = MS_TRUE;
1808     else
1809       (yyval.intval) = MS_FALSE;
1810   }
1811 #line 1812 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1812     break;
1813 
1814   case 24:
1815 #line 247 "mapparser.y" /* yacc.c:1646  */
1816     {
1817     if((yyvsp[-2].dblval) > (yyvsp[0].dblval))
1818       (yyval.intval) = MS_TRUE;
1819     else
1820       (yyval.intval) = MS_FALSE;
1821   }
1822 #line 1823 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1823     break;
1824 
1825   case 25:
1826 #line 253 "mapparser.y" /* yacc.c:1646  */
1827     {
1828     if((yyvsp[-2].dblval) < (yyvsp[0].dblval))
1829       (yyval.intval) = MS_TRUE;
1830     else
1831       (yyval.intval) = MS_FALSE;
1832   }
1833 #line 1834 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1834     break;
1835 
1836   case 26:
1837 #line 259 "mapparser.y" /* yacc.c:1646  */
1838     {
1839     if((yyvsp[-2].dblval) >= (yyvsp[0].dblval))
1840       (yyval.intval) = MS_TRUE;
1841     else
1842       (yyval.intval) = MS_FALSE;
1843   }
1844 #line 1845 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1845     break;
1846 
1847   case 27:
1848 #line 265 "mapparser.y" /* yacc.c:1646  */
1849     {
1850     if((yyvsp[-2].dblval) <= (yyvsp[0].dblval))
1851       (yyval.intval) = MS_TRUE;
1852     else
1853       (yyval.intval) = MS_FALSE;
1854   }
1855 #line 1856 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1856     break;
1857 
1858   case 28:
1859 #line 271 "mapparser.y" /* yacc.c:1646  */
1860     {
1861     if(strcmp((yyvsp[-2].strval), (yyvsp[0].strval)) == 0)
1862       (yyval.intval) = MS_TRUE;
1863     else
1864       (yyval.intval) = MS_FALSE;
1865     free((yyvsp[-2].strval));
1866     free((yyvsp[0].strval));
1867   }
1868 #line 1869 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1869     break;
1870 
1871   case 29:
1872 #line 279 "mapparser.y" /* yacc.c:1646  */
1873     {
1874     if(strcmp((yyvsp[-2].strval), (yyvsp[0].strval)) != 0)
1875       (yyval.intval) = MS_TRUE;
1876     else
1877       (yyval.intval) = MS_FALSE;
1878     free((yyvsp[-2].strval));
1879     free((yyvsp[0].strval));
1880   }
1881 #line 1882 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1882     break;
1883 
1884   case 30:
1885 #line 287 "mapparser.y" /* yacc.c:1646  */
1886     {
1887     if(strcmp((yyvsp[-2].strval), (yyvsp[0].strval)) > 0)
1888       (yyval.intval) = MS_TRUE;
1889     else
1890       (yyval.intval) = MS_FALSE;
1891     free((yyvsp[-2].strval));
1892     free((yyvsp[0].strval));
1893   }
1894 #line 1895 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1895     break;
1896 
1897   case 31:
1898 #line 295 "mapparser.y" /* yacc.c:1646  */
1899     {
1900     if(strcmp((yyvsp[-2].strval), (yyvsp[0].strval)) < 0)
1901       (yyval.intval) = MS_TRUE;
1902     else
1903       (yyval.intval) = MS_FALSE;
1904     free((yyvsp[-2].strval));
1905     free((yyvsp[0].strval));
1906   }
1907 #line 1908 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1908     break;
1909 
1910   case 32:
1911 #line 303 "mapparser.y" /* yacc.c:1646  */
1912     {
1913     if(strcmp((yyvsp[-2].strval), (yyvsp[0].strval)) >= 0)
1914       (yyval.intval) = MS_TRUE;
1915     else
1916       (yyval.intval) = MS_FALSE;
1917     free((yyvsp[-2].strval));
1918     free((yyvsp[0].strval));
1919   }
1920 #line 1921 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1921     break;
1922 
1923   case 33:
1924 #line 311 "mapparser.y" /* yacc.c:1646  */
1925     {
1926     if(strcmp((yyvsp[-2].strval), (yyvsp[0].strval)) <= 0)
1927       (yyval.intval) = MS_TRUE;
1928     else
1929       (yyval.intval) = MS_FALSE;
1930     free((yyvsp[-2].strval));
1931     free((yyvsp[0].strval));
1932   }
1933 #line 1934 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1934     break;
1935 
1936   case 34:
1937 #line 319 "mapparser.y" /* yacc.c:1646  */
1938     {
1939     if(msTimeCompare(&((yyvsp[-2].tmval)), &((yyvsp[0].tmval))) == 0)
1940       (yyval.intval) = MS_TRUE;
1941     else
1942       (yyval.intval) = MS_FALSE;
1943   }
1944 #line 1945 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1945     break;
1946 
1947   case 35:
1948 #line 325 "mapparser.y" /* yacc.c:1646  */
1949     {
1950     if(msTimeCompare(&((yyvsp[-2].tmval)), &((yyvsp[0].tmval))) != 0)
1951       (yyval.intval) = MS_TRUE;
1952     else
1953       (yyval.intval) = MS_FALSE;
1954   }
1955 #line 1956 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1956     break;
1957 
1958   case 36:
1959 #line 331 "mapparser.y" /* yacc.c:1646  */
1960     {
1961     if(msTimeCompare(&((yyvsp[-2].tmval)), &((yyvsp[0].tmval))) > 0)
1962       (yyval.intval) = MS_TRUE;
1963     else
1964       (yyval.intval) = MS_FALSE;
1965   }
1966 #line 1967 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1967     break;
1968 
1969   case 37:
1970 #line 337 "mapparser.y" /* yacc.c:1646  */
1971     {
1972     if(msTimeCompare(&((yyvsp[-2].tmval)), &((yyvsp[0].tmval))) < 0)
1973       (yyval.intval) = MS_TRUE;
1974     else
1975       (yyval.intval) = MS_FALSE;
1976   }
1977 #line 1978 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1978     break;
1979 
1980   case 38:
1981 #line 343 "mapparser.y" /* yacc.c:1646  */
1982     {
1983     if(msTimeCompare(&((yyvsp[-2].tmval)), &((yyvsp[0].tmval))) >= 0)
1984       (yyval.intval) = MS_TRUE;
1985     else
1986       (yyval.intval) = MS_FALSE;
1987   }
1988 #line 1989 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
1989     break;
1990 
1991   case 39:
1992 #line 349 "mapparser.y" /* yacc.c:1646  */
1993     {
1994     if(msTimeCompare(&((yyvsp[-2].tmval)), &((yyvsp[0].tmval))) <= 0)
1995       (yyval.intval) = MS_TRUE;
1996     else
1997       (yyval.intval) = MS_FALSE;
1998   }
1999 #line 2000 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2000     break;
2001 
2002   case 40:
2003 #line 355 "mapparser.y" /* yacc.c:1646  */
2004     {
2005     char *delim, *bufferp;
2006 
2007     (yyval.intval) = MS_FALSE;
2008     bufferp=(yyvsp[0].strval);
2009 
2010     while((delim=strchr(bufferp,',')) != NULL) {
2011       *delim='\0';
2012       if(strcmp((yyvsp[-2].strval),bufferp) == 0) {
2013         (yyval.intval) = MS_TRUE;
2014         break;
2015       }
2016       *delim=',';
2017       bufferp=delim+1;
2018     }
2019 
2020     if((yyval.intval) == MS_FALSE && strcmp((yyvsp[-2].strval),bufferp) == 0) // test for last (or only) item
2021       (yyval.intval) = MS_TRUE;
2022     free((yyvsp[-2].strval));
2023     free((yyvsp[0].strval));
2024   }
2025 #line 2026 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2026     break;
2027 
2028   case 41:
2029 #line 376 "mapparser.y" /* yacc.c:1646  */
2030     {
2031     char *delim,*bufferp;
2032 
2033     (yyval.intval) = MS_FALSE;
2034     bufferp=(yyvsp[0].strval);
2035 
2036     while((delim=strchr(bufferp,',')) != NULL) {
2037       *delim='\0';
2038       if((yyvsp[-2].dblval) == atof(bufferp)) {
2039         (yyval.intval) = MS_TRUE;
2040         break;
2041       }
2042       *delim=',';
2043       bufferp=delim+1;
2044     }
2045 
2046     if((yyvsp[-2].dblval) == atof(bufferp)) // is this test necessary?
2047       (yyval.intval) = MS_TRUE;
2048     free((yyvsp[0].strval));
2049   }
2050 #line 2051 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2051     break;
2052 
2053   case 42:
2054 #line 396 "mapparser.y" /* yacc.c:1646  */
2055     {
2056     if((yyvsp[-2].dblval) == (yyvsp[0].dblval))
2057       (yyval.intval) = MS_TRUE;
2058     else
2059       (yyval.intval) = MS_FALSE;
2060   }
2061 #line 2062 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2062     break;
2063 
2064   case 43:
2065 #line 402 "mapparser.y" /* yacc.c:1646  */
2066     {
2067     if(strcasecmp((yyvsp[-2].strval), (yyvsp[0].strval)) == 0)
2068       (yyval.intval) = MS_TRUE;
2069     else
2070       (yyval.intval) = MS_FALSE;
2071     free((yyvsp[-2].strval));
2072     free((yyvsp[0].strval));
2073   }
2074 #line 2075 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2075     break;
2076 
2077   case 44:
2078 #line 410 "mapparser.y" /* yacc.c:1646  */
2079     {
2080     if(msTimeCompare(&((yyvsp[-2].tmval)), &((yyvsp[0].tmval))) == 0)
2081       (yyval.intval) = MS_TRUE;
2082     else
2083       (yyval.intval) = MS_FALSE;
2084   }
2085 #line 2086 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2086     break;
2087 
2088   case 45:
2089 #line 416 "mapparser.y" /* yacc.c:1646  */
2090     {
2091     int rval;
2092     rval = msGEOSEquals((yyvsp[-2].shpval), (yyvsp[0].shpval));
2093     if((yyvsp[-2].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-2].shpval));
2094     if((yyvsp[0].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[0].shpval));
2095     if(rval == -1) {
2096       yyerror(p, "Equals (EQ or ==) operator failed.");
2097       return(-1);
2098     } else
2099       (yyval.intval) = rval;
2100   }
2101 #line 2102 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2102     break;
2103 
2104   case 46:
2105 #line 427 "mapparser.y" /* yacc.c:1646  */
2106     {
2107     int rval;
2108     rval = msGEOSEquals((yyvsp[-3].shpval), (yyvsp[-1].shpval));
2109     if((yyvsp[-3].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-3].shpval));
2110     if((yyvsp[-1].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-1].shpval));
2111     if(rval == -1) {
2112       yyerror(p, "Equals function failed.");
2113       return(-1);
2114     } else
2115       (yyval.intval) = rval;
2116   }
2117 #line 2118 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2118     break;
2119 
2120   case 47:
2121 #line 438 "mapparser.y" /* yacc.c:1646  */
2122     {
2123     int rval;
2124     rval = msGEOSIntersects((yyvsp[-3].shpval), (yyvsp[-1].shpval));
2125     if((yyvsp[-3].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-3].shpval));
2126     if((yyvsp[-1].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-1].shpval));
2127     if(rval == -1) {
2128       yyerror(p, "Intersects function failed.");
2129       return(-1);
2130     } else
2131     (yyval.intval) = rval;
2132   }
2133 #line 2134 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2134     break;
2135 
2136   case 48:
2137 #line 449 "mapparser.y" /* yacc.c:1646  */
2138     {
2139     int rval;
2140     rval = msGEOSIntersects((yyvsp[-2].shpval), (yyvsp[0].shpval));
2141     if((yyvsp[-2].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-2].shpval));
2142     if((yyvsp[0].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[0].shpval));
2143     if(rval == -1) {
2144       yyerror(p, "Intersects operator failed.");
2145       return(-1);
2146     } else
2147       (yyval.intval) = rval;
2148   }
2149 #line 2150 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2150     break;
2151 
2152   case 49:
2153 #line 460 "mapparser.y" /* yacc.c:1646  */
2154     {
2155     int rval;
2156     rval = msGEOSDisjoint((yyvsp[-3].shpval), (yyvsp[-1].shpval));
2157     if((yyvsp[-3].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-3].shpval));
2158     if((yyvsp[-1].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-1].shpval));
2159     if(rval == -1) {
2160       yyerror(p, "Disjoint function failed.");
2161       return(-1);
2162     } else
2163       (yyval.intval) = rval;
2164   }
2165 #line 2166 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2166     break;
2167 
2168   case 50:
2169 #line 471 "mapparser.y" /* yacc.c:1646  */
2170     {
2171     int rval;
2172     rval = msGEOSDisjoint((yyvsp[-2].shpval), (yyvsp[0].shpval));
2173     if((yyvsp[-2].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-2].shpval));
2174     if((yyvsp[0].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[0].shpval));
2175     if(rval == -1) {
2176       yyerror(p, "Disjoint operator failed.");
2177       return(-1);
2178     } else
2179       (yyval.intval) = rval;
2180   }
2181 #line 2182 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2182     break;
2183 
2184   case 51:
2185 #line 482 "mapparser.y" /* yacc.c:1646  */
2186     {
2187     int rval;
2188     rval = msGEOSTouches((yyvsp[-3].shpval), (yyvsp[-1].shpval));
2189     if((yyvsp[-3].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-3].shpval));
2190     if((yyvsp[-1].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-1].shpval));
2191     if(rval == -1) {
2192       yyerror(p, "Touches function failed.");
2193       return(-1);
2194     } else
2195       (yyval.intval) = rval;
2196   }
2197 #line 2198 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2198     break;
2199 
2200   case 52:
2201 #line 493 "mapparser.y" /* yacc.c:1646  */
2202     {
2203     int rval;
2204     rval = msGEOSTouches((yyvsp[-2].shpval), (yyvsp[0].shpval));
2205     if((yyvsp[-2].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-2].shpval));
2206     if((yyvsp[0].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[0].shpval));
2207     if(rval == -1) {
2208       yyerror(p, "Touches operator failed.");
2209       return(-1);
2210     } else
2211       (yyval.intval) = rval;
2212   }
2213 #line 2214 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2214     break;
2215 
2216   case 53:
2217 #line 504 "mapparser.y" /* yacc.c:1646  */
2218     {
2219     int rval;
2220     rval = msGEOSOverlaps((yyvsp[-3].shpval), (yyvsp[-1].shpval));
2221     if((yyvsp[-3].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-3].shpval));
2222     if((yyvsp[-1].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-1].shpval));
2223     if(rval == -1) {
2224       yyerror(p, "Overlaps function failed.");
2225       return(-1);
2226     } else
2227       (yyval.intval) = rval;
2228   }
2229 #line 2230 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2230     break;
2231 
2232   case 54:
2233 #line 515 "mapparser.y" /* yacc.c:1646  */
2234     {
2235     int rval;
2236      rval = msGEOSOverlaps((yyvsp[-2].shpval), (yyvsp[0].shpval));
2237     if((yyvsp[-2].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-2].shpval));
2238     if((yyvsp[0].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[0].shpval));
2239     if(rval == -1) {
2240       yyerror(p, "Overlaps operator failed.");
2241       return(-1);
2242     } else
2243       (yyval.intval) = rval;
2244   }
2245 #line 2246 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2246     break;
2247 
2248   case 55:
2249 #line 526 "mapparser.y" /* yacc.c:1646  */
2250     {
2251     int rval;
2252     rval = msGEOSCrosses((yyvsp[-3].shpval), (yyvsp[-1].shpval));
2253     if((yyvsp[-3].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-3].shpval));
2254     if((yyvsp[-1].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-1].shpval));
2255     if(rval == -1) {
2256       yyerror(p, "Crosses function failed.");
2257       return(-1);
2258     } else
2259       (yyval.intval) = rval;
2260   }
2261 #line 2262 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2262     break;
2263 
2264   case 56:
2265 #line 537 "mapparser.y" /* yacc.c:1646  */
2266     {
2267     int rval;
2268     rval = msGEOSCrosses((yyvsp[-2].shpval), (yyvsp[0].shpval));
2269     if((yyvsp[-2].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-2].shpval));
2270     if((yyvsp[0].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[0].shpval));
2271     if(rval == -1) {
2272       yyerror(p, "Crosses operator failed.");
2273       return(-1);
2274     } else
2275       (yyval.intval) = rval;
2276   }
2277 #line 2278 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2278     break;
2279 
2280   case 57:
2281 #line 548 "mapparser.y" /* yacc.c:1646  */
2282     {
2283     int rval;
2284     rval = msGEOSWithin((yyvsp[-3].shpval), (yyvsp[-1].shpval));
2285     if((yyvsp[-3].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-3].shpval));
2286     if((yyvsp[-1].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-1].shpval));
2287     if(rval == -1) {
2288       yyerror(p, "Within function failed.");
2289       return(-1);
2290     } else
2291       (yyval.intval) = rval;
2292   }
2293 #line 2294 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2294     break;
2295 
2296   case 58:
2297 #line 559 "mapparser.y" /* yacc.c:1646  */
2298     {
2299     int rval;
2300     rval = msGEOSWithin((yyvsp[-2].shpval), (yyvsp[0].shpval));
2301     if((yyvsp[-2].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-2].shpval));
2302     if((yyvsp[0].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[0].shpval));
2303     if(rval == -1) {
2304       yyerror(p, "Within operator failed.");
2305       return(-1);
2306     } else
2307       (yyval.intval) = rval;
2308   }
2309 #line 2310 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2310     break;
2311 
2312   case 59:
2313 #line 570 "mapparser.y" /* yacc.c:1646  */
2314     {
2315     int rval;
2316     rval = msGEOSContains((yyvsp[-3].shpval), (yyvsp[-1].shpval));
2317     if((yyvsp[-3].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-3].shpval));
2318     if((yyvsp[-1].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-1].shpval));
2319     if(rval == -1) {
2320       yyerror(p, "Contains function failed.");
2321       return(-1);
2322     } else
2323       (yyval.intval) = rval;
2324   }
2325 #line 2326 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2326     break;
2327 
2328   case 60:
2329 #line 581 "mapparser.y" /* yacc.c:1646  */
2330     {
2331     int rval;
2332     rval = msGEOSContains((yyvsp[-2].shpval), (yyvsp[0].shpval));
2333     if((yyvsp[-2].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-2].shpval));
2334     if((yyvsp[0].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[0].shpval));
2335     if(rval == -1) {
2336       yyerror(p, "Contains operator failed.");
2337       return(-1);
2338     } else
2339       (yyval.intval) = rval;
2340   }
2341 #line 2342 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2342     break;
2343 
2344   case 61:
2345 #line 592 "mapparser.y" /* yacc.c:1646  */
2346     {
2347     double d;
2348     d = msGEOSDistance((yyvsp[-5].shpval), (yyvsp[-3].shpval));
2349     if((yyvsp[-5].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-5].shpval));
2350     if((yyvsp[-3].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-3].shpval));
2351     if(d <= (yyvsp[-1].dblval))
2352       (yyval.intval) = MS_TRUE;
2353     else
2354       (yyval.intval) = MS_FALSE;
2355   }
2356 #line 2357 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2357     break;
2358 
2359   case 62:
2360 #line 602 "mapparser.y" /* yacc.c:1646  */
2361     {
2362     double d;
2363     d = msGEOSDistance((yyvsp[-5].shpval), (yyvsp[-3].shpval));
2364     if((yyvsp[-5].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-5].shpval));
2365     if((yyvsp[-3].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-3].shpval));
2366     if(d > (yyvsp[-1].dblval))
2367       (yyval.intval) = MS_TRUE;
2368     else
2369       (yyval.intval) = MS_FALSE;
2370   }
2371 #line 2372 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2372     break;
2373 
2374   case 64:
2375 #line 615 "mapparser.y" /* yacc.c:1646  */
2376     { (yyval.dblval) = (yyvsp[-1].dblval); }
2377 #line 2378 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2378     break;
2379 
2380   case 65:
2381 #line 616 "mapparser.y" /* yacc.c:1646  */
2382     { (yyval.dblval) = (yyvsp[-2].dblval) + (yyvsp[0].dblval); }
2383 #line 2384 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2384     break;
2385 
2386   case 66:
2387 #line 617 "mapparser.y" /* yacc.c:1646  */
2388     { (yyval.dblval) = (yyvsp[-2].dblval) - (yyvsp[0].dblval); }
2389 #line 2390 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2390     break;
2391 
2392   case 67:
2393 #line 618 "mapparser.y" /* yacc.c:1646  */
2394     { (yyval.dblval) = (yyvsp[-2].dblval) * (yyvsp[0].dblval); }
2395 #line 2396 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2396     break;
2397 
2398   case 68:
2399 #line 619 "mapparser.y" /* yacc.c:1646  */
2400     { (yyval.dblval) = (int)(yyvsp[-2].dblval) % (int)(yyvsp[0].dblval); }
2401 #line 2402 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2402     break;
2403 
2404   case 69:
2405 #line 620 "mapparser.y" /* yacc.c:1646  */
2406     {
2407     if((yyvsp[0].dblval) == 0.0) {
2408       yyerror(p, "Division by zero.");
2409       return(-1);
2410     } else
2411       (yyval.dblval) = (yyvsp[-2].dblval) / (yyvsp[0].dblval);
2412   }
2413 #line 2414 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2414     break;
2415 
2416   case 70:
2417 #line 627 "mapparser.y" /* yacc.c:1646  */
2418     { (yyval.dblval) = (yyvsp[0].dblval); }
2419 #line 2420 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2420     break;
2421 
2422   case 71:
2423 #line 628 "mapparser.y" /* yacc.c:1646  */
2424     { (yyval.dblval) = pow((yyvsp[-2].dblval), (yyvsp[0].dblval)); }
2425 #line 2426 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2426     break;
2427 
2428   case 72:
2429 #line 629 "mapparser.y" /* yacc.c:1646  */
2430     { (yyval.dblval) = strlen((yyvsp[-1].strval)); }
2431 #line 2432 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2432     break;
2433 
2434   case 73:
2435 #line 630 "mapparser.y" /* yacc.c:1646  */
2436     {
2437     if((yyvsp[-1].shpval)->type != MS_SHAPE_POLYGON) {
2438       yyerror(p, "Area can only be computed for polygon shapes.");
2439       return(-1);
2440     }
2441     (yyval.dblval) = msGetPolygonArea((yyvsp[-1].shpval));
2442     if((yyvsp[-1].shpval)->scratch == MS_TRUE) msFreeShape((yyvsp[-1].shpval));
2443   }
2444 #line 2445 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2445     break;
2446 
2447   case 74:
2448 #line 638 "mapparser.y" /* yacc.c:1646  */
2449     { (yyval.dblval) = (MS_NINT((yyvsp[-3].dblval)/(yyvsp[-1].dblval)))*(yyvsp[-1].dblval); }
2450 #line 2451 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2451     break;
2452 
2453   case 76:
2454 #line 642 "mapparser.y" /* yacc.c:1646  */
2455     { (yyval.shpval) = (yyvsp[-1].shpval); }
2456 #line 2457 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2457     break;
2458 
2459   case 77:
2460 #line 643 "mapparser.y" /* yacc.c:1646  */
2461     {
2462     shapeObj *s;
2463     s = msGEOSBuffer((yyvsp[-3].shpval), (yyvsp[-1].dblval));
2464     if(!s) {
2465       yyerror(p, "Executing buffer failed.");
2466       return(-1);
2467     }
2468     s->scratch = MS_TRUE;
2469     (yyval.shpval) = s;
2470   }
2471 #line 2472 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2472     break;
2473 
2474   case 78:
2475 #line 653 "mapparser.y" /* yacc.c:1646  */
2476     {
2477     shapeObj *s;
2478     s = msGEOSDifference((yyvsp[-3].shpval), (yyvsp[-1].shpval));
2479     if(!s) {
2480       yyerror(p, "Executing difference failed.");
2481       return(-1);
2482     }
2483     s->scratch = MS_TRUE;
2484     (yyval.shpval) = s;
2485   }
2486 #line 2487 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2487     break;
2488 
2489   case 79:
2490 #line 663 "mapparser.y" /* yacc.c:1646  */
2491     {
2492     shapeObj *s;
2493     s = msGEOSSimplify((yyvsp[-3].shpval), (yyvsp[-1].dblval));
2494     if(!s) {
2495       yyerror(p, "Executing simplify failed.");
2496       return(-1);
2497     }
2498     s->scratch = MS_TRUE;
2499     (yyval.shpval) = s;
2500   }
2501 #line 2502 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2502     break;
2503 
2504   case 80:
2505 #line 673 "mapparser.y" /* yacc.c:1646  */
2506     {
2507     shapeObj *s;
2508     s = msGEOSTopologyPreservingSimplify((yyvsp[-3].shpval), (yyvsp[-1].dblval));
2509     if(!s) {
2510       yyerror(p, "Executing simplifypt failed.");
2511       return(-1);
2512     }
2513     s->scratch = MS_TRUE;
2514     (yyval.shpval) = s;
2515   }
2516 #line 2517 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2517     break;
2518 
2519   case 81:
2520 #line 683 "mapparser.y" /* yacc.c:1646  */
2521     {
2522     shapeObj *s;
2523     s = msGeneralize((yyvsp[-3].shpval), (yyvsp[-1].dblval));
2524     if(!s) {
2525       yyerror(p, "Executing generalize failed.");
2526       return(-1);
2527     }
2528     s->scratch = MS_TRUE;
2529     (yyval.shpval) = s;
2530   }
2531 #line 2532 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2532     break;
2533 
2534   case 82:
2535 #line 693 "mapparser.y" /* yacc.c:1646  */
2536     {
2537     shapeObj *s;
2538     s = msSmoothShapeSIA((yyvsp[-1].shpval), 3, 1, NULL);
2539     if(!s) {
2540       yyerror(p, "Executing smoothsia failed.");
2541       return(-1);
2542     }
2543     s->scratch = MS_TRUE;
2544     (yyval.shpval) = s;
2545   }
2546 #line 2547 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2547     break;
2548 
2549   case 83:
2550 #line 703 "mapparser.y" /* yacc.c:1646  */
2551     {
2552     shapeObj *s;
2553     s = msSmoothShapeSIA((yyvsp[-3].shpval), (yyvsp[-1].dblval), 1, NULL);
2554     if(!s) {
2555       yyerror(p, "Executing smoothsia failed.");
2556       return(-1);
2557     }
2558     s->scratch = MS_TRUE;
2559     (yyval.shpval) = s;
2560   }
2561 #line 2562 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2562     break;
2563 
2564   case 84:
2565 #line 713 "mapparser.y" /* yacc.c:1646  */
2566     {
2567     shapeObj *s;
2568     s = msSmoothShapeSIA((yyvsp[-5].shpval), (yyvsp[-3].dblval), (yyvsp[-1].dblval), NULL);
2569     if(!s) {
2570       yyerror(p, "Executing smoothsia failed.");
2571       return(-1);
2572     }
2573     s->scratch = MS_TRUE;
2574     (yyval.shpval) = s;
2575   }
2576 #line 2577 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2577     break;
2578 
2579   case 85:
2580 #line 723 "mapparser.y" /* yacc.c:1646  */
2581     {
2582     shapeObj *s;
2583     s = msSmoothShapeSIA((yyvsp[-7].shpval), (yyvsp[-5].dblval), (yyvsp[-3].dblval), (yyvsp[-1].strval));
2584     free((yyvsp[-1].strval));
2585     if(!s) {
2586       yyerror(p, "Executing smoothsia failed.");
2587       return(-1);
2588     }
2589     s->scratch = MS_TRUE;
2590     (yyval.shpval) = s;
2591   }
2592 #line 2593 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2593     break;
2594 
2595   case 86:
2596 #line 734 "mapparser.y" /* yacc.c:1646  */
2597     {
2598 #ifdef USE_V8_MAPSCRIPT
2599     shapeObj *s;
2600     s = msV8TransformShape((yyvsp[-3].shpval), (yyvsp[-1].strval));
2601     free((yyvsp[-1].strval));
2602     if(!s) {
2603       yyerror(p, "Executing javascript failed.");
2604       return(-1);
2605     }
2606     s->scratch = MS_TRUE;
2607     (yyval.shpval) = s;
2608 #else
2609     yyerror(p, "Javascript support not compiled in");
2610     return(-1);
2611 #endif
2612   }
2613 #line 2614 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2614     break;
2615 
2616   case 88:
2617 #line 753 "mapparser.y" /* yacc.c:1646  */
2618     { (yyval.strval) = (yyvsp[-1].strval); }
2619 #line 2620 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2620     break;
2621 
2622   case 89:
2623 #line 754 "mapparser.y" /* yacc.c:1646  */
2624     {
2625     (yyval.strval) = (char *)malloc(strlen((yyvsp[-2].strval)) + strlen((yyvsp[0].strval)) + 1);
2626     sprintf((yyval.strval), "%s%s", (yyvsp[-2].strval), (yyvsp[0].strval)); free((yyvsp[-2].strval)); free((yyvsp[0].strval));
2627   }
2628 #line 2629 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2629     break;
2630 
2631   case 90:
2632 #line 758 "mapparser.y" /* yacc.c:1646  */
2633     {
2634     (yyval.strval) = (char *) malloc(strlen((yyvsp[-1].strval)) + 64); /* Plenty big? Should use snprintf below... */
2635     sprintf((yyval.strval), (yyvsp[-1].strval), (yyvsp[-3].dblval));
2636     free((yyvsp[-1].strval));
2637   }
2638 #line 2639 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2639     break;
2640 
2641   case 91:
2642 #line 763 "mapparser.y" /* yacc.c:1646  */
2643     {
2644     (yyvsp[-1].strval) = msCommifyString((yyvsp[-1].strval));
2645     (yyval.strval) = (yyvsp[-1].strval);
2646   }
2647 #line 2648 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2648     break;
2649 
2650   case 92:
2651 #line 767 "mapparser.y" /* yacc.c:1646  */
2652     {
2653     msStringToUpper((yyvsp[-1].strval));
2654     (yyval.strval) = (yyvsp[-1].strval);
2655   }
2656 #line 2657 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2657     break;
2658 
2659   case 93:
2660 #line 771 "mapparser.y" /* yacc.c:1646  */
2661     {
2662     msStringToLower((yyvsp[-1].strval));
2663     (yyval.strval) = (yyvsp[-1].strval);
2664   }
2665 #line 2666 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2666     break;
2667 
2668   case 94:
2669 #line 775 "mapparser.y" /* yacc.c:1646  */
2670     {
2671     msStringInitCap((yyvsp[-1].strval));
2672     (yyval.strval) = (yyvsp[-1].strval);
2673   }
2674 #line 2675 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2675     break;
2676 
2677   case 95:
2678 #line 779 "mapparser.y" /* yacc.c:1646  */
2679     {
2680     msStringFirstCap((yyvsp[-1].strval));
2681     (yyval.strval) = (yyvsp[-1].strval);
2682   }
2683 #line 2684 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2684     break;
2685 
2686   case 97:
2687 #line 786 "mapparser.y" /* yacc.c:1646  */
2688     { (yyval.tmval) = (yyvsp[-1].tmval); }
2689 #line 2690 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2690     break;
2691 
2692 
2693 #line 2694 "/home/even/mapserver/mapserver/mapparser.c" /* yacc.c:1646  */
2694       default: break;
2695     }
2696   /* User semantic actions sometimes alter yychar, and that requires
2697      that yytoken be updated with the new translation.  We take the
2698      approach of translating immediately before every use of yytoken.
2699      One alternative is translating here after every semantic action,
2700      but that translation would be missed if the semantic action invokes
2701      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2702      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
2703      incorrect destructor might then be invoked immediately.  In the
2704      case of YYERROR or YYBACKUP, subsequent parser actions might lead
2705      to an incorrect destructor call or verbose syntax error message
2706      before the lookahead is translated.  */
2707   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2708 
2709   YYPOPSTACK (yylen);
2710   yylen = 0;
2711   YY_STACK_PRINT (yyss, yyssp);
2712 
2713   *++yyvsp = yyval;
2714 
2715   /* Now 'shift' the result of the reduction.  Determine what state
2716      that goes to, based on the state we popped back to and the rule
2717      number reduced by.  */
2718 
2719   yyn = yyr1[yyn];
2720 
2721   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2722   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2723     yystate = yytable[yystate];
2724   else
2725     yystate = yydefgoto[yyn - YYNTOKENS];
2726 
2727   goto yynewstate;
2728 
2729 
2730 /*--------------------------------------.
2731 | yyerrlab -- here on detecting error.  |
2732 `--------------------------------------*/
2733 yyerrlab:
2734   /* Make sure we have latest lookahead translation.  See comments at
2735      user semantic actions for why this is necessary.  */
2736   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2737 
2738   /* If not already recovering from an error, report this error.  */
2739   if (!yyerrstatus)
2740     {
2741       ++yynerrs;
2742 #if ! YYERROR_VERBOSE
2743       yyerror (p, YY_("syntax error"));
2744 #else
2745 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2746                                         yyssp, yytoken)
2747       {
2748         char const *yymsgp = YY_("syntax error");
2749         int yysyntax_error_status;
2750         yysyntax_error_status = YYSYNTAX_ERROR;
2751         if (yysyntax_error_status == 0)
2752           yymsgp = yymsg;
2753         else if (yysyntax_error_status == 1)
2754           {
2755             if (yymsg != yymsgbuf)
2756               YYSTACK_FREE (yymsg);
2757             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2758             if (!yymsg)
2759               {
2760                 yymsg = yymsgbuf;
2761                 yymsg_alloc = sizeof yymsgbuf;
2762                 yysyntax_error_status = 2;
2763               }
2764             else
2765               {
2766                 yysyntax_error_status = YYSYNTAX_ERROR;
2767                 yymsgp = yymsg;
2768               }
2769           }
2770         yyerror (p, yymsgp);
2771         if (yysyntax_error_status == 2)
2772           goto yyexhaustedlab;
2773       }
2774 # undef YYSYNTAX_ERROR
2775 #endif
2776     }
2777 
2778 
2779 
2780   if (yyerrstatus == 3)
2781     {
2782       /* If just tried and failed to reuse lookahead token after an
2783          error, discard it.  */
2784 
2785       if (yychar <= YYEOF)
2786         {
2787           /* Return failure if at end of input.  */
2788           if (yychar == YYEOF)
2789             YYABORT;
2790         }
2791       else
2792         {
2793           yydestruct ("Error: discarding",
2794                       yytoken, &yylval, p);
2795           yychar = YYEMPTY;
2796         }
2797     }
2798 
2799   /* Else will try to reuse lookahead token after shifting the error
2800      token.  */
2801   goto yyerrlab1;
2802 
2803 
2804 /*---------------------------------------------------.
2805 | yyerrorlab -- error raised explicitly by YYERROR.  |
2806 `---------------------------------------------------*/
2807 yyerrorlab:
2808 
2809   /* Pacify compilers like GCC when the user code never invokes
2810      YYERROR and the label yyerrorlab therefore never appears in user
2811      code.  */
2812   if (/*CONSTCOND*/ 0)
2813      goto yyerrorlab;
2814 
2815   /* Do not reclaim the symbols of the rule whose action triggered
2816      this YYERROR.  */
2817   YYPOPSTACK (yylen);
2818   yylen = 0;
2819   YY_STACK_PRINT (yyss, yyssp);
2820   yystate = *yyssp;
2821   goto yyerrlab1;
2822 
2823 
2824 /*-------------------------------------------------------------.
2825 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
2826 `-------------------------------------------------------------*/
2827 yyerrlab1:
2828   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2829 
2830   for (;;)
2831     {
2832       yyn = yypact[yystate];
2833       if (!yypact_value_is_default (yyn))
2834         {
2835           yyn += YYTERROR;
2836           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2837             {
2838               yyn = yytable[yyn];
2839               if (0 < yyn)
2840                 break;
2841             }
2842         }
2843 
2844       /* Pop the current state because it cannot handle the error token.  */
2845       if (yyssp == yyss)
2846         YYABORT;
2847 
2848 
2849       yydestruct ("Error: popping",
2850                   yystos[yystate], yyvsp, p);
2851       YYPOPSTACK (1);
2852       yystate = *yyssp;
2853       YY_STACK_PRINT (yyss, yyssp);
2854     }
2855 
2856   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2857   *++yyvsp = yylval;
2858   YY_IGNORE_MAYBE_UNINITIALIZED_END
2859 
2860 
2861   /* Shift the error token.  */
2862   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2863 
2864   yystate = yyn;
2865   goto yynewstate;
2866 
2867 
2868 /*-------------------------------------.
2869 | yyacceptlab -- YYACCEPT comes here.  |
2870 `-------------------------------------*/
2871 yyacceptlab:
2872   yyresult = 0;
2873   goto yyreturn;
2874 
2875 /*-----------------------------------.
2876 | yyabortlab -- YYABORT comes here.  |
2877 `-----------------------------------*/
2878 yyabortlab:
2879   yyresult = 1;
2880   goto yyreturn;
2881 
2882 #if !defined yyoverflow || YYERROR_VERBOSE
2883 /*-------------------------------------------------.
2884 | yyexhaustedlab -- memory exhaustion comes here.  |
2885 `-------------------------------------------------*/
2886 yyexhaustedlab:
2887   yyerror (p, YY_("memory exhausted"));
2888   yyresult = 2;
2889   /* Fall through.  */
2890 #endif
2891 
2892 yyreturn:
2893   if (yychar != YYEMPTY)
2894     {
2895       /* Make sure we have latest lookahead translation.  See comments at
2896          user semantic actions for why this is necessary.  */
2897       yytoken = YYTRANSLATE (yychar);
2898       yydestruct ("Cleanup: discarding lookahead",
2899                   yytoken, &yylval, p);
2900     }
2901   /* Do not reclaim the symbols of the rule whose action triggered
2902      this YYABORT or YYACCEPT.  */
2903   YYPOPSTACK (yylen);
2904   YY_STACK_PRINT (yyss, yyssp);
2905   while (yyssp != yyss)
2906     {
2907       yydestruct ("Cleanup: popping",
2908                   yystos[*yyssp], yyvsp, p);
2909       YYPOPSTACK (1);
2910     }
2911 #ifndef yyoverflow
2912   if (yyss != yyssa)
2913     YYSTACK_FREE (yyss);
2914 #endif
2915 #if YYERROR_VERBOSE
2916   if (yymsg != yymsgbuf)
2917     YYSTACK_FREE (yymsg);
2918 #endif
2919   return yyresult;
2920 }
2921 #line 789 "mapparser.y" /* yacc.c:1906  */
2922 
2923 
2924 /*
2925 ** Any extra C functions
2926 */
2927 
yylex(YYSTYPE * lvalp,parseObj * p)2928 int yylex(YYSTYPE *lvalp, parseObj *p)
2929 {
2930   int token;
2931 
2932   if(p->expr->curtoken == NULL) return(0); /* done */
2933 
2934   // fprintf(stderr, "in yylex() - curtoken=%d...\n", p->expr->curtoken->token);
2935 
2936   token = p->expr->curtoken->token; /* may override */
2937   switch(p->expr->curtoken->token) {
2938   case MS_TOKEN_LITERAL_BOOLEAN:
2939     token = BOOLEAN;
2940     (*lvalp).intval = p->expr->curtoken->tokenval.dblval;
2941     break;
2942   case MS_TOKEN_LITERAL_NUMBER:
2943     token = NUMBER;
2944     (*lvalp).dblval = p->expr->curtoken->tokenval.dblval;
2945     break;
2946   case MS_TOKEN_LITERAL_SHAPE:
2947     token = SHAPE;
2948     // fprintf(stderr, "token value = %s\n", msShapeToWKT(p->expr->curtoken->tokenval.shpval));
2949     (*lvalp).shpval = p->expr->curtoken->tokenval.shpval;
2950     break;
2951   case MS_TOKEN_LITERAL_STRING:
2952     // printf("token value = %s\n", p->expr->curtoken->tokenval.strval);
2953     token = STRING;
2954     (*lvalp).strval = msStrdup(p->expr->curtoken->tokenval.strval);
2955     break;
2956   case MS_TOKEN_LITERAL_TIME:
2957     token = TIME;
2958     (*lvalp).tmval = p->expr->curtoken->tokenval.tmval;
2959     break;
2960 
2961   case MS_TOKEN_COMPARISON_EQ: token = EQ; break;
2962   case MS_TOKEN_COMPARISON_IEQ: token = IEQ; break;
2963   case MS_TOKEN_COMPARISON_NE: token = NE; break;
2964   case MS_TOKEN_COMPARISON_LT: token = LT; break;
2965   case MS_TOKEN_COMPARISON_GT: token = GT; break;
2966   case MS_TOKEN_COMPARISON_LE: token = LE; break;
2967   case MS_TOKEN_COMPARISON_GE: token = GE; break;
2968   case MS_TOKEN_COMPARISON_RE: token = RE; break;
2969   case MS_TOKEN_COMPARISON_IRE: token = IRE; break;
2970 
2971   case MS_TOKEN_COMPARISON_IN: token = IN; break;
2972 
2973   case MS_TOKEN_COMPARISON_INTERSECTS: token = INTERSECTS; break;
2974   case MS_TOKEN_COMPARISON_DISJOINT: token = DISJOINT; break;
2975   case MS_TOKEN_COMPARISON_TOUCHES: token = TOUCHES; break;
2976   case MS_TOKEN_COMPARISON_OVERLAPS: token = OVERLAPS; break;
2977   case MS_TOKEN_COMPARISON_CROSSES: token = CROSSES; break;
2978   case MS_TOKEN_COMPARISON_WITHIN: token = WITHIN; break;
2979   case MS_TOKEN_COMPARISON_CONTAINS: token = CONTAINS; break;
2980   case MS_TOKEN_COMPARISON_EQUALS: token = EQUALS; break;
2981   case MS_TOKEN_COMPARISON_BEYOND: token = BEYOND; break;
2982   case MS_TOKEN_COMPARISON_DWITHIN: token = DWITHIN; break;
2983 
2984   case MS_TOKEN_LOGICAL_AND: token = AND; break;
2985   case MS_TOKEN_LOGICAL_OR: token = OR; break;
2986   case MS_TOKEN_LOGICAL_NOT: token = NOT; break;
2987 
2988   case MS_TOKEN_BINDING_DOUBLE:
2989   case MS_TOKEN_BINDING_INTEGER:
2990     token = NUMBER;
2991     (*lvalp).dblval = atof(p->shape->values[p->expr->curtoken->tokenval.bindval.index]);
2992     break;
2993   case MS_TOKEN_BINDING_STRING:
2994     token = STRING;
2995     (*lvalp).strval = msStrdup(p->shape->values[p->expr->curtoken->tokenval.bindval.index]);
2996     break;
2997   case MS_TOKEN_BINDING_SHAPE:
2998     token = SHAPE;
2999     // fprintf(stderr, "token value = %s\n", msShapeToWKT(p->shape));
3000     (*lvalp).shpval = p->shape;
3001     break;
3002   case MS_TOKEN_BINDING_MAP_CELLSIZE:
3003     token = NUMBER;
3004     (*lvalp).dblval = p->dblval;
3005     break;
3006   case MS_TOKEN_BINDING_DATA_CELLSIZE:
3007     token = NUMBER;
3008     (*lvalp).dblval = p->dblval2;
3009     break;
3010   case MS_TOKEN_BINDING_TIME:
3011     token = TIME;
3012     msTimeInit(&((*lvalp).tmval));
3013     if(msParseTime(p->shape->values[p->expr->curtoken->tokenval.bindval.index], &((*lvalp).tmval)) != MS_TRUE) {
3014       yyerror(p, "Parsing time value failed.");
3015       return(-1);
3016     }
3017     break;
3018 
3019   case MS_TOKEN_FUNCTION_AREA: token = AREA; break;
3020   case MS_TOKEN_FUNCTION_LENGTH: token = LENGTH; break;
3021   case MS_TOKEN_FUNCTION_TOSTRING: token = TOSTRING; break;
3022   case MS_TOKEN_FUNCTION_COMMIFY: token = COMMIFY; break;
3023   case MS_TOKEN_FUNCTION_UPPER: token = UPPER; break;
3024   case MS_TOKEN_FUNCTION_LOWER: token = LOWER; break;
3025   case MS_TOKEN_FUNCTION_INITCAP: token = INITCAP; break;
3026   case MS_TOKEN_FUNCTION_FIRSTCAP: token = FIRSTCAP; break;
3027   case MS_TOKEN_FUNCTION_ROUND: token = ROUND; break;
3028 
3029   case MS_TOKEN_FUNCTION_BUFFER: token = YYBUFFER; break;
3030   case MS_TOKEN_FUNCTION_DIFFERENCE: token = DIFFERENCE; break;
3031   case MS_TOKEN_FUNCTION_SIMPLIFY: token = SIMPLIFY; break;
3032   case MS_TOKEN_FUNCTION_SIMPLIFYPT: token = SIMPLIFYPT; break;
3033   case MS_TOKEN_FUNCTION_GENERALIZE: token = GENERALIZE; break;
3034   case MS_TOKEN_FUNCTION_SMOOTHSIA: token = SMOOTHSIA; break;
3035   case MS_TOKEN_FUNCTION_JAVASCRIPT: token = JAVASCRIPT; break;
3036 
3037   default:
3038     break;
3039   }
3040 
3041   p->expr->curtoken = p->expr->curtoken->next; /* re-position */
3042   return(token);
3043 }
3044 
yyerror(parseObj * p,const char * s)3045 int yyerror(parseObj *p, const char *s) {
3046   msSetError(MS_PARSEERR, "%s", "yyparse()", s);
3047   return(0);
3048 }
3049