1 /* A Bison parser, made by GNU Bison 3.0.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989-1990, 2000-2013 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"
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 /* Substitute the variable and function names.  */
63 #define yyparse         osr_cs_wkt_parse
64 #define yylex           osr_cs_wkt_lex
65 #define yyerror         osr_cs_wkt_error
66 #define yydebug         osr_cs_wkt_debug
67 #define yynerrs         osr_cs_wkt_nerrs
68 
69 
70 /* Copy the first part of user declarations.  */
71 
72 
73 /******************************************************************************
74  * $Id: osr_cs_wkt_parser.c 27975 2014-11-17 12:37:48Z rouault $
75  *
76  * Project:  OpenGIS Simple Features Reference Implementation
77  * Purpose:  CS WKT parser grammar
78  * Author:   Even Rouault, <even dot rouault at mines dash paris dot org>
79  *
80  ******************************************************************************
81  * Copyright (c) 2013 Even Rouault, <even dot rouault at mines dash paris dot org>
82  *
83  * Permission is hereby granted, free of charge, to any person obtaining a
84  * copy of this software and associated documentation files (the "Software"),
85  * to deal in the Software without restriction, including without limitation
86  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
87  * and/or sell copies of the Software, and to permit persons to whom the
88  * Software is furnished to do so, subject to the following conditions:
89  *
90  * The above copyright notice and this permission notice shall be included
91  * in all copies or substantial portions of the Software.
92  *
93  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
94  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
95  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
96  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
97  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
98  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
99  * DEALINGS IN THE SOFTWARE.
100  ****************************************************************************/
101 
102 #include "osr_cs_wkt.h"
103 
104 
105 
106 
107 # ifndef YY_NULL
108 #  if defined __cplusplus && 201103L <= __cplusplus
109 #   define YY_NULL nullptr
110 #  else
111 #   define YY_NULL 0
112 #  endif
113 # endif
114 
115 /* Enabling verbose error messages.  */
116 #ifdef YYERROR_VERBOSE
117 # undef YYERROR_VERBOSE
118 # define YYERROR_VERBOSE 1
119 #else
120 # define YYERROR_VERBOSE 1
121 #endif
122 
123 /* In a future release of Bison, this section will be replaced
124    by #include "osr_cs_wkt_parser.h".  */
125 #ifndef YY_OSR_CS_WKT_OSR_CS_WKT_PARSER_H_INCLUDED
126 # define YY_OSR_CS_WKT_OSR_CS_WKT_PARSER_H_INCLUDED
127 /* Debug traces.  */
128 #ifndef YYDEBUG
129 # define YYDEBUG 0
130 #endif
131 #if YYDEBUG
132 extern int osr_cs_wkt_debug;
133 #endif
134 
135 /* Token type.  */
136 #ifndef YYTOKENTYPE
137 # define YYTOKENTYPE
138   enum yytokentype
139   {
140     END = 0,
141     T_PARAM_MT = 258,
142     T_CONCAT_MT = 259,
143     T_INVERSE_MT = 260,
144     T_PASSTHROUGH_MT = 261,
145     T_PROJCS = 262,
146     T_PROJECTION = 263,
147     T_GEOGCS = 264,
148     T_DATUM = 265,
149     T_SPHEROID = 266,
150     T_PRIMEM = 267,
151     T_UNIT = 268,
152     T_GEOCCS = 269,
153     T_AUTHORITY = 270,
154     T_VERT_CS = 271,
155     T_VERT_DATUM = 272,
156     T_COMPD_CS = 273,
157     T_AXIS = 274,
158     T_TOWGS84 = 275,
159     T_FITTED_CS = 276,
160     T_LOCAL_CS = 277,
161     T_LOCAL_DATUM = 278,
162     T_PARAMETER = 279,
163     T_EXTENSION = 280,
164     T_STRING = 281,
165     T_NUMBER = 282,
166     T_IDENTIFIER = 283
167   };
168 #endif
169 
170 /* Value type.  */
171 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
172 typedef int YYSTYPE;
173 # define YYSTYPE_IS_TRIVIAL 1
174 # define YYSTYPE_IS_DECLARED 1
175 #endif
176 
177 
178 
179 int osr_cs_wkt_parse (osr_cs_wkt_parse_context *context);
180 
181 #endif /* !YY_OSR_CS_WKT_OSR_CS_WKT_PARSER_H_INCLUDED  */
182 
183 /* Copy the second part of user declarations.  */
184 
185 
186 
187 #ifdef short
188 # undef short
189 #endif
190 
191 #ifdef YYTYPE_UINT8
192 typedef YYTYPE_UINT8 yytype_uint8;
193 #else
194 typedef unsigned char yytype_uint8;
195 #endif
196 
197 #ifdef YYTYPE_INT8
198 typedef YYTYPE_INT8 yytype_int8;
199 #else
200 typedef signed char yytype_int8;
201 #endif
202 
203 #ifdef YYTYPE_UINT16
204 typedef YYTYPE_UINT16 yytype_uint16;
205 #else
206 typedef unsigned short int yytype_uint16;
207 #endif
208 
209 #ifdef YYTYPE_INT16
210 typedef YYTYPE_INT16 yytype_int16;
211 #else
212 typedef short int yytype_int16;
213 #endif
214 
215 #ifndef YYSIZE_T
216 # ifdef __SIZE_TYPE__
217 #  define YYSIZE_T __SIZE_TYPE__
218 # elif defined size_t
219 #  define YYSIZE_T size_t
220 # elif ! defined YYSIZE_T
221 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
222 #  define YYSIZE_T size_t
223 # else
224 #  define YYSIZE_T unsigned int
225 # endif
226 #endif
227 
228 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
229 
230 #ifndef YY_
231 # if defined YYENABLE_NLS && YYENABLE_NLS
232 #  if ENABLE_NLS
233 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
234 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
235 #  endif
236 # endif
237 # ifndef YY_
238 #  define YY_(Msgid) Msgid
239 # endif
240 #endif
241 
242 #ifndef __attribute__
243 /* This feature is available in gcc versions 2.5 and later.  */
244 # if (! defined __GNUC__ || __GNUC__ < 2 \
245       || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
246 #  define __attribute__(Spec) /* empty */
247 # endif
248 #endif
249 
250 /* Suppress unused-variable warnings by "using" E.  */
251 #if ! defined lint || defined __GNUC__
252 # define YYUSE(E) ((void) (E))
253 #else
254 # define YYUSE(E) /* empty */
255 #endif
256 
257 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
258 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
259 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
260     _Pragma ("GCC diagnostic push") \
261     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
262     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
263 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
264     _Pragma ("GCC diagnostic pop")
265 #else
266 # define YY_INITIAL_VALUE(Value) Value
267 #endif
268 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
269 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
270 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
271 #endif
272 #ifndef YY_INITIAL_VALUE
273 # define YY_INITIAL_VALUE(Value) /* Nothing. */
274 #endif
275 
276 
277 #if ! defined yyoverflow || YYERROR_VERBOSE
278 
279 /* The parser invokes alloca or malloc; define the necessary symbols.  */
280 
281 # ifdef YYSTACK_USE_ALLOCA
282 #  if YYSTACK_USE_ALLOCA
283 #   ifdef __GNUC__
284 #    define YYSTACK_ALLOC __builtin_alloca
285 #   elif defined __BUILTIN_VA_ARG_INCR
286 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
287 #   elif defined _AIX
288 #    define YYSTACK_ALLOC __alloca
289 #   elif defined _MSC_VER
290 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
291 #    define alloca _alloca
292 #   else
293 #    define YYSTACK_ALLOC alloca
294 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
295 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
296       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
297 #     ifndef EXIT_SUCCESS
298 #      define EXIT_SUCCESS 0
299 #     endif
300 #    endif
301 #   endif
302 #  endif
303 # endif
304 
305 # ifdef YYSTACK_ALLOC
306    /* Pacify GCC's 'empty if-body' warning.  */
307 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
308 #  ifndef YYSTACK_ALLOC_MAXIMUM
309     /* The OS might guarantee only one guard page at the bottom of the stack,
310        and a page size can be as small as 4096 bytes.  So we cannot safely
311        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
312        to allow for a few compiler-allocated temporary stack slots.  */
313 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
314 #  endif
315 # else
316 #  define YYSTACK_ALLOC YYMALLOC
317 #  define YYSTACK_FREE YYFREE
318 #  ifndef YYSTACK_ALLOC_MAXIMUM
319 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
320 #  endif
321 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
322        && ! ((defined YYMALLOC || defined malloc) \
323              && (defined YYFREE || defined free)))
324 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
325 #   ifndef EXIT_SUCCESS
326 #    define EXIT_SUCCESS 0
327 #   endif
328 #  endif
329 #  ifndef YYMALLOC
330 #   define YYMALLOC malloc
331 #   if ! defined malloc && ! defined EXIT_SUCCESS
332 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
333 #   endif
334 #  endif
335 #  ifndef YYFREE
336 #   define YYFREE free
337 #   if ! defined free && ! defined EXIT_SUCCESS
338 void free (void *); /* INFRINGES ON USER NAME SPACE */
339 #   endif
340 #  endif
341 # endif
342 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
343 
344 
345 #if (! defined yyoverflow \
346      && (! defined __cplusplus \
347          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
348 
349 /* A type that is properly aligned for any stack member.  */
350 union yyalloc
351 {
352   yytype_int16 yyss_alloc;
353   YYSTYPE yyvs_alloc;
354 };
355 
356 /* The size of the maximum gap between one aligned stack and the next.  */
357 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
358 
359 /* The size of an array large to enough to hold all stacks, each with
360    N elements.  */
361 # define YYSTACK_BYTES(N) \
362      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
363       + YYSTACK_GAP_MAXIMUM)
364 
365 # define YYCOPY_NEEDED 1
366 
367 /* Relocate STACK from its old location to the new one.  The
368    local variables YYSIZE and YYSTACKSIZE give the old and new number of
369    elements in the stack, and YYPTR gives the new location of the
370    stack.  Advance YYPTR to a properly aligned location for the next
371    stack.  */
372 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
373     do                                                                  \
374       {                                                                 \
375         YYSIZE_T yynewbytes;                                            \
376         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
377         Stack = &yyptr->Stack_alloc;                                    \
378         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
379         yyptr += yynewbytes / sizeof (*yyptr);                          \
380       }                                                                 \
381     while (0)
382 
383 #endif
384 
385 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
386 /* Copy COUNT objects from SRC to DST.  The source and destination do
387    not overlap.  */
388 # ifndef YYCOPY
389 #  if defined __GNUC__ && 1 < __GNUC__
390 #   define YYCOPY(Dst, Src, Count) \
391       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
392 #  else
393 #   define YYCOPY(Dst, Src, Count)              \
394       do                                        \
395         {                                       \
396           YYSIZE_T yyi;                         \
397           for (yyi = 0; yyi < (Count); yyi++)   \
398             (Dst)[yyi] = (Src)[yyi];            \
399         }                                       \
400       while (0)
401 #  endif
402 # endif
403 #endif /* !YYCOPY_NEEDED */
404 
405 /* YYFINAL -- State number of the termination state.  */
406 #define YYFINAL  27
407 /* YYLAST -- Last index in YYTABLE.  */
408 #define YYLAST   197
409 
410 /* YYNTOKENS -- Number of terminals.  */
411 #define YYNTOKENS  32
412 /* YYNNTS -- Number of nonterminals.  */
413 #define YYNNTS  66
414 /* YYNRULES -- Number of rules.  */
415 #define YYNRULES  96
416 /* YYNSTATES -- Number of states.  */
417 #define YYNSTATES  252
418 
419 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
420    by yylex, with out-of-bounds checking.  */
421 #define YYUNDEFTOK  2
422 #define YYMAXUTOK   283
423 
424 #define YYTRANSLATE(YYX)                                                \
425   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
426 
427 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
428    as returned by yylex, without out-of-bounds checking.  */
429 static const yytype_uint8 yytranslate[] =
430 {
431        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
432        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
433        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
434        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
435        2,     2,     2,     2,    31,     2,     2,     2,     2,     2,
436        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
437        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
438        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
439        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
440        2,    29,     2,    30,     2,     2,     2,     2,     2,     2,
441        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
442        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
443        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
444        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
445        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
446        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
447        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
448        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
449        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
450        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
451        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
452        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
453        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
454        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
455        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
456        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
457        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
458       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
459       25,    26,    27,    28
460 };
461 
462 #if YYDEBUG
463   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
464 static const yytype_uint16 yyrline[] =
465 {
466        0,    78,    78,    89,    92,    95,    98,    98,    98,    98,
467      101,   104,   107,   108,   111,   113,   114,   115,   118,   121,
468      125,   130,   130,   130,   130,   130,   130,   133,   133,   137,
469      141,   142,   145,   146,   148,   149,   150,   151,   153,   154,
470      157,   160,   163,   167,   169,   170,   171,   172,   175,   179,
471      182,   185,   188,   191,   194,   197,   200,   203,   206,   207,
472      208,   211,   214,   217,   219,   220,   221,   224,   226,   227,
473      228,   231,   234,   237,   240,   242,   245,   250,   253,   255,
474      258,   261,   264,   267,   270,   273,   276,   279,   282,   285,
475      288,   291,   294,   296,   297,   298,   301
476 };
477 #endif
478 
479 #if YYDEBUG || YYERROR_VERBOSE || 1
480 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
481    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
482 static const char *const yytname[] =
483 {
484   "\"end of string\"", "error", "$undefined", "\"PARAM_MT\"",
485   "\"CONCAT_MT\"", "\"INVERSE_MT\"", "\"PASSTHROUGH_MT\"", "\"PROJCS\"",
486   "\"PROJECTION\"", "\"GEOGCS\"", "\"DATUM\"", "\"SPHEROID\"",
487   "\"PRIMEM\"", "\"UNIT\"", "\"GEOCCS\"", "\"AUTHORITY\"", "\"VERT_CS\"",
488   "\"VERT_DATUM\"", "\"COMPD_CS\"", "\"AXIS\"", "\"TOWGS84\"",
489   "\"FITTED_CS\"", "\"LOCAL_CS\"", "\"LOCAL_DATUM\"", "\"PARAMETER\"",
490   "\"EXTENSION\"", "\"string\"", "\"number\"", "\"identifier\"", "'['",
491   "']'", "','", "$accept", "input", "begin_node", "begin_node_name",
492   "end_node", "math_transform", "param_mt", "parameter",
493   "opt_parameter_list", "concat_mt", "opt_math_transform_list", "inv_mt",
494   "passthrough_mt", "integer", "coordinate_system", "horz_cs",
495   "projected_cs", "opt_parameter_list_linear_unit",
496   "parameter_list_linear_unit", "opt_twin_axis_extension_authority",
497   "opt_authority", "extension", "projection", "geographic_cs", "datum",
498   "opt_towgs84_authority_extension", "spheroid", "semi_major_axis",
499   "inverse_flattening", "prime_meridian", "longitude", "angular_unit",
500   "linear_unit", "unit", "conversion_factor", "geocentric_cs",
501   "opt_three_axis_authority", "three_axis", "authority", "vert_cs",
502   "opt_axis_authority", "vert_datum", "opt_extension_authority",
503   "datum_type", "compd_cs", "head_cs", "tail_cs", "twin_axis", "axis",
504   "towgs84", "towgs84_parameters", "three_parameters", "seven_parameters",
505   "dx", "dy", "dz", "ex", "ey", "ez", "ppm", "fitted_cs", "to_base",
506   "base_cs", "local_cs", "opt_axis_list_authority", "local_datum", YY_NULL
507 };
508 #endif
509 
510 # ifdef YYPRINT
511 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
512    (internal) symbol number NUM (which must be that of a token).  */
513 static const yytype_uint16 yytoknum[] =
514 {
515        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
516      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
517      275,   276,   277,   278,   279,   280,   281,   282,   283,    91,
518       93,    44
519 };
520 # endif
521 
522 #define YYPACT_NINF -114
523 
524 #define yypact_value_is_default(Yystate) \
525   (!!((Yystate) == (-114)))
526 
527 #define YYTABLE_NINF -1
528 
529 #define yytable_value_is_error(Yytable_value) \
530   0
531 
532   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
533      STATE-NUM.  */
534 static const yytype_int16 yypact[] =
535 {
536      131,    -2,    -2,    -2,    -2,    -2,    -2,    -2,    28,  -114,
537     -114,  -114,  -114,  -114,  -114,  -114,  -114,  -114,  -114,    10,
538       19,    21,    24,    33,    35,    37,    40,  -114,  -114,    63,
539       65,    65,    56,   131,    91,    59,    53,    -2,    54,    55,
540       -2,    57,  -114,    58,    -2,    -2,    -2,    -2,  -114,  -114,
541     -114,  -114,  -114,    68,    -2,    69,    93,    72,    92,    92,
542       75,    94,   131,    77,    91,    91,    82,   131,    81,    94,
543       -2,    83,   102,    -2,    85,    87,    95,    -2,    88,  -114,
544     -114,    89,   101,    96,    91,    96,  -114,    98,  -114,    96,
545       95,   100,   104,    11,    -2,   108,   112,    94,    94,  -114,
546       89,   113,    38,    96,    14,    96,    -2,    77,  -114,  -114,
547      117,    96,  -114,    91,  -114,   104,   132,   135,    96,   123,
548      124,  -114,  -114,   125,    31,    96,   130,   124,  -114,   127,
549       96,   133,    -2,    -2,  -114,   104,  -114,    -2,   104,  -114,
550     -114,   128,  -114,    91,  -114,    96,    96,   134,  -114,  -114,
551       11,     0,    96,   136,    -2,   104,  -114,    89,  -114,  -114,
552      104,    96,    38,    96,  -114,  -114,   104,   137,   138,  -114,
553      139,  -114,   140,  -114,  -114,  -114,    38,    96,  -114,  -114,
554      104,  -114,    89,   141,  -114,  -114,   142,   144,  -114,  -114,
555       96,  -114,   104,  -114,   143,  -114,    96,   149,    99,   150,
556       96,  -114,   134,  -114,  -114,  -114,   132,   151,  -114,    96,
557     -114,  -114,   146,  -114,  -114,   132,  -114,    96,    96,    96,
558     -114,  -114,  -114,  -114,   104,  -114,   152,   153,  -114,  -114,
559     -114,    96,  -114,   154,   132,  -114,   155,  -114,  -114,   156,
560      159,  -114,   157,   162,  -114,   160,   163,  -114,   161,   166,
561     -114,  -114
562 };
563 
564   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
565      Performed when YYTABLE does not specify something else to do.  Zero
566      means the default is an error.  */
567 static const yytype_uint8 yydefact[] =
568 {
569        0,     0,     0,     0,     0,     0,     0,     0,     0,     2,
570       21,    28,    27,    22,    23,    24,    25,    26,     3,     0,
571        0,     0,     0,     0,     0,     0,     0,     1,     4,     0,
572        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
573        0,     0,    73,     0,     0,     0,     0,     0,    90,     6,
574        7,     8,     9,     0,     0,     0,     0,     0,     0,     0,
575        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
576        0,     0,     0,     0,     0,     0,     0,     0,    64,    54,
577       74,    68,     0,     0,    15,     0,    20,     0,    91,     0,
578        0,     0,    38,     0,     0,    44,     0,     0,     0,    71,
579       68,     0,     0,     0,     0,     0,     0,    12,     5,    10,
580       16,     0,    18,     0,    89,    38,     0,     0,     0,     0,
581       34,    31,    30,     0,     0,     0,     0,    34,    53,    58,
582        0,     0,     0,     0,    66,    38,    63,     0,    38,    70,
583       72,     0,    13,    15,    14,     0,     0,    93,    39,    41,
584        0,     0,     0,     0,     0,    38,    47,    68,    43,    52,
585       38,     0,     0,     0,    67,    56,    38,     0,     0,    65,
586        0,    69,     0,    17,    19,    96,     0,     0,    32,    33,
587       38,    37,    68,     0,    29,    49,     0,     0,    46,    45,
588        0,    42,    38,    60,     0,    57,     0,     0,     0,     0,
589        0,    94,    93,    92,    36,    35,     0,     0,    82,     0,
590       79,    78,     0,    51,    59,     0,    55,     0,     0,     0,
591       11,    95,    75,    50,    38,    77,     0,     0,    62,    76,
592       40,     0,    83,     0,     0,    48,     0,    61,    84,    80,
593        0,    85,     0,     0,    86,     0,     0,    87,     0,     0,
594       88,    81
595 };
596 
597   /* YYPGOTO[NTERM-NUM].  */
598 static const yytype_int16 yypgoto[] =
599 {
600     -114,  -114,   -24,     4,   -85,   -33,  -114,    79,    73,  -114,
601       23,  -114,  -114,  -114,   -20,  -114,  -114,  -114,    12,    67,
602     -101,  -108,  -114,   167,   164,  -114,  -114,  -114,  -114,   105,
603     -114,  -114,   -81,   -67,  -114,  -114,  -114,  -114,   -34,  -114,
604     -114,  -114,   -95,   107,  -114,  -114,  -114,  -114,  -113,  -114,
605     -114,  -114,  -114,  -114,  -114,  -114,  -114,  -114,  -114,  -114,
606     -114,  -114,  -114,  -114,   -21,  -114
607 };
608 
609   /* YYDEFGOTO[NTERM-NUM].  */
610 static const yytype_int16 yydefgoto[] =
611 {
612       -1,     8,    19,    20,   109,   110,    49,   119,    83,    50,
613      111,    51,    52,    87,     9,    10,    11,   120,   121,   152,
614      118,   138,    71,    12,    38,   125,    95,   186,   224,    74,
615      160,   127,    78,    79,   166,    13,   163,   192,   134,    14,
616      103,    41,   105,   100,    15,    43,    81,   182,   135,   157,
617      209,   210,   211,   212,   233,   239,   242,   245,   248,   251,
618       16,    53,    89,    17,   177,    55
619 };
620 
621   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
622      positive, shift that token.  If negative, reduce the rule whose
623      number is the opposite.  If YYTABLE_NINF, syntax error.  */
624 static const yytype_uint8 yytable[] =
625 {
626      112,    48,    91,   147,   114,   130,    21,    22,    23,    24,
627       25,    26,   122,    42,   146,   132,   155,   129,   136,   133,
628      140,    64,    65,    66,    77,   137,   144,    18,    27,   132,
629      128,    84,    85,   149,   169,   106,    28,   171,   183,   137,
630      158,    57,    80,   180,    60,   164,   132,    88,    63,   194,
631       29,   154,    30,   132,   188,    31,   137,   133,    68,   190,
632      174,   175,   189,   202,    32,   196,    33,   184,    34,   179,
633      139,    35,     2,    40,    92,    37,   191,    96,   195,   204,
634      145,   101,    54,   148,    56,    58,    59,   205,    61,    62,
635      156,   214,   203,   222,    44,    45,    46,    47,   123,    67,
636       69,    70,   227,    72,    73,   213,    76,    77,    82,    86,
637      141,   216,    90,    94,    93,   220,    97,   181,    98,   102,
638      104,   237,    99,   231,   225,   106,   108,   218,   193,   113,
639      187,   116,   228,   229,   230,   117,   167,   168,     1,   124,
640        2,   170,   201,   126,   131,     3,   235,     4,   143,     5,
641      132,   133,     6,     7,   150,   151,   153,   159,   162,   172,
642      165,   107,   178,   185,    75,   176,   173,   200,   197,   198,
643      199,   208,   206,   207,   215,   217,   219,   226,   223,   232,
644      142,   221,   238,     0,   234,   236,   241,   240,   243,   244,
645      247,   246,   249,   250,   161,    39,    36,   115
646 };
647 
648 static const yytype_int16 yycheck[] =
649 {
650       85,    34,    69,   116,    89,   100,     2,     3,     4,     5,
651        6,     7,    93,    33,   115,    15,   124,    98,   103,    19,
652      105,    45,    46,    47,    13,    25,   111,    29,     0,    15,
653       97,    64,    65,   118,   135,    24,    26,   138,   151,    25,
654      125,    37,    62,   151,    40,   130,    15,    67,    44,   162,
655       31,    20,    31,    15,   155,    31,    25,    19,    54,   160,
656      145,   146,   157,   176,    31,   166,    31,   152,    31,   150,
657      104,    31,     9,    17,    70,    10,   161,    73,   163,   180,
658      113,    77,    23,   117,    31,    31,    31,   182,    31,    31,
659      124,   192,   177,   206,     3,     4,     5,     6,    94,    31,
660       31,     8,   215,    31,    12,   190,    31,    13,    31,    27,
661      106,   196,    31,    11,    31,   200,    31,   151,    31,    31,
662       31,   234,    27,   224,   209,    24,    30,    28,   162,    31,
663      154,    31,   217,   218,   219,    31,   132,   133,     7,    31,
664        9,   137,   176,    31,    31,    14,   231,    16,    31,    18,
665       15,    19,    21,    22,    31,    31,    31,    27,    31,    31,
666       27,    82,   150,    27,    59,    31,   143,    27,    31,    31,
667       31,    27,    31,    31,    31,    26,    26,    31,    27,    27,
668      107,   202,    27,    -1,    31,    31,    27,    31,    31,    27,
669       27,    31,    31,    27,   127,    31,    29,    90
670 };
671 
672   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
673      symbol of state STATE-NUM.  */
674 static const yytype_uint8 yystos[] =
675 {
676        0,     7,     9,    14,    16,    18,    21,    22,    33,    46,
677       47,    48,    55,    67,    71,    76,    92,    95,    29,    34,
678       35,    35,    35,    35,    35,    35,    35,     0,    26,    31,
679       31,    31,    31,    31,    31,    31,    55,    10,    56,    56,
680       17,    73,    46,    77,     3,     4,     5,     6,    37,    38,
681       41,    43,    44,    93,    23,    97,    31,    35,    31,    31,
682       35,    31,    31,    35,    34,    34,    34,    31,    35,    31,
683        8,    54,    31,    12,    61,    61,    31,    13,    64,    65,
684       46,    78,    31,    40,    37,    37,    27,    45,    46,    94,
685       31,    65,    35,    31,    11,    58,    35,    31,    31,    27,
686       75,    35,    31,    72,    31,    74,    24,    39,    30,    36,
687       37,    42,    36,    31,    36,    75,    31,    31,    52,    39,
688       49,    50,    64,    35,    31,    57,    31,    63,    65,    64,
689       74,    31,    15,    19,    70,    80,    36,    25,    53,    70,
690       36,    35,    40,    31,    36,    37,    52,    80,    70,    36,
691       31,    31,    51,    31,    20,    53,    70,    81,    36,    27,
692       62,    51,    31,    68,    36,    27,    66,    35,    35,    52,
693       35,    52,    31,    42,    36,    36,    31,    96,    50,    64,
694       53,    70,    79,    80,    36,    27,    59,    34,    52,    74,
695       52,    36,    69,    70,    80,    36,    52,    31,    31,    31,
696       27,    70,    80,    36,    52,    74,    31,    31,    27,    82,
697       83,    84,    85,    36,    52,    31,    36,    26,    28,    26,
698       36,    96,    80,    27,    60,    36,    31,    80,    36,    36,
699       36,    52,    27,    86,    31,    36,    31,    80,    27,    87,
700       31,    27,    88,    31,    27,    89,    31,    27,    90,    31,
701       27,    91
702 };
703 
704   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
705 static const yytype_uint8 yyr1[] =
706 {
707        0,    32,    33,    34,    35,    36,    37,    37,    37,    37,
708       38,    39,    40,    40,    41,    42,    42,    42,    43,    44,
709       45,    46,    46,    46,    46,    46,    46,    47,    47,    48,
710       49,    49,    50,    50,    51,    51,    51,    51,    52,    52,
711       53,    54,    55,    56,    57,    57,    57,    57,    58,    59,
712       60,    61,    62,    63,    64,    65,    66,    67,    68,    68,
713       68,    69,    70,    71,    72,    72,    72,    73,    74,    74,
714       74,    75,    76,    77,    78,    79,    80,    81,    82,    82,
715       83,    84,    85,    86,    87,    88,    89,    90,    91,    92,
716       93,    94,    95,    96,    96,    96,    97
717 };
718 
719   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
720 static const yytype_uint8 yyr2[] =
721 {
722        0,     2,     1,     1,     2,     1,     1,     1,     1,     1,
723        4,     5,     2,     3,     5,     0,     1,     3,     4,     6,
724        1,     1,     1,     1,     1,     1,     1,     1,     1,    10,
725        1,     1,     3,     3,     0,     3,     3,     2,     0,     2,
726        5,     4,    10,     6,     0,     3,     3,     2,     8,     1,
727        1,     6,     1,     1,     1,     6,     1,    10,     0,     3,
728        2,     5,     5,     8,     0,     3,     2,     6,     0,     3,
729        2,     1,     8,     1,     1,     3,     5,     4,     1,     1,
730        5,    13,     1,     1,     1,     1,     1,     1,     1,     7,
731        1,     1,    10,     0,     2,     3,     6
732 };
733 
734 
735 #define yyerrok         (yyerrstatus = 0)
736 #define yyclearin       (yychar = YYEMPTY)
737 #define YYEMPTY         (-2)
738 #define YYEOF           0
739 
740 #define YYACCEPT        goto yyacceptlab
741 #define YYABORT         goto yyabortlab
742 #define YYERROR         goto yyerrorlab
743 
744 
745 #define YYRECOVERING()  (!!yyerrstatus)
746 
747 #define YYBACKUP(Token, Value)                                  \
748 do                                                              \
749   if (yychar == YYEMPTY)                                        \
750     {                                                           \
751       yychar = (Token);                                         \
752       yylval = (Value);                                         \
753       YYPOPSTACK (yylen);                                       \
754       yystate = *yyssp;                                         \
755       goto yybackup;                                            \
756     }                                                           \
757   else                                                          \
758     {                                                           \
759       yyerror (context, YY_("syntax error: cannot back up")); \
760       YYERROR;                                                  \
761     }                                                           \
762 while (0)
763 
764 /* Error token number */
765 #define YYTERROR        1
766 #define YYERRCODE       256
767 
768 
769 
770 /* Enable debugging if requested.  */
771 #if YYDEBUG
772 
773 # ifndef YYFPRINTF
774 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
775 #  define YYFPRINTF fprintf
776 # endif
777 
778 # define YYDPRINTF(Args)                        \
779 do {                                            \
780   if (yydebug)                                  \
781     YYFPRINTF Args;                             \
782 } while (0)
783 
784 /* This macro is provided for backward compatibility. */
785 #ifndef YY_LOCATION_PRINT
786 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
787 #endif
788 
789 
790 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
791 do {                                                                      \
792   if (yydebug)                                                            \
793     {                                                                     \
794       YYFPRINTF (stderr, "%s ", Title);                                   \
795       yy_symbol_print (stderr,                                            \
796                   Type, Value, context); \
797       YYFPRINTF (stderr, "\n");                                           \
798     }                                                                     \
799 } while (0)
800 
801 
802 /*----------------------------------------.
803 | Print this symbol's value on YYOUTPUT.  |
804 `----------------------------------------*/
805 
806 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep,osr_cs_wkt_parse_context * context)807 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, osr_cs_wkt_parse_context *context)
808 {
809   FILE *yyo = yyoutput;
810   YYUSE (yyo);
811   YYUSE (context);
812   if (!yyvaluep)
813     return;
814 # ifdef YYPRINT
815   if (yytype < YYNTOKENS)
816     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
817 # endif
818   YYUSE (yytype);
819 }
820 
821 
822 /*--------------------------------.
823 | Print this symbol on YYOUTPUT.  |
824 `--------------------------------*/
825 
826 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep,osr_cs_wkt_parse_context * context)827 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, osr_cs_wkt_parse_context *context)
828 {
829   YYFPRINTF (yyoutput, "%s %s (",
830              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
831 
832   yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
833   YYFPRINTF (yyoutput, ")");
834 }
835 
836 /*------------------------------------------------------------------.
837 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
838 | TOP (included).                                                   |
839 `------------------------------------------------------------------*/
840 
841 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)842 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
843 {
844   YYFPRINTF (stderr, "Stack now");
845   for (; yybottom <= yytop; yybottom++)
846     {
847       int yybot = *yybottom;
848       YYFPRINTF (stderr, " %d", yybot);
849     }
850   YYFPRINTF (stderr, "\n");
851 }
852 
853 # define YY_STACK_PRINT(Bottom, Top)                            \
854 do {                                                            \
855   if (yydebug)                                                  \
856     yy_stack_print ((Bottom), (Top));                           \
857 } while (0)
858 
859 
860 /*------------------------------------------------.
861 | Report that the YYRULE is going to be reduced.  |
862 `------------------------------------------------*/
863 
864 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule,osr_cs_wkt_parse_context * context)865 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, osr_cs_wkt_parse_context *context)
866 {
867   unsigned long int yylno = yyrline[yyrule];
868   int yynrhs = yyr2[yyrule];
869   int yyi;
870   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
871              yyrule - 1, yylno);
872   /* The symbols being reduced.  */
873   for (yyi = 0; yyi < yynrhs; yyi++)
874     {
875       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
876       yy_symbol_print (stderr,
877                        yystos[yyssp[yyi + 1 - yynrhs]],
878                        &(yyvsp[(yyi + 1) - (yynrhs)])
879                                               , context);
880       YYFPRINTF (stderr, "\n");
881     }
882 }
883 
884 # define YY_REDUCE_PRINT(Rule)          \
885 do {                                    \
886   if (yydebug)                          \
887     yy_reduce_print (yyssp, yyvsp, Rule, context); \
888 } while (0)
889 
890 /* Nonzero means print parse trace.  It is left uninitialized so that
891    multiple parsers can coexist.  */
892 int yydebug;
893 #else /* !YYDEBUG */
894 # define YYDPRINTF(Args)
895 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
896 # define YY_STACK_PRINT(Bottom, Top)
897 # define YY_REDUCE_PRINT(Rule)
898 #endif /* !YYDEBUG */
899 
900 
901 /* YYINITDEPTH -- initial size of the parser's stacks.  */
902 #ifndef YYINITDEPTH
903 # define YYINITDEPTH 200
904 #endif
905 
906 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
907    if the built-in stack extension method is used).
908 
909    Do not make this value too large; the results are undefined if
910    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
911    evaluated with infinite-precision integer arithmetic.  */
912 
913 #ifndef YYMAXDEPTH
914 # define YYMAXDEPTH 10000
915 #endif
916 
917 
918 #if YYERROR_VERBOSE
919 
920 # ifndef yystrlen
921 #  if defined __GLIBC__ && defined _STRING_H
922 #   define yystrlen strlen
923 #  else
924 /* Return the length of YYSTR.  */
925 static YYSIZE_T
yystrlen(const char * yystr)926 yystrlen (const char *yystr)
927 {
928   YYSIZE_T yylen;
929   for (yylen = 0; yystr[yylen]; yylen++)
930     continue;
931   return yylen;
932 }
933 #  endif
934 # endif
935 
936 # ifndef yystpcpy
937 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
938 #   define yystpcpy stpcpy
939 #  else
940 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
941    YYDEST.  */
942 static char *
yystpcpy(char * yydest,const char * yysrc)943 yystpcpy (char *yydest, const char *yysrc)
944 {
945   char *yyd = yydest;
946   const char *yys = yysrc;
947 
948   while ((*yyd++ = *yys++) != '\0')
949     continue;
950 
951   return yyd - 1;
952 }
953 #  endif
954 # endif
955 
956 # ifndef yytnamerr
957 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
958    quotes and backslashes, so that it's suitable for yyerror.  The
959    heuristic is that double-quoting is unnecessary unless the string
960    contains an apostrophe, a comma, or backslash (other than
961    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
962    null, do not copy; instead, return the length of what the result
963    would have been.  */
964 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)965 yytnamerr (char *yyres, const char *yystr)
966 {
967   if (*yystr == '"')
968     {
969       YYSIZE_T yyn = 0;
970       char const *yyp = yystr;
971 
972       for (;;)
973         switch (*++yyp)
974           {
975           case '\'':
976           case ',':
977             goto do_not_strip_quotes;
978 
979           case '\\':
980             if (*++yyp != '\\')
981               goto do_not_strip_quotes;
982             /* Fall through.  */
983           default:
984             if (yyres)
985               yyres[yyn] = *yyp;
986             yyn++;
987             break;
988 
989           case '"':
990             if (yyres)
991               yyres[yyn] = '\0';
992             return yyn;
993           }
994     do_not_strip_quotes: ;
995     }
996 
997   if (! yyres)
998     return yystrlen (yystr);
999 
1000   return yystpcpy (yyres, yystr) - yyres;
1001 }
1002 # endif
1003 
1004 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1005    about the unexpected token YYTOKEN for the state stack whose top is
1006    YYSSP.
1007 
1008    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
1009    not large enough to hold the message.  In that case, also set
1010    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
1011    required number of bytes is too large to store.  */
1012 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)1013 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1014                 yytype_int16 *yyssp, int yytoken)
1015 {
1016   YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
1017   YYSIZE_T yysize = yysize0;
1018   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1019   /* Internationalized format string. */
1020   const char *yyformat = YY_NULL;
1021   /* Arguments of yyformat. */
1022   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1023   /* Number of reported tokens (one for the "unexpected", one per
1024      "expected"). */
1025   int yycount = 0;
1026 
1027   /* There are many possibilities here to consider:
1028      - If this state is a consistent state with a default action, then
1029        the only way this function was invoked is if the default action
1030        is an error action.  In that case, don't check for expected
1031        tokens because there are none.
1032      - The only way there can be no lookahead present (in yychar) is if
1033        this state is a consistent state with a default action.  Thus,
1034        detecting the absence of a lookahead is sufficient to determine
1035        that there is no unexpected or expected token to report.  In that
1036        case, just report a simple "syntax error".
1037      - Don't assume there isn't a lookahead just because this state is a
1038        consistent state with a default action.  There might have been a
1039        previous inconsistent state, consistent state with a non-default
1040        action, or user semantic action that manipulated yychar.
1041      - Of course, the expected token list depends on states to have
1042        correct lookahead information, and it depends on the parser not
1043        to perform extra reductions after fetching a lookahead from the
1044        scanner and before detecting a syntax error.  Thus, state merging
1045        (from LALR or IELR) and default reductions corrupt the expected
1046        token list.  However, the list is correct for canonical LR with
1047        one exception: it will still contain any token that will not be
1048        accepted due to an error action in a later state.
1049   */
1050   if (yytoken != YYEMPTY)
1051     {
1052       int yyn = yypact[*yyssp];
1053       yyarg[yycount++] = yytname[yytoken];
1054       if (!yypact_value_is_default (yyn))
1055         {
1056           /* Start YYX at -YYN if negative to avoid negative indexes in
1057              YYCHECK.  In other words, skip the first -YYN actions for
1058              this state because they are default actions.  */
1059           int yyxbegin = yyn < 0 ? -yyn : 0;
1060           /* Stay within bounds of both yycheck and yytname.  */
1061           int yychecklim = YYLAST - yyn + 1;
1062           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1063           int yyx;
1064 
1065           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1066             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1067                 && !yytable_value_is_error (yytable[yyx + yyn]))
1068               {
1069                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1070                   {
1071                     yycount = 1;
1072                     yysize = yysize0;
1073                     break;
1074                   }
1075                 yyarg[yycount++] = yytname[yyx];
1076                 {
1077                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
1078                   if (! (yysize <= yysize1
1079                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1080                     return 2;
1081                   yysize = yysize1;
1082                 }
1083               }
1084         }
1085     }
1086 
1087   switch (yycount)
1088     {
1089 # define YYCASE_(N, S)                      \
1090       case N:                               \
1091         yyformat = S;                       \
1092       break
1093       YYCASE_(0, YY_("syntax error"));
1094       YYCASE_(1, YY_("syntax error, unexpected %s"));
1095       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1096       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1097       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1098       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1099 # undef YYCASE_
1100     }
1101 
1102   {
1103     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1104     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1105       return 2;
1106     yysize = yysize1;
1107   }
1108 
1109   if (*yymsg_alloc < yysize)
1110     {
1111       *yymsg_alloc = 2 * yysize;
1112       if (! (yysize <= *yymsg_alloc
1113              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1114         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1115       return 1;
1116     }
1117 
1118   /* Avoid sprintf, as that infringes on the user's name space.
1119      Don't have undefined behavior even if the translation
1120      produced a string with the wrong number of "%s"s.  */
1121   {
1122     char *yyp = *yymsg;
1123     int yyi = 0;
1124     while ((*yyp = *yyformat) != '\0')
1125       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1126         {
1127           yyp += yytnamerr (yyp, yyarg[yyi++]);
1128           yyformat += 2;
1129         }
1130       else
1131         {
1132           yyp++;
1133           yyformat++;
1134         }
1135   }
1136   return 0;
1137 }
1138 #endif /* YYERROR_VERBOSE */
1139 
1140 /*-----------------------------------------------.
1141 | Release the memory associated to this symbol.  |
1142 `-----------------------------------------------*/
1143 
1144 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep,osr_cs_wkt_parse_context * context)1145 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, osr_cs_wkt_parse_context *context)
1146 {
1147   YYUSE (yyvaluep);
1148   YYUSE (context);
1149   if (!yymsg)
1150     yymsg = "Deleting";
1151   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1152 
1153   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1154   YYUSE (yytype);
1155   YY_IGNORE_MAYBE_UNINITIALIZED_END
1156 }
1157 
1158 
1159 
1160 
1161 /*----------.
1162 | yyparse.  |
1163 `----------*/
1164 
1165 int
yyparse(osr_cs_wkt_parse_context * context)1166 yyparse (osr_cs_wkt_parse_context *context)
1167 {
1168 /* The lookahead symbol.  */
1169 int yychar;
1170 
1171 
1172 /* The semantic value of the lookahead symbol.  */
1173 /* Default value used for initialization, for pacifying older GCCs
1174    or non-GCC compilers.  */
1175 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1176 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1177 
1178     /* Number of syntax errors so far.  */
1179     int yynerrs;
1180 
1181     int yystate;
1182     /* Number of tokens to shift before error messages enabled.  */
1183     int yyerrstatus;
1184 
1185     /* The stacks and their tools:
1186        'yyss': related to states.
1187        'yyvs': related to semantic values.
1188 
1189        Refer to the stacks through separate pointers, to allow yyoverflow
1190        to reallocate them elsewhere.  */
1191 
1192     /* The state stack.  */
1193     yytype_int16 yyssa[YYINITDEPTH];
1194     yytype_int16 *yyss;
1195     yytype_int16 *yyssp;
1196 
1197     /* The semantic value stack.  */
1198     YYSTYPE yyvsa[YYINITDEPTH];
1199     YYSTYPE *yyvs;
1200     YYSTYPE *yyvsp;
1201 
1202     YYSIZE_T yystacksize;
1203 
1204   int yyn;
1205   int yyresult;
1206   /* Lookahead token as an internal (translated) token number.  */
1207   int yytoken = 0;
1208   /* The variables used to return semantic value and location from the
1209      action routines.  */
1210   YYSTYPE yyval;
1211 
1212 #if YYERROR_VERBOSE
1213   /* Buffer for error messages, and its allocated size.  */
1214   char yymsgbuf[128];
1215   char *yymsg = yymsgbuf;
1216   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1217 #endif
1218 
1219 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1220 
1221   /* The number of symbols on the RHS of the reduced rule.
1222      Keep to zero when no symbol should be popped.  */
1223   int yylen = 0;
1224 
1225   yyssp = yyss = yyssa;
1226   yyvsp = yyvs = yyvsa;
1227   yystacksize = YYINITDEPTH;
1228 
1229   YYDPRINTF ((stderr, "Starting parse\n"));
1230 
1231   yystate = 0;
1232   yyerrstatus = 0;
1233   yynerrs = 0;
1234   yychar = YYEMPTY; /* Cause a token to be read.  */
1235   goto yysetstate;
1236 
1237 /*------------------------------------------------------------.
1238 | yynewstate -- Push a new state, which is found in yystate.  |
1239 `------------------------------------------------------------*/
1240  yynewstate:
1241   /* In all cases, when you get here, the value and location stacks
1242      have just been pushed.  So pushing a state here evens the stacks.  */
1243   yyssp++;
1244 
1245  yysetstate:
1246   *yyssp = yystate;
1247 
1248   if (yyss + yystacksize - 1 <= yyssp)
1249     {
1250       /* Get the current used size of the three stacks, in elements.  */
1251       YYSIZE_T yysize = yyssp - yyss + 1;
1252 
1253 #ifdef yyoverflow
1254       {
1255         /* Give user a chance to reallocate the stack.  Use copies of
1256            these so that the &'s don't force the real ones into
1257            memory.  */
1258         YYSTYPE *yyvs1 = yyvs;
1259         yytype_int16 *yyss1 = yyss;
1260 
1261         /* Each stack pointer address is followed by the size of the
1262            data in use in that stack, in bytes.  This used to be a
1263            conditional around just the two extra args, but that might
1264            be undefined if yyoverflow is a macro.  */
1265         yyoverflow (YY_("memory exhausted"),
1266                     &yyss1, yysize * sizeof (*yyssp),
1267                     &yyvs1, yysize * sizeof (*yyvsp),
1268                     &yystacksize);
1269 
1270         yyss = yyss1;
1271         yyvs = yyvs1;
1272       }
1273 #else /* no yyoverflow */
1274 # ifndef YYSTACK_RELOCATE
1275       goto yyexhaustedlab;
1276 # else
1277       /* Extend the stack our own way.  */
1278       if (YYMAXDEPTH <= yystacksize)
1279         goto yyexhaustedlab;
1280       yystacksize *= 2;
1281       if (YYMAXDEPTH < yystacksize)
1282         yystacksize = YYMAXDEPTH;
1283 
1284       {
1285         yytype_int16 *yyss1 = yyss;
1286         union yyalloc *yyptr =
1287           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1288         if (! yyptr)
1289           goto yyexhaustedlab;
1290         YYSTACK_RELOCATE (yyss_alloc, yyss);
1291         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1292 #  undef YYSTACK_RELOCATE
1293         if (yyss1 != yyssa)
1294           YYSTACK_FREE (yyss1);
1295       }
1296 # endif
1297 #endif /* no yyoverflow */
1298 
1299       yyssp = yyss + yysize - 1;
1300       yyvsp = yyvs + yysize - 1;
1301 
1302       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1303                   (unsigned long int) yystacksize));
1304 
1305       if (yyss + yystacksize - 1 <= yyssp)
1306         YYABORT;
1307     }
1308 
1309   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1310 
1311   if (yystate == YYFINAL)
1312     YYACCEPT;
1313 
1314   goto yybackup;
1315 
1316 /*-----------.
1317 | yybackup.  |
1318 `-----------*/
1319 yybackup:
1320 
1321   /* Do appropriate processing given the current state.  Read a
1322      lookahead token if we need one and don't already have one.  */
1323 
1324   /* First try to decide what to do without reference to lookahead token.  */
1325   yyn = yypact[yystate];
1326   if (yypact_value_is_default (yyn))
1327     goto yydefault;
1328 
1329   /* Not known => get a lookahead token if don't already have one.  */
1330 
1331   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1332   if (yychar == YYEMPTY)
1333     {
1334       YYDPRINTF ((stderr, "Reading a token: "));
1335       yychar = yylex (&yylval, context);
1336     }
1337 
1338   if (yychar <= YYEOF)
1339     {
1340       yychar = yytoken = YYEOF;
1341       YYDPRINTF ((stderr, "Now at end of input.\n"));
1342     }
1343   else
1344     {
1345       yytoken = YYTRANSLATE (yychar);
1346       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1347     }
1348 
1349   /* If the proper action on seeing token YYTOKEN is to reduce or to
1350      detect an error, take that action.  */
1351   yyn += yytoken;
1352   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1353     goto yydefault;
1354   yyn = yytable[yyn];
1355   if (yyn <= 0)
1356     {
1357       if (yytable_value_is_error (yyn))
1358         goto yyerrlab;
1359       yyn = -yyn;
1360       goto yyreduce;
1361     }
1362 
1363   /* Count tokens shifted since error; after three, turn off error
1364      status.  */
1365   if (yyerrstatus)
1366     yyerrstatus--;
1367 
1368   /* Shift the lookahead token.  */
1369   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1370 
1371   /* Discard the shifted token.  */
1372   yychar = YYEMPTY;
1373 
1374   yystate = yyn;
1375   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1376   *++yyvsp = yylval;
1377   YY_IGNORE_MAYBE_UNINITIALIZED_END
1378 
1379   goto yynewstate;
1380 
1381 
1382 /*-----------------------------------------------------------.
1383 | yydefault -- do the default action for the current state.  |
1384 `-----------------------------------------------------------*/
1385 yydefault:
1386   yyn = yydefact[yystate];
1387   if (yyn == 0)
1388     goto yyerrlab;
1389   goto yyreduce;
1390 
1391 
1392 /*-----------------------------.
1393 | yyreduce -- Do a reduction.  |
1394 `-----------------------------*/
1395 yyreduce:
1396   /* yyn is the number of a rule to reduce with.  */
1397   yylen = yyr2[yyn];
1398 
1399   /* If YYLEN is nonzero, implement the default value of the action:
1400      '$$ = $1'.
1401 
1402      Otherwise, the following line sets YYVAL to garbage.
1403      This behavior is undocumented and Bison
1404      users should not rely upon it.  Assigning to YYVAL
1405      unconditionally makes the parser a bit smaller, and it avoids a
1406      GCC warning that YYVAL may be used uninitialized.  */
1407   yyval = yyvsp[1-yylen];
1408 
1409 
1410   YY_REDUCE_PRINT (yyn);
1411   switch (yyn)
1412     {
1413 
1414 
1415       default: break;
1416     }
1417   /* User semantic actions sometimes alter yychar, and that requires
1418      that yytoken be updated with the new translation.  We take the
1419      approach of translating immediately before every use of yytoken.
1420      One alternative is translating here after every semantic action,
1421      but that translation would be missed if the semantic action invokes
1422      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1423      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1424      incorrect destructor might then be invoked immediately.  In the
1425      case of YYERROR or YYBACKUP, subsequent parser actions might lead
1426      to an incorrect destructor call or verbose syntax error message
1427      before the lookahead is translated.  */
1428   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1429 
1430   YYPOPSTACK (yylen);
1431   yylen = 0;
1432   YY_STACK_PRINT (yyss, yyssp);
1433 
1434   *++yyvsp = yyval;
1435 
1436   /* Now 'shift' the result of the reduction.  Determine what state
1437      that goes to, based on the state we popped back to and the rule
1438      number reduced by.  */
1439 
1440   yyn = yyr1[yyn];
1441 
1442   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1443   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1444     yystate = yytable[yystate];
1445   else
1446     yystate = yydefgoto[yyn - YYNTOKENS];
1447 
1448   goto yynewstate;
1449 
1450 
1451 /*--------------------------------------.
1452 | yyerrlab -- here on detecting error.  |
1453 `--------------------------------------*/
1454 yyerrlab:
1455   /* Make sure we have latest lookahead translation.  See comments at
1456      user semantic actions for why this is necessary.  */
1457   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1458 
1459   /* If not already recovering from an error, report this error.  */
1460   if (!yyerrstatus)
1461     {
1462       ++yynerrs;
1463 #if ! YYERROR_VERBOSE
1464       yyerror (context, YY_("syntax error"));
1465 #else
1466 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1467                                         yyssp, yytoken)
1468       {
1469         char const *yymsgp = YY_("syntax error");
1470         int yysyntax_error_status;
1471         yysyntax_error_status = YYSYNTAX_ERROR;
1472         if (yysyntax_error_status == 0)
1473           yymsgp = yymsg;
1474         else if (yysyntax_error_status == 1)
1475           {
1476             if (yymsg != yymsgbuf)
1477               YYSTACK_FREE (yymsg);
1478             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1479             if (!yymsg)
1480               {
1481                 yymsg = yymsgbuf;
1482                 yymsg_alloc = sizeof yymsgbuf;
1483                 yysyntax_error_status = 2;
1484               }
1485             else
1486               {
1487                 yysyntax_error_status = YYSYNTAX_ERROR;
1488                 yymsgp = yymsg;
1489               }
1490           }
1491         yyerror (context, yymsgp);
1492         if (yysyntax_error_status == 2)
1493           goto yyexhaustedlab;
1494       }
1495 # undef YYSYNTAX_ERROR
1496 #endif
1497     }
1498 
1499 
1500 
1501   if (yyerrstatus == 3)
1502     {
1503       /* If just tried and failed to reuse lookahead token after an
1504          error, discard it.  */
1505 
1506       if (yychar <= YYEOF)
1507         {
1508           /* Return failure if at end of input.  */
1509           if (yychar == YYEOF)
1510             YYABORT;
1511         }
1512       else
1513         {
1514           yydestruct ("Error: discarding",
1515                       yytoken, &yylval, context);
1516           yychar = YYEMPTY;
1517         }
1518     }
1519 
1520   /* Else will try to reuse lookahead token after shifting the error
1521      token.  */
1522   goto yyerrlab1;
1523 
1524 
1525 /*---------------------------------------------------.
1526 | yyerrorlab -- error raised explicitly by YYERROR.  |
1527 `---------------------------------------------------*/
1528 yyerrorlab:
1529 
1530   /* Pacify compilers like GCC when the user code never invokes
1531      YYERROR and the label yyerrorlab therefore never appears in user
1532      code.  */
1533   if (/*CONSTCOND*/ 0)
1534      goto yyerrorlab;
1535 
1536   /* Do not reclaim the symbols of the rule whose action triggered
1537      this YYERROR.  */
1538   YYPOPSTACK (yylen);
1539   yylen = 0;
1540   YY_STACK_PRINT (yyss, yyssp);
1541   yystate = *yyssp;
1542   goto yyerrlab1;
1543 
1544 
1545 /*-------------------------------------------------------------.
1546 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1547 `-------------------------------------------------------------*/
1548 yyerrlab1:
1549   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1550 
1551   for (;;)
1552     {
1553       yyn = yypact[yystate];
1554       if (!yypact_value_is_default (yyn))
1555         {
1556           yyn += YYTERROR;
1557           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1558             {
1559               yyn = yytable[yyn];
1560               if (0 < yyn)
1561                 break;
1562             }
1563         }
1564 
1565       /* Pop the current state because it cannot handle the error token.  */
1566       if (yyssp == yyss)
1567         YYABORT;
1568 
1569 
1570       yydestruct ("Error: popping",
1571                   yystos[yystate], yyvsp, context);
1572       YYPOPSTACK (1);
1573       yystate = *yyssp;
1574       YY_STACK_PRINT (yyss, yyssp);
1575     }
1576 
1577   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1578   *++yyvsp = yylval;
1579   YY_IGNORE_MAYBE_UNINITIALIZED_END
1580 
1581 
1582   /* Shift the error token.  */
1583   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1584 
1585   yystate = yyn;
1586   goto yynewstate;
1587 
1588 
1589 /*-------------------------------------.
1590 | yyacceptlab -- YYACCEPT comes here.  |
1591 `-------------------------------------*/
1592 yyacceptlab:
1593   yyresult = 0;
1594   goto yyreturn;
1595 
1596 /*-----------------------------------.
1597 | yyabortlab -- YYABORT comes here.  |
1598 `-----------------------------------*/
1599 yyabortlab:
1600   yyresult = 1;
1601   goto yyreturn;
1602 
1603 #if !defined yyoverflow || YYERROR_VERBOSE
1604 /*-------------------------------------------------.
1605 | yyexhaustedlab -- memory exhaustion comes here.  |
1606 `-------------------------------------------------*/
1607 yyexhaustedlab:
1608   yyerror (context, YY_("memory exhausted"));
1609   yyresult = 2;
1610   /* Fall through.  */
1611 #endif
1612 
1613 yyreturn:
1614   if (yychar != YYEMPTY)
1615     {
1616       /* Make sure we have latest lookahead translation.  See comments at
1617          user semantic actions for why this is necessary.  */
1618       yytoken = YYTRANSLATE (yychar);
1619       yydestruct ("Cleanup: discarding lookahead",
1620                   yytoken, &yylval, context);
1621     }
1622   /* Do not reclaim the symbols of the rule whose action triggered
1623      this YYABORT or YYACCEPT.  */
1624   YYPOPSTACK (yylen);
1625   YY_STACK_PRINT (yyss, yyssp);
1626   while (yyssp != yyss)
1627     {
1628       yydestruct ("Cleanup: popping",
1629                   yystos[*yyssp], yyvsp, context);
1630       YYPOPSTACK (1);
1631     }
1632 #ifndef yyoverflow
1633   if (yyss != yyssa)
1634     YYSTACK_FREE (yyss);
1635 #endif
1636 #if YYERROR_VERBOSE
1637   if (yymsg != yymsgbuf)
1638     YYSTACK_FREE (yymsg);
1639 #endif
1640   return yyresult;
1641 }
1642