diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2018-12-17 19:30:34 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2018-12-17 20:01:05 +0100 |
| commit | 898b8595276779cd8613e0c4b267181a76acecab (patch) | |
| tree | ff1bfd55bd1919ca28ffb335470d0f901d0de09c /src | |
| parent | dcb58eb624f87fad1362bfc593b274f84fa44889 (diff) | |
| download | PROJ-898b8595276779cd8613e0c4b267181a76acecab.tar.gz PROJ-898b8595276779cd8613e0c4b267181a76acecab.zip | |
Add WKT2 grammar validation
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.am | 12 | ||||
| -rw-r--r-- | src/io.cpp | 13 | ||||
| -rw-r--r-- | src/lib_proj.cmake | 3 | ||||
| -rw-r--r-- | src/pj_wkt1_parser.cpp | 48 | ||||
| -rw-r--r-- | src/pj_wkt2_generated_parser.c | 3094 | ||||
| -rw-r--r-- | src/pj_wkt2_generated_parser.h | 208 | ||||
| -rw-r--r-- | src/pj_wkt2_grammar.y | 1499 | ||||
| -rw-r--r-- | src/pj_wkt2_parser.cpp | 221 | ||||
| -rw-r--r-- | src/pj_wkt2_parser.h | 54 | ||||
| -rw-r--r-- | src/pj_wkt_parser.cpp | 60 | ||||
| -rw-r--r-- | src/pj_wkt_parser.hpp | 50 | ||||
| -rw-r--r-- | src/static.cpp | 1 |
12 files changed, 5223 insertions, 40 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 9cf1eb88..02b30c7d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -16,7 +16,7 @@ include_HEADERS = proj.h proj_experimental.h proj_constants.h proj_api.h geodesi EXTRA_DIST = bin_cct.cmake bin_gie.cmake bin_cs2cs.cmake \ bin_geod.cmake bin_nad2bin.cmake bin_proj.cmake bin_projinfo.cmake \ lib_proj.cmake CMakeLists.txt bin_geodtest.cmake geodtest.c \ - pj_wkt1_grammar.y + pj_wkt1_grammar.y pj_wkt2_grammar.y proj_SOURCES = proj.c gen_cheb.c p_series.c projinfo_SOURCES = projinfo.cpp @@ -96,8 +96,11 @@ libproj_la_SOURCES = \ proj_4D_api.c PJ_cart.c PJ_pipeline.c PJ_horner.c PJ_helmert.c \ PJ_vgridshift.c PJ_hgridshift.c PJ_unitconvert.c PJ_molodensky.c \ PJ_deformation.c pj_internal.c PJ_axisswap.c PJ_affine.c \ + pj_wkt_parser.hpp pj_wkt_parser.cpp \ pj_wkt1_parser.h pj_wkt1_parser.cpp \ - pj_wkt1_generated_parser.h pj_wkt1_generated_parser.c + pj_wkt1_generated_parser.h pj_wkt1_generated_parser.c \ + pj_wkt2_parser.h pj_wkt2_parser.cpp \ + pj_wkt2_generated_parser.h pj_wkt2_generated_parser.c # The sed hack is to please MSVC @@ -106,6 +109,11 @@ wkt1_parser: sed "s/\*yyssp = yystate/\*yyssp = (yytype_int16)yystate/" < $(top_srcdir)/src/pj_wkt1_generated_parser.c | sed "s/yyerrorlab:/#if 0\nyyerrorlab:/" | sed "s/yyerrlab1:/#endif\nyyerrlab1:/" | sed "s/for (yylen = 0; yystr\[yylen\]; yylen++)/for (yylen = 0; yystr \&\& yystr\[yylen\]; yylen++)/" > $(top_srcdir)/src/pj_wkt1_generated_parser.c.tmp mv $(top_srcdir)/src/pj_wkt1_generated_parser.c.tmp $(top_srcdir)/src/pj_wkt1_generated_parser.c +wkt2_parser: + bison --no-lines -d -p pj_wkt2_ -o$(top_srcdir)/src/pj_wkt2_generated_parser.c $(top_srcdir)/src/pj_wkt2_grammar.y + sed "s/\*yyssp = yystate/\*yyssp = (yytype_int16)yystate/" < $(top_srcdir)/src/pj_wkt2_generated_parser.c | sed "s/yyerrorlab:/#if 0\nyyerrorlab:/" | sed "s/yyerrlab1:/#endif\nyyerrlab1:/" | sed "s/for (yylen = 0; yystr\[yylen\]; yylen++)/for (yylen = 0; yystr \&\& yystr\[yylen\]; yylen++)/" > $(top_srcdir)/src/pj_wkt2_generated_parser.c.tmp + mv $(top_srcdir)/src/pj_wkt2_generated_parser.c.tmp $(top_srcdir)/src/pj_wkt2_generated_parser.c + install-exec-local: rm -f $(DESTDIR)$(bindir)/invproj$(EXEEXT) @@ -61,6 +61,7 @@ #include "proj_constants.h" #include "pj_wkt1_parser.h" +#include "pj_wkt2_parser.h" // PROJ include order is sensitive // clang-format off @@ -1782,6 +1783,12 @@ UnitOfMeasure WKTParser::Private::buildUnitInSubNode(const WKTNodeNNPtr &node, return buildUnit(unitNode, UnitOfMeasure::Type::TIME); } } + { + auto &unitNode = nodeP->lookForChild(WKTConstants::TEMPORALQUANTITY); + if (!isNull(unitNode)) { + return buildUnit(unitNode, UnitOfMeasure::Type::TIME); + } + } { auto &unitNode = nodeP->lookForChild(WKTConstants::PARAMETRICUNIT); @@ -4366,6 +4373,12 @@ BaseObjectNNPtr WKTParser::createFromWKT(const std::string &wkt) { if (!errorMsg.empty()) { d->emitRecoverableAssertion(errorMsg); } + } else if (dialect == WKTGuessedDialect::WKT2_2015 || + dialect == WKTGuessedDialect::WKT2_2018) { + auto errorMsg = pj_wkt2_parse(wkt); + if (!errorMsg.empty()) { + d->emitRecoverableAssertion(errorMsg); + } } return obj; diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake index 9eb75c0b..4f29f4d5 100644 --- a/src/lib_proj.cmake +++ b/src/lib_proj.cmake @@ -245,6 +245,7 @@ SET(SRC_LIBPROJ_CORE vector1.c pj_strtod.c pj_wkt1_generated_parser.c + pj_wkt2_generated_parser.c ${CMAKE_CURRENT_BINARY_DIR}/proj_config.h ) @@ -261,7 +262,9 @@ set(SRC_LIBPROJ_CPP internal.cpp factory.cpp c_api.cpp + pj_wkt_parser.cpp pj_wkt1_parser.cpp + pj_wkt2_parser.cpp ) set(HEADERS_LIBPROJ diff --git a/src/pj_wkt1_parser.cpp b/src/pj_wkt1_parser.cpp index 7ddd595a..cdeb6b87 100644 --- a/src/pj_wkt1_parser.cpp +++ b/src/pj_wkt1_parser.cpp @@ -36,6 +36,7 @@ #include <string> #include "pj_wkt1_parser.h" +#include "pj_wkt_parser.hpp" using namespace NS_PROJ::internal; @@ -43,44 +44,12 @@ using namespace NS_PROJ::internal; // --------------------------------------------------------------------------- -struct pj_wkt1_parse_context { - const char *pszInput = nullptr; - const char *pszLastSuccess = nullptr; - const char *pszNext = nullptr; - std::string errorMsg{}; - - pj_wkt1_parse_context() = default; - pj_wkt1_parse_context(const pj_wkt1_parse_context &) = delete; - pj_wkt1_parse_context &operator=(const pj_wkt1_parse_context &) = delete; -}; +struct pj_wkt1_parse_context : public pj_wkt_parse_context {}; // --------------------------------------------------------------------------- void pj_wkt1_error(pj_wkt1_parse_context *context, const char *msg) { - context->errorMsg = "Parsing error : "; - context->errorMsg += msg; - context->errorMsg += ". Error occurred around:\n"; - - std::string ctxtMsg; - const int n = static_cast<int>(context->pszLastSuccess - context->pszInput); - int start_i = std::max(0, n - 40); - for (int i = start_i; i < n + 40 && context->pszInput[i]; i++) { - if (context->pszInput[i] == '\r' || context->pszInput[i] == '\n') { - if (i > n) { - break; - } else { - ctxtMsg.clear(); - start_i = i + 1; - } - } else { - ctxtMsg += context->pszInput[i]; - } - } - context->errorMsg += ctxtMsg; - context->errorMsg += '\n'; - for (int i = start_i; i < n; i++) - context->errorMsg += ' '; - context->errorMsg += '^'; + pj_wkt_error(context, msg); } // --------------------------------------------------------------------------- @@ -141,10 +110,13 @@ int pj_wkt1_lex(YYSTYPE * /*pNode */, pj_wkt1_parse_context *context) { /* -------------------------------------------------------------------- */ /* Recognize node names. */ /* -------------------------------------------------------------------- */ - for (i = 0; i < sizeof(tokens) / sizeof(tokens[0]); i++) { - if (ci_starts_with(pszInput, tokens[i].pszToken)) { - context->pszNext = pszInput + strlen(tokens[i].pszToken); - return tokens[i].nTokenVal; + if (isalpha(*pszInput)) { + for (i = 0; i < sizeof(tokens) / sizeof(tokens[0]); i++) { + if (ci_starts_with(pszInput, tokens[i].pszToken) && + !isalpha(pszInput[strlen(tokens[i].pszToken)])) { + context->pszNext = pszInput + strlen(tokens[i].pszToken); + return tokens[i].nTokenVal; + } } } diff --git a/src/pj_wkt2_generated_parser.c b/src/pj_wkt2_generated_parser.c new file mode 100644 index 00000000..e5085995 --- /dev/null +++ b/src/pj_wkt2_generated_parser.c @@ -0,0 +1,3094 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + +/* Substitute the variable and function names. */ +#define yyparse pj_wkt2_parse +#define yylex pj_wkt2_lex +#define yyerror pj_wkt2_error +#define yydebug pj_wkt2_debug +#define yynerrs pj_wkt2_nerrs + + +/* Copy the first part of user declarations. */ + + +/****************************************************************************** + * Project: PROJ + * Purpose: WKT2 parser grammar + * Author: Even Rouault, <even.rouault at spatialys.com> + * + ****************************************************************************** + * Copyright (c) 2018 Even Rouault, <even.rouault at spatialys.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + ****************************************************************************/ + +#include "pj_wkt2_parser.h" + + + + +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* In a future release of Bison, this section will be replaced + by #include "pj_wkt2_generated_parser.h". */ +#ifndef YY_PJ_WKT2_SRC_PJ_WKT2_GENERATED_PARSER_H_INCLUDED +# define YY_PJ_WKT2_SRC_PJ_WKT2_GENERATED_PARSER_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int pj_wkt2_debug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + END = 0, + T_PROJECTION = 258, + T_DATUM = 259, + T_SPHEROID = 260, + T_PRIMEM = 261, + T_UNIT = 262, + T_AXIS = 263, + T_PARAMETER = 264, + T_GEODCRS = 265, + T_LENGTHUNIT = 266, + T_ANGLEUNIT = 267, + T_SCALEUNIT = 268, + T_TIMEUNIT = 269, + T_ELLIPSOID = 270, + T_CS = 271, + T_ID = 272, + T_PROJCRS = 273, + T_BASEGEODCRS = 274, + T_MERIDIAN = 275, + T_BEARING = 276, + T_ORDER = 277, + T_ANCHOR = 278, + T_CONVERSION = 279, + T_METHOD = 280, + T_REMARK = 281, + T_GEOGCRS = 282, + T_BASEGEOGCRS = 283, + T_SCOPE = 284, + T_AREA = 285, + T_BBOX = 286, + T_CITATION = 287, + T_URI = 288, + T_VERTCRS = 289, + T_VDATUM = 290, + T_GEOIDMODEL = 291, + T_COMPOUNDCRS = 292, + T_PARAMETERFILE = 293, + T_COORDINATEOPERATION = 294, + T_SOURCECRS = 295, + T_TARGETCRS = 296, + T_INTERPOLATIONCRS = 297, + T_OPERATIONACCURACY = 298, + T_CONCATENATEDOPERATION = 299, + T_STEP = 300, + T_BOUNDCRS = 301, + T_ABRIDGEDTRANSFORMATION = 302, + T_DERIVINGCONVERSION = 303, + T_TDATUM = 304, + T_CALENDAR = 305, + T_TIMEORIGIN = 306, + T_TIMECRS = 307, + T_VERTICALEXTENT = 308, + T_TIMEEXTENT = 309, + T_USAGE = 310, + T_DYNAMIC = 311, + T_FRAMEEPOCH = 312, + T_MODEL = 313, + T_VELOCITYGRID = 314, + T_ENSEMBLE = 315, + T_MEMBER = 316, + T_ENSEMBLEACCURACY = 317, + T_DERIVEDPROJCRS = 318, + T_BASEPROJCRS = 319, + T_EDATUM = 320, + T_ENGCRS = 321, + T_PDATUM = 322, + T_PARAMETRICCRS = 323, + T_PARAMETRICUNIT = 324, + T_BASEVERTCRS = 325, + T_BASEENGCRS = 326, + T_BASEPARAMCRS = 327, + T_BASETIMECRS = 328, + T_EPOCH = 329, + T_COORDEPOCH = 330, + T_COORDINATEMETADATA = 331, + T_POINTMOTIONOPERATION = 332, + T_GEODETICCRS = 333, + T_GEODETICDATUM = 334, + T_PROJECTEDCRS = 335, + T_PRIMEMERIDIAN = 336, + T_GEOGRAPHICCRS = 337, + T_TRF = 338, + T_VERTICALCRS = 339, + T_VERTICALDATUM = 340, + T_VRF = 341, + T_TIMEDATUM = 342, + T_TEMPORALQUANTITY = 343, + T_ENGINEERINGDATUM = 344, + T_ENGINEERINGCRS = 345, + T_PARAMETRICDATUM = 346, + T_AFFINE = 347, + T_CARTESIAN = 348, + T_CYLINDRICAL = 349, + T_ELLIPSOIDAL = 350, + T_LINEAR = 351, + T_PARAMETRIC = 352, + T_POLAR = 353, + T_SPHERICAL = 354, + T_VERTICAL = 355, + T_TEMPORAL = 356, + T_TEMPORALCOUNT = 357, + T_TEMPORALMEASURE = 358, + T_ORDINAL = 359, + T_TEMPORALDATETIME = 360, + T_NORTH = 361, + T_NORTHNORTHEAST = 362, + T_NORTHEAST = 363, + T_EASTNORTHEAST = 364, + T_EAST = 365, + T_EASTSOUTHEAST = 366, + T_SOUTHEAST = 367, + T_SOUTHSOUTHEAST = 368, + T_SOUTH = 369, + T_SOUTHSOUTHWEST = 370, + T_SOUTHWEST = 371, + T_WESTSOUTHWEST = 372, + T_WEST = 373, + T_WESTNORTHWEST = 374, + T_NORTHWEST = 375, + T_NORTHNORTHWEST = 376, + T_UP = 377, + T_DOWN = 378, + T_GEOCENTRICX = 379, + T_GEOCENTRICY = 380, + T_GEOCENTRICZ = 381, + T_COLUMNPOSITIVE = 382, + T_COLUMNNEGATIVE = 383, + T_ROWPOSITIVE = 384, + T_ROWNEGATIVE = 385, + T_DISPLAYRIGHT = 386, + T_DISPLAYLEFT = 387, + T_DISPLAYUP = 388, + T_DISPLAYDOWN = 389, + T_FORWARD = 390, + T_AFT = 391, + T_PORT = 392, + T_STARBOARD = 393, + T_CLOCKWISE = 394, + T_COUNTERCLOCKWISE = 395, + T_TOWARDS = 396, + T_AWAYFROM = 397, + T_FUTURE = 398, + T_PAST = 399, + T_UNSPECIFIED = 400, + T_STRING = 401, + T_UNSIGNED_INTEGER_DIFFERENT_ONE_TWO_THREE = 402 + }; +#endif + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + + +int pj_wkt2_parse (pj_wkt2_parse_context *context); + +#endif /* !YY_PJ_WKT2_SRC_PJ_WKT2_GENERATED_PARSER_H_INCLUDED */ + +/* Copy the second part of user declarations. */ + + + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 99 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 3087 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 163 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 324 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 651 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 1347 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 402 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 159, 161, 2, 153, 162, 154, 148, 2, 2, 150, + 151, 152, 2, 2, 2, 2, 2, 2, 155, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 149, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 156, 2, 2, 2, 2, 2, + 157, 158, 2, 160, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 206, 206, 206, 206, 206, 206, 206, 207, 207, + 207, 208, 211, 211, 212, 212, 212, 213, 216, 216, + 216, 216, 217, 217, 217, 217, 218, 218, 218, 219, + 219, 219, 223, 227, 227, 229, 231, 233, 233, 235, + 235, 237, 239, 241, 243, 245, 245, 247, 247, 249, + 249, 249, 249, 251, 251, 255, 257, 261, 262, 263, + 265, 265, 267, 269, 271, 273, 277, 278, 281, 282, + 284, 286, 288, 291, 292, 293, 295, 297, 299, 299, + 301, 304, 305, 307, 307, 312, 312, 314, 314, 316, + 318, 320, 324, 325, 328, 329, 330, 332, 332, 333, + 336, 337, 341, 342, 343, 347, 348, 349, 350, 352, + 356, 358, 361, 363, 366, 367, 368, 369, 370, 371, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 383, + 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 401, 403, 405, 409, 414, 416, + 418, 420, 422, 426, 431, 432, 434, 436, 438, 442, + 446, 448, 448, 450, 450, 455, 460, 461, 462, 463, + 464, 465, 466, 468, 470, 472, 472, 474, 474, 476, + 478, 480, 482, 484, 486, 490, 492, 496, 496, 499, + 502, 507, 507, 507, 507, 507, 510, 515, 515, 515, + 515, 518, 522, 523, 525, 541, 545, 546, 548, 548, + 550, 550, 556, 556, 558, 560, 567, 567, 567, 569, + 576, 577, 578, 579, 581, 588, 595, 596, 597, 599, + 601, 601, 601, 601, 601, 601, 601, 601, 601, 604, + 604, 604, 606, 606, 608, 608, 608, 610, 615, 621, + 626, 629, 632, 633, 634, 635, 636, 637, 638, 639, + 640, 643, 644, 645, 646, 647, 648, 649, 650, 653, + 654, 655, 656, 657, 658, 659, 660, 663, 664, 667, + 668, 669, 670, 675, 676, 677, 678, 679, 680, 681, + 682, 683, 686, 687, 688, 689, 692, 693, 694, 695, + 698, 699, 702, 703, 708, 709, 712, 713, 714, 715, + 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, + 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, + 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, + 748, 749, 750, 751, 752, 753, 755, 758, 760, 762, + 764, 766, 768, 784, 784, 786, 794, 795, 797, 798, + 800, 808, 809, 811, 813, 815, 820, 821, 823, 825, + 827, 829, 831, 833, 835, 840, 844, 846, 849, 852, + 853, 854, 856, 857, 859, 864, 865, 867, 867, 869, + 873, 873, 873, 873, 875, 883, 891, 900, 910, 911, + 913, 915, 915, 917, 917, 920, 921, 925, 931, 932, + 933, 935, 935, 937, 939, 941, 945, 950, 950, 952, + 955, 956, 960, 965, 965, 965, 967, 969, 970, 971, + 972, 974, 977, 979, 983, 989, 989, 993, 993, 995, + 1000, 1001, 1002, 1003, 1005, 1011, 1011, 1013, 1015, 1019, + 1027, 1028, 1030, 1032, 1034, 1038, 1038, 1040, 1042, 1047, + 1048, 1050, 1052, 1054, 1056, 1060, 1060, 1062, 1068, 1075, + 1075, 1078, 1085, 1086, 1087, 1088, 1089, 1091, 1095, 1097, + 1099, 1099, 1103, 1108, 1108, 1108, 1112, 1117, 1117, 1119, + 1123, 1123, 1127, 1132, 1134, 1138, 1138, 1142, 1147, 1149, + 1153, 1154, 1155, 1156, 1157, 1159, 1159, 1161, 1164, 1166, + 1166, 1168, 1170, 1172, 1176, 1183, 1183, 1185, 1186, 1187, + 1188, 1190, 1192, 1196, 1201, 1203, 1206, 1211, 1215, 1221, + 1221, 1221, 1221, 1221, 1221, 1225, 1230, 1232, 1238, 1245, + 1255, 1261, 1263, 1265, 1270, 1275, 1281, 1281, 1283, 1286, + 1290, 1295, 1301, 1304, 1309, 1315, 1318, 1323, 1329, 1332, + 1337, 1343, 1344, 1345, 1346, 1347, 1349, 1351, 1353, 1353, + 1353, 1355, 1355, 1360, 1363, 1363, 1366, 1367, 1368, 1370, + 1374, 1375, 1377, 1379, 1379, 1380, 1380, 1381, 1381, 1381, + 1382, 1382, 1383, 1383, 1384, 1384, 1385, 1385, 1387, 1387, + 1388, 1388, 1389, 1389, 1390, 1390, 1394, 1401, 1402, 1403, + 1404, 1405, 1406, 1407, 1409, 1411, 1413, 1415, 1417, 1419, + 1421, 1423, 1425, 1427, 1432, 1439, 1440, 1441, 1442, 1443, + 1445, 1450, 1458, 1458, 1458, 1460, 1461, 1462, 1463, 1465, + 1467, 1472, 1478, 1480, 1487, 1487, 1489, 1490, 1491, 1492, + 1494, 1496 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 1 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "\"end of string\"", "error", "$undefined", "\"PROJECTION\"", + "\"DATUM\"", "\"SPHEROID\"", "\"PRIMEM\"", "\"UNIT\"", "\"AXIS\"", + "\"PARAMETER\"", "\"GEODCRS\"", "\"LENGTHUNIT\"", "\"ANGLEUNIT\"", + "\"SCALEUNIT\"", "\"TIMEUNIT\"", "\"ELLIPSOID\"", "\"CS\"", "\"ID\"", + "\"PROJCRS\"", "\"BASEGEODCRS\"", "\"MERIDIAN\"", "\"BEARING\"", + "\"ORDER\"", "\"ANCHOR\"", "\"CONVERSION\"", "\"METHOD\"", "\"REMARK\"", + "\"GEOGCRS\"", "\"BASEGEOGCRS\"", "\"SCOPE\"", "\"AREA\"", "\"BBOX\"", + "\"CITATION\"", "\"URI\"", "\"VERTCRS\"", "\"VDATUM\"", "\"GEOIDMODEL\"", + "\"COMPOUNDCRS\"", "\"PARAMETERFILE\"", "\"COORDINATEOPERATION\"", + "\"SOURCECRS\"", "\"TARGETCRS\"", "\"INTERPOLATIONCRS\"", + "\"OPERATIONACCURACY\"", "\"CONCATENATEDOPERATION\"", "\"STEP\"", + "\"BOUNDCRS\"", "\"ABRIDGEDTRANSFORMATION\"", "\"DERIVINGCONVERSION\"", + "\"TDATUM\"", "\"CALENDAR\"", "\"TIMEORIGIN\"", "\"TIMECRS\"", + "\"VERTICALEXTENT\"", "\"TIMEEXTENT\"", "\"USAGE\"", "\"DYNAMIC\"", + "\"FRAMEEPOCH\"", "\"MODEL\"", "\"VELOCITYGRID\"", "\"ENSEMBLE\"", + "\"MEMBER\"", "\"ENSEMBLEACCURACY\"", "\"DERIVEDPROJCRS\"", + "\"BASEPROJCRS\"", "\"EDATUM\"", "\"ENGCRS\"", "\"PDATUM\"", + "\"PARAMETRICCRS\"", "\"PARAMETRICUNIT\"", "\"BASEVERTCRS\"", + "\"BASEENGCRS\"", "\"BASEPARAMCRS\"", "\"BASETIMECRS\"", "\"EPOCH\"", + "\"COORDEPOCH\"", "\"COORDINATEMETADATA\"", "\"POINTMOTIONOPERATION\"", + "\"GEODETICCRS\"", "\"GEODETICDATUM\"", "\"PROJECTEDCRS\"", + "\"PRIMEMERIDIAN\"", "\"GEOGRAPHICCRS\"", "\"TRF\"", "\"VERTICALCRS\"", + "\"VERTICALDATUM\"", "\"VRF\"", "\"TIMEDATUM\"", "\"TEMPORALQUANTITY\"", + "\"ENGINEERINGDATUM\"", "\"ENGINEERINGCRS\"", "\"PARAMETRICDATUM\"", + "\"affine\"", "\"Cartesian\"", "\"cylindrical\"", "\"ellipsoidal\"", + "\"linear\"", "\"parametric\"", "\"polar\"", "\"spherical\"", + "\"vertical\"", "\"temporal\"", "\"temporalCount\"", + "\"temporalMeasure\"", "\"ordinal\"", "\"temporalDateTime\"", + "\"north\"", "\"northNorthEast\"", "\"northEast\"", "\"eastNorthEast\"", + "\"east\"", "\"eastSouthEast\"", "\"southEast\"", "\"southSouthEast\"", + "\"south\"", "\"southSouthWest\"", "\"southWest\"", "\"westSouthWest\"", + "\"west\"", "\"westNorthWest\"", "\"northWest\"", "\"northNorthWest\"", + "\"up\"", "\"down\"", "\"geocentricX\"", "\"geocentricY\"", + "\"geocentricZ\"", "\"columnPositive\"", "\"columnNegative\"", + "\"rowPositive\"", "\"rowNegative\"", "\"displayRight\"", + "\"displayLeft\"", "\"displayUp\"", "\"displayDown\"", "\"forward\"", + "\"aft\"", "\"port\"", "\"starboard\"", "\"clockwise\"", + "\"counterClockwise\"", "\"towards\"", "\"awayFrom\"", "\"future\"", + "\"part\"", "\"unspecified\"", "\"string\"", "\"unsigned integer\"", + "'.'", "'E'", "'1'", "'2'", "'3'", "'+'", "'-'", "':'", "'T'", "'Z'", + "'['", "'('", "']'", "')'", "','", "$accept", "input", "datum", "crs", + "period", "number", "signed_numeric_literal_with_sign", + "signed_numeric_literal", "unsigned_numeric_literal", "opt_sign", + "approximate_numeric_literal", "mantissa", "exponent", "signed_integer", + "exact_numeric_literal", "opt_period_unsigned_integer", + "unsigned_integer", "sign", "colon", "hyphen", "datetime", + "opt_24_hour_clock", "year", "month", "day", "_24_hour_clock", + "opt_colon_minute_colon_second_time_zone_designator", + "opt_colon_second_time_zone_designator", "time_designator", "hour", + "minute", "second_time_zone_designator", "seconds_integer", + "seconds_fraction", "time_zone_designator", "utc_designator", + "local_time_zone_designator", "opt_colon_minute", "left_delimiter", + "right_delimiter", "wkt_separator", "quoted_latin_text", + "quoted_unicode_text", "opt_separator_scope_extent_identifier_remark", + "no_opt_separator_scope_extent_identifier_remark", + "opt_identifier_list_remark", + "scope_extent_opt_identifier_list_opt_remark", + "scope_extent_opt_identifier_list_remark", + "usage_list_opt_identifier_list_remark", "usage", "usage_keyword", + "scope", "scope_keyword", "scope_text_description", "extent", + "extent_opt_identifier_list_remark", "area_description", + "area_description_keyword", "area_text_description", + "geographic_bounding_box", "geographic_bounding_box_keyword", + "lower_left_latitude", "lower_left_longitude", "upper_right_latitude", + "upper_right_longitude", "vertical_extent", "opt_separator_length_unit", + "vertical_extent_keyword", "vertical_extent_minimum_height", + "vertical_extent_maximum_height", "temporal_extent", + "temporal_extent_keyword", "temporal_extent_start", + "temporal_extent_end", "identifier", + "opt_version_authority_citation_uri", "identifier_keyword", + "authority_name", "authority_unique_identifier", "version", + "authority_citation", "citation_keyword", "citation", "id_uri", + "uri_keyword", "uri", "remark", "remark_keyword", "unit", "spatial_unit", + "angle_or_length_or_parametric_or_scale_unit", + "angle_or_length_or_parametric_or_scale_unit_keyword", + "angle_or_length_or_scale_unit", "angle_or_length_or_scale_unit_keyword", + "angle_unit", "opt_separator_identifier_list", "length_unit", + "time_unit", "opt_separator_conversion_factor_identifier_list", + "angle_unit_keyword", "length_unit_keyword", "time_unit_keyword", + "unit_name", "conversion_factor", + "coordinate_system_scope_extent_identifier_remark", + "spatial_cs_scope_extent_identifier_remark", + "opt_separator_spatial_axis_list_opt_separator_cs_unit_scope_extent_identifier_remark", + "temporalcountmeasure_cs_scope_extent_identifier_remark", + "ordinaldatetime_cs_scope_extent_identifier_remark", + "opt_separator_ordinaldatetime_axis_list_scope_extent_identifier_remark", + "cs_keyword", "spatial_cs_type", "temporalcountmeasure_cs_type", + "ordinaldatetime_cs_type", "dimension", "spatial_axis", + "temporalcountmeasure_axis", "ordinaldatetime_axis", "axis_keyword", + "axis_name_abbrev", + "axis_direction_opt_axis_order_spatial_unit_identifier_list", + "north_south_options_spatial_unit", + "clockwise_counter_clockwise_options_spatial_unit", + "axis_direction_except_n_s_cw_ccw_opt_axis_spatial_unit_identifier_list", + "axis_direction_except_n_s_cw_ccw_opt_axis_spatial_unit_identifier_list_options", + "axis_direction_opt_axis_order_identifier_list", "north_south_options", + "clockwise_counter_clockwise_options", + "axis_direction_except_n_s_cw_ccw_opt_axis_identifier_list", + "axis_direction_except_n_s_cw_ccw_opt_axis_identifier_list_options", + "opt_separator_axis_time_unit_identifier_list", + "axis_direction_except_n_s_cw_ccw_opt_axis_time_unit_identifier_list_options", + "axis_direction_except_n_s_cw_ccw", "meridian", "meridian_keyword", + "bearing", "bearing_keyword", "axis_order", "axis_order_keyword", + "cs_unit", "datum_ensemble", "geodetic_datum_ensemble_without_pm", + "datum_ensemble_member_list_ellipsoid_accuracy_identifier_list", + "opt_separator_datum_ensemble_identifier_list", + "vertical_datum_ensemble", + "datum_ensemble_member_list_accuracy_identifier_list", + "datum_ensemble_keyword", "datum_ensemble_name", "datum_ensemble_member", + "opt_datum_ensemble_member_identifier_list", + "datum_ensemble_member_keyword", "datum_ensemble_member_name", + "datum_ensemble_member_identifier", "datum_ensemble_accuracy", + "datum_ensemble_accuracy_keyword", "accuracy", + "datum_ensemble_identifier", "dynamic_crs", "dynamic_crs_keyword", + "frame_reference_epoch", "frame_reference_epoch_keyword", + "reference_epoch", "opt_separator_deformation_model_id", + "deformation_model_id", "opt_separator_identifier", + "deformation_model_id_keyword", "deformation_model_name", "geodetic_crs", + "static_geodetic_crs", "static_geographic_crs", "dynamic_geodetic_crs", + "dynamic_geographic_crs", + "opt_prime_meridian_coordinate_system_scope_extent_identifier_remark", + "crs_name", "geodetic_crs_keyword", "geographic_crs_keyword", + "geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm", + "ellipsoid", "opt_separator_length_unit_identifier_list", + "ellipsoid_keyword", "ellipsoid_name", "semi_major_axis", + "inverse_flattening", "prime_meridian", "prime_meridian_keyword", + "prime_meridian_name", "irm_longitude_opt_separator_identifier_list", + "geodetic_reference_frame_without_pm", + "geodetic_reference_frame_keyword", "datum_name", + "opt_separator_datum_anchor_identifier_list", "datum_anchor", + "datum_anchor_keyword", "datum_anchor_description", "projected_crs", + "projected_crs_keyword", "base_geodetic_crs", "base_static_geodetic_crs", + "opt_separator_pm_ellipsoidal_cs_unit", "base_dynamic_geodetic_crs", + "base_geodetic_crs_keyword", "base_crs_name", "ellipsoidal_cs_unit", + "map_projection", "parameter_list_identifier_list", + "map_projection_keyword", "map_projection_name", "map_projection_method", + "map_projection_method_keyword", "map_projection_method_name", + "map_projection_parameter", "opt_separator_param_unit_identifier_list", + "parameter_keyword", "parameter_name", "parameter_value", + "map_projection_parameter_unit", "vertical_crs", "static_vertical_crs", + "dynamic_vertical_crs", + "vertical_reference_frame_or_vertical_datum_ensemble", + "vertical_cs_opt_geoid_model_id_scope_extent_identifier_remark", + "opt_separator_cs_unit_opt_geoid_model_id_scope_extent_identifier_remark", + "geoid_model_id", "geoid_model_keyword", "geoid_model_name", + "vertical_crs_keyword", "vertical_reference_frame", + "vertical_reference_frame_keyword", "engineering_crs", + "engineering_crs_keyword", "engineering_datum", + "engineering_datum_keyword", "parametric_crs", "parametric_crs_keyword", + "parametric_datum", "parametric_datum_keyword", "temporal_crs", + "temporal_crs_keyword", "temporal_datum", + "opt_separator_temporal_datum_end", "temporal_datum_keyword", + "temporal_origin", "temporal_origin_keyword", + "temporal_origin_description", "calendar", "calendar_keyword", + "calendar_identifier", "deriving_conversion", + "parameter_or_parameter_file", "opt_separator_deriving_conversion_end", + "deriving_conversion_keyword", "deriving_conversion_name", + "operation_method", "operation_method_keyword", "operation_method_name", + "operation_parameter", "parameter_unit", + "length_or_angle_or_scale_or_time_or_parametric_unit", + "length_or_angle_or_scale_or_time_or_parametric_unit_keyword", + "operation_parameter_file", "parameter_file_keyword", + "parameter_file_name", "derived_geodetic_crs", "derived_geographic_crs", + "derived_projected_crs", "derived_projected_crs_keyword", + "derived_crs_name", "base_projected_crs", "base_projected_crs_keyword", + "derived_vertical_crs", "base_vertical_crs", "base_static_vertical_crs", + "base_dynamic_vertical_crs", "base_vertical_crs_keyword", + "derived_engineering_crs", "base_engineering_crs", + "base_engineering_crs_keyword", "derived_parametric_crs", + "base_parametric_crs", "base_parametric_crs_keyword", + "derived_temporal_crs", "base_temporal_crs", "base_temporal_crs_keyword", + "compound_crs", "compound_crs_other_components", "compound_crs_keyword", + "compound_crs_name", "horizontal_crs", "geographic2D_crs", + "metadata_coordinate_epoch", "coordinate_epoch_keyword", + "coordinate_epoch", "coordinate_metadata", "coordinate_metadata_crs", + "coordinate_metadata_keyword", "static_crs", + "dynamic_crs_coordinate_metadata", "coordinate_operation", + "opt_coordinate_operation_end", "operation_keyword", "operation_name", + "source_crs", "source_crs_keyword", "target_crs", "target_crs_keyword", + "interpolation_crs", "interpolation_crs_keyword", "operation_accuracy", + "operation_accuracy_keyword", "point_motion_operation", + "opt_point_motion_operation_end", "point_motion_keyword", + "concatenated_operation", "step", "opt_concatenated_operation_end", + "concatenated_operation_keyword", "step_keyword", "bound_crs", + "bound_crs_keyword", "abridged_coordinate_transformation", + "abridged_parameter_or_parameter_file", + "opt_end_abridged_coordinate_transformation", + "abridged_transformation_keyword", "abridged_transformation_parameter", YY_NULLPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, 398, 399, 400, 401, 402, 46, 69, + 49, 50, 51, 43, 45, 58, 84, 90, 91, 40, + 93, 41, 44 +}; +# endif + +#define YYPACT_NINF -1139 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-1139))) + +#define YYTABLE_NINF -606 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 1364, -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, + -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, + -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, + -1139, -1139, -1139, -1139, -1139, -1139, -1139, 206, -1139, -1139, + -1139, 353, -1139, -1139, -1139, 353, -1139, -1139, -1139, -1139, + -1139, 353, 353, -1139, 353, -1139, 353, -1139, 353, -1139, + 353, -1139, -1139, -1139, 353, -1139, 353, -1139, 353, -1139, + 353, -1139, 353, -1139, 353, -1139, 353, -1139, 353, -1139, + -1139, -1139, 353, -1139, -1139, -1139, -1139, -1139, 353, -1139, + 353, -1139, 353, -1139, 353, -1139, 353, -1139, 353, -1139, + -1139, -1139, 71, 71, 71, 71, 71, 71, 71, 71, + 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, + 873, 71, 71, 71, 231, -1139, -1139, 140, -1139, 140, + -1139, 140, 140, -1139, 140, -1139, 140, 140, -1139, 140, + 140, 140, 140, 140, 140, 140, 140, 140, -1139, 140, + -1139, 140, -1139, -1139, -1139, -1139, 176, -1139, -1139, -1139, + -1139, -1139, 191, 224, 239, 256, -1139, -1139, -1139, -1139, + 468, -1139, 140, -1139, 140, 140, 140, -1139, 140, 353, + -1139, 1335, 370, 337, 337, 714, 122, 481, 143, 471, + 247, 468, 263, 468, 268, 468, 99, 408, 468, 392, + 452, -1139, -1139, -1139, 584, 231, 231, 231, 421, 873, + -1139, -1139, -1139, -1139, -1139, -1139, -1139, 576, -1139, -1139, + -1139, -1139, 311, 319, 330, 714, -1139, 140, -1139, 140, + 353, -1139, -1139, -1139, -1139, 353, 140, 353, 140, -1139, + 140, -1139, -1139, 353, 140, 140, 140, -1139, 140, 140, + 140, -1139, -1139, 140, 353, -1139, -1139, 353, 140, 140, + -1139, 140, -1139, -1139, 353, -1139, 140, 140, 353, -1139, + -1139, 140, 140, 353, -1139, -1139, 140, 140, 353, -1139, + -1139, 140, 140, 353, -1139, -1139, 140, 140, 353, 140, + 353, -1139, -1139, 140, 353, -1139, -1139, 353, -1139, -1139, + 353, 140, -1139, -1139, -1139, -1139, 353, 140, 140, 140, + -1139, 140, 353, 468, -1139, 479, 576, -1139, -1139, 543, + 468, 108, 468, 468, 71, 71, 83, 448, 342, 460, + 71, 83, 342, 460, 714, 468, 527, 545, 71, 71, + 379, 547, 460, 71, 557, -1139, 557, 71, 547, 460, + 71, 547, 460, 71, 547, 460, 71, -1139, -1139, 437, + 195, -1139, 71, 460, 71, 71, 71, 558, 576, 421, + 575, 421, 533, 873, -1139, 576, -1139, -1139, -1139, -1139, + -1139, -1139, -1139, -1139, 140, 140, 353, -1139, 353, -1139, + -1139, 140, 140, 353, 140, -1139, -1139, -1139, 140, 140, + 140, -1139, 140, 353, -1139, -1139, -1139, -1139, -1139, -1139, + -1139, 353, 468, 140, 353, -1139, 140, 353, -1139, 140, + 140, 468, 140, -1139, 140, -1139, 140, -1139, 468, 140, + 353, -1139, 140, 140, 140, 353, 468, 140, 140, 140, + 140, -1139, 468, 468, 140, 140, 468, 140, 140, 468, + 140, 140, -1139, -1139, 80, -1139, 468, 140, -1139, 468, + 140, 140, 140, 140, 140, 353, 140, 353, 140, 353, + 468, 330, 468, 140, -1139, 140, 353, 140, -1139, 140, + 353, 468, -1139, 588, 589, 71, 71, -1139, -1139, 557, + -1139, 870, 546, 557, 468, 370, 342, 624, 468, 576, + 1172, -1139, 547, 71, 547, 71, 154, 342, -1139, 547, + 365, 468, 547, -1139, 364, -1139, 71, 468, 370, 547, + 1021, -1139, 547, 386, -1139, -1139, -1139, -1139, 547, 44, + -1139, 547, 185, -1139, 547, 67, -1139, -1139, 576, -1139, + -1139, 576, -1139, -1139, -1139, 547, 481, 160, 44, 686, + -1139, 71, 686, -1139, 71, 1035, -1139, 71, -1139, 576, + -1139, 575, 91, 71, 591, 468, 71, -1139, 140, -1139, + -1139, 468, -1139, 468, -1139, 140, -1139, 468, 140, -1139, + 140, -1139, 140, 468, -1139, -1139, -1139, 353, -1139, 330, + 468, -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, + -1139, -1139, -1139, -1139, -1139, 140, 140, 140, -1139, -1139, + 140, 468, -1139, 140, 140, 140, 468, 468, -1139, -1139, + 140, 140, 353, -1139, 468, -1139, -1139, 140, -1139, 140, + 468, 140, 468, 140, 468, 468, 468, 468, 468, 468, + 468, 162, 484, -1139, 1152, 468, 140, -1139, -1139, -1139, + -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, 140, 353, + 140, 353, -1139, 140, 353, 140, 353, 140, 353, 140, + 353, 140, -1139, 353, 140, 140, 140, 140, 140, -1139, + 140, -1139, 353, 140, -1139, -1139, 353, -1139, 140, -1139, + 353, -1139, 140, 589, -1139, -1139, -1139, -1139, -1139, -1139, + 146, -1139, 71, 576, -1139, 419, 419, 419, 479, -1139, + 575, 136, 297, 468, -1139, -1139, -1139, -1139, 71, -1139, + 479, 643, -1139, 419, -1139, 187, -1139, -1139, -1139, -1139, + -1139, -1139, -1139, -1139, 576, -1139, -1139, 576, 576, -1139, + 496, -1139, -1139, -1139, -1139, 527, 374, 627, 647, -1139, + 71, 581, -1139, 71, 449, -1139, 870, 127, -1139, 870, + 511, -1139, 437, -1139, 507, -1139, 89, -1139, 185, 67, + 91, 71, 1123, 468, 71, 557, 468, 409, 575, -1139, + 140, -1139, 140, -1139, -1139, -1139, -1139, 140, 140, 140, + 140, 714, 468, 140, 140, -1139, -1139, -1139, 353, 140, + -1139, -1139, -1139, 140, -1139, 140, 140, 140, 468, -1139, + 518, 496, -1139, 1152, 576, -1139, 468, -1139, 140, -1139, + 140, -1139, 140, -1139, -1139, 468, 140, 140, 140, -1139, + 468, 140, 140, -1139, 140, 140, -1139, 140, -1139, -1139, + 140, -1139, 468, 140, 140, -1139, -1139, 140, 140, 140, + 353, -1139, 140, -1139, -1139, -1139, -1139, -1139, 468, 140, + 468, 468, 468, 468, 423, -1139, -1139, -1139, 91, 468, + 71, 325, 714, 659, 468, 468, -1139, -1139, -1139, 576, + -1139, -1139, -1139, -1139, -1139, 615, -1139, -1139, 449, -1139, + 127, -1139, -1139, -1139, 127, -1139, -1139, 870, -1139, 870, + 437, -1139, 1069, 468, 479, -1139, -1139, -1139, 870, 71, + 140, 91, -1139, 140, 140, 140, 140, 140, -1139, 140, + -1139, -1139, 140, -1139, -1139, -1139, -1139, -1139, 353, 140, + -1139, 140, -1139, -1139, 1310, 468, 140, 140, 140, -1139, + 140, 140, 140, 140, -1139, 140, -1139, 140, -1139, -1139, + 468, -1139, -1139, 140, 140, 140, 353, 140, -1139, 140, + 468, -1139, 140, 591, 353, -1139, 140, -1139, 655, 655, + 655, -1139, 556, 468, 714, 468, 71, -1139, 655, 691, + -1139, -1139, 445, 656, 625, 127, -1139, -1139, -1139, -1139, + 870, 443, 468, -1139, -1139, -1139, 947, -1139, 873, -1139, + 592, -1139, 468, 353, 71, 762, 468, -1139, 140, 353, + 140, 353, 140, 353, 140, 140, 140, -1139, 140, -1139, + 140, 140, 582, 691, -1139, 140, 140, -1139, 140, -1139, + -1139, 140, -1139, 140, -1139, -1139, 140, 468, -1139, -1139, + -1139, -1139, -1139, -1139, 140, -1139, 353, -1139, 409, 140, + -1139, 140, 140, -1139, 751, -1139, 71, -1139, 71, 768, + -1139, 71, -1139, -1139, -1139, 468, 714, 820, -1139, -1139, + 656, 625, 625, -1139, 870, -1139, -1139, 468, 71, 468, + 479, -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, + -1139, -1139, -1139, -1139, 353, -1139, 353, 140, 140, -1139, + 140, 140, -1139, 140, 140, -1139, 140, -1139, -1139, 140, + 140, 353, 140, -1139, -1139, -1139, -1139, 468, -1139, 140, + 140, 140, 71, 71, -1139, -1139, 1118, 1528, -1139, 1652, + 468, 957, -1139, 350, 71, 625, -1139, 714, 468, 875, + 468, 468, 140, 140, 140, -1139, -1139, -1139, -1139, -1139, + -1139, -1139, 140, -1139, -1139, -1139, -1139, -1139, -1139, -1139, + -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, -1139, + -1139, -1139, -1139, -1139, -1139, -1139, -1139, 140, 140, -1139, + -1139, -1139, -1139, -1139, 468, -1139, 140, 140, 140, 140, + 140, 140, 468, -1139, 140, -1139, 140, 140, -1139, 140, + -1139, 140, -1139, -1139, 140, 353, -1139, -1139, 714, 468, + 470, 470, 377, 377, -1139, 555, 363, 468, 513, 470, + 574, 574, -1139, 536, 350, -1139, 468, -1139, -1139, 409, + 140, -1139, -1139, -1139, 140, 140, -1139, 140, 353, 140, + 353, -1139, -1139, 140, 140, -1139, 140, 353, 140, -1139, + 140, 140, -1139, 140, 140, 140, -1139, 140, -1139, 140, + -1139, 140, 140, -1139, 140, -1139, 140, 140, -1139, 140, + -1139, 140, 140, -1139, 468, 468, -1139, -1139, 555, -1139, + 870, 637, -1139, 576, -1139, -1139, 555, -1139, 870, 637, + -1139, -1139, -1139, 637, -1139, -1139, -1139, 121, -1139, -1139, + 536, -1139, -1139, -1139, 536, -1139, -1139, -1139, -1139, -1139, + 140, -1139, 140, 140, 140, 140, 468, 140, 140, 468, + 140, 140, 140, 140, 140, -1139, -1139, 637, -1139, 325, + -1139, -1139, -1139, 637, -1139, -1139, -1139, -1139, -1139, -1139, + -1139, 140, 468, 140, -1139, -1139, -1139 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint16 yydefact[] = +{ + 0, 423, 412, 401, 411, 173, 435, 452, 403, 480, + 483, 566, 614, 639, 642, 505, 498, 363, 541, 490, + 487, 495, 493, 582, 630, 402, 425, 436, 404, 424, + 481, 485, 484, 506, 491, 488, 496, 0, 4, 5, + 2, 0, 13, 353, 354, 0, 18, 390, 391, 392, + 393, 0, 0, 3, 0, 12, 0, 19, 0, 11, + 0, 20, 465, 466, 0, 14, 0, 21, 0, 15, + 0, 22, 0, 16, 0, 23, 0, 17, 0, 24, + 25, 26, 0, 27, 28, 29, 30, 31, 0, 7, + 0, 8, 0, 9, 0, 10, 0, 6, 0, 1, + 85, 86, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 90, 174, 0, 364, 0, + 400, 0, 0, 413, 0, 426, 0, 0, 453, 0, + 0, 427, 0, 427, 0, 427, 0, 500, 542, 0, + 567, 0, 583, 584, 598, 599, 585, 586, 601, 587, + 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, + 0, 580, 0, 615, 0, 0, 0, 617, 0, 0, + 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 87, 88, 579, 0, 0, 0, 0, 0, 0, + 52, 32, 49, 50, 51, 53, 54, 0, 175, 33, + 34, 38, 0, 37, 47, 0, 176, 166, 368, 0, + 0, 445, 446, 376, 406, 0, 0, 0, 0, 405, + 0, 437, 438, 0, 0, 0, 0, 414, 0, 427, + 0, 456, 455, 0, 0, 550, 470, 0, 0, 0, + 469, 0, 546, 547, 0, 432, 202, 428, 0, 482, + 553, 0, 0, 0, 489, 556, 0, 0, 0, 494, + 559, 0, 0, 0, 512, 508, 202, 202, 0, 202, + 0, 499, 544, 0, 0, 571, 572, 0, 569, 570, + 0, 0, 568, 574, 575, 581, 0, 0, 0, 0, + 619, 0, 0, 0, 46, 39, 0, 45, 35, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 429, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 504, 503, 0, + 0, 501, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 616, 0, 41, 43, 40, 48, + 180, 183, 177, 178, 167, 170, 0, 172, 0, 165, + 372, 0, 358, 0, 0, 355, 360, 369, 366, 0, + 0, 378, 382, 0, 417, 229, 418, 399, 216, 217, + 218, 0, 0, 0, 0, 521, 0, 0, 447, 0, + 0, 0, 0, 415, 408, 422, 0, 461, 0, 202, + 0, 457, 202, 0, 0, 0, 0, 0, 0, 202, + 202, 433, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 62, 509, 60, 510, 0, 202, 513, 0, + 0, 0, 0, 0, 92, 0, 92, 0, 92, 0, + 0, 576, 0, 0, 524, 0, 0, 0, 650, 92, + 0, 0, 44, 0, 0, 0, 0, 357, 362, 0, + 361, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 394, 0, 0, 0, 0, 0, 0, 395, 0, + 0, 0, 0, 449, 0, 450, 0, 0, 0, 0, + 0, 467, 0, 0, 203, 430, 431, 486, 0, 0, + 492, 0, 0, 497, 0, 0, 56, 70, 0, 57, + 61, 0, 507, 502, 511, 0, 0, 0, 0, 0, + 561, 0, 0, 562, 0, 0, 563, 0, 560, 577, + 573, 0, 0, 0, 0, 0, 0, 618, 168, 171, + 181, 0, 184, 0, 374, 358, 373, 0, 358, 370, + 366, 365, 0, 0, 387, 388, 383, 0, 375, 379, + 0, 230, 231, 232, 233, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 0, 0, 0, 398, 419, + 0, 0, 522, 0, 0, 440, 0, 0, 211, 210, + 202, 202, 0, 407, 0, 451, 462, 0, 454, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 60, 0, 71, 0, 0, 0, 186, 112, 145, + 148, 156, 160, 110, 93, 94, 100, 101, 105, 0, + 97, 0, 104, 97, 0, 97, 0, 97, 0, 97, + 0, 97, 96, 0, 92, 0, 92, 0, 0, 578, + 0, 536, 0, 625, 515, 516, 0, 525, 385, 640, + 0, 641, 0, 0, 179, 182, 359, 371, 356, 367, + 0, 396, 0, 380, 377, 0, 0, 0, 39, 538, + 0, 0, 0, 0, 397, 539, 410, 409, 0, 434, + 39, 0, 468, 0, 545, 0, 548, 551, 552, 554, + 555, 557, 558, 58, 0, 55, 80, 0, 0, 65, + 83, 67, 78, 79, 540, 0, 0, 0, 0, 103, + 0, 0, 129, 0, 0, 130, 0, 0, 131, 0, + 0, 132, 0, 95, 0, 564, 0, 565, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 169, + 0, 389, 385, 381, 244, 245, 246, 202, 202, 202, + 202, 0, 0, 0, 440, 209, 208, 448, 0, 441, + 443, 439, 214, 0, 463, 459, 0, 202, 0, 64, + 60, 83, 72, 0, 0, 82, 0, 108, 97, 106, + 0, 102, 97, 99, 113, 0, 97, 97, 97, 146, + 0, 97, 97, 149, 0, 97, 157, 0, 161, 162, + 0, 91, 0, 607, 0, 623, 629, 625, 625, 92, + 0, 624, 0, 386, 523, 634, 632, 633, 0, 0, + 0, 0, 0, 0, 0, 421, 36, 416, 0, 0, + 0, 0, 0, 0, 0, 0, 549, 59, 81, 0, + 66, 69, 84, 543, 107, 0, 98, 111, 0, 133, + 0, 134, 135, 144, 0, 136, 137, 0, 138, 0, + 0, 185, 0, 0, 39, 626, 627, 628, 0, 0, + 0, 0, 384, 0, 0, 0, 202, 517, 444, 0, + 442, 215, 202, 200, 198, 197, 199, 464, 0, 202, + 458, 0, 76, 68, 0, 0, 114, 115, 116, 117, + 97, 97, 97, 97, 150, 0, 158, 154, 163, 164, + 0, 621, 613, 607, 607, 92, 0, 92, 606, 0, + 0, 537, 385, 0, 0, 645, 646, 644, 0, 0, + 0, 420, 0, 0, 0, 0, 0, 460, 0, 0, + 75, 109, 0, 0, 0, 0, 139, 140, 141, 142, + 0, 0, 0, 159, 608, 609, 0, 610, 0, 612, + 0, 622, 0, 0, 0, 0, 0, 250, 220, 0, + 92, 0, 226, 0, 385, 517, 517, 514, 202, 204, + 0, 472, 77, 0, 73, 118, 119, 120, 121, 122, + 123, 97, 151, 0, 155, 153, 92, 0, 534, 529, + 530, 531, 532, 533, 385, 527, 0, 535, 0, 0, + 649, 646, 646, 643, 0, 219, 0, 224, 0, 0, + 225, 0, 520, 518, 519, 0, 0, 0, 471, 74, + 0, 0, 0, 143, 0, 611, 620, 0, 0, 0, + 39, 648, 647, 195, 192, 191, 194, 212, 193, 213, + 223, 352, 187, 189, 0, 188, 0, 220, 92, 251, + 0, 0, 228, 226, 0, 201, 202, 478, 476, 92, + 0, 0, 124, 125, 126, 127, 152, 0, 526, 206, + 635, 202, 0, 0, 222, 221, 0, 0, 227, 0, + 0, 0, 473, 0, 0, 0, 147, 0, 0, 0, + 0, 0, 0, 206, 253, 310, 311, 312, 313, 314, + 315, 316, 255, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 335, 336, 337, 338, 339, 340, 257, 259, 341, + 342, 343, 344, 345, 0, 252, 277, 304, 284, 286, + 288, 290, 0, 283, 300, 196, 0, 92, 479, 385, + 128, 202, 528, 638, 92, 0, 631, 651, 0, 0, + 0, 0, 0, 0, 247, 0, 0, 0, 0, 0, + 0, 0, 249, 0, 0, 475, 0, 207, 637, 0, + 202, 205, 347, 351, 202, 202, 254, 202, 0, 202, + 0, 256, 349, 202, 202, 258, 202, 0, 202, 260, + 202, 202, 278, 202, 202, 202, 305, 202, 248, 202, + 285, 202, 202, 287, 202, 289, 202, 202, 291, 202, + 301, 202, 92, 477, 0, 0, 261, 268, 0, 265, + 0, 0, 267, 0, 269, 276, 0, 273, 0, 0, + 275, 279, 282, 0, 280, 306, 309, 0, 307, 292, + 0, 294, 295, 296, 0, 298, 299, 302, 303, 474, + 635, 190, 202, 202, 0, 202, 0, 202, 202, 0, + 202, 202, 202, 202, 202, 636, 264, 0, 262, 0, + 266, 350, 272, 0, 270, 348, 274, 281, 308, 293, + 297, 202, 0, 202, 263, 346, 271 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -1139, -1139, -1139, -208, -210, -178, -1139, -23, -139, 384, + -1139, -1139, -1139, -1139, -1139, -1139, -212, -293, -534, 50, + -672, -510, -1139, -1139, -1139, -1139, -1139, -1139, -1139, -493, + -107, -1139, -1139, -1139, -711, -1139, -1139, -97, -43, 1745, + 898, -42, -1139, -396, -684, -537, -1139, -1139, -21, -1139, + -1139, 9, -1139, -1139, -1139, -3, -138, -1139, -1139, -707, + -1139, -1139, -1139, -1139, -1139, -659, -1139, -1139, -1139, -1139, + -575, -1139, -1139, -1139, 0, -1139, -1139, -1139, -1139, -1139, + 278, -1139, -1139, -427, -1139, -1139, -421, -1139, -1139, -696, + -1139, -1139, -1139, -1139, -845, 1185, -225, -1138, -374, -1139, + -1139, -1139, -816, -924, 153, -1139, -319, -1139, -1139, -317, + -259, 269, -1139, -1139, -311, -870, -1139, -257, -863, -906, + -1139, -783, -410, -1139, -1139, -1139, -1139, -412, -1139, -1139, + -1139, -1139, -760, -408, -1139, -471, -1139, -1101, -1139, -976, + -1139, 813, -363, -90, 814, -361, 4, -101, -287, 238, + -1139, -1139, -1139, 327, -1139, -84, -1139, -157, -1139, -1139, + -1139, -1139, -1139, -1139, -758, -1139, -1139, -1139, 705, -27, + 706, -2, -165, -11, -1139, 629, -99, 63, -1139, -1139, + -1139, -1139, -1139, 118, -1139, -1139, -1139, 7, -1139, 502, + -47, -1139, -1139, -1139, 1, -1139, -144, -1139, 42, -1139, + -1139, 504, -31, -298, 338, -1139, -1139, -1139, -1139, -1139, + -1139, -1139, -325, -712, -838, -1139, 486, 735, 739, 523, + 351, -1139, -262, -1139, -1139, 505, 6, -1139, 5, 671, + 18, -1139, -68, 510, 16, -1139, -100, -299, 10, -1139, + -1139, 519, -1139, -1139, -1139, -1139, -1139, 593, -685, -263, + -1139, -1139, -519, -1139, -1139, -714, -1139, -1139, -1139, -731, + -1139, -1139, 758, 760, 761, -1139, -1139, -1139, -1139, 764, + -1139, -1139, -1139, -1139, 766, -1139, -1139, 767, -1139, -1139, + 773, -1139, -1139, 775, -1139, -1139, -1139, -1139, -1139, -1139, + -1139, -1139, -1139, -1139, -1139, -1139, -1139, 882, -180, -1139, + -86, 529, -1139, 167, -1139, -1139, -1139, -846, -1139, -1139, + -64, 897, -1139, -974, -411, -1139, -874, -1139, -1139, -1139, + -1139, -256, -1139, -102 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 37, 38, 39, 217, 576, 219, 804, 220, 791, + 221, 222, 376, 377, 223, 317, 224, 225, 814, 538, + 453, 539, 454, 642, 810, 540, 739, 880, 541, 740, + 813, 933, 934, 1023, 741, 742, 743, 815, 102, 203, + 344, 130, 842, 550, 654, 749, 655, 656, 657, 658, + 659, 660, 661, 825, 935, 662, 663, 664, 830, 665, + 666, 834, 945, 1033, 1117, 667, 992, 668, 837, 947, + 669, 670, 840, 950, 439, 320, 41, 127, 227, 384, + 385, 386, 571, 387, 388, 573, 672, 673, 1091, 1092, + 1093, 1094, 927, 928, 797, 345, 621, 1095, 1138, 798, + 622, 1096, 803, 922, 407, 408, 1055, 409, 410, 1060, + 411, 605, 606, 607, 787, 1008, 1010, 1012, 1009, 1100, + 1184, 1236, 1245, 1185, 1252, 1192, 1260, 1265, 1193, 1270, + 1217, 1256, 1186, 1237, 1238, 1246, 1247, 1239, 1240, 1098, + 42, 234, 322, 490, 256, 323, 235, 129, 229, 494, + 230, 398, 580, 392, 393, 577, 575, 244, 237, 402, + 403, 590, 498, 586, 776, 587, 782, 46, 47, 48, + 49, 50, 412, 131, 51, 52, 245, 394, 511, 54, + 134, 248, 424, 413, 414, 610, 792, 239, 56, 136, + 191, 267, 268, 442, 57, 58, 240, 241, 713, 242, + 243, 419, 800, 59, 428, 60, 139, 253, 254, 432, + 429, 874, 682, 627, 805, 929, 61, 62, 63, 259, + 436, 1068, 1110, 1111, 1199, 64, 260, 66, 67, 68, + 271, 70, 71, 72, 276, 74, 75, 76, 281, 198, + 78, 287, 288, 456, 289, 290, 459, 855, 683, 973, + 417, 613, 475, 476, 688, 684, 1044, 1045, 1046, 685, + 686, 962, 79, 80, 81, 82, 149, 293, 294, 83, + 261, 262, 263, 264, 84, 272, 273, 85, 277, 278, + 86, 282, 283, 87, 470, 88, 151, 301, 302, 305, + 306, 472, 89, 170, 90, 171, 172, 856, 903, 92, + 174, 178, 179, 311, 312, 955, 956, 849, 850, 93, + 773, 857, 95, 858, 1140, 96, 690, 97, 98, 479, + 966, 1006, 480, 967 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int16 yytable[] = +{ + 40, 313, 103, 218, 45, 314, 65, 55, 104, 105, + 77, 106, 430, 107, 316, 108, 73, 109, 69, 916, + 161, 110, 378, 111, 860, 112, 236, 113, 487, 114, + 488, 115, 258, 116, 391, 117, 175, 176, 426, 118, + 246, 848, 680, 250, 826, 119, 247, 120, 644, 121, + 1018, 122, 160, 123, 919, 124, 957, 569, 847, 844, + 126, 128, 852, 53, 133, 135, 959, 138, 469, 135, + 553, 135, 556, 135, 1079, 135, 148, 150, 1255, 173, + 173, 173, 435, 565, 238, 843, 318, 1, 846, 1003, + 838, 1109, 827, 153, 132, 831, 193, 137, 195, 140, + 427, 142, 881, 144, 379, 146, 1011, 1013, 1021, 19, + 738, 1248, 1248, 2, 1253, 1257, 15, 1262, 155, 1267, + 1267, 156, 1271, 4, 10, 159, 752, 2, 755, 681, + 758, 733, 761, 34, 763, 1087, 209, 4, 5, 226, + 1, 382, 1106, 17, 5, 233, 251, 452, 15, 17, + 1036, 2, 1101, 647, 33, 1104, 471, 1197, 1, 1322, + 1020, 4, 26, 482, 1, 481, 29, 421, 252, 228, + 390, 954, 280, 295, 31, 32, 828, 1313, 937, 832, + 965, 652, 835, 917, 1097, 1318, 33, 324, 953, 430, + 266, 793, 325, 257, 327, 423, 1013, 286, 296, 1323, + 330, 298, 335, 1324, 1002, 299, 99, 228, 582, 1089, + 233, 338, 5, 1201, 339, 26, 233, 125, 952, 29, + 17, 343, 10, 980, 399, 347, 938, 400, 948, 940, + 350, 629, 420, 26, 536, 353, 537, 29, 433, 26, + 356, 1016, 1121, 29, 811, 359, 285, 362, 1272, 249, + 469, 364, 21, 469, 365, 1274, 1062, 366, 1015, 859, + 435, 559, 1119, 368, 5, 1205, 779, 468, 1024, 373, + 265, 177, 31, 32, 1051, 1025, 36, 383, 765, 879, + 767, 884, 397, 128, 1230, 886, 1077, 589, 418, 889, + 891, 892, 1049, 1204, 895, 896, 431, 128, 898, 466, + 877, 418, 180, 404, 795, 441, 1142, 1143, 418, 796, + 939, 418, 1069, 941, 418, 942, -63, 455, 537, 943, + 458, 1050, 418, 1026, 1028, 819, 641, 823, 19, 643, + 823, 583, 795, 823, 270, 21, 823, 796, -600, 823, + 275, 1, 616, 485, 257, 486, 440, 679, 404, 614, + 491, 737, 34, -602, 462, 463, 231, 1083, 405, 36, + 499, 1084, 1085, 1086, 1087, 232, 633, 1187, 500, 1194, + 1090, 503, 618, 427, 505, 1102, 619, 1087, 406, 703, + 5, 5, 5, 1108, 1083, 1233, -603, 516, 1084, 1085, + 1086, 5, 520, 233, 5, 788, 789, 17, 1242, 1233, + 647, -604, 646, 986, 987, 988, 989, 1027, 1029, 1030, + 1031, 1112, 807, 780, 10, 378, 26, 487, -605, 1088, + 29, 10, 551, 406, 554, 5, 557, 378, 1241, 653, + 795, 228, 643, 563, 806, 796, 1263, 566, 1089, 17, + 5, 1226, 233, 570, 572, 488, 1088, 816, 12, 674, + 618, 1089, 676, 907, 619, 1203, 292, 415, 284, 285, + 315, 609, 310, 612, 31, 32, 5, 823, -42, 823, + 6, 31, 32, 823, 626, 647, 650, 1083, 211, 8, + 692, 1084, 1085, 1086, 1342, 696, 24, 5, 698, 574, + 1232, 783, 1233, 579, 1073, 1113, 1114, 1115, 651, 652, + 231, 443, 651, 652, 446, 401, 10, 449, 415, 232, + 620, 100, 101, 615, 1235, 1235, 1244, 1244, 20, 1251, + 737, 687, 809, 1235, 173, 643, 812, 233, 5, 634, + 5, 17, 27, 1232, 28, 1233, 473, 647, 477, 1088, + 675, 255, 35, 677, 702, 640, 678, 636, 638, 671, + 452, 7, 671, 5, 427, 671, 31, 32, 1233, 997, + 1200, 999, 1083, 405, 823, 427, 1084, 1085, 1086, 784, + 785, 786, 5, 5, 5, 380, 381, 1233, 833, 718, + 478, 836, 1312, 125, 210, 1315, 964, 212, 213, 214, + 1317, 5, 9, 1320, 681, 1242, 1233, 1321, 5, 1038, + 474, 643, 812, 1039, 1040, 1041, 1042, 647, 390, 258, + 16, 378, 650, 141, 1057, 143, 747, 145, 750, 147, + 380, 753, 381, 756, 1088, 759, 22, 762, 201, 202, + 764, 1341, 215, 216, 651, 652, 689, 1343, 536, 771, + 1075, 737, 30, 774, 1083, 649, 650, 777, 1084, 1085, + 1086, 735, 866, 841, 5, 608, 648, 611, 303, 304, + 781, 1043, 617, 1007, 5, 624, 923, 932, 651, 652, + 924, 925, 926, 647, 537, 632, 802, 649, 650, 652, + 964, 635, 584, 585, 637, 790, 737, 639, 452, 125, + 210, 211, 734, 212, 213, 214, 215, 216, 645, 375, + 651, 652, 1125, 5, 228, 390, 1088, 882, 824, 651, + 652, 829, 647, 1132, 878, 648, 649, 650, 794, 944, + 839, 946, 643, 210, 979, 817, 212, 213, 214, 626, + 737, 808, 626, 921, 307, 308, 309, -71, 16, 651, + 652, 653, -71, -71, -71, 821, 818, 936, 822, 1266, + 1266, 822, 1063, 1064, 822, 870, 820, 822, 1083, 1007, + 822, 568, 1084, 1085, 1086, 1087, 1034, 1022, 5, 1209, + 257, 427, 671, 994, 995, 853, 1007, 647, 1124, 5, + 648, 649, 650, 905, 906, 5, 1128, 378, 647, 631, + 1037, 648, 649, 650, 647, 1081, 1082, 648, 649, 650, + 681, 1225, 1103, 1249, 651, 652, 653, 908, 1228, 1268, + 1261, 643, 1032, 43, 44, 651, 652, 653, 699, 578, + 1088, 651, 652, 653, 960, 152, 154, 1083, 802, 297, + 799, 1084, 1085, 1086, 1087, 921, 869, 5, 210, 1089, + 920, 212, 213, 214, 215, 216, 647, 438, 736, 648, + 649, 650, 625, 464, 445, 157, 1107, 448, 949, 158, + 451, 210, 211, 434, 212, 213, 214, 961, 461, 1196, + 630, 300, 465, 651, 652, 653, 1309, 467, 162, 457, + 163, 164, 91, 3, 165, 976, 166, 167, 822, 1088, + 822, 6, 5, 168, 822, 169, 1116, 94, 0, 1325, + 8, 647, 671, 1052, 648, 649, 650, 9, 1089, 0, + 11, 0, 0, 998, 0, 0, 0, 0, 845, 0, + 689, 1004, 416, 0, 0, 16, 422, 921, 651, 652, + 653, 0, 0, 0, 802, 437, 18, 0, 0, 20, + 0, 22, 444, 0, 0, 447, 0, 0, 450, 0, + 0, 25, 0, 27, 0, 28, 460, 30, 0, 0, + 1048, 0, 626, 35, 5, 0, 1056, 0, 1058, 0, + 1061, 0, 1014, 647, 5, 0, 648, 649, 650, 0, + 0, 0, 0, 647, 0, 822, 648, 649, 650, 0, + 845, 0, 0, 1107, 0, 0, 671, 0, 921, 0, + 651, 652, 653, 1078, 0, 671, 0, 0, 0, 0, + 651, 652, 653, 0, 1099, 0, 1099, 210, 211, 1099, + 212, 213, 214, 215, 216, 181, 0, 182, 0, 183, + 184, 0, 185, 0, 186, 187, 802, 188, 189, 190, + 192, 190, 194, 190, 196, 197, 0, 199, 0, 200, + 0, 1122, 5, 1123, 671, 0, 0, 0, 0, 671, + 0, 647, 0, 0, 648, 649, 650, 671, 1134, 921, + 204, 1316, 205, 206, 207, 0, 208, 0, 427, 0, + 802, 802, 0, 0, 0, 0, 5, 0, 651, 652, + 653, 0, 1198, 0, 0, 647, 0, 0, 648, 649, + 650, 0, 1314, 0, 0, 0, 0, 681, 0, 0, + 1319, 951, 845, 591, 592, 593, 594, 595, 596, 597, + 598, 599, 651, 652, 653, 319, 0, 321, 0, 0, + 0, 671, 427, 0, 326, 0, 328, 0, 329, 671, + 5, 0, 331, 332, 333, 0, 334, 190, 336, 647, + 0, 337, 648, 649, 650, 0, 340, 341, 0, 342, + 0, 681, 1229, 0, 0, 346, 845, 0, 0, 348, + 349, 0, 0, 0, 351, 352, 651, 652, 653, 354, + 355, 0, 0, 0, 0, 0, 0, 360, 0, 0, + 0, 363, 0, 0, 0, 1280, 0, 1283, 0, 367, + 0, 0, 0, 0, 1288, 369, 370, 371, 0, 372, + 1234, 1234, 1243, 1243, 0, 1250, 1254, 0, 1259, 1234, + 1264, 1264, 0, 1269, 1144, 1145, 1146, 1147, 1148, 1149, + 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, + 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, + 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, + 1180, 1181, 1182, 1183, 591, 592, 593, 594, 595, 596, + 597, 598, 599, 600, 601, 602, 603, 604, 0, 0, + 0, 0, 483, 484, 0, 0, 0, 0, 0, 321, + 489, 0, 492, 0, 0, 0, 493, 495, 496, 210, + 497, 0, 212, 213, 214, 215, 216, 735, 0, 736, + 0, 502, 0, 0, 504, 0, 0, 506, 507, 0, + 509, 0, 510, 0, 512, 0, 0, 514, 0, 0, + 0, 518, 519, 0, 0, 522, 523, 0, 0, 0, + 0, 0, 528, 529, 0, 531, 532, 0, 534, 535, + 0, 0, 0, 0, 0, 0, 0, 0, 545, 546, + 547, 548, 549, 0, 552, 0, 555, 0, 1, 2, + 0, 561, 0, 562, 3, 564, 0, 555, 0, 4, + 0, 5, 6, 0, 0, 0, 0, 0, 7, 0, + 0, 8, 0, 0, 0, 0, 0, 0, 9, 10, + 0, 11, 0, 12, 0, 0, 0, 0, 13, 0, + 14, 0, 0, 15, 0, 0, 16, 0, 0, 0, + 0, 0, 0, 0, 17, 0, 0, 18, 0, 19, + 20, 21, 22, 0, 0, 0, 0, 0, 0, 0, + 23, 24, 25, 26, 27, 0, 28, 29, 30, 31, + 32, 33, 0, 34, 35, 36, 0, 210, 211, 0, + 212, 213, 214, 215, 216, 0, 693, 736, 0, 0, + 0, 357, 358, 489, 361, 0, 489, 0, 493, 0, + 700, 125, 210, 211, 0, 212, 213, 214, 215, 216, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 705, 706, 707, 0, 0, 708, 0, + 0, 710, 711, 712, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 720, 0, 721, 0, 723, + 0, 725, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 745, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 746, 0, 748, 0, + 0, 751, 0, 754, 0, 757, 0, 760, 0, 760, + 0, 0, 555, 766, 555, 768, 769, 0, 770, 0, + 0, 772, 0, 0, 0, 0, 775, 0, 0, 0, + 778, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 515, 0, 0, 517, 0, 0, + 0, 0, 0, 0, 524, 525, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1145, 1146, 1147, 1148, 1149, + 1150, 1151, 543, 1153, 1154, 1155, 1156, 1157, 1158, 1159, + 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, + 1170, 1171, 1172, 1173, 1174, 1175, 1176, 0, 0, 1179, + 1180, 1181, 1182, 1183, 0, 0, 0, 0, 700, 0, + 775, 0, 0, 0, 0, 0, 0, 0, 864, 0, + 0, 868, 712, 0, 0, 0, 0, 871, 0, 0, + 0, 872, 0, 873, 721, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 760, 0, 885, 0, + 760, 0, 0, 0, 888, 890, 760, 0, 0, 894, + 760, 0, 897, 760, 0, 899, 0, 0, 900, 0, + 0, 902, 904, 0, 0, 772, 772, 555, 0, 0, + 909, 0, 0, 0, 0, 0, 0, 911, 1188, 1145, + 1146, 1147, 1148, 1149, 1150, 1151, 1189, 1153, 1154, 1155, + 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, + 1166, 1167, 1168, 1169, 1170, 1171, 1172, 1173, 1174, 1175, + 1176, 1190, 1191, 1179, 1180, 1181, 1182, 1183, 0, 0, + 0, 0, 0, 0, 0, 716, 717, 0, 963, 0, + 0, 968, 969, 970, 0, 972, 0, 974, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 978, + 0, 0, 0, 0, 982, 983, 984, 0, 985, 760, + 760, 760, 0, 990, 0, 991, 0, 0, 0, 0, + 0, 902, 902, 996, 0, 555, 0, 1000, 0, 0, + 775, 0, 0, 0, 1005, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1054, 0, 555, 0, + 1059, 0, 775, 972, 972, 0, 0, 0, 1066, 1067, + 0, 0, 0, 1070, 1071, 0, 1072, 0, 0, 760, + 0, 1074, 0, 0, 555, 0, 269, 0, 274, 0, + 279, 0, 775, 291, 0, 0, 0, 1080, 0, 1005, + 1005, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 861, 862, 863, 865, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 875, 0, 0, 1054, 555, 0, 1126, 1127, + 0, 1059, 1129, 0, 0, 0, 0, 1131, 1133, 0, + 1135, 0, 0, 0, 0, 0, 0, 1137, 1139, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1208, 1137, 1210, 0, 0, 0, 0, 0, 0, 0, + 1211, 0, 0, 0, 0, 0, 0, 0, 374, 0, + 0, 0, 0, 0, 0, 389, 0, 395, 396, 0, + 0, 0, 0, 0, 0, 1212, 1213, 0, 0, 0, + 425, 0, 0, 0, 1215, 1216, 1218, 1219, 1220, 1221, + 0, 0, 1223, 0, 1224, 555, 0, 775, 0, 0, + 0, 971, 555, 0, 0, 0, 0, 975, 0, 0, + 0, 0, 0, 0, 977, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1278, 0, 1281, 0, 0, + 0, 0, 0, 0, 1286, 0, 1289, 0, 0, 0, + 0, 1293, 0, 0, 0, 1297, 0, 501, 0, 1300, + 0, 0, 0, 0, 1304, 0, 508, 0, 0, 0, + 555, 0, 0, 513, 0, 0, 0, 0, 0, 0, + 0, 521, 0, 0, 0, 0, 0, 526, 527, 0, + 0, 530, 0, 0, 533, 0, 0, 0, 0, 0, + 0, 542, 0, 1065, 544, 0, 0, 0, 1139, 0, + 0, 1327, 1329, 0, 0, 558, 1333, 560, 0, 0, + 0, 0, 0, 0, 0, 0, 567, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 581, + 0, 0, 0, 588, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 623, 0, 0, 0, + 0, 0, 628, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1130, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1141, 0, 0, 0, + 691, 0, 0, 0, 0, 0, 694, 0, 695, 0, + 0, 0, 697, 0, 0, 0, 0, 0, 701, 0, + 0, 0, 0, 0, 0, 704, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 709, 0, 0, 0, + 0, 714, 715, 0, 0, 0, 0, 0, 0, 719, + 0, 0, 0, 0, 0, 722, 0, 724, 0, 726, + 727, 728, 729, 730, 731, 732, 1227, 0, 0, 0, + 744, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1275, 0, 0, 0, 1276, + 1277, 0, 1279, 0, 1282, 0, 0, 0, 1284, 1285, + 0, 1287, 0, 1290, 0, 1291, 1292, 0, 1294, 1295, + 1296, 0, 1298, 0, 1299, 0, 1301, 1302, 0, 1303, + 0, 1305, 1306, 0, 1307, 0, 1308, 0, 801, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1326, 1328, 0, + 1330, 0, 1332, 1334, 0, 1336, 1337, 1338, 1339, 1340, + 0, 0, 0, 0, 0, 0, 0, 0, 851, 0, + 0, 854, 0, 0, 0, 0, 1344, 0, 1346, 0, + 0, 0, 0, 0, 0, 0, 0, 867, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 876, 0, 0, 0, 0, 0, 0, + 0, 883, 0, 0, 0, 0, 0, 0, 0, 0, + 887, 0, 0, 0, 0, 893, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 901, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 910, 0, 912, 913, 914, 915, 0, + 0, 0, 0, 0, 918, 0, 0, 0, 0, 930, + 931, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 958, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 981, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 993, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1001, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1017, 0, + 1019, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1035, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1047, 0, 0, + 0, 1053, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1076, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1105, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1118, 0, 1120, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1136, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1195, 0, 0, 0, 0, + 0, 0, 0, 1202, 0, 1206, 1207, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1214, + 0, 0, 0, 0, 0, 0, 0, 1222, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1231, 0, 0, 0, 0, 0, + 0, 0, 1258, 0, 0, 0, 0, 0, 0, 0, + 0, 1273, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1310, + 1311, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1331, 0, 0, 1335, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1345 +}; + +static const yytype_int16 yycheck[] = +{ + 0, 209, 45, 181, 0, 217, 0, 0, 51, 52, + 0, 54, 337, 56, 224, 58, 0, 60, 0, 864, + 120, 64, 315, 66, 782, 68, 183, 70, 391, 72, + 391, 74, 189, 76, 321, 78, 122, 123, 336, 82, + 184, 772, 561, 187, 751, 88, 185, 90, 541, 92, + 974, 94, 120, 96, 870, 98, 902, 484, 772, 771, + 102, 103, 774, 0, 106, 107, 904, 109, 367, 111, + 466, 113, 468, 115, 1048, 117, 118, 119, 1216, 121, + 122, 123, 341, 479, 183, 770, 225, 4, 772, 963, + 762, 1067, 751, 120, 105, 754, 143, 108, 145, 110, + 9, 112, 813, 114, 316, 116, 969, 970, 978, 65, + 644, 1212, 1213, 5, 1215, 1216, 49, 1218, 120, 1220, + 1221, 120, 1223, 15, 35, 120, 663, 5, 665, 38, + 667, 641, 669, 89, 671, 14, 179, 15, 17, 181, + 4, 319, 1066, 60, 17, 56, 3, 359, 49, 60, + 996, 5, 1058, 26, 87, 1061, 368, 1133, 4, 1297, + 976, 15, 79, 375, 4, 373, 83, 332, 25, 61, + 62, 902, 73, 200, 85, 86, 751, 1278, 885, 754, + 911, 54, 757, 868, 1054, 1286, 87, 230, 902, 514, + 190, 710, 235, 189, 237, 334, 1059, 197, 200, 1300, + 243, 200, 249, 1304, 962, 200, 0, 61, 495, 88, + 56, 254, 17, 1137, 257, 79, 56, 146, 902, 83, + 60, 264, 35, 934, 325, 268, 885, 326, 900, 888, + 273, 518, 331, 79, 154, 278, 156, 83, 339, 79, + 283, 972, 1080, 83, 737, 288, 51, 290, 1224, 186, + 549, 294, 67, 552, 297, 1229, 1014, 300, 972, 778, + 519, 471, 1078, 306, 17, 1139, 693, 367, 979, 312, + 23, 40, 85, 86, 1005, 982, 91, 319, 674, 813, + 676, 818, 324, 325, 1208, 822, 1044, 499, 330, 826, + 827, 828, 1004, 1139, 831, 832, 338, 339, 835, 367, + 810, 343, 162, 6, 7, 347, 1122, 1123, 350, 12, + 885, 353, 1023, 888, 356, 890, 154, 359, 156, 894, + 362, 1005, 364, 982, 983, 746, 538, 748, 65, 541, + 751, 496, 7, 754, 71, 67, 757, 12, 162, 760, + 72, 4, 507, 386, 340, 388, 346, 559, 6, 506, + 393, 644, 89, 162, 365, 366, 19, 7, 16, 91, + 403, 11, 12, 13, 14, 28, 523, 1127, 411, 1129, + 1054, 414, 7, 9, 417, 1059, 11, 14, 81, 589, + 17, 17, 17, 1067, 7, 22, 162, 430, 11, 12, + 13, 17, 435, 56, 17, 706, 707, 60, 21, 22, + 26, 162, 546, 940, 941, 942, 943, 982, 983, 984, + 985, 1070, 723, 700, 35, 708, 79, 780, 162, 69, + 83, 35, 465, 81, 467, 17, 469, 720, 1211, 55, + 7, 61, 644, 476, 721, 12, 1219, 480, 88, 60, + 17, 1199, 56, 485, 486, 806, 69, 745, 39, 549, + 7, 88, 552, 849, 11, 1139, 64, 48, 50, 51, + 149, 503, 41, 505, 85, 86, 17, 888, 149, 890, + 18, 85, 86, 894, 516, 26, 31, 7, 148, 27, + 566, 11, 12, 13, 1329, 575, 77, 17, 578, 489, + 20, 703, 22, 493, 1031, 1070, 1071, 1072, 53, 54, + 19, 348, 53, 54, 351, 57, 35, 354, 48, 28, + 510, 158, 159, 506, 1210, 1211, 1212, 1213, 66, 1215, + 813, 563, 734, 1219, 566, 737, 738, 56, 17, 523, + 17, 60, 80, 20, 82, 22, 369, 26, 371, 69, + 551, 70, 90, 554, 587, 535, 557, 529, 532, 549, + 762, 24, 552, 17, 9, 555, 85, 86, 22, 955, + 1135, 957, 7, 16, 985, 9, 11, 12, 13, 150, + 151, 152, 17, 17, 17, 32, 33, 22, 756, 622, + 47, 759, 1278, 146, 147, 1281, 911, 150, 151, 152, + 1286, 17, 34, 1289, 38, 21, 22, 1293, 17, 7, + 25, 813, 814, 11, 12, 13, 14, 26, 62, 766, + 52, 904, 31, 111, 1010, 113, 659, 115, 661, 117, + 32, 664, 33, 666, 69, 668, 68, 670, 160, 161, + 673, 1327, 153, 154, 53, 54, 45, 1333, 154, 682, + 1036, 934, 84, 686, 7, 30, 31, 690, 11, 12, + 13, 155, 791, 146, 17, 502, 29, 504, 74, 75, + 702, 69, 509, 8, 17, 512, 7, 879, 53, 54, + 11, 12, 13, 26, 156, 522, 718, 30, 31, 54, + 1005, 528, 58, 59, 531, 708, 979, 534, 900, 146, + 147, 148, 642, 150, 151, 152, 153, 154, 545, 315, + 53, 54, 1098, 17, 61, 62, 69, 814, 750, 53, + 54, 753, 26, 1109, 811, 29, 30, 31, 711, 897, + 762, 899, 934, 147, 934, 746, 150, 151, 152, 771, + 1023, 725, 774, 872, 205, 206, 207, 155, 52, 53, + 54, 55, 160, 161, 162, 748, 746, 885, 748, 1220, + 1221, 751, 1015, 1016, 754, 798, 747, 757, 7, 8, + 760, 483, 11, 12, 13, 14, 991, 979, 17, 1143, + 766, 9, 772, 953, 954, 775, 8, 26, 1097, 17, + 29, 30, 31, 847, 848, 17, 1103, 1080, 26, 520, + 998, 29, 30, 31, 26, 1051, 1052, 29, 30, 31, + 38, 1197, 1059, 1213, 53, 54, 55, 850, 1204, 1221, + 1218, 1023, 990, 0, 0, 53, 54, 55, 580, 492, + 69, 53, 54, 55, 908, 120, 120, 7, 870, 200, + 712, 11, 12, 13, 14, 974, 794, 17, 147, 88, + 871, 150, 151, 152, 153, 154, 26, 343, 157, 29, + 30, 31, 514, 367, 350, 120, 36, 353, 900, 120, + 356, 147, 148, 340, 150, 151, 152, 909, 364, 1131, + 519, 200, 367, 53, 54, 55, 1272, 367, 120, 360, + 120, 120, 0, 10, 120, 928, 120, 120, 888, 69, + 890, 18, 17, 120, 894, 120, 1074, 0, -1, 1310, + 27, 26, 902, 1005, 29, 30, 31, 34, 88, -1, + 37, -1, -1, 956, -1, -1, -1, -1, 43, -1, + 45, 964, 329, -1, -1, 52, 333, 1066, 53, 54, + 55, -1, -1, -1, 976, 342, 63, -1, -1, 66, + -1, 68, 349, -1, -1, 352, -1, -1, 355, -1, + -1, 78, -1, 80, -1, 82, 363, 84, -1, -1, + 1003, -1, 1004, 90, 17, -1, 1009, -1, 1011, -1, + 1013, -1, 972, 26, 17, -1, 29, 30, 31, -1, + -1, -1, -1, 26, -1, 985, 29, 30, 31, -1, + 43, -1, -1, 36, -1, -1, 996, -1, 1137, -1, + 53, 54, 55, 1046, -1, 1005, -1, -1, -1, -1, + 53, 54, 55, -1, 1056, -1, 1058, 147, 148, 1061, + 150, 151, 152, 153, 154, 127, -1, 129, -1, 131, + 132, -1, 134, -1, 136, 137, 1078, 139, 140, 141, + 142, 143, 144, 145, 146, 147, -1, 149, -1, 151, + -1, 1094, 17, 1096, 1054, -1, -1, -1, -1, 1059, + -1, 26, -1, -1, 29, 30, 31, 1067, 1111, 1208, + 172, 1283, 174, 175, 176, -1, 178, -1, 9, -1, + 1122, 1123, -1, -1, -1, -1, 17, -1, 53, 54, + 55, -1, 1134, -1, -1, 26, -1, -1, 29, 30, + 31, -1, 1280, -1, -1, -1, -1, 38, -1, -1, + 1288, 42, 43, 92, 93, 94, 95, 96, 97, 98, + 99, 100, 53, 54, 55, 227, -1, 229, -1, -1, + -1, 1131, 9, -1, 236, -1, 238, -1, 240, 1139, + 17, -1, 244, 245, 246, -1, 248, 249, 250, 26, + -1, 253, 29, 30, 31, -1, 258, 259, -1, 261, + -1, 38, 1205, -1, -1, 267, 43, -1, -1, 271, + 272, -1, -1, -1, 276, 277, 53, 54, 55, 281, + 282, -1, -1, -1, -1, -1, -1, 289, -1, -1, + -1, 293, -1, -1, -1, 1238, -1, 1240, -1, 301, + -1, -1, -1, -1, 1247, 307, 308, 309, -1, 311, + 1210, 1211, 1212, 1213, -1, 1215, 1216, -1, 1218, 1219, + 1220, 1221, -1, 1223, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, -1, -1, + -1, -1, 384, 385, -1, -1, -1, -1, -1, 391, + 392, -1, 394, -1, -1, -1, 398, 399, 400, 147, + 402, -1, 150, 151, 152, 153, 154, 155, -1, 157, + -1, 413, -1, -1, 416, -1, -1, 419, 420, -1, + 422, -1, 424, -1, 426, -1, -1, 429, -1, -1, + -1, 433, 434, -1, -1, 437, 438, -1, -1, -1, + -1, -1, 444, 445, -1, 447, 448, -1, 450, 451, + -1, -1, -1, -1, -1, -1, -1, -1, 460, 461, + 462, 463, 464, -1, 466, -1, 468, -1, 4, 5, + -1, 473, -1, 475, 10, 477, -1, 479, -1, 15, + -1, 17, 18, -1, -1, -1, -1, -1, 24, -1, + -1, 27, -1, -1, -1, -1, -1, -1, 34, 35, + -1, 37, -1, 39, -1, -1, -1, -1, 44, -1, + 46, -1, -1, 49, -1, -1, 52, -1, -1, -1, + -1, -1, -1, -1, 60, -1, -1, 63, -1, 65, + 66, 67, 68, -1, -1, -1, -1, -1, -1, -1, + 76, 77, 78, 79, 80, -1, 82, 83, 84, 85, + 86, 87, -1, 89, 90, 91, -1, 147, 148, -1, + 150, 151, 152, 153, 154, -1, 568, 157, -1, -1, + -1, 286, 287, 575, 289, -1, 578, -1, 580, -1, + 582, 146, 147, 148, -1, 150, 151, 152, 153, 154, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 605, 606, 607, -1, -1, 610, -1, + -1, 613, 614, 615, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 627, -1, 629, -1, 631, + -1, 633, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 646, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 658, -1, 660, -1, + -1, 663, -1, 665, -1, 667, -1, 669, -1, 671, + -1, -1, 674, 675, 676, 677, 678, -1, 680, -1, + -1, 683, -1, -1, -1, -1, 688, -1, -1, -1, + 692, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 429, -1, -1, 432, -1, -1, + -1, -1, -1, -1, 439, 440, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 107, 108, 109, 110, 111, + 112, 113, 457, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, -1, -1, 141, + 142, 143, 144, 145, -1, -1, -1, -1, 780, -1, + 782, -1, -1, -1, -1, -1, -1, -1, 790, -1, + -1, 793, 794, -1, -1, -1, -1, 799, -1, -1, + -1, 803, -1, 805, 806, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 818, -1, 820, -1, + 822, -1, -1, -1, 826, 827, 828, -1, -1, 831, + 832, -1, 834, 835, -1, 837, -1, -1, 840, -1, + -1, 843, 844, -1, -1, 847, 848, 849, -1, -1, + 852, -1, -1, -1, -1, -1, -1, 859, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, -1, -1, + -1, -1, -1, -1, -1, 620, 621, -1, 910, -1, + -1, 913, 914, 915, -1, 917, -1, 919, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 931, + -1, -1, -1, -1, 936, 937, 938, -1, 940, 941, + 942, 943, -1, 945, -1, 947, -1, -1, -1, -1, + -1, 953, 954, 955, -1, 957, -1, 959, -1, -1, + 962, -1, -1, -1, 966, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 1008, -1, 1010, -1, + 1012, -1, 1014, 1015, 1016, -1, -1, -1, 1020, 1021, + -1, -1, -1, 1025, 1026, -1, 1028, -1, -1, 1031, + -1, 1033, -1, -1, 1036, -1, 191, -1, 193, -1, + 195, -1, 1044, 198, -1, -1, -1, 1049, -1, 1051, + 1052, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 787, 788, 789, 790, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 807, -1, -1, 1097, 1098, -1, 1100, 1101, + -1, 1103, 1104, -1, -1, -1, -1, 1109, 1110, -1, + 1112, -1, -1, -1, -1, -1, -1, 1119, 1120, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 1142, 1143, 1144, -1, -1, -1, -1, -1, -1, -1, + 1152, -1, -1, -1, -1, -1, -1, -1, 313, -1, + -1, -1, -1, -1, -1, 320, -1, 322, 323, -1, + -1, -1, -1, -1, -1, 1177, 1178, -1, -1, -1, + 335, -1, -1, -1, 1186, 1187, 1188, 1189, 1190, 1191, + -1, -1, 1194, -1, 1196, 1197, -1, 1199, -1, -1, + -1, 916, 1204, -1, -1, -1, -1, 922, -1, -1, + -1, -1, -1, -1, 929, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 1237, -1, 1239, -1, -1, + -1, -1, -1, -1, 1246, -1, 1248, -1, -1, -1, + -1, 1253, -1, -1, -1, 1257, -1, 412, -1, 1261, + -1, -1, -1, -1, 1266, -1, 421, -1, -1, -1, + 1272, -1, -1, 428, -1, -1, -1, -1, -1, -1, + -1, 436, -1, -1, -1, -1, -1, 442, 443, -1, + -1, 446, -1, -1, 449, -1, -1, -1, -1, -1, + -1, 456, -1, 1018, 459, -1, -1, -1, 1310, -1, + -1, 1313, 1314, -1, -1, 470, 1318, 472, -1, -1, + -1, -1, -1, -1, -1, -1, 481, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 494, + -1, -1, -1, 498, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 511, -1, -1, -1, + -1, -1, 517, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 1106, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 1121, -1, -1, -1, + 565, -1, -1, -1, -1, -1, 571, -1, 573, -1, + -1, -1, 577, -1, -1, -1, -1, -1, 583, -1, + -1, -1, -1, -1, -1, 590, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 611, -1, -1, -1, + -1, 616, 617, -1, -1, -1, -1, -1, -1, 624, + -1, -1, -1, -1, -1, 630, -1, 632, -1, 634, + 635, 636, 637, 638, 639, 640, 1201, -1, -1, -1, + 645, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 1230, -1, -1, -1, 1234, + 1235, -1, 1237, -1, 1239, -1, -1, -1, 1243, 1244, + -1, 1246, -1, 1248, -1, 1250, 1251, -1, 1253, 1254, + 1255, -1, 1257, -1, 1259, -1, 1261, 1262, -1, 1264, + -1, 1266, 1267, -1, 1269, -1, 1271, -1, 713, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 1312, 1313, -1, + 1315, -1, 1317, 1318, -1, 1320, 1321, 1322, 1323, 1324, + -1, -1, -1, -1, -1, -1, -1, -1, 773, -1, + -1, 776, -1, -1, -1, -1, 1341, -1, 1343, -1, + -1, -1, -1, -1, -1, -1, -1, 792, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 808, -1, -1, -1, -1, -1, -1, + -1, 816, -1, -1, -1, -1, -1, -1, -1, -1, + 825, -1, -1, -1, -1, 830, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 842, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 858, -1, 860, 861, 862, 863, -1, + -1, -1, -1, -1, 869, -1, -1, -1, -1, 874, + 875, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 903, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 935, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 950, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 960, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 973, -1, + 975, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 992, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 1002, -1, -1, + -1, 1006, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 1037, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 1065, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 1077, -1, 1079, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 1117, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 1130, -1, -1, -1, -1, + -1, -1, -1, 1138, -1, 1140, 1141, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 1184, + -1, -1, -1, -1, -1, -1, -1, 1192, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 1209, -1, -1, -1, -1, -1, + -1, -1, 1217, -1, -1, -1, -1, -1, -1, -1, + -1, 1226, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 1274, + 1275, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 1316, -1, -1, 1319, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 1342 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint16 yystos[] = +{ + 0, 4, 5, 10, 15, 17, 18, 24, 27, 34, + 35, 37, 39, 44, 46, 49, 52, 60, 63, 65, + 66, 67, 68, 76, 77, 78, 79, 80, 82, 83, + 84, 85, 86, 87, 89, 90, 91, 164, 165, 166, + 237, 239, 303, 304, 307, 309, 330, 331, 332, 333, + 334, 337, 338, 340, 342, 350, 351, 357, 358, 366, + 368, 379, 380, 381, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, 400, 401, 403, 425, + 426, 427, 428, 432, 437, 440, 443, 446, 448, 455, + 457, 460, 462, 472, 474, 475, 478, 480, 481, 0, + 158, 159, 201, 201, 201, 201, 201, 201, 201, 201, + 201, 201, 201, 201, 201, 201, 201, 201, 201, 201, + 201, 201, 201, 201, 201, 146, 204, 240, 204, 310, + 204, 336, 336, 204, 343, 204, 352, 336, 204, 369, + 336, 352, 336, 352, 336, 352, 336, 352, 204, 429, + 204, 449, 331, 332, 333, 334, 357, 380, 381, 391, + 395, 399, 425, 426, 427, 432, 437, 440, 443, 446, + 456, 458, 459, 204, 463, 463, 463, 40, 464, 465, + 162, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 353, 203, 353, 203, 353, 203, 203, 402, 203, + 203, 160, 161, 202, 203, 203, 203, 203, 203, 201, + 147, 148, 150, 151, 152, 153, 154, 167, 168, 169, + 171, 173, 174, 177, 179, 180, 204, 241, 61, 311, + 313, 19, 28, 56, 304, 309, 320, 321, 339, 350, + 359, 360, 362, 363, 320, 339, 359, 171, 344, 340, + 359, 3, 25, 370, 371, 70, 307, 309, 320, 382, + 389, 433, 434, 435, 436, 23, 237, 354, 355, 202, + 71, 393, 438, 439, 202, 72, 397, 441, 442, 202, + 73, 401, 444, 445, 50, 51, 237, 404, 405, 407, + 408, 202, 64, 430, 431, 332, 334, 338, 357, 391, + 392, 450, 451, 74, 75, 452, 453, 464, 464, 464, + 41, 466, 467, 166, 179, 149, 167, 178, 171, 203, + 238, 203, 305, 308, 201, 201, 203, 201, 203, 203, + 201, 203, 203, 203, 203, 353, 203, 203, 201, 201, + 203, 203, 203, 201, 203, 258, 203, 201, 203, 203, + 201, 203, 203, 201, 203, 203, 201, 258, 258, 201, + 203, 258, 201, 203, 201, 201, 201, 203, 201, 203, + 203, 203, 203, 201, 202, 172, 175, 176, 180, 179, + 32, 33, 168, 204, 242, 243, 244, 246, 247, 202, + 62, 311, 316, 317, 340, 202, 202, 204, 314, 310, + 339, 57, 322, 323, 6, 16, 81, 267, 268, 270, + 271, 273, 335, 346, 347, 48, 410, 413, 204, 364, + 339, 335, 410, 171, 345, 202, 366, 9, 367, 373, + 375, 204, 372, 310, 382, 273, 383, 410, 364, 237, + 237, 204, 356, 267, 410, 364, 267, 410, 364, 267, + 410, 364, 179, 183, 185, 204, 406, 404, 204, 409, + 410, 364, 336, 336, 379, 388, 395, 396, 399, 400, + 447, 179, 454, 466, 25, 415, 416, 466, 47, 482, + 485, 166, 179, 203, 203, 201, 201, 305, 308, 203, + 306, 201, 203, 203, 312, 203, 203, 203, 325, 201, + 201, 202, 203, 201, 203, 201, 203, 203, 202, 203, + 203, 341, 203, 202, 203, 258, 201, 258, 203, 203, + 201, 202, 203, 203, 258, 258, 202, 202, 203, 203, + 202, 203, 203, 202, 203, 203, 154, 156, 182, 184, + 188, 191, 202, 258, 202, 203, 203, 203, 203, 203, + 206, 201, 203, 206, 201, 203, 206, 201, 202, 167, + 202, 203, 203, 201, 203, 206, 201, 202, 243, 246, + 204, 245, 204, 248, 237, 319, 168, 318, 316, 237, + 315, 202, 311, 335, 58, 59, 326, 328, 202, 179, + 324, 92, 93, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 274, 275, 276, 267, 204, + 348, 267, 204, 414, 320, 350, 335, 267, 7, 11, + 237, 259, 263, 202, 267, 367, 204, 376, 202, 311, + 383, 274, 267, 320, 389, 267, 393, 267, 397, 267, + 401, 179, 186, 179, 192, 267, 359, 26, 29, 30, + 31, 53, 54, 55, 207, 209, 210, 211, 212, 213, + 214, 215, 218, 219, 220, 222, 223, 228, 230, 233, + 234, 237, 249, 250, 399, 336, 399, 336, 336, 179, + 415, 38, 375, 411, 418, 422, 423, 204, 417, 45, + 479, 202, 463, 203, 202, 202, 306, 202, 306, 312, + 203, 202, 201, 167, 202, 203, 203, 203, 203, 202, + 203, 203, 203, 361, 202, 202, 258, 258, 201, 202, + 203, 203, 202, 203, 202, 203, 202, 202, 202, 202, + 202, 202, 202, 184, 182, 155, 157, 180, 181, 189, + 192, 197, 198, 199, 202, 203, 203, 201, 203, 208, + 201, 203, 208, 201, 203, 208, 201, 203, 208, 201, + 203, 208, 201, 208, 201, 206, 203, 206, 203, 203, + 203, 201, 203, 473, 201, 203, 327, 201, 203, 246, + 311, 204, 329, 179, 150, 151, 152, 277, 277, 277, + 170, 172, 349, 415, 350, 7, 12, 257, 262, 346, + 365, 202, 204, 265, 170, 377, 311, 277, 389, 179, + 187, 192, 179, 193, 181, 200, 366, 211, 237, 249, + 214, 218, 237, 249, 204, 216, 222, 228, 233, 204, + 221, 228, 233, 168, 224, 233, 168, 231, 183, 204, + 235, 146, 205, 411, 376, 43, 207, 418, 422, 470, + 471, 202, 376, 237, 202, 410, 460, 474, 476, 415, + 327, 258, 258, 258, 203, 258, 171, 202, 203, 361, + 201, 203, 203, 203, 374, 258, 202, 184, 200, 181, + 190, 197, 193, 202, 208, 203, 208, 202, 203, 208, + 203, 208, 208, 202, 203, 208, 208, 203, 208, 203, + 203, 202, 203, 461, 203, 473, 473, 206, 201, 203, + 202, 203, 202, 202, 202, 202, 257, 411, 202, 265, + 365, 171, 266, 7, 11, 12, 13, 255, 256, 378, + 202, 202, 179, 194, 195, 217, 219, 222, 228, 233, + 228, 233, 233, 233, 168, 225, 168, 232, 183, 204, + 236, 42, 207, 418, 422, 468, 469, 470, 202, 377, + 318, 204, 424, 203, 375, 422, 483, 486, 203, 203, + 203, 258, 203, 412, 203, 258, 201, 258, 203, 167, + 197, 202, 203, 203, 203, 203, 208, 208, 208, 208, + 203, 203, 229, 202, 461, 461, 203, 206, 201, 206, + 203, 202, 327, 479, 201, 203, 484, 8, 278, 281, + 279, 281, 280, 281, 237, 418, 422, 202, 266, 202, + 265, 278, 179, 196, 197, 222, 228, 233, 228, 233, + 233, 233, 168, 226, 259, 202, 470, 166, 7, 11, + 12, 13, 14, 69, 419, 420, 421, 202, 201, 376, + 207, 422, 486, 202, 203, 269, 201, 206, 201, 203, + 272, 201, 327, 412, 412, 258, 203, 203, 384, 197, + 203, 203, 203, 208, 203, 206, 202, 327, 201, 476, + 203, 484, 484, 7, 11, 12, 13, 14, 69, 88, + 207, 251, 252, 253, 254, 260, 264, 278, 302, 204, + 282, 282, 207, 280, 282, 202, 266, 36, 207, 302, + 385, 386, 228, 233, 233, 233, 168, 227, 202, 265, + 202, 377, 201, 201, 269, 206, 203, 203, 272, 203, + 258, 203, 206, 203, 201, 203, 202, 203, 261, 203, + 477, 258, 265, 265, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 283, 286, 295, 295, 106, 114, + 139, 140, 288, 291, 295, 202, 385, 302, 204, 387, + 233, 266, 202, 207, 470, 479, 202, 202, 203, 261, + 203, 203, 203, 203, 202, 203, 203, 293, 203, 203, + 203, 203, 202, 203, 203, 206, 327, 258, 206, 201, + 266, 202, 20, 22, 237, 252, 284, 296, 297, 300, + 301, 284, 21, 237, 252, 285, 298, 299, 300, 285, + 237, 252, 287, 300, 237, 260, 294, 300, 202, 237, + 289, 296, 300, 284, 237, 290, 298, 300, 290, 237, + 292, 300, 302, 202, 476, 258, 258, 258, 203, 258, + 201, 203, 258, 201, 258, 258, 203, 258, 201, 203, + 258, 258, 258, 203, 258, 258, 258, 203, 258, 258, + 203, 258, 258, 258, 203, 258, 258, 258, 258, 206, + 202, 202, 252, 300, 168, 252, 179, 252, 300, 168, + 252, 252, 260, 300, 300, 477, 258, 203, 258, 203, + 258, 202, 258, 203, 258, 202, 258, 258, 258, 258, + 258, 252, 257, 252, 258, 202, 258 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint16 yyr1[] = +{ + 0, 163, 164, 164, 164, 164, 164, 164, 164, 164, + 164, 164, 165, 165, 165, 165, 165, 165, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, + 166, 166, 167, 168, 168, 169, 170, 171, 171, 172, + 172, 173, 174, 175, 176, 177, 177, 178, 178, 179, + 179, 179, 179, 180, 180, 181, 182, 183, 183, 183, + 184, 184, 185, 186, 187, 188, 189, 189, 190, 190, + 191, 192, 193, 194, 194, 194, 195, 196, 197, 197, + 198, 199, 199, 200, 200, 201, 201, 202, 202, 203, + 204, 205, 206, 206, 207, 207, 207, 208, 208, 208, + 209, 209, 210, 210, 210, 211, 211, 211, 211, 212, + 213, 214, 215, 216, 217, 217, 217, 217, 217, 217, + 217, 217, 217, 217, 217, 217, 217, 217, 217, 218, + 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, + 218, 218, 218, 218, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 229, 230, 231, 232, 233, + 234, 235, 235, 236, 236, 237, 238, 238, 238, 238, + 238, 238, 238, 239, 240, 241, 241, 242, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 251, 252, + 253, 254, 254, 254, 254, 254, 255, 256, 256, 256, + 256, 257, 258, 258, 259, 260, 261, 261, 262, 262, + 263, 263, 264, 264, 265, 266, 267, 267, 267, 268, + 269, 269, 269, 269, 270, 271, 272, 272, 272, 273, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 275, + 275, 275, 276, 276, 277, 277, 277, 278, 279, 280, + 281, 282, 283, 283, 283, 283, 283, 283, 283, 283, + 283, 284, 284, 284, 284, 284, 284, 284, 284, 285, + 285, 285, 285, 285, 285, 285, 285, 286, 286, 287, + 287, 287, 287, 288, 288, 288, 288, 288, 288, 288, + 288, 288, 289, 289, 289, 289, 290, 290, 290, 290, + 291, 291, 292, 292, 293, 293, 294, 294, 294, 294, + 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, + 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, + 295, 295, 295, 295, 295, 295, 295, 295, 295, 295, + 295, 295, 295, 295, 295, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 303, 304, 305, 305, 306, 306, + 307, 308, 308, 309, 310, 311, 312, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 324, 324, 325, 325, 326, 327, 327, 328, 328, 329, + 330, 330, 330, 330, 331, 332, 333, 334, 335, 335, + 336, 337, 337, 338, 338, 339, 339, 340, 341, 341, + 341, 342, 342, 343, 344, 345, 346, 347, 347, 348, + 349, 349, 350, 351, 351, 351, 352, 353, 353, 353, + 353, 354, 355, 356, 357, 358, 358, 359, 359, 360, + 361, 361, 361, 361, 362, 363, 363, 364, 365, 366, + 367, 367, 368, 369, 370, 371, 371, 372, 373, 374, + 374, 375, 376, 377, 378, 379, 379, 380, 381, 382, + 382, 383, 384, 384, 384, 384, 384, 385, 386, 387, + 388, 388, 389, 390, 390, 390, 391, 392, 392, 393, + 394, 394, 395, 396, 397, 398, 398, 399, 400, 401, + 402, 402, 402, 402, 402, 403, 403, 404, 405, 406, + 406, 407, 408, 409, 410, 411, 411, 412, 412, 412, + 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, + 421, 421, 421, 421, 421, 422, 423, 424, 425, 426, + 427, 428, 429, 430, 431, 432, 433, 433, 434, 435, + 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, + 446, 447, 447, 447, 447, 447, 448, 449, 450, 450, + 450, 451, 451, 452, 453, 453, 454, 454, 454, 455, + 456, 456, 457, 458, 458, 458, 458, 458, 458, 458, + 458, 458, 458, 458, 458, 458, 458, 458, 459, 459, + 459, 459, 459, 459, 459, 459, 460, 461, 461, 461, + 461, 461, 461, 461, 462, 463, 464, 465, 466, 467, + 468, 469, 470, 471, 472, 473, 473, 473, 473, 473, + 474, 475, 476, 476, 476, 477, 477, 477, 477, 478, + 479, 480, 481, 482, 483, 483, 484, 484, 484, 484, + 485, 486 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 2, 1, 1, 0, + 1, 3, 1, 1, 2, 2, 2, 0, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 2, 4, 6, + 0, 1, 1, 1, 1, 3, 3, 1, 2, 1, + 1, 1, 1, 3, 4, 2, 1, 1, 1, 1, + 1, 3, 2, 0, 2, 1, 1, 1, 1, 1, + 1, 1, 0, 2, 1, 2, 1, 0, 3, 2, + 1, 1, 3, 2, 1, 1, 3, 4, 3, 6, + 1, 4, 1, 1, 1, 1, 1, 1, 3, 3, + 3, 3, 3, 3, 5, 5, 5, 5, 7, 2, + 2, 2, 2, 4, 4, 4, 4, 4, 4, 6, + 6, 6, 6, 8, 4, 1, 1, 10, 1, 1, + 1, 1, 1, 7, 0, 2, 1, 1, 1, 6, + 1, 1, 1, 1, 1, 7, 0, 2, 4, 6, + 2, 4, 2, 1, 1, 1, 1, 1, 1, 4, + 1, 1, 4, 1, 1, 4, 1, 1, 1, 1, + 7, 1, 1, 1, 1, 1, 7, 1, 1, 1, + 1, 7, 0, 3, 7, 5, 0, 3, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, + 0, 3, 3, 2, 10, 10, 0, 3, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 6, 7, 6, + 1, 1, 1, 1, 3, 1, 3, 1, 3, 1, + 3, 2, 4, 6, 4, 2, 4, 2, 2, 2, + 4, 6, 4, 2, 4, 2, 2, 1, 3, 2, + 2, 4, 2, 1, 1, 3, 1, 3, 1, 3, + 1, 3, 2, 4, 2, 2, 2, 4, 2, 2, + 1, 3, 2, 2, 0, 2, 2, 2, 4, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 6, 1, 4, 1, + 4, 1, 1, 1, 1, 7, 5, 3, 0, 3, + 7, 3, 3, 1, 1, 5, 0, 3, 1, 1, + 1, 4, 1, 1, 1, 5, 1, 4, 1, 1, + 2, 3, 0, 2, 5, 0, 2, 1, 1, 1, + 1, 1, 1, 1, 8, 8, 10, 10, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 9, 0, 3, + 3, 1, 1, 1, 1, 1, 6, 1, 1, 1, + 4, 2, 7, 1, 1, 1, 1, 0, 2, 3, + 5, 4, 1, 1, 10, 1, 1, 1, 1, 7, + 0, 2, 4, 2, 9, 1, 1, 1, 1, 8, + 2, 3, 1, 1, 5, 1, 1, 1, 7, 0, + 3, 1, 1, 1, 1, 1, 1, 8, 10, 1, + 1, 10, 0, 3, 7, 5, 2, 5, 1, 1, + 1, 1, 5, 1, 1, 1, 8, 1, 1, 5, + 1, 1, 8, 1, 5, 1, 1, 8, 1, 5, + 0, 3, 5, 3, 3, 1, 1, 4, 1, 1, + 1, 4, 1, 1, 9, 1, 1, 0, 3, 3, + 3, 1, 1, 5, 1, 1, 9, 1, 5, 1, + 1, 1, 1, 1, 1, 7, 1, 1, 10, 10, + 10, 1, 1, 8, 1, 10, 1, 1, 6, 8, + 1, 10, 6, 1, 10, 6, 1, 10, 6, 1, + 8, 2, 2, 2, 4, 4, 1, 1, 1, 1, + 1, 1, 1, 4, 1, 1, 1, 2, 3, 4, + 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 13, 0, 3, 3, + 3, 5, 3, 2, 1, 1, 4, 1, 4, 1, + 4, 1, 4, 1, 11, 0, 3, 3, 3, 2, + 1, 19, 1, 1, 1, 0, 6, 3, 2, 1, + 1, 9, 1, 9, 1, 1, 0, 3, 3, 2, + 1, 7 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (context, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, context); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, pj_wkt2_parse_context *context) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (context); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, pj_wkt2_parse_context *context) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep, context); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, pj_wkt2_parse_context *context) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , context); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule, context); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr && yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, + yytype_int16 *yyssp, int yytoken) +{ + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat. */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Number of reported tokens (one for the "unexpected", one per + "expected"). */ + int yycount = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[*yyssp]; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (! (yysize <= yysize1 + && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + YYCASE_(0, YY_("syntax error")); + YYCASE_(1, YY_("syntax error, unexpected %s")); + YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); + YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); + YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); + YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); +# undef YYCASE_ + } + + { + YYSIZE_T yysize1 = yysize + yystrlen (yyformat); + if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) + return 2; + yysize = yysize1; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + yyp++; + yyformat++; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, pj_wkt2_parse_context *context) +{ + YYUSE (yyvaluep); + YYUSE (context); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (pj_wkt2_parse_context *context) +{ +/* The lookahead symbol. */ +int yychar; + + +/* The semantic value of the lookahead symbol. */ +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); + + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = (yytype_int16)yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (&yylval, context); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + + + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (context, YY_("syntax error")); +#else +# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ + yyssp, yytoken) + { + char const *yymsgp = YY_("syntax error"); + int yysyntax_error_status; + yysyntax_error_status = YYSYNTAX_ERROR; + if (yysyntax_error_status == 0) + yymsgp = yymsg; + else if (yysyntax_error_status == 1) + { + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (context, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, context); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +#if 0 +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +#endif +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp, context); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (context, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, context); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, context); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} diff --git a/src/pj_wkt2_generated_parser.h b/src/pj_wkt2_generated_parser.h new file mode 100644 index 00000000..f9d17ea0 --- /dev/null +++ b/src/pj_wkt2_generated_parser.h @@ -0,0 +1,208 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef YY_PJ_WKT2_SRC_PJ_WKT2_GENERATED_PARSER_H_INCLUDED +# define YY_PJ_WKT2_SRC_PJ_WKT2_GENERATED_PARSER_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int pj_wkt2_debug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + END = 0, + T_PROJECTION = 258, + T_DATUM = 259, + T_SPHEROID = 260, + T_PRIMEM = 261, + T_UNIT = 262, + T_AXIS = 263, + T_PARAMETER = 264, + T_GEODCRS = 265, + T_LENGTHUNIT = 266, + T_ANGLEUNIT = 267, + T_SCALEUNIT = 268, + T_TIMEUNIT = 269, + T_ELLIPSOID = 270, + T_CS = 271, + T_ID = 272, + T_PROJCRS = 273, + T_BASEGEODCRS = 274, + T_MERIDIAN = 275, + T_BEARING = 276, + T_ORDER = 277, + T_ANCHOR = 278, + T_CONVERSION = 279, + T_METHOD = 280, + T_REMARK = 281, + T_GEOGCRS = 282, + T_BASEGEOGCRS = 283, + T_SCOPE = 284, + T_AREA = 285, + T_BBOX = 286, + T_CITATION = 287, + T_URI = 288, + T_VERTCRS = 289, + T_VDATUM = 290, + T_GEOIDMODEL = 291, + T_COMPOUNDCRS = 292, + T_PARAMETERFILE = 293, + T_COORDINATEOPERATION = 294, + T_SOURCECRS = 295, + T_TARGETCRS = 296, + T_INTERPOLATIONCRS = 297, + T_OPERATIONACCURACY = 298, + T_CONCATENATEDOPERATION = 299, + T_STEP = 300, + T_BOUNDCRS = 301, + T_ABRIDGEDTRANSFORMATION = 302, + T_DERIVINGCONVERSION = 303, + T_TDATUM = 304, + T_CALENDAR = 305, + T_TIMEORIGIN = 306, + T_TIMECRS = 307, + T_VERTICALEXTENT = 308, + T_TIMEEXTENT = 309, + T_USAGE = 310, + T_DYNAMIC = 311, + T_FRAMEEPOCH = 312, + T_MODEL = 313, + T_VELOCITYGRID = 314, + T_ENSEMBLE = 315, + T_MEMBER = 316, + T_ENSEMBLEACCURACY = 317, + T_DERIVEDPROJCRS = 318, + T_BASEPROJCRS = 319, + T_EDATUM = 320, + T_ENGCRS = 321, + T_PDATUM = 322, + T_PARAMETRICCRS = 323, + T_PARAMETRICUNIT = 324, + T_BASEVERTCRS = 325, + T_BASEENGCRS = 326, + T_BASEPARAMCRS = 327, + T_BASETIMECRS = 328, + T_EPOCH = 329, + T_COORDEPOCH = 330, + T_COORDINATEMETADATA = 331, + T_POINTMOTIONOPERATION = 332, + T_GEODETICCRS = 333, + T_GEODETICDATUM = 334, + T_PROJECTEDCRS = 335, + T_PRIMEMERIDIAN = 336, + T_GEOGRAPHICCRS = 337, + T_TRF = 338, + T_VERTICALCRS = 339, + T_VERTICALDATUM = 340, + T_VRF = 341, + T_TIMEDATUM = 342, + T_TEMPORALQUANTITY = 343, + T_ENGINEERINGDATUM = 344, + T_ENGINEERINGCRS = 345, + T_PARAMETRICDATUM = 346, + T_AFFINE = 347, + T_CARTESIAN = 348, + T_CYLINDRICAL = 349, + T_ELLIPSOIDAL = 350, + T_LINEAR = 351, + T_PARAMETRIC = 352, + T_POLAR = 353, + T_SPHERICAL = 354, + T_VERTICAL = 355, + T_TEMPORAL = 356, + T_TEMPORALCOUNT = 357, + T_TEMPORALMEASURE = 358, + T_ORDINAL = 359, + T_TEMPORALDATETIME = 360, + T_NORTH = 361, + T_NORTHNORTHEAST = 362, + T_NORTHEAST = 363, + T_EASTNORTHEAST = 364, + T_EAST = 365, + T_EASTSOUTHEAST = 366, + T_SOUTHEAST = 367, + T_SOUTHSOUTHEAST = 368, + T_SOUTH = 369, + T_SOUTHSOUTHWEST = 370, + T_SOUTHWEST = 371, + T_WESTSOUTHWEST = 372, + T_WEST = 373, + T_WESTNORTHWEST = 374, + T_NORTHWEST = 375, + T_NORTHNORTHWEST = 376, + T_UP = 377, + T_DOWN = 378, + T_GEOCENTRICX = 379, + T_GEOCENTRICY = 380, + T_GEOCENTRICZ = 381, + T_COLUMNPOSITIVE = 382, + T_COLUMNNEGATIVE = 383, + T_ROWPOSITIVE = 384, + T_ROWNEGATIVE = 385, + T_DISPLAYRIGHT = 386, + T_DISPLAYLEFT = 387, + T_DISPLAYUP = 388, + T_DISPLAYDOWN = 389, + T_FORWARD = 390, + T_AFT = 391, + T_PORT = 392, + T_STARBOARD = 393, + T_CLOCKWISE = 394, + T_COUNTERCLOCKWISE = 395, + T_TOWARDS = 396, + T_AWAYFROM = 397, + T_FUTURE = 398, + T_PAST = 399, + T_UNSPECIFIED = 400, + T_STRING = 401, + T_UNSIGNED_INTEGER_DIFFERENT_ONE_TWO_THREE = 402 + }; +#endif + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef int YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + + +int pj_wkt2_parse (pj_wkt2_parse_context *context); + +#endif /* !YY_PJ_WKT2_SRC_PJ_WKT2_GENERATED_PARSER_H_INCLUDED */ diff --git a/src/pj_wkt2_grammar.y b/src/pj_wkt2_grammar.y new file mode 100644 index 00000000..52adfadd --- /dev/null +++ b/src/pj_wkt2_grammar.y @@ -0,0 +1,1499 @@ +%{ +/****************************************************************************** + * Project: PROJ + * Purpose: WKT2 parser grammar + * Author: Even Rouault, <even.rouault at spatialys.com> + * + ****************************************************************************** + * Copyright (c) 2018 Even Rouault, <even.rouault at spatialys.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + ****************************************************************************/ + +#include "pj_wkt2_parser.h" + +%} + +%define api.pure +%define parse.error verbose +%require "3.0" + +%parse-param {pj_wkt2_parse_context *context} +%lex-param {pj_wkt2_parse_context *context} + +/* From WKT1 */ +%token T_PROJECTION "PROJECTION" +%token T_DATUM "DATUM" +%token T_SPHEROID "SPHEROID" +%token T_PRIMEM "PRIMEM" +%token T_UNIT "UNIT" +%token T_AXIS "AXIS" +%token T_PARAMETER "PARAMETER" + +/* WKT2 preferred */ +%token T_GEODCRS "GEODCRS"; +%token T_LENGTHUNIT "LENGTHUNIT"; +%token T_ANGLEUNIT "ANGLEUNIT"; +%token T_SCALEUNIT "SCALEUNIT"; +%token T_TIMEUNIT "TIMEUNIT"; +%token T_ELLIPSOID "ELLIPSOID"; +%token T_CS "CS"; +%token T_ID "ID"; +%token T_PROJCRS "PROJCRS"; +%token T_BASEGEODCRS "BASEGEODCRS"; +%token T_MERIDIAN "MERIDIAN"; +%token T_BEARING "BEARING"; +%token T_ORDER "ORDER"; +%token T_ANCHOR "ANCHOR"; +%token T_CONVERSION "CONVERSION"; +%token T_METHOD "METHOD"; +%token T_REMARK "REMARK"; +%token T_GEOGCRS "GEOGCRS"; +%token T_BASEGEOGCRS "BASEGEOGCRS"; +%token T_SCOPE "SCOPE"; +%token T_AREA "AREA"; +%token T_BBOX "BBOX"; +%token T_CITATION "CITATION"; +%token T_URI "URI"; +%token T_VERTCRS "VERTCRS"; +%token T_VDATUM "VDATUM"; +%token T_GEOIDMODEL "GEOIDMODEL"; +%token T_COMPOUNDCRS "COMPOUNDCRS"; +%token T_PARAMETERFILE "PARAMETERFILE"; +%token T_COORDINATEOPERATION "COORDINATEOPERATION"; +%token T_SOURCECRS "SOURCECRS"; +%token T_TARGETCRS "TARGETCRS"; +%token T_INTERPOLATIONCRS "INTERPOLATIONCRS"; +%token T_OPERATIONACCURACY "OPERATIONACCURACY"; +%token T_CONCATENATEDOPERATION "CONCATENATEDOPERATION"; +%token T_STEP "STEP"; +%token T_BOUNDCRS "BOUNDCRS"; +%token T_ABRIDGEDTRANSFORMATION "ABRIDGEDTRANSFORMATION"; +%token T_DERIVINGCONVERSION "DERIVINGCONVERSION"; +%token T_TDATUM "TDATUM"; +%token T_CALENDAR "CALENDAR"; +%token T_TIMEORIGIN "TIMEORIGIN"; +%token T_TIMECRS "TIMECRS"; +%token T_VERTICALEXTENT "VERTICALEXTENT"; +%token T_TIMEEXTENT "TIMEEXTENT"; +%token T_USAGE "USAGE"; +%token T_DYNAMIC "DYNAMIC"; +%token T_FRAMEEPOCH "FRAMEEPOCH"; +%token T_MODEL "MODEL"; +%token T_VELOCITYGRID "VELOCITYGRID"; +%token T_ENSEMBLE "ENSEMBLE"; +%token T_MEMBER "MEMBER"; +%token T_ENSEMBLEACCURACY "ENSEMBLEACCURACY"; +%token T_DERIVEDPROJCRS "DERIVEDPROJCRS"; +%token T_BASEPROJCRS "BASEPROJCRS"; +%token T_EDATUM "EDATUM"; +%token T_ENGCRS "ENGCRS"; +%token T_PDATUM "PDATUM"; +%token T_PARAMETRICCRS "PARAMETRICCRS"; +%token T_PARAMETRICUNIT "PARAMETRICUNIT"; +%token T_BASEVERTCRS "BASEVERTCRS"; +%token T_BASEENGCRS "BASEENGCRS"; +%token T_BASEPARAMCRS "BASEPARAMCRS"; +%token T_BASETIMECRS "BASETIMECRS"; +%token T_EPOCH "EPOCH" +%token T_COORDEPOCH "COORDEPOCH" +%token T_COORDINATEMETADATA "COORDINATEMETADATA" +%token T_POINTMOTIONOPERATION "POINTMOTIONOPERATION" + +/* WKT2 alternate (longer or shorter) */ +%token T_GEODETICCRS "GEODETICCRS"; +%token T_GEODETICDATUM "GEODETICDATUM"; +%token T_PROJECTEDCRS "PROJECTEDCRS"; +%token T_PRIMEMERIDIAN "PRIMEMERIDIAN"; +%token T_GEOGRAPHICCRS "GEOGRAPHICCRS"; +%token T_TRF "TRF"; +%token T_VERTICALCRS "VERTICALCRS"; +%token T_VERTICALDATUM "VERTICALDATUM"; +%token T_VRF "VRF"; +%token T_TIMEDATUM "TIMEDATUM"; +%token T_TEMPORALQUANTITY "TEMPORALQUANTITY"; +%token T_ENGINEERINGDATUM "ENGINEERINGDATUM"; +%token T_ENGINEERINGCRS "ENGINEERINGCRS"; +%token T_PARAMETRICDATUM "PARAMETRICDATUM"; + + +/* CS types */ +%token T_AFFINE "affine"; +%token T_CARTESIAN "Cartesian"; +%token T_CYLINDRICAL "cylindrical"; +%token T_ELLIPSOIDAL "ellipsoidal"; +%token T_LINEAR "linear"; +%token T_PARAMETRIC "parametric"; +%token T_POLAR "polar"; +%token T_SPHERICAL "spherical"; +%token T_VERTICAL "vertical"; +%token T_TEMPORAL "temporal"; // WKT2_2015 only +%token T_TEMPORALCOUNT "temporalCount"; +%token T_TEMPORALMEASURE "temporalMeasure"; +%token T_ORDINAL "ordinal"; +%token T_TEMPORALDATETIME "temporalDateTime"; + +/* Axis directions */ +%token T_NORTH "north"; +%token T_NORTHNORTHEAST "northNorthEast"; +%token T_NORTHEAST "northEast"; +%token T_EASTNORTHEAST "eastNorthEast"; +%token T_EAST "east"; +%token T_EASTSOUTHEAST "eastSouthEast"; +%token T_SOUTHEAST "southEast"; +%token T_SOUTHSOUTHEAST "southSouthEast"; +%token T_SOUTH "south"; +%token T_SOUTHSOUTHWEST "southSouthWest"; +%token T_SOUTHWEST "southWest"; +%token T_WESTSOUTHWEST "westSouthWest"; +%token T_WEST "west"; +%token T_WESTNORTHWEST "westNorthWest"; +%token T_NORTHWEST "northWest"; +%token T_NORTHNORTHWEST "northNorthWest"; +%token T_UP "up"; +%token T_DOWN "down"; +%token T_GEOCENTRICX "geocentricX"; +%token T_GEOCENTRICY "geocentricY"; +%token T_GEOCENTRICZ "geocentricZ"; +%token T_COLUMNPOSITIVE "columnPositive"; +%token T_COLUMNNEGATIVE "columnNegative"; +%token T_ROWPOSITIVE "rowPositive"; +%token T_ROWNEGATIVE "rowNegative"; +%token T_DISPLAYRIGHT "displayRight"; +%token T_DISPLAYLEFT "displayLeft"; +%token T_DISPLAYUP "displayUp"; +%token T_DISPLAYDOWN "displayDown"; +%token T_FORWARD "forward"; +%token T_AFT "aft"; +%token T_PORT "port"; +%token T_STARBOARD "starboard"; +%token T_CLOCKWISE "clockwise"; +%token T_COUNTERCLOCKWISE "counterClockwise"; +%token T_TOWARDS "towards"; +%token T_AWAYFROM "awayFrom"; +%token T_FUTURE "future"; +%token T_PAST "part"; +%token T_UNSPECIFIED "unspecified"; + + +%token T_STRING "string" +%token T_UNSIGNED_INTEGER_DIFFERENT_ONE_TWO_THREE "unsigned integer" + +%token END 0 "end of string" + +%% + +/* Derived from BNF grammar in OGC 18-010r3 (WKT2:2018), with a few back + additions from GC 12-063r5 (WKT2:2015) */ + +input: + identifier | ellipsoid | datum | crs | bound_crs | coordinate_metadata | + coordinate_operation | point_motion_operation | concatenated_operation | + map_projection + +datum: + geodetic_reference_frame_without_pm | datum_ensemble | + vertical_reference_frame | engineering_datum | parametric_datum | + temporal_datum + +crs: + geodetic_crs | projected_crs | vertical_crs | engineering_crs | + parametric_crs | temporal_crs | derived_geodetic_crs | derived_geographic_crs | + derived_projected_crs | derived_vertical_crs | derived_engineering_crs | + derived_parametric_crs | derived_temporal_crs | compound_crs + +// Basic characters + +period: '.' + +// Numbers + +number: signed_numeric_literal_with_sign | unsigned_numeric_literal + +signed_numeric_literal_with_sign: sign unsigned_numeric_literal + +signed_numeric_literal: opt_sign unsigned_numeric_literal + +unsigned_numeric_literal: exact_numeric_literal | approximate_numeric_literal + +opt_sign: | sign + +approximate_numeric_literal: mantissa 'E' exponent + +mantissa: exact_numeric_literal + +exponent: signed_integer + +signed_integer: opt_sign unsigned_integer + +exact_numeric_literal: unsigned_integer opt_period_unsigned_integer | period unsigned_integer + +opt_period_unsigned_integer: | period unsigned_integer + +unsigned_integer: '1' | '2' | '3' | T_UNSIGNED_INTEGER_DIFFERENT_ONE_TWO_THREE + +sign: '+' | '-' + +// Date and time + +colon: ':' + +hyphen: '-' + +// Significantly modified to avoid shift-reduce ambiguities for Bison +datetime: + year opt_24_hour_clock + | year hyphen unsigned_integer opt_24_hour_clock + | year hyphen month hyphen day opt_24_hour_clock + +opt_24_hour_clock: | _24_hour_clock + +year: unsigned_integer + +month: unsigned_integer + +day: unsigned_integer + +_24_hour_clock: time_designator hour + opt_colon_minute_colon_second_time_zone_designator + +opt_colon_minute_colon_second_time_zone_designator: + colon minute opt_colon_second_time_zone_designator + | time_zone_designator + +opt_colon_second_time_zone_designator: + colon second_time_zone_designator + | time_zone_designator + +time_designator: 'T' + +hour: unsigned_integer + +minute: unsigned_integer + +second_time_zone_designator: + seconds_integer period time_zone_designator + | seconds_integer period seconds_fraction time_zone_designator + | seconds_integer time_zone_designator + +seconds_integer: unsigned_integer + +seconds_fraction: unsigned_integer + +time_zone_designator: utc_designator | local_time_zone_designator + +utc_designator: 'Z' + +local_time_zone_designator: + sign hour opt_colon_minute + | hour opt_colon_minute + +opt_colon_minute: | colon minute + + +// CRS WKT characters + +left_delimiter: '[' | '(' + +right_delimiter: ']' | ')' + +wkt_separator: ',' + +quoted_latin_text: T_STRING + +quoted_unicode_text: T_STRING + +// Scope, extent, identifier and remark + +opt_separator_scope_extent_identifier_remark: + | wkt_separator no_opt_separator_scope_extent_identifier_remark + +no_opt_separator_scope_extent_identifier_remark: + scope_extent_opt_identifier_list_opt_remark + | identifier opt_identifier_list_remark + | remark + +opt_identifier_list_remark: | wkt_separator identifier opt_identifier_list_remark + | wkt_separator remark + +scope_extent_opt_identifier_list_opt_remark: + scope_extent_opt_identifier_list_remark + | usage_list_opt_identifier_list_remark + +// WKT2-2015 way +scope_extent_opt_identifier_list_remark: + scope wkt_separator extent_opt_identifier_list_remark + | scope opt_identifier_list_remark + | extent_opt_identifier_list_remark + +// WKT2-2018 way +usage_list_opt_identifier_list_remark: + usage + | usage wkt_separator remark + | usage wkt_separator identifier opt_identifier_list_remark + | usage wkt_separator usage_list_opt_identifier_list_remark + +usage: usage_keyword left_delimiter + scope wkt_separator extent + right_delimiter + +usage_keyword: T_USAGE + +scope: scope_keyword left_delimiter + scope_text_description right_delimiter + +scope_keyword: T_SCOPE + +scope_text_description: quoted_latin_text + +extent: + area_description + | geographic_bounding_box + | vertical_extent + | temporal_extent + | area_description wkt_separator geographic_bounding_box + | area_description wkt_separator vertical_extent + | area_description wkt_separator temporal_extent + | geographic_bounding_box wkt_separator vertical_extent + | geographic_bounding_box wkt_separator temporal_extent + | vertical_extent wkt_separator temporal_extent + | area_description wkt_separator geographic_bounding_box wkt_separator vertical_extent + | area_description wkt_separator geographic_bounding_box wkt_separator temporal_extent + | area_description wkt_separator vertical_extent wkt_separator temporal_extent + | geographic_bounding_box wkt_separator vertical_extent wkt_separator temporal_extent + | area_description wkt_separator geographic_bounding_box wkt_separator vertical_extent wkt_separator temporal_extent + +extent_opt_identifier_list_remark: + area_description opt_identifier_list_remark + | geographic_bounding_box opt_identifier_list_remark + | vertical_extent opt_identifier_list_remark + | temporal_extent opt_identifier_list_remark + | area_description wkt_separator geographic_bounding_box opt_identifier_list_remark + | area_description wkt_separator vertical_extent opt_identifier_list_remark + | area_description wkt_separator temporal_extent opt_identifier_list_remark + | geographic_bounding_box wkt_separator vertical_extent opt_identifier_list_remark + | geographic_bounding_box wkt_separator temporal_extent opt_identifier_list_remark + | vertical_extent wkt_separator temporal_extent opt_identifier_list_remark + | area_description wkt_separator geographic_bounding_box wkt_separator vertical_extent opt_identifier_list_remark + | area_description wkt_separator geographic_bounding_box wkt_separator temporal_extent opt_identifier_list_remark + | area_description wkt_separator vertical_extent wkt_separator temporal_extent opt_identifier_list_remark + | geographic_bounding_box wkt_separator vertical_extent wkt_separator temporal_extent opt_identifier_list_remark + | area_description wkt_separator geographic_bounding_box wkt_separator vertical_extent wkt_separator temporal_extent opt_identifier_list_remark + +// Area description + +area_description: area_description_keyword left_delimiter area_text_description right_delimiter + +area_description_keyword: T_AREA + +area_text_description: quoted_latin_text + +// Geographic bounding box + +geographic_bounding_box: geographic_bounding_box_keyword left_delimiter + lower_left_latitude wkt_separator lower_left_longitude + wkt_separator upper_right_latitude wkt_separator + upper_right_longitude right_delimiter + +geographic_bounding_box_keyword: T_BBOX + +lower_left_latitude: number + +lower_left_longitude: number + +upper_right_latitude: number + +upper_right_longitude: number + +// Vertical extent + +vertical_extent: vertical_extent_keyword left_delimiter + vertical_extent_minimum_height wkt_separator + vertical_extent_maximum_height + opt_separator_length_unit right_delimiter + +opt_separator_length_unit: + | wkt_separator length_unit + +vertical_extent_keyword: T_VERTICALEXTENT + +vertical_extent_minimum_height: number + +vertical_extent_maximum_height: number + +// Temporal extent + +temporal_extent: temporal_extent_keyword left_delimiter + temporal_extent_start wkt_separator + temporal_extent_end right_delimiter + +temporal_extent_keyword: T_TIMEEXTENT + +temporal_extent_start: datetime | quoted_latin_text + +temporal_extent_end: datetime | quoted_latin_text + + +// Identifier + +identifier: identifier_keyword left_delimiter authority_name + wkt_separator authority_unique_identifier + opt_version_authority_citation_uri + right_delimiter + +opt_version_authority_citation_uri: + | wkt_separator version + | wkt_separator version wkt_separator authority_citation + | wkt_separator version wkt_separator authority_citation wkt_separator id_uri + | wkt_separator authority_citation + | wkt_separator authority_citation wkt_separator id_uri + | wkt_separator id_uri + +identifier_keyword: T_ID + +authority_name: quoted_latin_text + +authority_unique_identifier: number | quoted_latin_text + +version: number | quoted_latin_text + +authority_citation: citation_keyword left_delimiter citation right_delimiter + +citation_keyword: T_CITATION + +citation: quoted_latin_text + +id_uri: uri_keyword left_delimiter uri right_delimiter + +uri_keyword: T_URI + +uri: quoted_latin_text + +// Remark + +remark: remark_keyword left_delimiter quoted_unicode_text right_delimiter + +remark_keyword: T_REMARK + +// Unit + +unit: spatial_unit | time_unit + +//spatial_unit: angle_unit | length_unit | parametric_unit | scale_unit +spatial_unit: angle_or_length_or_parametric_or_scale_unit + +angle_or_length_or_parametric_or_scale_unit: + angle_or_length_or_parametric_or_scale_unit_keyword + left_delimiter unit_name + wkt_separator conversion_factor + opt_separator_identifier_list right_delimiter + +angle_or_length_or_parametric_or_scale_unit_keyword: T_ANGLEUNIT | T_LENGTHUNIT | T_PARAMETRICUNIT | T_SCALEUNIT | T_UNIT + +angle_or_length_or_scale_unit: + angle_or_length_or_scale_unit_keyword + left_delimiter unit_name + wkt_separator conversion_factor + opt_separator_identifier_list right_delimiter + +angle_or_length_or_scale_unit_keyword: T_ANGLEUNIT | T_LENGTHUNIT | T_SCALEUNIT | T_UNIT + + +angle_unit: angle_unit_keyword left_delimiter unit_name + wkt_separator conversion_factor + opt_separator_identifier_list right_delimiter + +opt_separator_identifier_list: + | wkt_separator identifier opt_separator_identifier_list + +length_unit: length_unit_keyword left_delimiter unit_name + wkt_separator conversion_factor + opt_separator_identifier_list right_delimiter + +/* +parametric_unit: parametric_unit_keyword left_delimiter unit_name + wkt_separator conversion_factor + opt_separator_identifier_list right_delimiter +*/ + +/* +scale_unit: scale_unit_keyword left_delimiter unit_name + wkt_separator conversion_factor + opt_separator_identifier_list right_delimiter +*/ + +time_unit: time_unit_keyword left_delimiter unit_name + opt_separator_conversion_factor_identifier_list + right_delimiter + +opt_separator_conversion_factor_identifier_list: + | wkt_separator conversion_factor opt_separator_identifier_list + +angle_unit_keyword: T_ANGLEUNIT | T_UNIT + +length_unit_keyword: T_LENGTHUNIT | T_UNIT + +// parametric_unit_keyword: T_PARAMETRICUNIT + +// scale_unit_keyword: T_SCALEUNIT | T_UNIT + +time_unit_keyword: T_TIMEUNIT | T_TEMPORALQUANTITY + +unit_name: quoted_latin_text + +conversion_factor: unsigned_numeric_literal + + +// Coordinate system + +// coordinate_system: spatial_cs | temporalcountmeasure_cs | ordinatedatetime_cs + +coordinate_system_scope_extent_identifier_remark: spatial_cs_scope_extent_identifier_remark | temporalcountmeasure_cs_scope_extent_identifier_remark | ordinaldatetime_cs_scope_extent_identifier_remark + +spatial_cs_scope_extent_identifier_remark: cs_keyword left_delimiter spatial_cs_type + wkt_separator dimension + opt_separator_identifier_list + right_delimiter + wkt_separator spatial_axis + opt_separator_spatial_axis_list_opt_separator_cs_unit_scope_extent_identifier_remark + +opt_separator_spatial_axis_list_opt_separator_cs_unit_scope_extent_identifier_remark: + | wkt_separator cs_unit opt_separator_scope_extent_identifier_remark + | wkt_separator spatial_axis opt_separator_spatial_axis_list_opt_separator_cs_unit_scope_extent_identifier_remark + | wkt_separator no_opt_separator_scope_extent_identifier_remark + +temporalcountmeasure_cs_scope_extent_identifier_remark: cs_keyword left_delimiter temporalcountmeasure_cs_type + wkt_separator dimension + opt_separator_identifier_list + right_delimiter + wkt_separator temporalcountmeasure_axis + opt_separator_scope_extent_identifier_remark + +ordinaldatetime_cs_scope_extent_identifier_remark: cs_keyword left_delimiter ordinaldatetime_cs_type + wkt_separator dimension + opt_separator_identifier_list + right_delimiter + wkt_separator ordinaldatetime_axis + opt_separator_ordinaldatetime_axis_list_scope_extent_identifier_remark + +opt_separator_ordinaldatetime_axis_list_scope_extent_identifier_remark: + | wkt_separator ordinaldatetime_axis opt_separator_ordinaldatetime_axis_list_scope_extent_identifier_remark + | wkt_separator no_opt_separator_scope_extent_identifier_remark + +cs_keyword: T_CS + +spatial_cs_type: T_AFFINE | T_CARTESIAN | T_CYLINDRICAL | T_ELLIPSOIDAL | T_LINEAR | T_PARAMETRIC | T_POLAR | T_SPHERICAL | T_VERTICAL + +// T_TEMPORAL: WKT2_2015 +temporalcountmeasure_cs_type: T_TEMPORAL | T_TEMPORALCOUNT | T_TEMPORALMEASURE + +ordinaldatetime_cs_type: T_ORDINAL | T_TEMPORALDATETIME + +dimension: '1' | '2' | '3' + +spatial_axis: axis_keyword left_delimiter axis_name_abbrev + wkt_separator + axis_direction_opt_axis_order_spatial_unit_identifier_list + right_delimiter + +temporalcountmeasure_axis: axis_keyword left_delimiter axis_name_abbrev + wkt_separator + axis_direction_except_n_s_cw_ccw + opt_separator_axis_time_unit_identifier_list + right_delimiter + +ordinaldatetime_axis: axis_keyword left_delimiter axis_name_abbrev + wkt_separator + axis_direction_opt_axis_order_identifier_list + right_delimiter + +axis_keyword: T_AXIS + +// Approximation of <double quote> { <axis name> | <axis abbreviation> | <axis name and abbrev> } <double quote> +axis_name_abbrev: quoted_latin_text + +axis_direction_opt_axis_order_spatial_unit_identifier_list: + axis_direction_except_n_s_cw_ccw_opt_axis_spatial_unit_identifier_list + | T_NORTH + | T_NORTH wkt_separator north_south_options_spatial_unit + | T_SOUTH + | T_SOUTH wkt_separator north_south_options_spatial_unit + | T_CLOCKWISE + | T_CLOCKWISE wkt_separator clockwise_counter_clockwise_options_spatial_unit + | T_COUNTERCLOCKWISE + | T_COUNTERCLOCKWISE wkt_separator clockwise_counter_clockwise_options_spatial_unit + +north_south_options_spatial_unit: + identifier opt_separator_identifier_list + | meridian wkt_separator axis_order opt_separator_identifier_list + | meridian wkt_separator axis_order wkt_separator spatial_unit opt_separator_identifier_list + | meridian wkt_separator spatial_unit opt_separator_identifier_list + | meridian opt_separator_identifier_list + | axis_order wkt_separator spatial_unit opt_separator_identifier_list + | axis_order opt_separator_identifier_list + | spatial_unit opt_separator_identifier_list + +clockwise_counter_clockwise_options_spatial_unit: + identifier opt_separator_identifier_list + | bearing wkt_separator axis_order opt_separator_identifier_list + | bearing wkt_separator axis_order wkt_separator spatial_unit opt_separator_identifier_list + | bearing wkt_separator spatial_unit opt_separator_identifier_list + | bearing opt_separator_identifier_list + | axis_order wkt_separator spatial_unit opt_separator_identifier_list + | axis_order opt_separator_identifier_list + | spatial_unit opt_separator_identifier_list + +axis_direction_except_n_s_cw_ccw_opt_axis_spatial_unit_identifier_list: + axis_direction_except_n_s_cw_ccw + | axis_direction_except_n_s_cw_ccw wkt_separator axis_direction_except_n_s_cw_ccw_opt_axis_spatial_unit_identifier_list_options + +axis_direction_except_n_s_cw_ccw_opt_axis_spatial_unit_identifier_list_options: + identifier opt_separator_identifier_list + | axis_order opt_separator_identifier_list + | axis_order wkt_separator spatial_unit opt_separator_identifier_list + | spatial_unit opt_separator_identifier_list + + + +axis_direction_opt_axis_order_identifier_list: + axis_direction_except_n_s_cw_ccw_opt_axis_identifier_list + | T_NORTH + | T_NORTH wkt_separator north_south_options + | T_SOUTH + | T_SOUTH wkt_separator north_south_options_spatial_unit + | T_CLOCKWISE + | T_CLOCKWISE wkt_separator clockwise_counter_clockwise_options + | T_COUNTERCLOCKWISE + | T_COUNTERCLOCKWISE wkt_separator clockwise_counter_clockwise_options + +north_south_options: + identifier opt_separator_identifier_list + | meridian wkt_separator axis_order opt_separator_identifier_list + | meridian opt_separator_identifier_list + | axis_order opt_separator_identifier_list + +clockwise_counter_clockwise_options: + identifier opt_separator_identifier_list + | bearing wkt_separator axis_order opt_separator_identifier_list + | bearing opt_separator_identifier_list + | axis_order opt_separator_identifier_list + +axis_direction_except_n_s_cw_ccw_opt_axis_identifier_list: + axis_direction_except_n_s_cw_ccw + | axis_direction_except_n_s_cw_ccw wkt_separator axis_direction_except_n_s_cw_ccw_opt_axis_identifier_list_options + +axis_direction_except_n_s_cw_ccw_opt_axis_identifier_list_options: + identifier opt_separator_identifier_list + | axis_order opt_separator_identifier_list + + + + +opt_separator_axis_time_unit_identifier_list: + | wkt_separator axis_direction_except_n_s_cw_ccw_opt_axis_time_unit_identifier_list_options + +axis_direction_except_n_s_cw_ccw_opt_axis_time_unit_identifier_list_options: + identifier opt_separator_identifier_list + | axis_order opt_separator_identifier_list + | axis_order wkt_separator time_unit opt_separator_identifier_list + | time_unit opt_separator_identifier_list + +axis_direction_except_n_s_cw_ccw: + T_NORTHNORTHEAST + | T_NORTHEAST + | T_EASTNORTHEAST + | T_EAST + | T_EASTSOUTHEAST + | T_SOUTHEAST + | T_SOUTHSOUTHEAST + | T_SOUTHSOUTHWEST + | T_SOUTHWEST + | T_WESTSOUTHWEST + | T_WEST + | T_WESTNORTHWEST + | T_NORTHWEST + | T_NORTHNORTHWEST + | T_UP + | T_DOWN + | T_GEOCENTRICX + | T_GEOCENTRICY + | T_GEOCENTRICZ + | T_COLUMNPOSITIVE + | T_COLUMNNEGATIVE + | T_ROWPOSITIVE + | T_ROWNEGATIVE + | T_DISPLAYRIGHT + | T_DISPLAYLEFT + | T_DISPLAYUP + | T_DISPLAYDOWN + | T_FORWARD + | T_AFT + | T_PORT + | T_STARBOARD + | T_TOWARDS + | T_AWAYFROM + | T_FUTURE + | T_PAST + | T_UNSPECIFIED + +meridian: meridian_keyword left_delimiter number + wkt_separator angle_unit right_delimiter + +meridian_keyword: T_MERIDIAN + +bearing: bearing_keyword left_delimiter number right_delimiter + +bearing_keyword: T_BEARING + +axis_order: axis_order_keyword left_delimiter unsigned_integer right_delimiter + +axis_order_keyword: T_ORDER + +cs_unit: unit + +/* +ellipsoidal_2D_coordinate_system: cs_keyword left_delimiter ellipsoidal_2D_cs_type + wkt_separator ellipsoidal_2D_dimension + opt_separator_identifier_list right_delimiter + separator_spatial_axis_list + opt_separator_cs_unit + +ellipsoidal_2D_cs_type: T_ELLIPSOIDAL + +ellipsoidal_2D_dimension: '2' +*/ + +// Datum ensemble + +datum_ensemble: geodetic_datum_ensemble_without_pm | vertical_datum_ensemble + +geodetic_datum_ensemble_without_pm: datum_ensemble_keyword + left_delimiter + datum_ensemble_name + wkt_separator datum_ensemble_member + datum_ensemble_member_list_ellipsoid_accuracy_identifier_list + right_delimiter + +datum_ensemble_member_list_ellipsoid_accuracy_identifier_list: + wkt_separator ellipsoid wkt_separator datum_ensemble_accuracy opt_separator_datum_ensemble_identifier_list + | wkt_separator datum_ensemble_member datum_ensemble_member_list_ellipsoid_accuracy_identifier_list + +opt_separator_datum_ensemble_identifier_list: + | wkt_separator datum_ensemble_identifier opt_separator_datum_ensemble_identifier_list + +vertical_datum_ensemble: datum_ensemble_keyword + left_delimiter + datum_ensemble_name + wkt_separator datum_ensemble_member + datum_ensemble_member_list_accuracy_identifier_list + right_delimiter + +datum_ensemble_member_list_accuracy_identifier_list: + wkt_separator datum_ensemble_accuracy opt_separator_datum_ensemble_identifier_list + | wkt_separator datum_ensemble_member datum_ensemble_member_list_accuracy_identifier_list + +datum_ensemble_keyword: T_ENSEMBLE + +datum_ensemble_name: quoted_latin_text + +datum_ensemble_member: datum_ensemble_member_keyword left_delimiter + datum_ensemble_member_name + opt_datum_ensemble_member_identifier_list + right_delimiter + +opt_datum_ensemble_member_identifier_list: + | wkt_separator datum_ensemble_member_identifier opt_datum_ensemble_member_identifier_list + +datum_ensemble_member_keyword: T_MEMBER + +datum_ensemble_member_name: quoted_latin_text + +datum_ensemble_member_identifier: identifier + +datum_ensemble_accuracy: datum_ensemble_accuracy_keyword left_delimiter accuracy right_delimiter + +datum_ensemble_accuracy_keyword: T_ENSEMBLEACCURACY + +accuracy: number + +datum_ensemble_identifier: identifier + + +// Dynamic coordinate reference systems + +dynamic_crs: dynamic_crs_keyword left_delimiter frame_reference_epoch + opt_separator_deformation_model_id + right_delimiter + +dynamic_crs_keyword: T_DYNAMIC + +frame_reference_epoch: frame_reference_epoch_keyword left_delimiter + reference_epoch right_delimiter + +frame_reference_epoch_keyword: T_FRAMEEPOCH + +reference_epoch: + unsigned_integer + | unsigned_integer period + | unsigned_integer period unsigned_integer + +opt_separator_deformation_model_id: + | wkt_separator deformation_model_id + +deformation_model_id: deformation_model_id_keyword left_delimiter + deformation_model_name + opt_separator_identifier + right_delimiter + +opt_separator_identifier: + | wkt_separator identifier + +deformation_model_id_keyword: T_MODEL | T_VELOCITYGRID + +deformation_model_name: quoted_latin_text + +// Geodetic CRS + +geodetic_crs: static_geodetic_crs | static_geographic_crs | dynamic_geodetic_crs | dynamic_geographic_crs + +static_geodetic_crs: geodetic_crs_keyword + left_delimiter crs_name + wkt_separator + geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm + wkt_separator + opt_prime_meridian_coordinate_system_scope_extent_identifier_remark + right_delimiter + +static_geographic_crs: geographic_crs_keyword + left_delimiter crs_name + wkt_separator + geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm + wkt_separator + opt_prime_meridian_coordinate_system_scope_extent_identifier_remark + right_delimiter + +dynamic_geodetic_crs: geodetic_crs_keyword + left_delimiter crs_name + wkt_separator dynamic_crs + wkt_separator + geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm + wkt_separator + opt_prime_meridian_coordinate_system_scope_extent_identifier_remark + right_delimiter + +dynamic_geographic_crs: geographic_crs_keyword + left_delimiter crs_name + wkt_separator dynamic_crs + wkt_separator + geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm + wkt_separator + opt_prime_meridian_coordinate_system_scope_extent_identifier_remark + right_delimiter + +opt_prime_meridian_coordinate_system_scope_extent_identifier_remark: + prime_meridian wkt_separator coordinate_system_scope_extent_identifier_remark + | coordinate_system_scope_extent_identifier_remark + +crs_name: quoted_latin_text + +geodetic_crs_keyword: T_GEODCRS | T_GEODETICCRS + +geographic_crs_keyword: T_GEOGCRS | T_GEOGRAPHICCRS + +geodetic_reference_frame_or_geodetic_datum_ensemble_without_pm: + geodetic_reference_frame_without_pm + | geodetic_datum_ensemble_without_pm + +// Ellipsoid + +ellipsoid: ellipsoid_keyword left_delimiter ellipsoid_name + wkt_separator semi_major_axis + wkt_separator inverse_flattening + opt_separator_length_unit_identifier_list + right_delimiter + +opt_separator_length_unit_identifier_list: + | wkt_separator length_unit opt_separator_identifier_list + | wkt_separator identifier opt_separator_identifier_list + +ellipsoid_keyword: T_ELLIPSOID | T_SPHEROID + +ellipsoid_name: quoted_latin_text + +semi_major_axis: unsigned_numeric_literal + +inverse_flattening: unsigned_numeric_literal + +// Prime meridian + +prime_meridian: prime_meridian_keyword left_delimiter + prime_meridian_name wkt_separator + irm_longitude_opt_separator_identifier_list + right_delimiter + +prime_meridian_keyword: T_PRIMEM | T_PRIMEMERIDIAN + +prime_meridian_name: quoted_latin_text + +irm_longitude_opt_separator_identifier_list: + signed_numeric_literal wkt_separator angle_unit opt_separator_identifier_list + | signed_numeric_literal opt_separator_identifier_list + +// Geodetic reference frame + +geodetic_reference_frame_without_pm: geodetic_reference_frame_keyword + left_delimiter datum_name wkt_separator ellipsoid + opt_separator_datum_anchor_identifier_list + right_delimiter + +geodetic_reference_frame_keyword: T_DATUM | T_TRF | T_GEODETICDATUM + +datum_name: quoted_latin_text + +opt_separator_datum_anchor_identifier_list: + | wkt_separator datum_anchor + | wkt_separator identifier opt_separator_identifier_list + | wkt_separator datum_anchor wkt_separator identifier opt_separator_identifier_list + +datum_anchor: datum_anchor_keyword left_delimiter + datum_anchor_description right_delimiter + +datum_anchor_keyword: T_ANCHOR + +datum_anchor_description: quoted_latin_text + +// Projected CRS + +projected_crs: projected_crs_keyword left_delimiter crs_name + wkt_separator base_geodetic_crs + wkt_separator map_projection + wkt_separator coordinate_system_scope_extent_identifier_remark + right_delimiter + +projected_crs_keyword: T_PROJCRS | T_PROJECTEDCRS + +// Base CRS + +base_geodetic_crs: base_static_geodetic_crs | base_dynamic_geodetic_crs + +base_static_geodetic_crs: base_geodetic_crs_keyword left_delimiter base_crs_name + wkt_separator geodetic_reference_frame_without_pm + opt_separator_pm_ellipsoidal_cs_unit + right_delimiter + +opt_separator_pm_ellipsoidal_cs_unit: + | wkt_separator prime_meridian + | wkt_separator prime_meridian wkt_separator ellipsoidal_cs_unit + | wkt_separator ellipsoidal_cs_unit + +base_dynamic_geodetic_crs: base_geodetic_crs_keyword left_delimiter base_crs_name + wkt_separator dynamic_crs + wkt_separator geodetic_reference_frame_without_pm + opt_separator_pm_ellipsoidal_cs_unit + right_delimiter + +base_geodetic_crs_keyword: T_BASEGEODCRS | T_BASEGEOGCRS + +base_crs_name: quoted_latin_text + +ellipsoidal_cs_unit: angle_unit + +// Map projection + +map_projection: map_projection_keyword left_delimiter + map_projection_name + wkt_separator map_projection_method + wkt_separator + parameter_list_identifier_list + right_delimiter + +parameter_list_identifier_list: + map_projection_parameter opt_separator_identifier_list + | map_projection_parameter wkt_separator parameter_list_identifier_list + +map_projection_keyword: T_CONVERSION + +map_projection_name: quoted_latin_text + +map_projection_method: map_projection_method_keyword left_delimiter + map_projection_method_name + opt_separator_identifier_list right_delimiter + +map_projection_method_keyword: T_METHOD | T_PROJECTION + +map_projection_method_name: quoted_latin_text + +map_projection_parameter: parameter_keyword left_delimiter parameter_name + wkt_separator parameter_value + opt_separator_param_unit_identifier_list + right_delimiter + +opt_separator_param_unit_identifier_list: + | wkt_separator map_projection_parameter_unit opt_separator_identifier_list + +parameter_keyword: T_PARAMETER + +parameter_name: quoted_latin_text + +parameter_value: signed_numeric_literal + +map_projection_parameter_unit: angle_or_length_or_scale_unit + +// Vertical CRS + +vertical_crs: static_vertical_crs | dynamic_vertical_crs + +static_vertical_crs: vertical_crs_keyword left_delimiter crs_name + wkt_separator vertical_reference_frame_or_vertical_datum_ensemble + wkt_separator + vertical_cs_opt_geoid_model_id_scope_extent_identifier_remark + right_delimiter + +dynamic_vertical_crs: vertical_crs_keyword left_delimiter crs_name + wkt_separator dynamic_crs + wkt_separator vertical_reference_frame_or_vertical_datum_ensemble + wkt_separator + vertical_cs_opt_geoid_model_id_scope_extent_identifier_remark + right_delimiter + +vertical_reference_frame_or_vertical_datum_ensemble: vertical_reference_frame | vertical_datum_ensemble + +vertical_cs_opt_geoid_model_id_scope_extent_identifier_remark: + cs_keyword left_delimiter spatial_cs_type + wkt_separator dimension + opt_separator_identifier_list + right_delimiter + wkt_separator spatial_axis + opt_separator_cs_unit_opt_geoid_model_id_scope_extent_identifier_remark + +opt_separator_cs_unit_opt_geoid_model_id_scope_extent_identifier_remark: + | wkt_separator cs_unit opt_separator_scope_extent_identifier_remark + | wkt_separator cs_unit wkt_separator geoid_model_id wkt_separator cs_unit opt_separator_scope_extent_identifier_remark + | wkt_separator geoid_model_id wkt_separator cs_unit opt_separator_scope_extent_identifier_remark + | wkt_separator no_opt_separator_scope_extent_identifier_remark + +geoid_model_id: geoid_model_keyword left_delimiter + geoid_model_name opt_separator_identifier + right_delimiter + +geoid_model_keyword: T_GEOIDMODEL + +geoid_model_name: quoted_latin_text + +vertical_crs_keyword: T_VERTCRS | T_VERTICALCRS + +// Vertical reference frame + +vertical_reference_frame: vertical_reference_frame_keyword left_delimiter + datum_name + opt_separator_datum_anchor_identifier_list + right_delimiter + +vertical_reference_frame_keyword: T_VDATUM | T_VRF | T_VERTICALDATUM + +// Engineering CRS + +engineering_crs: engineering_crs_keyword left_delimiter crs_name + wkt_separator engineering_datum + wkt_separator coordinate_system_scope_extent_identifier_remark + right_delimiter + +engineering_crs_keyword: T_ENGCRS | T_ENGINEERINGCRS + +engineering_datum: engineering_datum_keyword left_delimiter datum_name + opt_separator_datum_anchor_identifier_list + right_delimiter + +engineering_datum_keyword: T_EDATUM | T_ENGINEERINGDATUM + +// Parametric CRS + +parametric_crs: parametric_crs_keyword left_delimiter crs_name + wkt_separator parametric_datum + wkt_separator coordinate_system_scope_extent_identifier_remark + right_delimiter + +parametric_crs_keyword: T_PARAMETRICCRS + +parametric_datum: parametric_datum_keyword left_delimiter datum_name + opt_separator_datum_anchor_identifier_list + right_delimiter + +parametric_datum_keyword: T_PDATUM | T_PARAMETRICDATUM + +// Temporal CRS + +temporal_crs: temporal_crs_keyword left_delimiter crs_name + wkt_separator temporal_datum + wkt_separator coordinate_system_scope_extent_identifier_remark + right_delimiter + +temporal_crs_keyword: T_TIMECRS + +temporal_datum: temporal_datum_keyword left_delimiter datum_name + opt_separator_temporal_datum_end + right_delimiter + +opt_separator_temporal_datum_end: + | wkt_separator calendar opt_separator_identifier_list + | wkt_separator calendar wkt_separator temporal_origin opt_separator_identifier_list + | wkt_separator temporal_origin opt_separator_identifier_list + | wkt_separator identifier opt_separator_identifier_list + +temporal_datum_keyword: T_TDATUM | T_TIMEDATUM + +temporal_origin: temporal_origin_keyword left_delimiter + temporal_origin_description right_delimiter + +temporal_origin_keyword: T_TIMEORIGIN + +temporal_origin_description: datetime | quoted_latin_text + +calendar: calendar_keyword left_delimiter calendar_identifier right_delimiter + +calendar_keyword: T_CALENDAR + +calendar_identifier: quoted_latin_text + +// Deriving conversion + +deriving_conversion: deriving_conversion_keyword left_delimiter + deriving_conversion_name wkt_separator + operation_method + wkt_separator parameter_or_parameter_file + opt_separator_deriving_conversion_end + right_delimiter + +parameter_or_parameter_file: operation_parameter | operation_parameter_file + +opt_separator_deriving_conversion_end: + | wkt_separator operation_parameter opt_separator_deriving_conversion_end + | wkt_separator operation_parameter_file opt_separator_deriving_conversion_end + | wkt_separator identifier opt_separator_identifier + +deriving_conversion_keyword: T_DERIVINGCONVERSION + +deriving_conversion_name: quoted_latin_text + +// Derived CRS conversion method + +operation_method: operation_method_keyword left_delimiter + operation_method_name + opt_separator_identifier + right_delimiter + +operation_method_keyword: T_METHOD + +operation_method_name: quoted_latin_text + +// Derived CRS conversion parameter +operation_parameter: parameter_keyword left_delimiter parameter_name + wkt_separator parameter_value wkt_separator parameter_unit + opt_separator_identifier + right_delimiter + +parameter_unit: length_or_angle_or_scale_or_time_or_parametric_unit + +// Approximate definition: conversion_factor should be optional only for a timeunit (but not easy to detect if UNIT keyword is used!) +length_or_angle_or_scale_or_time_or_parametric_unit: + length_or_angle_or_scale_or_time_or_parametric_unit_keyword + left_delimiter unit_name + opt_separator_conversion_factor_identifier_list + right_delimiter + +length_or_angle_or_scale_or_time_or_parametric_unit_keyword: + T_LENGTHUNIT | T_ANGLEUNIT | T_SCALEUNIT | T_TIMEUNIT | T_PARAMETRICUNIT | T_UNIT + +// Derived CRS conversion parameter file + +operation_parameter_file: parameter_file_keyword left_delimiter parameter_name + wkt_separator parameter_file_name + opt_separator_identifier + right_delimiter + +parameter_file_keyword: T_PARAMETERFILE + +parameter_file_name: quoted_latin_text + + +// Derived geodetic CRS and derived geographic CRS + +// Note: derived_geodetic_crs and derived_geographic_crs separated to avoid Bison shift/reduce conflicts +derived_geodetic_crs: geodetic_crs_keyword + left_delimiter crs_name + wkt_separator base_geodetic_crs + wkt_separator deriving_conversion + wkt_separator coordinate_system_scope_extent_identifier_remark + right_delimiter + +derived_geographic_crs: geographic_crs_keyword + left_delimiter crs_name + wkt_separator base_geodetic_crs + wkt_separator deriving_conversion + wkt_separator coordinate_system_scope_extent_identifier_remark + right_delimiter + + +// Derived projected CRS + +derived_projected_crs: derived_projected_crs_keyword left_delimiter + derived_crs_name wkt_separator base_projected_crs + wkt_separator deriving_conversion + wkt_separator coordinate_system_scope_extent_identifier_remark + right_delimiter + +derived_projected_crs_keyword: T_DERIVEDPROJCRS + +derived_crs_name: quoted_latin_text + +base_projected_crs: base_projected_crs_keyword left_delimiter base_crs_name + wkt_separator base_geodetic_crs + wkt_separator map_projection + right_delimiter + +base_projected_crs_keyword: T_BASEPROJCRS + + +// Derived vertical CRS + +derived_vertical_crs: vertical_crs_keyword left_delimiter crs_name + wkt_separator base_vertical_crs + wkt_separator deriving_conversion + wkt_separator coordinate_system_scope_extent_identifier_remark + right_delimiter + +base_vertical_crs: base_static_vertical_crs | base_dynamic_vertical_crs + +base_static_vertical_crs: base_vertical_crs_keyword left_delimiter base_crs_name + wkt_separator vertical_reference_frame right_delimiter + +base_dynamic_vertical_crs: base_vertical_crs_keyword left_delimiter base_crs_name + wkt_separator dynamic_crs + wkt_separator vertical_reference_frame right_delimiter + +base_vertical_crs_keyword: T_BASEVERTCRS + + +// Derived engineering CRS + +derived_engineering_crs: engineering_crs_keyword left_delimiter crs_name + wkt_separator base_engineering_crs + wkt_separator deriving_conversion + wkt_separator coordinate_system_scope_extent_identifier_remark + right_delimiter + +base_engineering_crs: base_engineering_crs_keyword left_delimiter base_crs_name + wkt_separator engineering_datum right_delimiter + +base_engineering_crs_keyword: T_BASEENGCRS + + +// Derived parametric CRS + +derived_parametric_crs: parametric_crs_keyword left_delimiter crs_name + wkt_separator base_parametric_crs + wkt_separator deriving_conversion + wkt_separator coordinate_system_scope_extent_identifier_remark + right_delimiter + +base_parametric_crs: base_parametric_crs_keyword left_delimiter base_crs_name + wkt_separator parametric_datum right_delimiter + +base_parametric_crs_keyword: T_BASEPARAMCRS + + +// Derived temporal CRS + +derived_temporal_crs: temporal_crs_keyword left_delimiter crs_name + wkt_separator base_temporal_crs + wkt_separator deriving_conversion + wkt_separator coordinate_system_scope_extent_identifier_remark + right_delimiter + +base_temporal_crs: base_temporal_crs_keyword left_delimiter base_crs_name + wkt_separator temporal_datum right_delimiter + +base_temporal_crs_keyword: T_BASETIMECRS + + +// Compound CRS + +compound_crs: compound_crs_keyword left_delimiter compound_crs_name + wkt_separator horizontal_crs wkt_separator + compound_crs_other_components + right_delimiter + +compound_crs_other_components: + vertical_crs opt_separator_scope_extent_identifier_remark + | parametric_crs opt_separator_scope_extent_identifier_remark + | temporal_crs opt_separator_scope_extent_identifier_remark + | vertical_crs wkt_separator temporal_crs opt_separator_scope_extent_identifier_remark + | parametric_crs wkt_separator temporal_crs opt_separator_scope_extent_identifier_remark + +compound_crs_keyword: T_COMPOUNDCRS + +compound_crs_name: quoted_latin_text + +horizontal_crs: geographic2D_crs | projected_crs | engineering_crs + +geographic2D_crs: static_geographic_crs | dynamic_geographic_crs + + +// coordinate epoch and coordinate metadata + +metadata_coordinate_epoch: coordinate_epoch_keyword left_delimiter + coordinate_epoch right_delimiter + +coordinate_epoch_keyword: T_EPOCH | T_COORDEPOCH + +coordinate_epoch: + unsigned_integer + | unsigned_integer period + | unsigned_integer period unsigned_integer + +coordinate_metadata: coordinate_metadata_keyword left_delimiter + coordinate_metadata_crs right_delimiter + +coordinate_metadata_crs: + static_crs + | dynamic_crs_coordinate_metadata wkt_separator metadata_coordinate_epoch + +coordinate_metadata_keyword: T_COORDINATEMETADATA + +static_crs: static_geodetic_crs | static_geographic_crs | + projected_crs | static_vertical_crs | + engineering_crs | parametric_crs | temporal_crs | + derived_geodetic_crs | derived_geographic_crs | + derived_projected_crs | derived_vertical_crs | + derived_engineering_crs | derived_parametric_crs | + derived_temporal_crs | compound_crs + +dynamic_crs_coordinate_metadata: dynamic_geodetic_crs | dynamic_geographic_crs | + projected_crs | dynamic_vertical_crs | + derived_geodetic_crs | derived_geographic_crs | + derived_projected_crs | derived_vertical_crs + +// Coordinate operations + +coordinate_operation: operation_keyword left_delimiter operation_name + wkt_separator source_crs wkt_separator target_crs + wkt_separator operation_method + wkt_separator parameter_or_parameter_file + opt_coordinate_operation_end + right_delimiter + +opt_coordinate_operation_end: + | wkt_separator operation_parameter opt_coordinate_operation_end + | wkt_separator operation_parameter_file opt_coordinate_operation_end + | wkt_separator interpolation_crs opt_separator_scope_extent_identifier_remark + | wkt_separator interpolation_crs wkt_separator operation_accuracy opt_separator_scope_extent_identifier_remark + | wkt_separator operation_accuracy opt_separator_scope_extent_identifier_remark + | wkt_separator no_opt_separator_scope_extent_identifier_remark + +operation_keyword: T_COORDINATEOPERATION + +operation_name: quoted_latin_text + +source_crs: source_crs_keyword left_delimiter crs right_delimiter + +source_crs_keyword: T_SOURCECRS + +target_crs: target_crs_keyword left_delimiter crs right_delimiter + +target_crs_keyword: T_TARGETCRS + +interpolation_crs: interpolation_crs_keyword left_delimiter crs right_delimiter + +interpolation_crs_keyword: T_INTERPOLATIONCRS + +operation_accuracy: operation_accuracy_keyword left_delimiter accuracy right_delimiter + +operation_accuracy_keyword: T_OPERATIONACCURACY + + +// Point motion operation + +point_motion_operation: point_motion_keyword left_delimiter operation_name + wkt_separator source_crs + wkt_separator operation_method + wkt_separator parameter_or_parameter_file + opt_point_motion_operation_end + right_delimiter + +opt_point_motion_operation_end: + | wkt_separator operation_parameter opt_point_motion_operation_end + | wkt_separator operation_parameter_file opt_point_motion_operation_end + | wkt_separator operation_accuracy opt_separator_scope_extent_identifier_remark + | wkt_separator no_opt_separator_scope_extent_identifier_remark + +point_motion_keyword: T_POINTMOTIONOPERATION + + +// Concatenated operation + +concatenated_operation: concatenated_operation_keyword left_delimiter + operation_name + wkt_separator source_crs wkt_separator target_crs + wkt_separator step_keyword left_delimiter step right_delimiter + wkt_separator step_keyword left_delimiter step right_delimiter + opt_concatenated_operation_end + right_delimiter + +step: coordinate_operation | point_motion_keyword | deriving_conversion + +opt_concatenated_operation_end: + | wkt_separator step_keyword left_delimiter step right_delimiter opt_concatenated_operation_end + | wkt_separator operation_accuracy opt_separator_scope_extent_identifier_remark + | wkt_separator no_opt_separator_scope_extent_identifier_remark + +concatenated_operation_keyword: T_CONCATENATEDOPERATION + +step_keyword: T_STEP + + +// Bound CRS + +bound_crs: bound_crs_keyword left_delimiter + source_crs wkt_separator target_crs + wkt_separator abridged_coordinate_transformation + opt_separator_scope_extent_identifier_remark + right_delimiter + +bound_crs_keyword: T_BOUNDCRS + +abridged_coordinate_transformation: abridged_transformation_keyword left_delimiter + operation_name wkt_separator + operation_method wkt_separator + abridged_parameter_or_parameter_file + opt_end_abridged_coordinate_transformation + right_delimiter + +abridged_parameter_or_parameter_file: abridged_transformation_parameter | operation_parameter_file + +opt_end_abridged_coordinate_transformation: + | wkt_separator abridged_transformation_parameter opt_end_abridged_coordinate_transformation + | wkt_separator operation_parameter_file opt_end_abridged_coordinate_transformation + | wkt_separator no_opt_separator_scope_extent_identifier_remark + +abridged_transformation_keyword: T_ABRIDGEDTRANSFORMATION + +abridged_transformation_parameter: parameter_keyword left_delimiter + parameter_name wkt_separator parameter_value + opt_separator_identifier_list + right_delimiter diff --git a/src/pj_wkt2_parser.cpp b/src/pj_wkt2_parser.cpp new file mode 100644 index 00000000..0e898436 --- /dev/null +++ b/src/pj_wkt2_parser.cpp @@ -0,0 +1,221 @@ +/****************************************************************************** + * Project: PROJ + * Purpose: WKT2 parser grammar + * Author: Even Rouault, <even.rouault at spatialys.com> + * + ****************************************************************************** + * Copyright (c) 2018 Even Rouault, <even.rouault at spatialys.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + ****************************************************************************/ + +#ifndef FROM_PROJ_CPP +#define FROM_PROJ_CPP +#endif + +#include "proj/internal/internal.hpp" + +#include <algorithm> +#include <cctype> +#include <cstring> +#include <string> + +#include "pj_wkt2_parser.h" +#include "pj_wkt_parser.hpp" + +using namespace NS_PROJ::internal; + +//! @cond Doxygen_Suppress + +// --------------------------------------------------------------------------- + +struct pj_wkt2_parse_context : public pj_wkt_parse_context {}; + +// --------------------------------------------------------------------------- + +void pj_wkt2_error(pj_wkt2_parse_context *context, const char *msg) { + pj_wkt_error(context, msg); +} + +// --------------------------------------------------------------------------- + +std::string pj_wkt2_parse(const std::string &wkt) { + pj_wkt2_parse_context context; + context.pszInput = wkt.c_str(); + context.pszLastSuccess = wkt.c_str(); + context.pszNext = wkt.c_str(); + if (pj_wkt2_parse(&context) != 0) { + return context.errorMsg; + } + return std::string(); +} + +// --------------------------------------------------------------------------- + +typedef struct { + const char *pszToken; + int nTokenVal; +} wkt2_tokens; + +#define PAIR(X) \ + { #X, T_##X } + +static const wkt2_tokens tokens[] = { + PAIR(PARAMETER), PAIR(PROJECTION), PAIR(DATUM), PAIR(SPHEROID), + PAIR(PRIMEM), PAIR(UNIT), PAIR(AXIS), + + PAIR(GEODCRS), PAIR(LENGTHUNIT), PAIR(ANGLEUNIT), PAIR(SCALEUNIT), + PAIR(TIMEUNIT), PAIR(ELLIPSOID), PAIR(CS), PAIR(ID), PAIR(PROJCRS), + PAIR(BASEGEODCRS), PAIR(MERIDIAN), PAIR(BEARING), PAIR(ORDER), PAIR(ANCHOR), + PAIR(CONVERSION), PAIR(METHOD), PAIR(REMARK), PAIR(GEOGCRS), + PAIR(BASEGEOGCRS), PAIR(SCOPE), PAIR(AREA), PAIR(BBOX), PAIR(CITATION), + PAIR(URI), PAIR(VERTCRS), PAIR(VDATUM), PAIR(GEOIDMODEL), PAIR(COMPOUNDCRS), + PAIR(PARAMETERFILE), PAIR(COORDINATEOPERATION), PAIR(SOURCECRS), + PAIR(TARGETCRS), PAIR(INTERPOLATIONCRS), PAIR(OPERATIONACCURACY), + PAIR(CONCATENATEDOPERATION), PAIR(STEP), PAIR(BOUNDCRS), + PAIR(ABRIDGEDTRANSFORMATION), PAIR(DERIVINGCONVERSION), PAIR(TDATUM), + PAIR(CALENDAR), PAIR(TIMEORIGIN), PAIR(TIMECRS), PAIR(VERTICALEXTENT), + PAIR(TIMEEXTENT), PAIR(USAGE), PAIR(DYNAMIC), PAIR(FRAMEEPOCH), PAIR(MODEL), + PAIR(VELOCITYGRID), PAIR(ENSEMBLE), PAIR(MEMBER), PAIR(ENSEMBLEACCURACY), + PAIR(DERIVEDPROJCRS), PAIR(BASEPROJCRS), PAIR(EDATUM), PAIR(ENGCRS), + PAIR(PDATUM), PAIR(PARAMETRICCRS), PAIR(PARAMETRICUNIT), PAIR(BASEVERTCRS), + PAIR(BASEENGCRS), PAIR(BASEPARAMCRS), PAIR(BASETIMECRS), PAIR(GEODETICCRS), + PAIR(GEODETICDATUM), PAIR(PROJECTEDCRS), PAIR(PRIMEMERIDIAN), + PAIR(GEOGRAPHICCRS), PAIR(TRF), PAIR(VERTICALCRS), PAIR(VERTICALDATUM), + PAIR(VRF), PAIR(TIMEDATUM), PAIR(TEMPORALQUANTITY), PAIR(ENGINEERINGDATUM), + PAIR(ENGINEERINGCRS), PAIR(PARAMETRICDATUM), PAIR(EPOCH), PAIR(COORDEPOCH), + PAIR(COORDINATEMETADATA), PAIR(POINTMOTIONOPERATION), + + // CS types + PAIR(AFFINE), PAIR(CARTESIAN), PAIR(CYLINDRICAL), PAIR(ELLIPSOIDAL), + PAIR(LINEAR), PAIR(PARAMETRIC), PAIR(POLAR), PAIR(SPHERICAL), + PAIR(VERTICAL), PAIR(TEMPORAL), PAIR(TEMPORALCOUNT), PAIR(TEMPORALMEASURE), + PAIR(ORDINAL), PAIR(TEMPORALDATETIME), + + // Axis directions + PAIR(NORTH), PAIR(NORTHNORTHEAST), PAIR(NORTHEAST), PAIR(EASTNORTHEAST), + PAIR(EAST), PAIR(EASTSOUTHEAST), PAIR(SOUTHEAST), PAIR(SOUTHSOUTHEAST), + PAIR(SOUTH), PAIR(SOUTHSOUTHWEST), PAIR(SOUTHWEST), PAIR(WESTSOUTHWEST), + PAIR(WEST), PAIR(WESTNORTHWEST), PAIR(NORTHWEST), PAIR(NORTHNORTHWEST), + PAIR(UP), PAIR(DOWN), PAIR(GEOCENTRICX), PAIR(GEOCENTRICY), + PAIR(GEOCENTRICZ), PAIR(COLUMNPOSITIVE), PAIR(COLUMNNEGATIVE), + PAIR(ROWPOSITIVE), PAIR(ROWNEGATIVE), PAIR(DISPLAYRIGHT), PAIR(DISPLAYLEFT), + PAIR(DISPLAYUP), PAIR(DISPLAYDOWN), PAIR(FORWARD), PAIR(AFT), PAIR(PORT), + PAIR(STARBOARD), PAIR(CLOCKWISE), PAIR(COUNTERCLOCKWISE), PAIR(TOWARDS), + PAIR(AWAYFROM), PAIR(FUTURE), PAIR(PAST), PAIR(UNSPECIFIED), +}; + +// --------------------------------------------------------------------------- + +int pj_wkt2_lex(YYSTYPE * /*pNode */, pj_wkt2_parse_context *context) { + size_t i; + const char *pszInput = context->pszNext; + + /* -------------------------------------------------------------------- */ + /* Skip white space. */ + /* -------------------------------------------------------------------- */ + while (*pszInput == ' ' || *pszInput == '\t' || *pszInput == 10 || + *pszInput == 13) + pszInput++; + + context->pszLastSuccess = pszInput; + + if (*pszInput == '\0') { + context->pszNext = pszInput; + return EOF; + } + + /* -------------------------------------------------------------------- */ + /* Recognize node names. */ + /* -------------------------------------------------------------------- */ + if (isalpha(*pszInput)) { + for (i = 0; i < sizeof(tokens) / sizeof(tokens[0]); i++) { + if (ci_starts_with(pszInput, tokens[i].pszToken) && + !isalpha(pszInput[strlen(tokens[i].pszToken)])) { + context->pszNext = pszInput + strlen(tokens[i].pszToken); + return tokens[i].nTokenVal; + } + } + } + + /* -------------------------------------------------------------------- */ + /* Recognize unsigned integer */ + /* -------------------------------------------------------------------- */ + + if (*pszInput >= '0' && *pszInput <= '9') { + + // Special case for 1, 2, 3 + if ((*pszInput == '1' || *pszInput == '2' || *pszInput == '3') && + !(pszInput[1] >= '0' && pszInput[1] <= '9')) { + context->pszNext = pszInput + 1; + return *pszInput; + } + + pszInput++; + while (*pszInput >= '0' && *pszInput <= '9') + pszInput++; + + context->pszNext = pszInput; + + return T_UNSIGNED_INTEGER_DIFFERENT_ONE_TWO_THREE; + } + + /* -------------------------------------------------------------------- */ + /* Recognize double quoted strings. */ + /* -------------------------------------------------------------------- */ + if (*pszInput == '"') { + pszInput++; + while (*pszInput != '\0') { + if (*pszInput == '"') { + if (pszInput[1] == '"') + pszInput++; + else + break; + } + pszInput++; + } + if (*pszInput == '\0') { + context->pszNext = pszInput; + return EOF; + } + context->pszNext = pszInput + 1; + return T_STRING; + } + + // As used in examples of OGC 12-063r5 + const char *startPrintedQuote = "\xE2\x80\x9C"; + const char *endPrintedQuote = "\xE2\x80\x9D"; + if (strncmp(pszInput, startPrintedQuote, 3) == 0) { + context->pszNext = strstr(pszInput, endPrintedQuote); + if (context->pszNext == nullptr) { + context->pszNext = pszInput + strlen(pszInput); + return EOF; + } + context->pszNext += 3; + return T_STRING; + } + + /* -------------------------------------------------------------------- */ + /* Handle special tokens. */ + /* -------------------------------------------------------------------- */ + context->pszNext = pszInput + 1; + return *pszInput; +} + +//! @endcond diff --git a/src/pj_wkt2_parser.h b/src/pj_wkt2_parser.h new file mode 100644 index 00000000..9229f2ff --- /dev/null +++ b/src/pj_wkt2_parser.h @@ -0,0 +1,54 @@ +/****************************************************************************** + * Project: PROJ + * Purpose: WKT2 parser grammar + * Author: Even Rouault, <even.rouault at spatialys.com> + * + ****************************************************************************** + * Copyright (c) 2018 Even Rouault, <even.rouault at spatialys.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + ****************************************************************************/ + +#ifndef PJ_WKT2_PARSER_H_INCLUDED +#define PJ_WKT2_PARSER_H_INCLUDED + +#ifndef DOXYGEN_SKIP + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct pj_wkt2_parse_context pj_wkt2_parse_context; + +#include "pj_wkt2_generated_parser.h" + +void pj_wkt2_error( pj_wkt2_parse_context *context, const char *msg ); +int pj_wkt2_lex(YYSTYPE* pNode, pj_wkt2_parse_context *context); +int pj_wkt2_parse(pj_wkt2_parse_context *context); + +#ifdef __cplusplus +} + +std::string pj_wkt2_parse(const std::string& wkt); + +#endif + +#endif /* #ifndef DOXYGEN_SKIP */ + +#endif /* PJ_WKT2_PARSER_H_INCLUDED */ diff --git a/src/pj_wkt_parser.cpp b/src/pj_wkt_parser.cpp new file mode 100644 index 00000000..ea8d2a29 --- /dev/null +++ b/src/pj_wkt_parser.cpp @@ -0,0 +1,60 @@ +/****************************************************************************** + * Project: PROJ + * Purpose: WKT parser common routines + * Author: Even Rouault, <even.rouault at spatialys.com> + * + ****************************************************************************** + * Copyright (c) 2018 Even Rouault, <even.rouault at spatialys.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + ****************************************************************************/ + +#include "pj_wkt_parser.hpp" + +#include <algorithm> +#include <string> + +// --------------------------------------------------------------------------- + +void pj_wkt_error(pj_wkt_parse_context *context, const char *msg) { + context->errorMsg = "Parsing error : "; + context->errorMsg += msg; + context->errorMsg += ". Error occurred around:\n"; + + std::string ctxtMsg; + const int n = static_cast<int>(context->pszLastSuccess - context->pszInput); + int start_i = std::max(0, n - 40); + for (int i = start_i; i < n + 40 && context->pszInput[i]; i++) { + if (context->pszInput[i] == '\r' || context->pszInput[i] == '\n') { + if (i > n) { + break; + } else { + ctxtMsg.clear(); + start_i = i + 1; + } + } else { + ctxtMsg += context->pszInput[i]; + } + } + context->errorMsg += ctxtMsg; + context->errorMsg += '\n'; + for (int i = start_i; i < n; i++) + context->errorMsg += ' '; + context->errorMsg += '^'; +} diff --git a/src/pj_wkt_parser.hpp b/src/pj_wkt_parser.hpp new file mode 100644 index 00000000..0e7e9e8b --- /dev/null +++ b/src/pj_wkt_parser.hpp @@ -0,0 +1,50 @@ +/****************************************************************************** + * Project: PROJ + * Purpose: WKT parser common routines + * Author: Even Rouault, <even.rouault at spatialys.com> + * + ****************************************************************************** + * Copyright (c) 2018 Even Rouault, <even.rouault at spatialys.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + ****************************************************************************/ + +#ifndef PJ_WKT_PARSER_H_INCLUDED +#define PJ_WKT_PARSER_H_INCLUDED + +//! @cond Doxygen_Suppress + +#include <string> + +struct pj_wkt_parse_context { + const char *pszInput = nullptr; + const char *pszLastSuccess = nullptr; + const char *pszNext = nullptr; + std::string errorMsg{}; + + pj_wkt_parse_context() = default; + pj_wkt_parse_context(const pj_wkt_parse_context &) = delete; + pj_wkt_parse_context &operator=(const pj_wkt_parse_context &) = delete; +}; + +void pj_wkt_error(pj_wkt_parse_context *context, const char *msg); + +//! @endcond + +#endif // PJ_WKT_PARSER_H_INCLUDED diff --git a/src/static.cpp b/src/static.cpp index c79f2099..5de046f1 100644 --- a/src/static.cpp +++ b/src/static.cpp @@ -282,6 +282,7 @@ DEFINE_WKT_CONSTANT(VERTICALCRS); DEFINE_WKT_CONSTANT(VERTICALDATUM); DEFINE_WKT_CONSTANT(VRF); DEFINE_WKT_CONSTANT(TIMEDATUM); +DEFINE_WKT_CONSTANT(TEMPORALQUANTITY); DEFINE_WKT_CONSTANT(ENGINEERINGDATUM); DEFINE_WKT_CONSTANT(ENGINEERINGCRS); DEFINE_WKT_CONSTANT(PARAMETRICDATUM); |
