Shapes
GIS made easy, a lightweight header-only planar geometry library for Modern C++
wkt_parser.hpp
1 #pragma once
2 
3 #include <ciso646>
4 #include <iostream>
5 #include <cassert>
6 #include <simo/geom/detail/types.hpp>
7 #include <simo/io/wkt_token.hpp>
8 
9 namespace simo
10 {
11 namespace shapes
12 {
13 
20 struct wkt_data
21 {
23  geometry_type geom_type;
24 
26  std::vector<double> coords;
27 
29  std::vector<std::size_t> offsets;
30 };
31 
38 struct wkt_result
39 {
41  bool parser_error = false;
42 
45 };
46 
47 /* Driver template for the LEMON parser generator.
48 ** The author disclaims copyright to this source code.
49 */
50 /* First off, code is included that follows the "include" declaration
51 ** in the input grammar file. */
52 #include <stdio.h>
53 
54 
55 #ifdef __GNUC__
56 #pragma GCC diagnostic push
57 #pragma GCC diagnostic ignored "-Wunused-parameter"
58 #pragma GCC diagnostic ignored "-Wunused-variable"
59 #endif
60 
61 #ifdef __clang__
62 #pragma clang diagnostic push
63 #pragma clang diagnostic ignored "-Wunused-parameter"
64 #pragma clang diagnostic ignored "-Wunused-variable"
65 #endif
66 
67 #ifdef _MSC_VER
68 #pragma warning(push)
69 #pragma warning(disable: 4100)
70 #pragma warning(disable: 4189)
71 #endif
72 
73 /* Next is all token values, in a form suitable for use by makeheaders.
74 ** This section will be null unless lemon is run with the -m switch.
75 */
76 /*
77 ** These constants (all generated automatically by the parser generator)
78 ** specify the various kinds of tokens (terminals) that the parser
79 ** understands.
80 **
81 ** Each symbol here is a terminal symbol in the grammar.
82 */
83 /* Make sure the INTERFACE macro is defined.
84 */
85 #ifndef INTERFACE
86 # define INTERFACE 1
87 #endif
88 /* The next thing included is series of defines which control
89 ** various aspects of the generated parser.
90 ** YYCODETYPE is the data type used for storing terminal
91 ** and nonterminal numbers. "unsigned char" is
92 ** used if there are fewer than 250 terminals
93 ** and nonterminals. "int" is used otherwise.
94 ** YYNOCODE is a number of type YYCODETYPE which corresponds
95 ** to no legal terminal or nonterminal number. This
96 ** number is used to fill in empty slots of the hash
97 ** table.
98 ** YYFALLBACK If defined, this indicates that one or more tokens
99 ** have fall-back values which should be used if the
100 ** original value of the token will not parse.
101 ** YYACTIONTYPE is the data type used for storing terminal
102 ** and nonterminal numbers. "unsigned char" is
103 ** used if there are fewer than 250 rules and
104 ** states combined. "int" is used otherwise.
105 ** ParseTOKENTYPE is the data type used for minor tokens given
106 ** directly to the parser from the tokenizer.
107 ** YYMINORTYPE is the data type used for all minor tokens.
108 ** This is typically a union of many types, one of
109 ** which is ParseTOKENTYPE. The entry in the union
110 ** for base tokens is called "yy0".
111 ** YYSTACKDEPTH is the maximum depth of the parser's stack. If
112 ** zero the stack is dynamically sized using realloc()
113 ** ParseARG_SDECL A static variable declaration for the %extra_argument
114 ** ParseARG_PDECL A parameter declaration for the %extra_argument
115 ** ParseARG_STORE Code to store %extra_argument into yypParser
116 ** ParseARG_FETCH Code to extract %extra_argument from yypParser
117 ** YYNSTATE the combined number of states.
118 ** YYNRULE the number of rules in the grammar
119 ** YYERRORSYMBOL is the code number of the error symbol. If not
120 ** defined, then do no error processing.
121 */
122 #define YYCODETYPE unsigned char
123 #define YYNOCODE 131
124 #define YYACTIONTYPE unsigned short int
125 #define ParseTOKENTYPE double
126 typedef union {
127  int yyinit;
128  ParseTOKENTYPE yy0;
129 } YYMINORTYPE;
130 #ifndef YYSTACKDEPTH
131 #define YYSTACKDEPTH 1048576
132 #endif
133 #define ParseARG_SDECL struct wkt_result *result ;
134 #define ParseARG_PDECL , struct wkt_result *result
135 #define ParseARG_FETCH struct wkt_result *result = yypParser->result
136 #define ParseARG_STORE yypParser->result = result
137 #define YYNSTATE 399
138 #define YYNRULE 202
139 #define YY_NO_ACTION (YYNSTATE+YYNRULE+2)
140 #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)
141 #define YY_ERROR_ACTION (YYNSTATE+YYNRULE)
142 
143 /* The yyzerominor constant is used to initialize instances of
144 ** YYMINORTYPE objects to zero. */
145 static const YYMINORTYPE yyzerominor = { 0 };
146 
147 /* Define the yytestcase() macro to be a no-op if is not already defined
148 ** otherwise.
149 **
150 ** Applications can choose to define yytestcase() in the %include section
151 ** to a macro that can assist in verifying code coverage. For production
152 ** code the yytestcase() macro should be turned off. But it is useful
153 ** for testing.
154 */
155 #ifndef yytestcase
156 # define yytestcase(X)
157 #endif
158 
159 
160 /* Next are the tables used to determine what action to take based on the
161 ** current state and lookahead token. These tables are used to implement
162 ** functions that take a state number and lookahead value and return an
163 ** action integer.
164 **
165 ** Suppose the action integer is N. Then the action is determined as
166 ** follows
167 **
168 ** 0 <= N < YYNSTATE Shift N. That is, push the lookahead
169 ** token onto the stack and goto state N.
170 **
171 ** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE.
172 **
173 ** N == YYNSTATE+YYNRULE A syntax error has occurred.
174 **
175 ** N == YYNSTATE+YYNRULE+1 The parser accepts its input.
176 **
177 ** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused
178 ** slots in the yy_action[] table.
179 **
180 ** The action table is constructed as a single large table named yy_action[].
181 ** Given state S and lookahead X, the action is computed as
182 **
183 ** yy_action[ yy_shift_ofst[S] + X ]
184 **
185 ** If the index value yy_shift_ofst[S]+X is out of range or if the value
186 ** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
187 ** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
188 ** and that yy_default[S] should be used instead.
189 **
190 ** The formula above is for computing the action when the lookahead is
191 ** a terminal symbol. If the lookahead is a non-terminal (as occurs after
192 ** a reduce action) then the yy_reduce_ofst[] array is used in place of
193 ** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
194 ** YY_SHIFT_USE_DFLT.
195 **
196 ** The following are the tables generated in this section:
197 **
198 ** yy_action[] A single table containing all actions.
199 ** yy_lookahead[] A table containing the lookahead for each entry in
200 ** yy_action. Used to detect hash collisions.
201 ** yy_shift_ofst[] For each state, the offset into yy_action for
202 ** shifting terminals.
203 ** yy_reduce_ofst[] For each state, the offset into yy_action for
204 ** shifting non-terminals after a reduce.
205 ** yy_default[] Default action for each state.
206 */
207 static const YYACTIONTYPE yy_action[] = {
208  /* 0 */ 602, 173, 321, 311, 301, 265, 262, 240, 238, 231,
209  /* 10 */ 368, 367, 361, 360, 359, 352, 351, 345, 344, 343,
210  /* 20 */ 336, 335, 329, 328, 327, 326, 325, 319, 318, 317,
211  /* 30 */ 56, 125, 57, 68, 63, 185, 25, 85, 169, 171,
212  /* 40 */ 172, 170, 60, 49, 69, 53, 72, 70, 58, 71,
213  /* 50 */ 50, 61, 54, 64, 62, 59, 66, 55, 65, 52,
214  /* 60 */ 67, 51, 353, 271, 337, 374, 354, 278, 338, 384,
215  /* 70 */ 355, 280, 339, 391, 356, 282, 340, 393, 357, 285,
216  /* 80 */ 341, 395, 358, 291, 342, 226, 374, 337, 271, 353,
217  /* 90 */ 384, 338, 278, 354, 391, 339, 280, 355, 393, 340,
218  /* 100 */ 282, 356, 395, 341, 285, 357, 226, 342, 291, 358,
219  /* 110 */ 63, 57, 36, 68, 206, 244, 5, 170, 171, 137,
220  /* 120 */ 172, 53, 49, 164, 69, 71, 70, 77, 58, 64,
221  /* 130 */ 61, 223, 54, 55, 59, 131, 66, 125, 158, 149,
222  /* 140 */ 29, 316, 161, 154, 80, 86, 41, 133, 147, 281,
223  /* 150 */ 56, 120, 141, 137, 9, 249, 144, 125, 169, 269,
224  /* 160 */ 10, 215, 60, 175, 11, 187, 72, 241, 93, 157,
225  /* 170 */ 50, 75, 122, 261, 62, 306, 131, 376, 12, 131,
226  /* 180 */ 37, 76, 112, 94, 313, 137, 210, 237, 131, 124,
227  /* 190 */ 189, 253, 27, 78, 131, 190, 83, 303, 288, 309,
228  /* 200 */ 120, 90, 130, 40, 293, 81, 41, 309, 137, 146,
229  /* 210 */ 349, 309, 131, 346, 40, 1, 177, 309, 37, 176,
230  /* 220 */ 323, 258, 120, 120, 23, 118, 6, 174, 82, 297,
231  /* 230 */ 131, 394, 137, 230, 23, 33, 38, 91, 131, 235,
232  /* 240 */ 140, 131, 370, 3, 120, 209, 386, 104, 156, 92,
233  /* 250 */ 137, 103, 120, 88, 379, 120, 30, 198, 167, 96,
234  /* 260 */ 200, 125, 125, 202, 120, 137, 228, 155, 205, 199,
235  /* 270 */ 125, 34, 13, 192, 137, 87, 79, 125, 137, 191,
236  /* 280 */ 137, 222, 214, 204, 233, 125, 213, 245, 166, 168,
237  /* 290 */ 120, 203, 7, 365, 125, 145, 388, 131, 4, 397,
238  /* 300 */ 188, 46, 273, 125, 208, 333, 120, 162, 201, 84,
239  /* 310 */ 114, 186, 21, 256, 100, 383, 27, 97, 98, 310,
240  /* 320 */ 46, 99, 109, 194, 330, 34, 106, 381, 110, 95,
241  /* 330 */ 146, 38, 105, 102, 221, 197, 107, 116, 195, 162,
242  /* 340 */ 121, 372, 108, 309, 373, 111, 83, 196, 308, 331,
243  /* 350 */ 2, 126, 299, 128, 132, 168, 295, 135, 178, 48,
244  /* 360 */ 138, 139, 101, 284, 15, 113, 41, 115, 142, 117,
245  /* 370 */ 320, 119, 220, 219, 123, 127, 300, 129, 218, 290,
246  /* 380 */ 134, 217, 143, 216, 24, 8, 136, 279, 152, 179,
247  /* 390 */ 150, 151, 276, 37, 180, 225, 242, 19, 270, 42,
248  /* 400 */ 268, 148, 159, 211, 212, 224, 181, 264, 23, 160,
249  /* 410 */ 182, 259, 74, 165, 73, 183, 40, 193, 153, 184,
250  /* 420 */ 399, 390, 307, 298, 289, 277, 275, 267, 263, 315,
251  /* 430 */ 257, 255, 247, 243, 89, 28, 239, 250, 35, 227,
252  /* 440 */ 39, 229, 22, 396, 382, 389, 380, 371, 375, 45,
253  /* 450 */ 385, 44, 398, 43, 234, 305, 283, 232, 32, 31,
254  /* 460 */ 26, 274, 377, 246, 366, 18, 252, 16, 14, 254,
255  /* 470 */ 236, 334, 287, 266, 47, 272, 20, 286, 347, 314,
256  /* 480 */ 294, 17, 304, 387, 292, 302, 312, 322, 324, 392,
257  /* 490 */ 378, 332, 369, 350, 348, 364, 251, 363, 260, 603,
258  /* 500 */ 362, 163, 207, 603, 603, 603, 603, 603, 296, 248,
259 };
260 static const YYCODETYPE yy_lookahead[] = {
261  /* 0 */ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
262  /* 10 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
263  /* 20 */ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
264  /* 30 */ 2, 65, 4, 5, 6, 85, 7, 71, 10, 11,
265  /* 40 */ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
266  /* 50 */ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
267  /* 60 */ 32, 33, 38, 40, 37, 39, 42, 44, 41, 43,
268  /* 70 */ 46, 48, 45, 47, 50, 52, 49, 51, 54, 56,
269  /* 80 */ 53, 55, 58, 60, 57, 59, 39, 37, 40, 38,
270  /* 90 */ 43, 41, 44, 42, 47, 45, 48, 46, 51, 49,
271  /* 100 */ 52, 50, 55, 53, 56, 54, 59, 57, 60, 58,
272  /* 110 */ 6, 4, 7, 5, 75, 85, 7, 13, 11, 65,
273  /* 120 */ 12, 17, 15, 69, 16, 21, 19, 73, 20, 25,
274  /* 130 */ 23, 121, 24, 29, 27, 65, 28, 65, 68, 67,
275  /* 140 */ 7, 3, 72, 71, 120, 118, 8, 124, 122, 3,
276  /* 150 */ 2, 65, 66, 65, 8, 3, 70, 65, 10, 3,
277  /* 160 */ 8, 73, 14, 71, 8, 74, 18, 74, 118, 122,
278  /* 170 */ 22, 120, 124, 3, 26, 3, 65, 3, 8, 65,
279  /* 180 */ 8, 99, 8, 72, 3, 65, 72, 3, 65, 8,
280  /* 190 */ 75, 3, 8, 73, 65, 72, 8, 3, 3, 1,
281  /* 200 */ 65, 72, 8, 8, 3, 70, 8, 1, 65, 8,
282  /* 210 */ 3, 1, 65, 119, 8, 8, 73, 1, 8, 72,
283  /* 220 */ 3, 3, 65, 65, 8, 8, 8, 70, 70, 3,
284  /* 230 */ 65, 3, 65, 102, 8, 8, 8, 72, 65, 75,
285  /* 240 */ 73, 65, 3, 7, 65, 72, 3, 8, 72, 70,
286  /* 250 */ 65, 8, 65, 7, 3, 65, 8, 70, 73, 8,
287  /* 260 */ 70, 65, 65, 102, 65, 65, 3, 71, 71, 70,
288  /* 270 */ 65, 8, 7, 73, 65, 98, 71, 65, 65, 76,
289  /* 280 */ 65, 119, 73, 71, 3, 65, 73, 3, 73, 8,
290  /* 290 */ 65, 71, 8, 3, 65, 70, 3, 65, 8, 76,
291  /* 300 */ 71, 8, 3, 65, 72, 3, 65, 8, 74, 71,
292  /* 310 */ 8, 70, 7, 83, 7, 93, 8, 86, 7, 111,
293  /* 320 */ 8, 86, 7, 90, 113, 8, 7, 90, 7, 89,
294  /* 330 */ 8, 8, 87, 89, 113, 93, 87, 7, 91, 8,
295  /* 340 */ 7, 91, 88, 1, 92, 88, 8, 92, 65, 125,
296  /* 350 */ 7, 65, 65, 7, 65, 8, 65, 7, 78, 8,
297  /* 360 */ 65, 65, 109, 65, 7, 109, 8, 108, 7, 108,
298  /* 370 */ 112, 107, 112, 111, 107, 106, 110, 106, 110, 105,
299  /* 380 */ 101, 105, 66, 77, 7, 7, 101, 78, 7, 79,
300  /* 390 */ 7, 67, 79, 8, 80, 125, 123, 8, 104, 7,
301  /* 400 */ 80, 100, 7, 76, 104, 123, 81, 81, 8, 68,
302  /* 410 */ 82, 82, 7, 7, 69, 83, 8, 77, 100, 84,
303  /* 420 */ 0, 77, 9, 9, 9, 9, 9, 9, 9, 66,
304  /* 430 */ 9, 9, 9, 9, 98, 7, 9, 103, 7, 87,
305  /* 440 */ 7, 9, 7, 9, 89, 9, 9, 9, 9, 7,
306  /* 450 */ 9, 7, 9, 7, 106, 67, 9, 9, 7, 7,
307  /* 460 */ 7, 108, 96, 9, 127, 7, 9, 7, 7, 107,
308  /* 470 */ 86, 117, 69, 9, 7, 9, 7, 9, 129, 115,
309  /* 480 */ 109, 7, 114, 97, 9, 9, 9, 9, 116, 88,
310  /* 490 */ 94, 9, 95, 126, 9, 9, 9, 9, 128, 130,
311  /* 500 */ 121, 99, 103, 130, 130, 130, 130, 130, 68, 84,
312 };
313 #define YY_SHIFT_USE_DFLT (-1)
314 #define YY_SHIFT_MAX 225
315 static const short yy_shift_ofst[] = {
316  /* 0 */ 28, 148, 104, 148, 107, 107, 108, 104, 108, 198,
317  /* 10 */ 206, 210, 216, 342, 342, 342, 342, 342, 342, 342,
318  /* 20 */ 342, 342, 342, 342, 342, 342, 342, 342, 342, 342,
319  /* 30 */ 342, 342, 342, 342, 342, 342, 342, 342, 342, 342,
320  /* 40 */ 342, 342, 342, 342, 342, 342, 342, 342, 342, 263,
321  /* 50 */ 281, 284, 290, 293, 299, 302, 138, 172, 174, 181,
322  /* 60 */ 184, 188, 194, 195, 201, 207, 217, 218, 226, 228,
323  /* 70 */ 239, 243, 251, 406, 227, 109, 405, 29, 29, 105,
324  /* 80 */ 109, 133, 133, 227, 105, 105, 236, 246, 248, 246,
325  /* 90 */ 265, 265, 133, 236, 305, 307, 308, 311, 308, 311,
326  /* 100 */ 312, 315, 307, 312, 317, 319, 317, 319, 321, 322,
327  /* 110 */ 323, 321, 323, 315, 322, 330, 331, 330, 331, 333,
328  /* 120 */ 342, 338, 343, 333, 338, 342, 342, 346, 347, 346,
329  /* 130 */ 347, 342, 342, 343, 350, 351, 350, 342, 342, 342,
330  /* 140 */ 357, 361, 358, 361, 377, 377, 351, 378, 381, 383,
331  /* 150 */ 385, 383, 389, 381, 392, 392, 265, 378, 395, 400,
332  /* 160 */ 395, 305, 389, 405, 406, 408, 357, 357, 248, 146,
333  /* 170 */ 152, 156, 170, 420, 413, 414, 415, 447, 416, 417,
334  /* 180 */ 418, 419, 421, 422, 423, 424, 428, 427, 431, 432,
335  /* 190 */ 433, 434, 435, 436, 437, 438, 439, 441, 442, 444,
336  /* 200 */ 446, 443, 448, 451, 452, 453, 454, 457, 458, 460,
337  /* 210 */ 461, 464, 466, 467, 469, 474, 468, 475, 476, 477,
338  /* 220 */ 478, 482, 485, 486, 487, 488,
339 };
340 #define YY_REDUCE_USE_DFLT (-51)
341 #define YY_REDUCE_MAX 168
342 static const short yy_reduce_ofst[] = {
343  /* 0 */ -35, 50, 48, 27, 24, 51, 47, 23, 26, 86,
344  /* 10 */ 54, 72, 70, 165, 176, 185, 114, 167, 173, 232,
345  /* 20 */ 88, 111, 215, 147, 225, 120, 205, 241, 135, 158,
346  /* 30 */ 187, 197, 212, 220, 229, 238, -34, 92, 123, 129,
347  /* 40 */ 143, 157, 196, 179, 190, 199, 200, 209, 213, 352,
348  /* 50 */ 348, 349, 337, 355, 353, 354, 363, 388, 366, 364,
349  /* 60 */ 384, 362, 368, 403, 371, 367, 372, 370, 440, 401,
350  /* 70 */ 397, 386, 396, 425, 402, 379, 399, -50, 30, 39,
351  /* 80 */ 10, 91, 93, 82, 115, 164, 94, 131, 177, 161,
352  /* 90 */ 203, 223, 234, 162, 230, 222, 231, 233, 235, 237,
353  /* 100 */ 240, 211, 242, 244, 245, 247, 249, 250, 252, 253,
354  /* 110 */ 254, 255, 257, 221, 256, 258, 259, 260, 261, 208,
355  /* 120 */ 283, 264, 224, 262, 267, 286, 287, 266, 269, 268,
356  /* 130 */ 271, 289, 291, 270, 274, 279, 276, 295, 296, 298,
357  /* 140 */ 306, 280, 316, 309, 310, 313, 285, 273, 294, 314,
358  /* 150 */ 324, 320, 301, 300, 325, 326, 327, 282, 328, 341,
359  /* 160 */ 329, 332, 318, 334, 335, 345, 340, 344, 336,
360 };
361 static const YYACTIONTYPE yy_default[] = {
362  /* 0 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601,
363  /* 10 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601,
364  /* 20 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601,
365  /* 30 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601,
366  /* 40 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601,
367  /* 50 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601,
368  /* 60 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601,
369  /* 70 */ 601, 601, 601, 465, 601, 571, 519, 467, 467, 443,
370  /* 80 */ 571, 441, 441, 601, 443, 443, 563, 517, 601, 517,
371  /* 90 */ 445, 445, 441, 563, 463, 491, 601, 485, 601, 485,
372  /* 100 */ 601, 535, 491, 601, 601, 487, 601, 487, 489, 601,
373  /* 110 */ 601, 489, 601, 535, 601, 533, 601, 533, 601, 531,
374  /* 120 */ 601, 601, 587, 531, 601, 601, 601, 529, 601, 529,
375  /* 130 */ 601, 601, 601, 587, 523, 601, 523, 601, 601, 601,
376  /* 140 */ 447, 453, 601, 453, 455, 455, 601, 579, 521, 457,
377  /* 150 */ 601, 457, 601, 521, 459, 459, 445, 579, 461, 601,
378  /* 160 */ 461, 463, 601, 519, 465, 601, 447, 447, 601, 601,
379  /* 170 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601,
380  /* 180 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601,
381  /* 190 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601,
382  /* 200 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601,
383  /* 210 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601,
384  /* 220 */ 601, 601, 601, 601, 601, 601, 578, 496, 495, 482,
385  /* 230 */ 518, 407, 525, 537, 538, 444, 494, 493, 406, 481,
386  /* 240 */ 405, 442, 580, 480, 468, 599, 514, 479, 466, 478,
387  /* 250 */ 520, 591, 526, 539, 540, 477, 464, 476, 597, 462,
388  /* 260 */ 598, 475, 404, 474, 460, 403, 515, 473, 458, 472,
389  /* 270 */ 522, 581, 527, 541, 542, 471, 456, 470, 582, 454,
390  /* 280 */ 583, 469, 584, 452, 440, 585, 516, 436, 435, 451,
391  /* 290 */ 524, 586, 528, 543, 544, 439, 434, 433, 450, 438,
392  /* 300 */ 530, 402, 545, 549, 550, 432, 431, 449, 437, 428,
393  /* 310 */ 532, 401, 546, 551, 552, 430, 429, 427, 426, 425,
394  /* 320 */ 534, 400, 547, 553, 554, 424, 423, 422, 421, 420,
395  /* 330 */ 536, 588, 548, 555, 556, 419, 418, 557, 558, 559,
396  /* 340 */ 560, 561, 562, 417, 416, 415, 564, 600, 589, 593,
397  /* 350 */ 594, 414, 413, 565, 566, 567, 568, 569, 570, 412,
398  /* 360 */ 411, 410, 572, 592, 590, 595, 596, 409, 408, 508,
399  /* 370 */ 507, 502, 488, 490, 573, 503, 509, 510, 506, 505,
400  /* 380 */ 501, 486, 500, 492, 574, 504, 511, 512, 499, 484,
401  /* 390 */ 448, 575, 498, 576, 497, 577, 483, 446, 513,
402 };
403 #define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))
404 
405 /* The next table maps tokens into fallback tokens. If a construct
406 ** like the following:
407 **
408 ** %fallback ID X Y Z.
409 **
410 ** appears in the grammar, then ID becomes a fallback token for X, Y,
411 ** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
412 ** but it does not parse, the type of the token is changed to ID and
413 ** the parse is retried before an error is thrown.
414 */
415 #ifdef YYFALLBACK
416 static const YYCODETYPE yyFallback[] = {
417 };
418 #endif /* YYFALLBACK */
419 
420 /* The following structure represents a single element of the
421 ** parser's stack. Information stored includes:
422 **
423 ** + The state number for the parser at this level of the stack.
424 **
425 ** + The value of the token stored at this level of the stack.
426 ** (In other words, the "major" token.)
427 **
428 ** + The semantic value stored at this level of the stack. This is
429 ** the information used by the action routines in the grammar.
430 ** It is sometimes called the "minor" token.
431 */
432 struct yyStackEntry {
433  YYACTIONTYPE stateno; /* The state-number */
434  YYCODETYPE major; /* The major token value. This is the code
435  ** number for the token at this stack level */
436  YYMINORTYPE minor; /* The user-supplied minor token value. This
437  ** is the value of the token */
438 };
439 typedef struct yyStackEntry yyStackEntry;
440 
441 /* The state of the parser is completely contained in an instance of
442 ** the following structure */
443 struct yyParser {
444  int yyidx; /* Index of top element in stack */
445 #ifdef YYTRACKMAXSTACKDEPTH
446  int yyidxMax; /* Maximum value of yyidx */
447 #endif
448  int yyerrcnt; /* Shifts left before out of the error */
449  ParseARG_SDECL /* A place to hold %extra_argument */
450 #if YYSTACKDEPTH<=0
451  int yystksz; /* Current side of the stack */
452  yyStackEntry *yystack; /* The parser's stack */
453 #else
454  yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
455 #endif
456 };
457 typedef struct yyParser yyParser;
458 
459 #ifndef NDEBUG
460 #include <stdio.h>
461 static FILE *yyTraceFILE = 0;
462 static char *yyTracePrompt = 0;
463 #endif /* NDEBUG */
464 
465 #ifndef NDEBUG
466 /*
467 ** Turn parser tracing on by giving a stream to which to write the trace
468 ** and a prompt to preface each trace message. Tracing is turned off
469 ** by making either argument NULL
470 **
471 ** Inputs:
472 ** <ul>
473 ** <li> A FILE* to which trace output should be written.
474 ** If NULL, then tracing is turned off.
475 ** <li> A prefix string written at the beginning of every
476 ** line of trace output. If NULL, then tracing is
477 ** turned off.
478 ** </ul>
479 **
480 ** Outputs:
481 ** None.
482 */
483 void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
484  yyTraceFILE = TraceFILE;
485  yyTracePrompt = zTracePrompt;
486  if( yyTraceFILE==0 ) yyTracePrompt = 0;
487  else if( yyTracePrompt==0 ) yyTraceFILE = 0;
488 }
489 #endif /* NDEBUG */
490 
491 #ifndef NDEBUG
492 /* For tracing shifts, the names of all terminals and nonterminals
493 ** are required. The following table supplies these names */
494 static const char *const yyTokenName[] = {
495  "$", "WKT_NUM", "WKT_POINT_TAGGED_TEXT", "WKT_EMPTY_SET",
496  "WKT_POINT_Z_TAGGED_TEXT", "WKT_POINT_M_TAGGED_TEXT", "WKT_POINT_ZM_TAGGED_TEXT", "WKT_COMMA",
497  "WKT_LPAREN", "WKT_RPAREN", "WKT_MULTIPOINT_TAGGED_TEXT", "WKT_MULTIPOINT_Z_TAGGED_TEXT",
498  "WKT_MULTIPOINT_M_TAGGED_TEXT", "WKT_MULTIPOINT_ZM_TAGGED_TEXT", "WKT_LINESTRING_TAGGED_TEXT", "WKT_LINESTRING_Z_TAGGED_TEXT",
499  "WKT_LINESTRING_M_TAGGED_TEXT", "WKT_LINESTRING_ZM_TAGGED_TEXT", "WKT_MULTILINESTRING_TAGGED_TEXT", "WKT_MULTILINESTRING_Z_TAGGED_TEXT",
500  "WKT_MULTILINESTRING_M_TAGGED_TEXT", "WKT_MULTILINESTRING_ZM_TAGGED_TEXT", "WKT_POLYGON_TAGGED_TEXT", "WKT_POLYGON_Z_TAGGED_TEXT",
501  "WKT_POLYGON_M_TAGGED_TEXT", "WKT_POLYGON_ZM_TAGGED_TEXT", "WKT_MULTIPOLYGON_TAGGED_TEXT", "WKT_MULTIPOLYGON_Z_TAGGED_TEXT",
502  "WKT_MULTIPOLYGON_M_TAGGED_TEXT", "WKT_MULTIPOLYGON_ZM_TAGGED_TEXT", "WKT_GEOMETRYCOLLECTION_TAGGED_TEXT", "WKT_GEOMETRYCOLLECTION_Z_TAGGED_TEXT",
503  "WKT_GEOMETRYCOLLECTION_M_TAGGED_TEXT", "WKT_GEOMETRYCOLLECTION_ZM_TAGGED_TEXT", "error", "program",
504  "wkt_text", "point", "point_z", "point_m",
505  "point_zm", "multipoint", "multipoint_z", "multipoint_m",
506  "multipoint_zm", "linestring", "linestring_z", "linestring_m",
507  "linestring_zm", "multilinestring", "multilinestring_z", "multilinestring_m",
508  "multilinestring_zm", "polygon", "polygon_z", "polygon_m",
509  "polygon_zm", "multipolygon", "multipolygon_z", "multipolygon_m",
510  "multipolygon_zm", "geometrycollection", "geometrycollection_z", "geometrycollection_m",
511  "geometrycollection_zm", "coord", "point_text", "point_text_z",
512  "point_text_m", "point_text_zm", "coord_xy", "coord_xyz",
513  "coord_xym", "coord_xyzm", "coord_xy_repeated", "coord_xyz_repeated",
514  "coord_xym_repeated", "coord_xyzm_repeated", "multipoint_text", "multipoint_text_2",
515  "multipoint_text_z", "multipoint_text_z_2", "multipoint_text_m", "multipoint_text_m_2",
516  "multipoint_text_zm", "multipoint_text_zm_2", "linestring_text", "linestring_text_z",
517  "linestring_text_m", "linestring_text_zm", "linestring_text_repeated", "linestring_text_z_repeated",
518  "linestring_text_m_repeated", "linestring_text_zm_repeated", "multilinestring_text", "multilinestring_text_z",
519  "multilinestring_text_m", "multilinestring_text_zm", "ring_text", "ring_text_z",
520  "ring_text_m", "ring_text_zm", "ring_text_repeated", "ring_text_z_repeated",
521  "ring_text_m_repeated", "ring_text_zm_repeated", "polygon_text", "polygon_text_z",
522  "polygon_text_m", "polygon_text_zm", "polygon_text_repeated", "polygon_text_z_repeated",
523  "polygon_text_m_repeated", "polygon_text_zm_repeated", "multipolygon_text", "multipolygon_text_z",
524  "multipolygon_text_m", "multipolygon_text_zm", "geometry_text", "geometry_text_repeated",
525  "geometry_text_z", "geometry_text_z_repeated", "geometry_text_m", "geometry_text_m_repeated",
526  "geometry_text_zm", "geometry_text_zm_repeated", "geometrycollection_text", "geometrycollection_text_z",
527  "geometrycollection_text_m", "geometrycollection_text_zm",
528 };
529 #endif /* NDEBUG */
530 
531 #ifndef NDEBUG
532 /* For tracing reduce actions, the names of all rules are required.
533 */
534 static const char *const yyRuleName[] = {
535  /* 0 */ "program ::= wkt_text",
536  /* 1 */ "wkt_text ::= point",
537  /* 2 */ "wkt_text ::= point_z",
538  /* 3 */ "wkt_text ::= point_m",
539  /* 4 */ "wkt_text ::= point_zm",
540  /* 5 */ "wkt_text ::= multipoint",
541  /* 6 */ "wkt_text ::= multipoint_z",
542  /* 7 */ "wkt_text ::= multipoint_m",
543  /* 8 */ "wkt_text ::= multipoint_zm",
544  /* 9 */ "wkt_text ::= linestring",
545  /* 10 */ "wkt_text ::= linestring_z",
546  /* 11 */ "wkt_text ::= linestring_m",
547  /* 12 */ "wkt_text ::= linestring_zm",
548  /* 13 */ "wkt_text ::= multilinestring",
549  /* 14 */ "wkt_text ::= multilinestring_z",
550  /* 15 */ "wkt_text ::= multilinestring_m",
551  /* 16 */ "wkt_text ::= multilinestring_zm",
552  /* 17 */ "wkt_text ::= polygon",
553  /* 18 */ "wkt_text ::= polygon_z",
554  /* 19 */ "wkt_text ::= polygon_m",
555  /* 20 */ "wkt_text ::= polygon_zm",
556  /* 21 */ "wkt_text ::= multipolygon",
557  /* 22 */ "wkt_text ::= multipolygon_z",
558  /* 23 */ "wkt_text ::= multipolygon_m",
559  /* 24 */ "wkt_text ::= multipolygon_zm",
560  /* 25 */ "wkt_text ::= geometrycollection",
561  /* 26 */ "wkt_text ::= geometrycollection_z",
562  /* 27 */ "wkt_text ::= geometrycollection_m",
563  /* 28 */ "wkt_text ::= geometrycollection_zm",
564  /* 29 */ "coord ::= WKT_NUM",
565  /* 30 */ "point ::= WKT_POINT_TAGGED_TEXT WKT_EMPTY_SET",
566  /* 31 */ "point ::= WKT_POINT_TAGGED_TEXT point_text",
567  /* 32 */ "point_z ::= WKT_POINT_Z_TAGGED_TEXT WKT_EMPTY_SET",
568  /* 33 */ "point_z ::= WKT_POINT_Z_TAGGED_TEXT point_text_z",
569  /* 34 */ "point_m ::= WKT_POINT_M_TAGGED_TEXT WKT_EMPTY_SET",
570  /* 35 */ "point_m ::= WKT_POINT_M_TAGGED_TEXT point_text_m",
571  /* 36 */ "point_zm ::= WKT_POINT_ZM_TAGGED_TEXT WKT_EMPTY_SET",
572  /* 37 */ "point_zm ::= WKT_POINT_ZM_TAGGED_TEXT point_text_zm",
573  /* 38 */ "coord_xy ::= coord coord",
574  /* 39 */ "coord_xyz ::= coord coord coord",
575  /* 40 */ "coord_xym ::= coord coord coord",
576  /* 41 */ "coord_xyzm ::= coord coord coord coord",
577  /* 42 */ "coord_xy_repeated ::=",
578  /* 43 */ "coord_xy_repeated ::= WKT_COMMA coord_xy coord_xy_repeated",
579  /* 44 */ "coord_xyz_repeated ::=",
580  /* 45 */ "coord_xyz_repeated ::= WKT_COMMA coord_xyz coord_xyz_repeated",
581  /* 46 */ "coord_xym_repeated ::=",
582  /* 47 */ "coord_xym_repeated ::= WKT_COMMA coord_xym coord_xym_repeated",
583  /* 48 */ "coord_xyzm_repeated ::=",
584  /* 49 */ "coord_xyzm_repeated ::= WKT_COMMA coord_xyzm coord_xyzm_repeated",
585  /* 50 */ "point_text ::= WKT_LPAREN coord_xy WKT_RPAREN",
586  /* 51 */ "point_text_z ::= WKT_LPAREN coord_xyz WKT_RPAREN",
587  /* 52 */ "point_text_m ::= WKT_LPAREN coord_xym WKT_RPAREN",
588  /* 53 */ "point_text_zm ::= WKT_LPAREN coord_xyzm WKT_RPAREN",
589  /* 54 */ "multipoint_text ::=",
590  /* 55 */ "multipoint_text ::= WKT_COMMA point_text multipoint_text",
591  /* 56 */ "multipoint_text_2 ::=",
592  /* 57 */ "multipoint_text_2 ::= WKT_COMMA coord_xy multipoint_text_2",
593  /* 58 */ "multipoint_text_z ::=",
594  /* 59 */ "multipoint_text_z ::= WKT_COMMA point_text_z multipoint_text_z",
595  /* 60 */ "multipoint_text_z_2 ::=",
596  /* 61 */ "multipoint_text_z_2 ::= WKT_COMMA coord_xyz multipoint_text_z_2",
597  /* 62 */ "multipoint_text_m ::=",
598  /* 63 */ "multipoint_text_m ::= WKT_COMMA point_text_m multipoint_text_m",
599  /* 64 */ "multipoint_text_m_2 ::=",
600  /* 65 */ "multipoint_text_m_2 ::= WKT_COMMA coord_xym multipoint_text_m_2",
601  /* 66 */ "multipoint_text_zm ::=",
602  /* 67 */ "multipoint_text_zm ::= WKT_COMMA point_text_zm multipoint_text_zm",
603  /* 68 */ "multipoint_text_zm_2 ::=",
604  /* 69 */ "multipoint_text_zm_2 ::= WKT_COMMA coord_xyzm multipoint_text_zm_2",
605  /* 70 */ "multipoint ::= WKT_MULTIPOINT_TAGGED_TEXT WKT_EMPTY_SET",
606  /* 71 */ "multipoint ::= WKT_MULTIPOINT_TAGGED_TEXT WKT_LPAREN point_text multipoint_text WKT_RPAREN",
607  /* 72 */ "multipoint ::= WKT_MULTIPOINT_TAGGED_TEXT WKT_LPAREN coord_xy multipoint_text_2 WKT_RPAREN",
608  /* 73 */ "multipoint_z ::= WKT_MULTIPOINT_Z_TAGGED_TEXT WKT_EMPTY_SET",
609  /* 74 */ "multipoint_z ::= WKT_MULTIPOINT_Z_TAGGED_TEXT WKT_LPAREN point_text_z multipoint_text_z WKT_RPAREN",
610  /* 75 */ "multipoint_z ::= WKT_MULTIPOINT_Z_TAGGED_TEXT WKT_LPAREN coord_xyz multipoint_text_z_2 WKT_RPAREN",
611  /* 76 */ "multipoint_m ::= WKT_MULTIPOINT_M_TAGGED_TEXT WKT_EMPTY_SET",
612  /* 77 */ "multipoint_m ::= WKT_MULTIPOINT_M_TAGGED_TEXT WKT_LPAREN point_text_m multipoint_text_m WKT_RPAREN",
613  /* 78 */ "multipoint_m ::= WKT_MULTIPOINT_M_TAGGED_TEXT WKT_LPAREN coord_xym multipoint_text_m_2 WKT_RPAREN",
614  /* 79 */ "multipoint_zm ::= WKT_MULTIPOINT_ZM_TAGGED_TEXT WKT_EMPTY_SET",
615  /* 80 */ "multipoint_zm ::= WKT_MULTIPOINT_ZM_TAGGED_TEXT WKT_LPAREN point_text_zm multipoint_text_zm WKT_RPAREN",
616  /* 81 */ "multipoint_zm ::= WKT_MULTIPOINT_ZM_TAGGED_TEXT WKT_LPAREN coord_xyzm multipoint_text_zm_2 WKT_RPAREN",
617  /* 82 */ "linestring_text ::= WKT_LPAREN coord_xy WKT_COMMA coord_xy coord_xy_repeated WKT_RPAREN",
618  /* 83 */ "linestring_text_z ::= WKT_LPAREN coord_xyz WKT_COMMA coord_xyz coord_xyz_repeated WKT_RPAREN",
619  /* 84 */ "linestring_text_m ::= WKT_LPAREN coord_xym WKT_COMMA coord_xym coord_xym_repeated WKT_RPAREN",
620  /* 85 */ "linestring_text_zm ::= WKT_LPAREN coord_xyzm WKT_COMMA coord_xyzm coord_xyzm_repeated WKT_RPAREN",
621  /* 86 */ "linestring_text_repeated ::=",
622  /* 87 */ "linestring_text_repeated ::= WKT_COMMA linestring_text linestring_text_repeated",
623  /* 88 */ "linestring_text_z_repeated ::=",
624  /* 89 */ "linestring_text_z_repeated ::= WKT_COMMA linestring_text_z linestring_text_z_repeated",
625  /* 90 */ "linestring_text_m_repeated ::=",
626  /* 91 */ "linestring_text_m_repeated ::= WKT_COMMA linestring_text_m linestring_text_m_repeated",
627  /* 92 */ "linestring_text_zm_repeated ::=",
628  /* 93 */ "linestring_text_zm_repeated ::= WKT_COMMA linestring_text_zm linestring_text_zm_repeated",
629  /* 94 */ "linestring ::= WKT_LINESTRING_TAGGED_TEXT WKT_EMPTY_SET",
630  /* 95 */ "linestring ::= WKT_LINESTRING_TAGGED_TEXT linestring_text",
631  /* 96 */ "linestring_z ::= WKT_LINESTRING_Z_TAGGED_TEXT WKT_EMPTY_SET",
632  /* 97 */ "linestring_z ::= WKT_LINESTRING_Z_TAGGED_TEXT linestring_text_z",
633  /* 98 */ "linestring_m ::= WKT_LINESTRING_M_TAGGED_TEXT WKT_EMPTY_SET",
634  /* 99 */ "linestring_m ::= WKT_LINESTRING_M_TAGGED_TEXT linestring_text_m",
635  /* 100 */ "linestring_zm ::= WKT_LINESTRING_ZM_TAGGED_TEXT WKT_EMPTY_SET",
636  /* 101 */ "linestring_zm ::= WKT_LINESTRING_ZM_TAGGED_TEXT linestring_text_zm",
637  /* 102 */ "multilinestring_text ::= WKT_LPAREN linestring_text linestring_text_repeated WKT_RPAREN",
638  /* 103 */ "multilinestring_text_z ::= WKT_LPAREN linestring_text_z linestring_text_z_repeated WKT_RPAREN",
639  /* 104 */ "multilinestring_text_m ::= WKT_LPAREN linestring_text_m linestring_text_m_repeated WKT_RPAREN",
640  /* 105 */ "multilinestring_text_zm ::= WKT_LPAREN linestring_text_zm linestring_text_zm_repeated WKT_RPAREN",
641  /* 106 */ "multilinestring ::= WKT_MULTILINESTRING_TAGGED_TEXT WKT_EMPTY_SET",
642  /* 107 */ "multilinestring ::= WKT_MULTILINESTRING_TAGGED_TEXT multilinestring_text",
643  /* 108 */ "multilinestring_z ::= WKT_MULTILINESTRING_Z_TAGGED_TEXT WKT_EMPTY_SET",
644  /* 109 */ "multilinestring_z ::= WKT_MULTILINESTRING_Z_TAGGED_TEXT multilinestring_text_z",
645  /* 110 */ "multilinestring_m ::= WKT_MULTILINESTRING_M_TAGGED_TEXT WKT_EMPTY_SET",
646  /* 111 */ "multilinestring_m ::= WKT_MULTILINESTRING_M_TAGGED_TEXT multilinestring_text_m",
647  /* 112 */ "multilinestring_zm ::= WKT_MULTILINESTRING_ZM_TAGGED_TEXT WKT_EMPTY_SET",
648  /* 113 */ "multilinestring_zm ::= WKT_MULTILINESTRING_ZM_TAGGED_TEXT multilinestring_text_zm",
649  /* 114 */ "ring_text ::= WKT_LPAREN coord_xy WKT_COMMA coord_xy WKT_COMMA coord_xy WKT_COMMA coord_xy coord_xy_repeated WKT_RPAREN",
650  /* 115 */ "ring_text_z ::= WKT_LPAREN coord_xyz WKT_COMMA coord_xyz WKT_COMMA coord_xyz WKT_COMMA coord_xyz coord_xyz_repeated WKT_RPAREN",
651  /* 116 */ "ring_text_m ::= WKT_LPAREN coord_xym WKT_COMMA coord_xym WKT_COMMA coord_xym WKT_COMMA coord_xym coord_xym_repeated WKT_RPAREN",
652  /* 117 */ "ring_text_zm ::= WKT_LPAREN coord_xyzm WKT_COMMA coord_xyzm WKT_COMMA coord_xyzm WKT_COMMA coord_xyzm coord_xyzm_repeated WKT_RPAREN",
653  /* 118 */ "ring_text_repeated ::=",
654  /* 119 */ "ring_text_repeated ::= WKT_COMMA ring_text ring_text_repeated",
655  /* 120 */ "ring_text_z_repeated ::=",
656  /* 121 */ "ring_text_z_repeated ::= WKT_COMMA ring_text_z ring_text_z_repeated",
657  /* 122 */ "ring_text_m_repeated ::=",
658  /* 123 */ "ring_text_m_repeated ::= WKT_COMMA ring_text_m ring_text_m_repeated",
659  /* 124 */ "ring_text_zm_repeated ::=",
660  /* 125 */ "ring_text_zm_repeated ::= WKT_COMMA ring_text_zm ring_text_zm_repeated",
661  /* 126 */ "polygon_text ::= WKT_LPAREN ring_text ring_text_repeated WKT_RPAREN",
662  /* 127 */ "polygon_text_z ::= WKT_LPAREN ring_text_z ring_text_z_repeated WKT_RPAREN",
663  /* 128 */ "polygon_text_m ::= WKT_LPAREN ring_text_m ring_text_m_repeated WKT_RPAREN",
664  /* 129 */ "polygon_text_zm ::= WKT_LPAREN ring_text_zm ring_text_zm_repeated WKT_RPAREN",
665  /* 130 */ "polygon_text_repeated ::=",
666  /* 131 */ "polygon_text_repeated ::= WKT_COMMA polygon_text polygon_text_repeated",
667  /* 132 */ "polygon_text_z_repeated ::=",
668  /* 133 */ "polygon_text_z_repeated ::= WKT_COMMA polygon_text_z polygon_text_z_repeated",
669  /* 134 */ "polygon_text_m_repeated ::=",
670  /* 135 */ "polygon_text_m_repeated ::= WKT_COMMA polygon_text_m polygon_text_m_repeated",
671  /* 136 */ "polygon_text_zm_repeated ::=",
672  /* 137 */ "polygon_text_zm_repeated ::= WKT_COMMA polygon_text_zm polygon_text_zm_repeated",
673  /* 138 */ "polygon ::= WKT_POLYGON_TAGGED_TEXT WKT_EMPTY_SET",
674  /* 139 */ "polygon ::= WKT_POLYGON_TAGGED_TEXT polygon_text",
675  /* 140 */ "polygon_z ::= WKT_POLYGON_Z_TAGGED_TEXT WKT_EMPTY_SET",
676  /* 141 */ "polygon_z ::= WKT_POLYGON_Z_TAGGED_TEXT polygon_text_z",
677  /* 142 */ "polygon_m ::= WKT_POLYGON_M_TAGGED_TEXT WKT_EMPTY_SET",
678  /* 143 */ "polygon_m ::= WKT_POLYGON_M_TAGGED_TEXT polygon_text_m",
679  /* 144 */ "polygon_zm ::= WKT_POLYGON_ZM_TAGGED_TEXT WKT_EMPTY_SET",
680  /* 145 */ "polygon_zm ::= WKT_POLYGON_ZM_TAGGED_TEXT polygon_text_zm",
681  /* 146 */ "multipolygon_text ::= WKT_LPAREN polygon_text polygon_text_repeated WKT_RPAREN",
682  /* 147 */ "multipolygon_text_z ::= WKT_LPAREN polygon_text_z polygon_text_z_repeated WKT_RPAREN",
683  /* 148 */ "multipolygon_text_m ::= WKT_LPAREN polygon_text_m polygon_text_m_repeated WKT_RPAREN",
684  /* 149 */ "multipolygon_text_zm ::= WKT_LPAREN polygon_text_zm polygon_text_zm_repeated WKT_RPAREN",
685  /* 150 */ "multipolygon ::= WKT_MULTIPOLYGON_TAGGED_TEXT WKT_EMPTY_SET",
686  /* 151 */ "multipolygon ::= WKT_MULTIPOLYGON_TAGGED_TEXT multipolygon_text",
687  /* 152 */ "multipolygon_z ::= WKT_MULTIPOLYGON_Z_TAGGED_TEXT WKT_EMPTY_SET",
688  /* 153 */ "multipolygon_z ::= WKT_MULTIPOLYGON_Z_TAGGED_TEXT multipolygon_text_z",
689  /* 154 */ "multipolygon_m ::= WKT_MULTIPOLYGON_M_TAGGED_TEXT WKT_EMPTY_SET",
690  /* 155 */ "multipolygon_m ::= WKT_MULTIPOLYGON_M_TAGGED_TEXT multipolygon_text_m",
691  /* 156 */ "multipolygon_zm ::= WKT_MULTIPOLYGON_ZM_TAGGED_TEXT WKT_EMPTY_SET",
692  /* 157 */ "multipolygon_zm ::= WKT_MULTIPOLYGON_ZM_TAGGED_TEXT multipolygon_text_zm",
693  /* 158 */ "geometry_text ::= point",
694  /* 159 */ "geometry_text ::= multipoint",
695  /* 160 */ "geometry_text ::= linestring",
696  /* 161 */ "geometry_text ::= multilinestring",
697  /* 162 */ "geometry_text ::= polygon",
698  /* 163 */ "geometry_text ::= multipolygon",
699  /* 164 */ "geometry_text_repeated ::=",
700  /* 165 */ "geometry_text_repeated ::= WKT_COMMA geometry_text geometry_text_repeated",
701  /* 166 */ "geometry_text_z ::= point_z",
702  /* 167 */ "geometry_text_z ::= multipoint_z",
703  /* 168 */ "geometry_text_z ::= linestring_z",
704  /* 169 */ "geometry_text_z ::= multilinestring_z",
705  /* 170 */ "geometry_text_z ::= polygon_z",
706  /* 171 */ "geometry_text_z ::= multipolygon_z",
707  /* 172 */ "geometry_text_z_repeated ::=",
708  /* 173 */ "geometry_text_z_repeated ::= WKT_COMMA geometry_text_z geometry_text_z_repeated",
709  /* 174 */ "geometry_text_m ::= point_m",
710  /* 175 */ "geometry_text_m ::= multipoint_m",
711  /* 176 */ "geometry_text_m ::= linestring_m",
712  /* 177 */ "geometry_text_m ::= multilinestring_m",
713  /* 178 */ "geometry_text_m ::= polygon_m",
714  /* 179 */ "geometry_text_m ::= multipolygon_m",
715  /* 180 */ "geometry_text_m_repeated ::=",
716  /* 181 */ "geometry_text_m_repeated ::= WKT_COMMA geometry_text_m geometry_text_m_repeated",
717  /* 182 */ "geometry_text_zm ::= point_zm",
718  /* 183 */ "geometry_text_zm ::= multipoint_zm",
719  /* 184 */ "geometry_text_zm ::= linestring_zm",
720  /* 185 */ "geometry_text_zm ::= multilinestring_zm",
721  /* 186 */ "geometry_text_zm ::= polygon_zm",
722  /* 187 */ "geometry_text_zm ::= multipolygon_zm",
723  /* 188 */ "geometry_text_zm_repeated ::=",
724  /* 189 */ "geometry_text_zm_repeated ::= WKT_COMMA geometry_text_zm geometry_text_zm_repeated",
725  /* 190 */ "geometrycollection_text ::= WKT_LPAREN geometry_text geometry_text_repeated WKT_RPAREN",
726  /* 191 */ "geometrycollection_text_z ::= WKT_LPAREN geometry_text_z geometry_text_z_repeated WKT_RPAREN",
727  /* 192 */ "geometrycollection_text_m ::= WKT_LPAREN geometry_text_m geometry_text_m_repeated WKT_RPAREN",
728  /* 193 */ "geometrycollection_text_zm ::= WKT_LPAREN geometry_text_zm geometry_text_zm_repeated WKT_RPAREN",
729  /* 194 */ "geometrycollection ::= WKT_GEOMETRYCOLLECTION_TAGGED_TEXT WKT_EMPTY_SET",
730  /* 195 */ "geometrycollection ::= WKT_GEOMETRYCOLLECTION_TAGGED_TEXT geometrycollection_text",
731  /* 196 */ "geometrycollection_z ::= WKT_GEOMETRYCOLLECTION_Z_TAGGED_TEXT WKT_EMPTY_SET",
732  /* 197 */ "geometrycollection_z ::= WKT_GEOMETRYCOLLECTION_Z_TAGGED_TEXT geometrycollection_text_z",
733  /* 198 */ "geometrycollection_m ::= WKT_GEOMETRYCOLLECTION_M_TAGGED_TEXT WKT_EMPTY_SET",
734  /* 199 */ "geometrycollection_m ::= WKT_GEOMETRYCOLLECTION_M_TAGGED_TEXT geometrycollection_text_m",
735  /* 200 */ "geometrycollection_zm ::= WKT_GEOMETRYCOLLECTION_ZM_TAGGED_TEXT WKT_EMPTY_SET",
736  /* 201 */ "geometrycollection_zm ::= WKT_GEOMETRYCOLLECTION_ZM_TAGGED_TEXT geometrycollection_text_zm",
737 };
738 #endif /* NDEBUG */
739 
740 
741 #if YYSTACKDEPTH<=0
742 /*
743 ** Try to increase the size of the parser stack.
744 */
745 static void yyGrowStack(yyParser *p){
746  int newSize;
747  yyStackEntry *pNew;
748 
749  newSize = p->yystksz*2 + 100;
750  pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
751  if( pNew ){
752  p->yystack = pNew;
753  p->yystksz = newSize;
754 #ifndef NDEBUG
755  if( yyTraceFILE ){
756  fprintf(yyTraceFILE,"%sStack grows to %d entries!\n",
757  yyTracePrompt, p->yystksz);
758  }
759 #endif
760  }
761 }
762 #endif
763 
764 /*
765 ** This function allocates a new parser.
766 ** The only argument is a pointer to a function which works like
767 ** malloc.
768 **
769 ** Inputs:
770 ** A pointer to the function used to allocate memory.
771 **
772 ** Outputs:
773 ** A pointer to a parser. This pointer is used in subsequent calls
774 ** to Parse and ParseFree.
775 */
776 void *ParseAlloc(void *(*mallocProc)(size_t)){
777  yyParser *pParser;
778  pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
779  if( pParser ){
780  pParser->yyidx = -1;
781 #ifdef YYTRACKMAXSTACKDEPTH
782  pParser->yyidxMax = 0;
783 #endif
784 #if YYSTACKDEPTH<=0
785  pParser->yystack = NULL;
786  pParser->yystksz = 0;
787  yyGrowStack(pParser);
788 #endif
789  }
790  return pParser;
791 }
792 
793 /* The following function deletes the value associated with a
794 ** symbol. The symbol can be either a terminal or nonterminal.
795 ** "yymajor" is the symbol code, and "yypminor" is a pointer to
796 ** the value.
797 */
798 static void yy_destructor(
799  yyParser *yypParser, /* The parser */
800  YYCODETYPE yymajor, /* Type code for object to destroy */
801  YYMINORTYPE *yypminor /* The object to be destroyed */
802 ){
803  ParseARG_FETCH;
804  switch( yymajor ){
805  /* Here is inserted the actions which take place when a
806  ** terminal or non-terminal is destroyed. This can happen
807  ** when the symbol is popped from the stack during a
808  ** reduce or during error processing or when a parser is
809  ** being destroyed before it is finished parsing.
810  **
811  ** Note: during a reduce, the only symbols destroyed are those
812  ** which appear on the RHS of the rule, but which are not used
813  ** inside the C code.
814  */
815  default: break; /* If no destructor action specified: do nothing */
816  }
817 }
818 
819 /*
820 ** Pop the parser's stack once.
821 **
822 ** If there is a destructor routine associated with the token which
823 ** is popped from the stack, then call it.
824 **
825 ** Return the major token number for the symbol popped.
826 */
827 static int yy_pop_parser_stack(yyParser *pParser){
828  YYCODETYPE yymajor;
829  yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];
830 
831  if( pParser->yyidx<0 ) return 0;
832 #ifndef NDEBUG
833  if( yyTraceFILE && pParser->yyidx>=0 ){
834  fprintf(yyTraceFILE,"%sPopping %s\n",
835  yyTracePrompt,
836  yyTokenName[yytos->major]);
837  }
838 #endif
839  yymajor = yytos->major;
840  yy_destructor(pParser, yymajor, &yytos->minor);
841  pParser->yyidx--;
842  return yymajor;
843 }
844 
845 /*
846 ** Deallocate and destroy a parser. Destructors are all called for
847 ** all stack elements before shutting the parser down.
848 **
849 ** Inputs:
850 ** <ul>
851 ** <li> A pointer to the parser. This should be a pointer
852 ** obtained from ParseAlloc.
853 ** <li> A pointer to a function used to reclaim memory obtained
854 ** from malloc.
855 ** </ul>
856 */
857 void ParseFree(
858  void *p, /* The parser to be deleted */
859  void (*freeProc)(void*) /* Function used to reclaim memory */
860 ){
861  yyParser *pParser = (yyParser*)p;
862  if( pParser==0 ) return;
863  while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
864 #if YYSTACKDEPTH<=0
865  free(pParser->yystack);
866 #endif
867  (*freeProc)((void*)pParser);
868 }
869 
870 /*
871 ** Return the peak depth of the stack for a parser.
872 */
873 #ifdef YYTRACKMAXSTACKDEPTH
874 int ParseStackPeak(void *p){
875  yyParser *pParser = (yyParser*)p;
876  return pParser->yyidxMax;
877 }
878 #endif
879 
880 /*
881 ** Find the appropriate action for a parser given the terminal
882 ** look-ahead token iLookAhead.
883 **
884 ** If the look-ahead token is YYNOCODE, then check to see if the action is
885 ** independent of the look-ahead. If it is, return the action, otherwise
886 ** return YY_NO_ACTION.
887 */
888 static int yy_find_shift_action(
889  yyParser *pParser, /* The parser */
890  YYCODETYPE iLookAhead /* The look-ahead token */
891 ){
892  int i;
893  int stateno = pParser->yystack[pParser->yyidx].stateno;
894 
895  if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){
896  return yy_default[stateno];
897  }
898  assert( iLookAhead!=YYNOCODE );
899  i += iLookAhead;
900  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
901  if( iLookAhead>0 ){
902 #ifdef YYFALLBACK
903  YYCODETYPE iFallback; /* Fallback token */
904  if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
905  && (iFallback = yyFallback[iLookAhead])!=0 ){
906 #ifndef NDEBUG
907  if( yyTraceFILE ){
908  fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
909  yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
910  }
911 #endif
912  return yy_find_shift_action(pParser, iFallback);
913  }
914 #endif
915 #ifdef YYWILDCARD
916  {
917  int j = i - iLookAhead + YYWILDCARD;
918  if( j>=0 && j<YY_SZ_ACTTAB && yy_lookahead[j]==YYWILDCARD ){
919 #ifndef NDEBUG
920  if( yyTraceFILE ){
921  fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
922  yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);
923  }
924 #endif /* NDEBUG */
925  return yy_action[j];
926  }
927  }
928 #endif /* YYWILDCARD */
929  }
930  return yy_default[stateno];
931  }else{
932  return yy_action[i];
933  }
934 }
935 
936 /*
937 ** Find the appropriate action for a parser given the non-terminal
938 ** look-ahead token iLookAhead.
939 **
940 ** If the look-ahead token is YYNOCODE, then check to see if the action is
941 ** independent of the look-ahead. If it is, return the action, otherwise
942 ** return YY_NO_ACTION.
943 */
944 static int yy_find_reduce_action(
945  int stateno, /* Current state number */
946  YYCODETYPE iLookAhead /* The look-ahead token */
947 ){
948  int i;
949 #ifdef YYERRORSYMBOL
950  if( stateno>YY_REDUCE_MAX ){
951  return yy_default[stateno];
952  }
953 #else
954  assert( stateno<=YY_REDUCE_MAX );
955 #endif
956  i = yy_reduce_ofst[stateno];
957  assert( i!=YY_REDUCE_USE_DFLT );
958  assert( iLookAhead!=YYNOCODE );
959  i += iLookAhead;
960 #ifdef YYERRORSYMBOL
961  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
962  return yy_default[stateno];
963  }
964 #else
965  assert( i>=0 && i<YY_SZ_ACTTAB );
966  assert( yy_lookahead[i]==iLookAhead );
967 #endif
968  return yy_action[i];
969 }
970 
971 /*
972 ** The following routine is called if the stack overflows.
973 */
974 static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
975  ParseARG_FETCH;
976  yypParser->yyidx--;
977 #ifndef NDEBUG
978  if( yyTraceFILE ){
979  fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
980  }
981 #endif
982  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
983  /* Here code is inserted which will execute if the parser
984  ** stack every overflows */
985 
986  result->parser_error = true;
987  ParseARG_STORE; /* Suppress warning about unused %extra_argument var */
988 }
989 
990 /*
991 ** Perform a shift action.
992 */
993 static void yy_shift(
994  yyParser *yypParser, /* The parser to be shifted */
995  int yyNewState, /* The new state to shift in */
996  int yyMajor, /* The major token to shift in */
997  YYMINORTYPE *yypMinor /* Pointer to the minor token to shift in */
998 ){
999  yyStackEntry *yytos;
1000  yypParser->yyidx++;
1001 #ifdef YYTRACKMAXSTACKDEPTH
1002  if( yypParser->yyidx>yypParser->yyidxMax ){
1003  yypParser->yyidxMax = yypParser->yyidx;
1004  }
1005 #endif
1006 #if YYSTACKDEPTH>0
1007  if( yypParser->yyidx>=YYSTACKDEPTH ){
1008  yyStackOverflow(yypParser, yypMinor);
1009  return;
1010  }
1011 #else
1012  if( yypParser->yyidx>=yypParser->yystksz ){
1013  yyGrowStack(yypParser);
1014  if( yypParser->yyidx>=yypParser->yystksz ){
1015  yyStackOverflow(yypParser, yypMinor);
1016  return;
1017  }
1018  }
1019 #endif
1020  yytos = &yypParser->yystack[yypParser->yyidx];
1021  yytos->stateno = (YYACTIONTYPE)yyNewState;
1022  yytos->major = (YYCODETYPE)yyMajor;
1023  yytos->minor = *yypMinor;
1024 #ifndef NDEBUG
1025  if( yyTraceFILE && yypParser->yyidx>0 ){
1026  int i;
1027  fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
1028  fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
1029  for(i=1; i<=yypParser->yyidx; i++)
1030  fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
1031  fprintf(yyTraceFILE,"\n");
1032  }
1033 #endif
1034 }
1035 
1036 /* The following table contains information about every rule that
1037 ** is used during the reduce.
1038 */
1039 static const struct {
1040  YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
1041  unsigned char nrhs; /* Number of right-hand side symbols in the rule */
1042 } yyRuleInfo[] = {
1043  { 35, 1 },
1044  { 36, 1 },
1045  { 36, 1 },
1046  { 36, 1 },
1047  { 36, 1 },
1048  { 36, 1 },
1049  { 36, 1 },
1050  { 36, 1 },
1051  { 36, 1 },
1052  { 36, 1 },
1053  { 36, 1 },
1054  { 36, 1 },
1055  { 36, 1 },
1056  { 36, 1 },
1057  { 36, 1 },
1058  { 36, 1 },
1059  { 36, 1 },
1060  { 36, 1 },
1061  { 36, 1 },
1062  { 36, 1 },
1063  { 36, 1 },
1064  { 36, 1 },
1065  { 36, 1 },
1066  { 36, 1 },
1067  { 36, 1 },
1068  { 36, 1 },
1069  { 36, 1 },
1070  { 36, 1 },
1071  { 36, 1 },
1072  { 65, 1 },
1073  { 37, 2 },
1074  { 37, 2 },
1075  { 38, 2 },
1076  { 38, 2 },
1077  { 39, 2 },
1078  { 39, 2 },
1079  { 40, 2 },
1080  { 40, 2 },
1081  { 70, 2 },
1082  { 71, 3 },
1083  { 72, 3 },
1084  { 73, 4 },
1085  { 74, 0 },
1086  { 74, 3 },
1087  { 75, 0 },
1088  { 75, 3 },
1089  { 76, 0 },
1090  { 76, 3 },
1091  { 77, 0 },
1092  { 77, 3 },
1093  { 66, 3 },
1094  { 67, 3 },
1095  { 68, 3 },
1096  { 69, 3 },
1097  { 78, 0 },
1098  { 78, 3 },
1099  { 79, 0 },
1100  { 79, 3 },
1101  { 80, 0 },
1102  { 80, 3 },
1103  { 81, 0 },
1104  { 81, 3 },
1105  { 82, 0 },
1106  { 82, 3 },
1107  { 83, 0 },
1108  { 83, 3 },
1109  { 84, 0 },
1110  { 84, 3 },
1111  { 85, 0 },
1112  { 85, 3 },
1113  { 41, 2 },
1114  { 41, 5 },
1115  { 41, 5 },
1116  { 42, 2 },
1117  { 42, 5 },
1118  { 42, 5 },
1119  { 43, 2 },
1120  { 43, 5 },
1121  { 43, 5 },
1122  { 44, 2 },
1123  { 44, 5 },
1124  { 44, 5 },
1125  { 86, 6 },
1126  { 87, 6 },
1127  { 88, 6 },
1128  { 89, 6 },
1129  { 90, 0 },
1130  { 90, 3 },
1131  { 91, 0 },
1132  { 91, 3 },
1133  { 92, 0 },
1134  { 92, 3 },
1135  { 93, 0 },
1136  { 93, 3 },
1137  { 45, 2 },
1138  { 45, 2 },
1139  { 46, 2 },
1140  { 46, 2 },
1141  { 47, 2 },
1142  { 47, 2 },
1143  { 48, 2 },
1144  { 48, 2 },
1145  { 94, 4 },
1146  { 95, 4 },
1147  { 96, 4 },
1148  { 97, 4 },
1149  { 49, 2 },
1150  { 49, 2 },
1151  { 50, 2 },
1152  { 50, 2 },
1153  { 51, 2 },
1154  { 51, 2 },
1155  { 52, 2 },
1156  { 52, 2 },
1157  { 98, 10 },
1158  { 99, 10 },
1159  { 100, 10 },
1160  { 101, 10 },
1161  { 102, 0 },
1162  { 102, 3 },
1163  { 103, 0 },
1164  { 103, 3 },
1165  { 104, 0 },
1166  { 104, 3 },
1167  { 105, 0 },
1168  { 105, 3 },
1169  { 106, 4 },
1170  { 107, 4 },
1171  { 108, 4 },
1172  { 109, 4 },
1173  { 110, 0 },
1174  { 110, 3 },
1175  { 111, 0 },
1176  { 111, 3 },
1177  { 112, 0 },
1178  { 112, 3 },
1179  { 113, 0 },
1180  { 113, 3 },
1181  { 53, 2 },
1182  { 53, 2 },
1183  { 54, 2 },
1184  { 54, 2 },
1185  { 55, 2 },
1186  { 55, 2 },
1187  { 56, 2 },
1188  { 56, 2 },
1189  { 114, 4 },
1190  { 115, 4 },
1191  { 116, 4 },
1192  { 117, 4 },
1193  { 57, 2 },
1194  { 57, 2 },
1195  { 58, 2 },
1196  { 58, 2 },
1197  { 59, 2 },
1198  { 59, 2 },
1199  { 60, 2 },
1200  { 60, 2 },
1201  { 118, 1 },
1202  { 118, 1 },
1203  { 118, 1 },
1204  { 118, 1 },
1205  { 118, 1 },
1206  { 118, 1 },
1207  { 119, 0 },
1208  { 119, 3 },
1209  { 120, 1 },
1210  { 120, 1 },
1211  { 120, 1 },
1212  { 120, 1 },
1213  { 120, 1 },
1214  { 120, 1 },
1215  { 121, 0 },
1216  { 121, 3 },
1217  { 122, 1 },
1218  { 122, 1 },
1219  { 122, 1 },
1220  { 122, 1 },
1221  { 122, 1 },
1222  { 122, 1 },
1223  { 123, 0 },
1224  { 123, 3 },
1225  { 124, 1 },
1226  { 124, 1 },
1227  { 124, 1 },
1228  { 124, 1 },
1229  { 124, 1 },
1230  { 124, 1 },
1231  { 125, 0 },
1232  { 125, 3 },
1233  { 126, 4 },
1234  { 127, 4 },
1235  { 128, 4 },
1236  { 129, 4 },
1237  { 61, 2 },
1238  { 61, 2 },
1239  { 62, 2 },
1240  { 62, 2 },
1241  { 63, 2 },
1242  { 63, 2 },
1243  { 64, 2 },
1244  { 64, 2 },
1245 };
1246 
1247 static void yy_accept(yyParser*); /* Forward Declaration */
1248 
1249 /*
1250 ** Perform a reduce action and the shift that must immediately
1251 ** follow the reduce.
1252 */
1253 static void yy_reduce(
1254  yyParser *yypParser, /* The parser */
1255  int yyruleno /* Number of the rule by which to reduce */
1256 ){
1257  int yygoto; /* The next state */
1258  int yyact; /* The next action */
1259  YYMINORTYPE yygotominor; /* The LHS of the rule reduced */
1260  yyStackEntry *yymsp; /* The top of the parser's stack */
1261  int yysize; /* Amount to pop the stack */
1262  ParseARG_FETCH;
1263  yymsp = &yypParser->yystack[yypParser->yyidx];
1264 #ifndef NDEBUG
1265  if( yyTraceFILE && yyruleno>=0
1266  && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
1267  fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
1268  yyRuleName[yyruleno]);
1269  }
1270 #endif /* NDEBUG */
1271 
1272  /* Silence complaints from purify about yygotominor being uninitialized
1273  ** in some cases when it is copied into the stack after the following
1274  ** switch. yygotominor is uninitialized when a rule reduces that does
1275  ** not set the value of its left-hand side nonterminal. Leaving the
1276  ** value of the nonterminal uninitialized is utterly harmless as long
1277  ** as the value is never used. So really the only thing this code
1278  ** accomplishes is to quieten purify.
1279  **
1280  ** 2007-01-16: The wireshark project (www.wireshark.org) reports that
1281  ** without this code, their parser segfaults. I'm not sure what there
1282  ** parser is doing to make this happen. This is the second bug report
1283  ** from wireshark this week. Clearly they are stressing Lemon in ways
1284  ** that it has not been previously stressed... (SQLite ticket #2172)
1285  */
1286  /*memset(&yygotominor, 0, sizeof(yygotominor));*/
1287  yygotominor = yyzerominor;
1288 
1289 
1290  switch( yyruleno ){
1291  /* Beginning here are the reduction cases. A typical example
1292  ** follows:
1293  ** case 0:
1294  ** #line <lineno> <grammarfile>
1295  ** { ... } // User supplied code
1296  ** #line <lineno> <thisfile>
1297  ** break;
1298  */
1299  case 29: /* coord ::= WKT_NUM */
1300 { yygotominor.yy0 = yymsp[0].minor.yy0; }
1301  break;
1302  case 30: /* point ::= WKT_POINT_TAGGED_TEXT WKT_EMPTY_SET */
1303 {
1304  result->data.coords.push_back(0);
1305  result->data.coords.push_back(0);
1306  result->data.geom_type = geometry_type::POINT;
1307 }
1308  break;
1309  case 31: /* point ::= WKT_POINT_TAGGED_TEXT point_text */
1310 {
1311  result->data.geom_type = geometry_type::POINT;
1312 }
1313  break;
1314  case 32: /* point_z ::= WKT_POINT_Z_TAGGED_TEXT WKT_EMPTY_SET */
1315 {
1316  result->data.coords.push_back(0);
1317  result->data.coords.push_back(0);
1318  result->data.coords.push_back(0);
1319  result->data.geom_type = geometry_type::POINTZ;
1320 }
1321  break;
1322  case 33: /* point_z ::= WKT_POINT_Z_TAGGED_TEXT point_text_z */
1323 {
1324  result->data.geom_type = geometry_type::POINTZ;
1325 }
1326  break;
1327  case 34: /* point_m ::= WKT_POINT_M_TAGGED_TEXT WKT_EMPTY_SET */
1328 {
1329  result->data.coords.push_back(0);
1330  result->data.coords.push_back(0);
1331  result->data.coords.push_back(0);
1332  result->data.geom_type = geometry_type::POINTM;
1333 }
1334  break;
1335  case 35: /* point_m ::= WKT_POINT_M_TAGGED_TEXT point_text_m */
1336 {
1337  result->data.geom_type = geometry_type::POINTM;
1338 }
1339  break;
1340  case 36: /* point_zm ::= WKT_POINT_ZM_TAGGED_TEXT WKT_EMPTY_SET */
1341 {
1342  result->data.coords.push_back(0);
1343  result->data.coords.push_back(0);
1344  result->data.coords.push_back(0);
1345  result->data.coords.push_back(0);
1346  result->data.geom_type = geometry_type::POINTZM;
1347 }
1348  break;
1349  case 37: /* point_zm ::= WKT_POINT_ZM_TAGGED_TEXT point_text_zm */
1350 {
1351  result->data.geom_type = geometry_type::POINTZM;
1352 }
1353  break;
1354  case 38: /* coord_xy ::= coord coord */
1355 {
1356  result->data.coords.push_back(yymsp[-1].minor.yy0);
1357  result->data.coords.push_back(yymsp[0].minor.yy0);
1358 }
1359  break;
1360  case 39: /* coord_xyz ::= coord coord coord */
1361  case 40: /* coord_xym ::= coord coord coord */ yytestcase(yyruleno==40);
1362 {
1363  result->data.coords.push_back(yymsp[-2].minor.yy0);
1364  result->data.coords.push_back(yymsp[-1].minor.yy0);
1365  result->data.coords.push_back(yymsp[0].minor.yy0);
1366 }
1367  break;
1368  case 41: /* coord_xyzm ::= coord coord coord coord */
1369 {
1370  result->data.coords.push_back(yymsp[-3].minor.yy0);
1371  result->data.coords.push_back(yymsp[-2].minor.yy0);
1372  result->data.coords.push_back(yymsp[-1].minor.yy0);
1373  result->data.coords.push_back(yymsp[0].minor.yy0);
1374 }
1375  break;
1376  case 70: /* multipoint ::= WKT_MULTIPOINT_TAGGED_TEXT WKT_EMPTY_SET */
1377  case 71: /* multipoint ::= WKT_MULTIPOINT_TAGGED_TEXT WKT_LPAREN point_text multipoint_text WKT_RPAREN */ yytestcase(yyruleno==71);
1378  case 72: /* multipoint ::= WKT_MULTIPOINT_TAGGED_TEXT WKT_LPAREN coord_xy multipoint_text_2 WKT_RPAREN */ yytestcase(yyruleno==72);
1379 {
1380  result->data.geom_type = geometry_type::MULTIPOINT;
1381 }
1382  break;
1383  case 73: /* multipoint_z ::= WKT_MULTIPOINT_Z_TAGGED_TEXT WKT_EMPTY_SET */
1384  case 74: /* multipoint_z ::= WKT_MULTIPOINT_Z_TAGGED_TEXT WKT_LPAREN point_text_z multipoint_text_z WKT_RPAREN */ yytestcase(yyruleno==74);
1385  case 75: /* multipoint_z ::= WKT_MULTIPOINT_Z_TAGGED_TEXT WKT_LPAREN coord_xyz multipoint_text_z_2 WKT_RPAREN */ yytestcase(yyruleno==75);
1386 {
1387  result->data.geom_type = geometry_type::MULTIPOINTZ;
1388 }
1389  break;
1390  case 76: /* multipoint_m ::= WKT_MULTIPOINT_M_TAGGED_TEXT WKT_EMPTY_SET */
1391  case 77: /* multipoint_m ::= WKT_MULTIPOINT_M_TAGGED_TEXT WKT_LPAREN point_text_m multipoint_text_m WKT_RPAREN */ yytestcase(yyruleno==77);
1392  case 78: /* multipoint_m ::= WKT_MULTIPOINT_M_TAGGED_TEXT WKT_LPAREN coord_xym multipoint_text_m_2 WKT_RPAREN */ yytestcase(yyruleno==78);
1393 {
1394  result->data.geom_type = geometry_type::MULTIPOINTM;
1395 }
1396  break;
1397  case 79: /* multipoint_zm ::= WKT_MULTIPOINT_ZM_TAGGED_TEXT WKT_EMPTY_SET */
1398  case 80: /* multipoint_zm ::= WKT_MULTIPOINT_ZM_TAGGED_TEXT WKT_LPAREN point_text_zm multipoint_text_zm WKT_RPAREN */ yytestcase(yyruleno==80);
1399  case 81: /* multipoint_zm ::= WKT_MULTIPOINT_ZM_TAGGED_TEXT WKT_LPAREN coord_xyzm multipoint_text_zm_2 WKT_RPAREN */ yytestcase(yyruleno==81);
1400 {
1401  result->data.geom_type = geometry_type::MULTIPOINTZM;
1402 }
1403  break;
1404  case 82: /* linestring_text ::= WKT_LPAREN coord_xy WKT_COMMA coord_xy coord_xy_repeated WKT_RPAREN */
1405  case 83: /* linestring_text_z ::= WKT_LPAREN coord_xyz WKT_COMMA coord_xyz coord_xyz_repeated WKT_RPAREN */ yytestcase(yyruleno==83);
1406  case 84: /* linestring_text_m ::= WKT_LPAREN coord_xym WKT_COMMA coord_xym coord_xym_repeated WKT_RPAREN */ yytestcase(yyruleno==84);
1407  case 85: /* linestring_text_zm ::= WKT_LPAREN coord_xyzm WKT_COMMA coord_xyzm coord_xyzm_repeated WKT_RPAREN */ yytestcase(yyruleno==85);
1408  case 114: /* ring_text ::= WKT_LPAREN coord_xy WKT_COMMA coord_xy WKT_COMMA coord_xy WKT_COMMA coord_xy coord_xy_repeated WKT_RPAREN */ yytestcase(yyruleno==114);
1409  case 115: /* ring_text_z ::= WKT_LPAREN coord_xyz WKT_COMMA coord_xyz WKT_COMMA coord_xyz WKT_COMMA coord_xyz coord_xyz_repeated WKT_RPAREN */ yytestcase(yyruleno==115);
1410  case 116: /* ring_text_m ::= WKT_LPAREN coord_xym WKT_COMMA coord_xym WKT_COMMA coord_xym WKT_COMMA coord_xym coord_xym_repeated WKT_RPAREN */ yytestcase(yyruleno==116);
1411  case 117: /* ring_text_zm ::= WKT_LPAREN coord_xyzm WKT_COMMA coord_xyzm WKT_COMMA coord_xyzm WKT_COMMA coord_xyzm coord_xyzm_repeated WKT_RPAREN */ yytestcase(yyruleno==117);
1412 {
1413  result->data.offsets.push_back(result->data.coords.size());
1414 }
1415  break;
1416  case 94: /* linestring ::= WKT_LINESTRING_TAGGED_TEXT WKT_EMPTY_SET */
1417  case 95: /* linestring ::= WKT_LINESTRING_TAGGED_TEXT linestring_text */ yytestcase(yyruleno==95);
1418 {
1419  result->data.geom_type = geometry_type::LINESTRING;
1420 }
1421  break;
1422  case 96: /* linestring_z ::= WKT_LINESTRING_Z_TAGGED_TEXT WKT_EMPTY_SET */
1423  case 97: /* linestring_z ::= WKT_LINESTRING_Z_TAGGED_TEXT linestring_text_z */ yytestcase(yyruleno==97);
1424 {
1425  result->data.geom_type = geometry_type::LINESTRINGZ;
1426 }
1427  break;
1428  case 98: /* linestring_m ::= WKT_LINESTRING_M_TAGGED_TEXT WKT_EMPTY_SET */
1429  case 99: /* linestring_m ::= WKT_LINESTRING_M_TAGGED_TEXT linestring_text_m */ yytestcase(yyruleno==99);
1430 {
1431  result->data.geom_type = geometry_type::LINESTRINGM;
1432 }
1433  break;
1434  case 100: /* linestring_zm ::= WKT_LINESTRING_ZM_TAGGED_TEXT WKT_EMPTY_SET */
1435  case 101: /* linestring_zm ::= WKT_LINESTRING_ZM_TAGGED_TEXT linestring_text_zm */ yytestcase(yyruleno==101);
1436 {
1437  result->data.geom_type = geometry_type::LINESTRINGZM;
1438 }
1439  break;
1440  case 106: /* multilinestring ::= WKT_MULTILINESTRING_TAGGED_TEXT WKT_EMPTY_SET */
1441  case 107: /* multilinestring ::= WKT_MULTILINESTRING_TAGGED_TEXT multilinestring_text */ yytestcase(yyruleno==107);
1442 {
1443  result->data.geom_type = geometry_type::MULTILINESTRING;
1444 }
1445  break;
1446  case 108: /* multilinestring_z ::= WKT_MULTILINESTRING_Z_TAGGED_TEXT WKT_EMPTY_SET */
1447  case 109: /* multilinestring_z ::= WKT_MULTILINESTRING_Z_TAGGED_TEXT multilinestring_text_z */ yytestcase(yyruleno==109);
1448 {
1449  result->data.geom_type = geometry_type::MULTILINESTRINGZ;
1450 }
1451  break;
1452  case 110: /* multilinestring_m ::= WKT_MULTILINESTRING_M_TAGGED_TEXT WKT_EMPTY_SET */
1453  case 111: /* multilinestring_m ::= WKT_MULTILINESTRING_M_TAGGED_TEXT multilinestring_text_m */ yytestcase(yyruleno==111);
1454 {
1455  result->data.geom_type = geometry_type::MULTILINESTRINGM;
1456 }
1457  break;
1458  case 112: /* multilinestring_zm ::= WKT_MULTILINESTRING_ZM_TAGGED_TEXT WKT_EMPTY_SET */
1459  case 113: /* multilinestring_zm ::= WKT_MULTILINESTRING_ZM_TAGGED_TEXT multilinestring_text_zm */ yytestcase(yyruleno==113);
1460 {
1461  result->data.geom_type = geometry_type::MULTILINESTRINGZM;
1462 }
1463  break;
1464  case 138: /* polygon ::= WKT_POLYGON_TAGGED_TEXT WKT_EMPTY_SET */
1465  case 139: /* polygon ::= WKT_POLYGON_TAGGED_TEXT polygon_text */ yytestcase(yyruleno==139);
1466 {
1467  result->data.geom_type = geometry_type::POLYGON;
1468 }
1469  break;
1470  case 140: /* polygon_z ::= WKT_POLYGON_Z_TAGGED_TEXT WKT_EMPTY_SET */
1471  case 141: /* polygon_z ::= WKT_POLYGON_Z_TAGGED_TEXT polygon_text_z */ yytestcase(yyruleno==141);
1472 {
1473  result->data.geom_type = geometry_type::POLYGONZ;
1474 }
1475  break;
1476  case 142: /* polygon_m ::= WKT_POLYGON_M_TAGGED_TEXT WKT_EMPTY_SET */
1477  case 143: /* polygon_m ::= WKT_POLYGON_M_TAGGED_TEXT polygon_text_m */ yytestcase(yyruleno==143);
1478 {
1479  result->data.geom_type = geometry_type::POLYGONM;
1480 }
1481  break;
1482  case 144: /* polygon_zm ::= WKT_POLYGON_ZM_TAGGED_TEXT WKT_EMPTY_SET */
1483  case 145: /* polygon_zm ::= WKT_POLYGON_ZM_TAGGED_TEXT polygon_text_zm */ yytestcase(yyruleno==145);
1484 {
1485  result->data.geom_type = geometry_type::POLYGONZM;
1486 }
1487  break;
1488  case 150: /* multipolygon ::= WKT_MULTIPOLYGON_TAGGED_TEXT WKT_EMPTY_SET */
1489  case 151: /* multipolygon ::= WKT_MULTIPOLYGON_TAGGED_TEXT multipolygon_text */ yytestcase(yyruleno==151);
1490 {
1491  result->data.geom_type = geometry_type::MULTIPOLYGON;
1492 }
1493  break;
1494  case 152: /* multipolygon_z ::= WKT_MULTIPOLYGON_Z_TAGGED_TEXT WKT_EMPTY_SET */
1495  case 153: /* multipolygon_z ::= WKT_MULTIPOLYGON_Z_TAGGED_TEXT multipolygon_text_z */ yytestcase(yyruleno==153);
1496 {
1497  result->data.geom_type = geometry_type::MULTIPOLYGONZ;
1498 }
1499  break;
1500  case 154: /* multipolygon_m ::= WKT_MULTIPOLYGON_M_TAGGED_TEXT WKT_EMPTY_SET */
1501  case 155: /* multipolygon_m ::= WKT_MULTIPOLYGON_M_TAGGED_TEXT multipolygon_text_m */ yytestcase(yyruleno==155);
1502 {
1503  result->data.geom_type = geometry_type::MULTIPOLYGONM;
1504 }
1505  break;
1506  case 156: /* multipolygon_zm ::= WKT_MULTIPOLYGON_ZM_TAGGED_TEXT WKT_EMPTY_SET */
1507  case 157: /* multipolygon_zm ::= WKT_MULTIPOLYGON_ZM_TAGGED_TEXT multipolygon_text_zm */ yytestcase(yyruleno==157);
1508 {
1509  result->data.geom_type = geometry_type::MULTIPOLYGONZM;
1510 }
1511  break;
1512  case 194: /* geometrycollection ::= WKT_GEOMETRYCOLLECTION_TAGGED_TEXT WKT_EMPTY_SET */
1513  case 195: /* geometrycollection ::= WKT_GEOMETRYCOLLECTION_TAGGED_TEXT geometrycollection_text */ yytestcase(yyruleno==195);
1514 {
1515  result->data.geom_type = geometry_type::GEOMETRYCOLLECTION;
1516 }
1517  break;
1518  case 196: /* geometrycollection_z ::= WKT_GEOMETRYCOLLECTION_Z_TAGGED_TEXT WKT_EMPTY_SET */
1519  case 197: /* geometrycollection_z ::= WKT_GEOMETRYCOLLECTION_Z_TAGGED_TEXT geometrycollection_text_z */ yytestcase(yyruleno==197);
1520 {
1521  result->data.geom_type = geometry_type::GEOMETRYCOLLECTIONZ;
1522 }
1523  break;
1524  case 198: /* geometrycollection_m ::= WKT_GEOMETRYCOLLECTION_M_TAGGED_TEXT WKT_EMPTY_SET */
1525  case 199: /* geometrycollection_m ::= WKT_GEOMETRYCOLLECTION_M_TAGGED_TEXT geometrycollection_text_m */ yytestcase(yyruleno==199);
1526 {
1527  result->data.geom_type = geometry_type::GEOMETRYCOLLECTIONM;
1528 }
1529  break;
1530  case 200: /* geometrycollection_zm ::= WKT_GEOMETRYCOLLECTION_ZM_TAGGED_TEXT WKT_EMPTY_SET */
1531  case 201: /* geometrycollection_zm ::= WKT_GEOMETRYCOLLECTION_ZM_TAGGED_TEXT geometrycollection_text_zm */ yytestcase(yyruleno==201);
1532 {
1533  result->data.geom_type = geometry_type::GEOMETRYCOLLECTIONZM;
1534 }
1535  break;
1536  default:
1537  /* (0) program ::= wkt_text */ yytestcase(yyruleno==0);
1538  /* (1) wkt_text ::= point */ yytestcase(yyruleno==1);
1539  /* (2) wkt_text ::= point_z */ yytestcase(yyruleno==2);
1540  /* (3) wkt_text ::= point_m */ yytestcase(yyruleno==3);
1541  /* (4) wkt_text ::= point_zm */ yytestcase(yyruleno==4);
1542  /* (5) wkt_text ::= multipoint */ yytestcase(yyruleno==5);
1543  /* (6) wkt_text ::= multipoint_z */ yytestcase(yyruleno==6);
1544  /* (7) wkt_text ::= multipoint_m */ yytestcase(yyruleno==7);
1545  /* (8) wkt_text ::= multipoint_zm */ yytestcase(yyruleno==8);
1546  /* (9) wkt_text ::= linestring */ yytestcase(yyruleno==9);
1547  /* (10) wkt_text ::= linestring_z */ yytestcase(yyruleno==10);
1548  /* (11) wkt_text ::= linestring_m */ yytestcase(yyruleno==11);
1549  /* (12) wkt_text ::= linestring_zm */ yytestcase(yyruleno==12);
1550  /* (13) wkt_text ::= multilinestring */ yytestcase(yyruleno==13);
1551  /* (14) wkt_text ::= multilinestring_z */ yytestcase(yyruleno==14);
1552  /* (15) wkt_text ::= multilinestring_m */ yytestcase(yyruleno==15);
1553  /* (16) wkt_text ::= multilinestring_zm */ yytestcase(yyruleno==16);
1554  /* (17) wkt_text ::= polygon */ yytestcase(yyruleno==17);
1555  /* (18) wkt_text ::= polygon_z */ yytestcase(yyruleno==18);
1556  /* (19) wkt_text ::= polygon_m */ yytestcase(yyruleno==19);
1557  /* (20) wkt_text ::= polygon_zm */ yytestcase(yyruleno==20);
1558  /* (21) wkt_text ::= multipolygon */ yytestcase(yyruleno==21);
1559  /* (22) wkt_text ::= multipolygon_z */ yytestcase(yyruleno==22);
1560  /* (23) wkt_text ::= multipolygon_m */ yytestcase(yyruleno==23);
1561  /* (24) wkt_text ::= multipolygon_zm */ yytestcase(yyruleno==24);
1562  /* (25) wkt_text ::= geometrycollection */ yytestcase(yyruleno==25);
1563  /* (26) wkt_text ::= geometrycollection_z */ yytestcase(yyruleno==26);
1564  /* (27) wkt_text ::= geometrycollection_m */ yytestcase(yyruleno==27);
1565  /* (28) wkt_text ::= geometrycollection_zm */ yytestcase(yyruleno==28);
1566  /* (42) coord_xy_repeated ::= */ yytestcase(yyruleno==42);
1567  /* (43) coord_xy_repeated ::= WKT_COMMA coord_xy coord_xy_repeated */ yytestcase(yyruleno==43);
1568  /* (44) coord_xyz_repeated ::= */ yytestcase(yyruleno==44);
1569  /* (45) coord_xyz_repeated ::= WKT_COMMA coord_xyz coord_xyz_repeated */ yytestcase(yyruleno==45);
1570  /* (46) coord_xym_repeated ::= */ yytestcase(yyruleno==46);
1571  /* (47) coord_xym_repeated ::= WKT_COMMA coord_xym coord_xym_repeated */ yytestcase(yyruleno==47);
1572  /* (48) coord_xyzm_repeated ::= */ yytestcase(yyruleno==48);
1573  /* (49) coord_xyzm_repeated ::= WKT_COMMA coord_xyzm coord_xyzm_repeated */ yytestcase(yyruleno==49);
1574  /* (50) point_text ::= WKT_LPAREN coord_xy WKT_RPAREN */ yytestcase(yyruleno==50);
1575  /* (51) point_text_z ::= WKT_LPAREN coord_xyz WKT_RPAREN */ yytestcase(yyruleno==51);
1576  /* (52) point_text_m ::= WKT_LPAREN coord_xym WKT_RPAREN */ yytestcase(yyruleno==52);
1577  /* (53) point_text_zm ::= WKT_LPAREN coord_xyzm WKT_RPAREN */ yytestcase(yyruleno==53);
1578  /* (54) multipoint_text ::= */ yytestcase(yyruleno==54);
1579  /* (55) multipoint_text ::= WKT_COMMA point_text multipoint_text */ yytestcase(yyruleno==55);
1580  /* (56) multipoint_text_2 ::= */ yytestcase(yyruleno==56);
1581  /* (57) multipoint_text_2 ::= WKT_COMMA coord_xy multipoint_text_2 */ yytestcase(yyruleno==57);
1582  /* (58) multipoint_text_z ::= */ yytestcase(yyruleno==58);
1583  /* (59) multipoint_text_z ::= WKT_COMMA point_text_z multipoint_text_z */ yytestcase(yyruleno==59);
1584  /* (60) multipoint_text_z_2 ::= */ yytestcase(yyruleno==60);
1585  /* (61) multipoint_text_z_2 ::= WKT_COMMA coord_xyz multipoint_text_z_2 */ yytestcase(yyruleno==61);
1586  /* (62) multipoint_text_m ::= */ yytestcase(yyruleno==62);
1587  /* (63) multipoint_text_m ::= WKT_COMMA point_text_m multipoint_text_m */ yytestcase(yyruleno==63);
1588  /* (64) multipoint_text_m_2 ::= */ yytestcase(yyruleno==64);
1589  /* (65) multipoint_text_m_2 ::= WKT_COMMA coord_xym multipoint_text_m_2 */ yytestcase(yyruleno==65);
1590  /* (66) multipoint_text_zm ::= */ yytestcase(yyruleno==66);
1591  /* (67) multipoint_text_zm ::= WKT_COMMA point_text_zm multipoint_text_zm */ yytestcase(yyruleno==67);
1592  /* (68) multipoint_text_zm_2 ::= */ yytestcase(yyruleno==68);
1593  /* (69) multipoint_text_zm_2 ::= WKT_COMMA coord_xyzm multipoint_text_zm_2 */ yytestcase(yyruleno==69);
1594  /* (86) linestring_text_repeated ::= */ yytestcase(yyruleno==86);
1595  /* (87) linestring_text_repeated ::= WKT_COMMA linestring_text linestring_text_repeated */ yytestcase(yyruleno==87);
1596  /* (88) linestring_text_z_repeated ::= */ yytestcase(yyruleno==88);
1597  /* (89) linestring_text_z_repeated ::= WKT_COMMA linestring_text_z linestring_text_z_repeated */ yytestcase(yyruleno==89);
1598  /* (90) linestring_text_m_repeated ::= */ yytestcase(yyruleno==90);
1599  /* (91) linestring_text_m_repeated ::= WKT_COMMA linestring_text_m linestring_text_m_repeated */ yytestcase(yyruleno==91);
1600  /* (92) linestring_text_zm_repeated ::= */ yytestcase(yyruleno==92);
1601  /* (93) linestring_text_zm_repeated ::= WKT_COMMA linestring_text_zm linestring_text_zm_repeated */ yytestcase(yyruleno==93);
1602  /* (102) multilinestring_text ::= WKT_LPAREN linestring_text linestring_text_repeated WKT_RPAREN */ yytestcase(yyruleno==102);
1603  /* (103) multilinestring_text_z ::= WKT_LPAREN linestring_text_z linestring_text_z_repeated WKT_RPAREN */ yytestcase(yyruleno==103);
1604  /* (104) multilinestring_text_m ::= WKT_LPAREN linestring_text_m linestring_text_m_repeated WKT_RPAREN */ yytestcase(yyruleno==104);
1605  /* (105) multilinestring_text_zm ::= WKT_LPAREN linestring_text_zm linestring_text_zm_repeated WKT_RPAREN */ yytestcase(yyruleno==105);
1606  /* (118) ring_text_repeated ::= */ yytestcase(yyruleno==118);
1607  /* (119) ring_text_repeated ::= WKT_COMMA ring_text ring_text_repeated */ yytestcase(yyruleno==119);
1608  /* (120) ring_text_z_repeated ::= */ yytestcase(yyruleno==120);
1609  /* (121) ring_text_z_repeated ::= WKT_COMMA ring_text_z ring_text_z_repeated */ yytestcase(yyruleno==121);
1610  /* (122) ring_text_m_repeated ::= */ yytestcase(yyruleno==122);
1611  /* (123) ring_text_m_repeated ::= WKT_COMMA ring_text_m ring_text_m_repeated */ yytestcase(yyruleno==123);
1612  /* (124) ring_text_zm_repeated ::= */ yytestcase(yyruleno==124);
1613  /* (125) ring_text_zm_repeated ::= WKT_COMMA ring_text_zm ring_text_zm_repeated */ yytestcase(yyruleno==125);
1614  /* (126) polygon_text ::= WKT_LPAREN ring_text ring_text_repeated WKT_RPAREN */ yytestcase(yyruleno==126);
1615  /* (127) polygon_text_z ::= WKT_LPAREN ring_text_z ring_text_z_repeated WKT_RPAREN */ yytestcase(yyruleno==127);
1616  /* (128) polygon_text_m ::= WKT_LPAREN ring_text_m ring_text_m_repeated WKT_RPAREN */ yytestcase(yyruleno==128);
1617  /* (129) polygon_text_zm ::= WKT_LPAREN ring_text_zm ring_text_zm_repeated WKT_RPAREN */ yytestcase(yyruleno==129);
1618  /* (130) polygon_text_repeated ::= */ yytestcase(yyruleno==130);
1619  /* (131) polygon_text_repeated ::= WKT_COMMA polygon_text polygon_text_repeated */ yytestcase(yyruleno==131);
1620  /* (132) polygon_text_z_repeated ::= */ yytestcase(yyruleno==132);
1621  /* (133) polygon_text_z_repeated ::= WKT_COMMA polygon_text_z polygon_text_z_repeated */ yytestcase(yyruleno==133);
1622  /* (134) polygon_text_m_repeated ::= */ yytestcase(yyruleno==134);
1623  /* (135) polygon_text_m_repeated ::= WKT_COMMA polygon_text_m polygon_text_m_repeated */ yytestcase(yyruleno==135);
1624  /* (136) polygon_text_zm_repeated ::= */ yytestcase(yyruleno==136);
1625  /* (137) polygon_text_zm_repeated ::= WKT_COMMA polygon_text_zm polygon_text_zm_repeated */ yytestcase(yyruleno==137);
1626  /* (146) multipolygon_text ::= WKT_LPAREN polygon_text polygon_text_repeated WKT_RPAREN */ yytestcase(yyruleno==146);
1627  /* (147) multipolygon_text_z ::= WKT_LPAREN polygon_text_z polygon_text_z_repeated WKT_RPAREN */ yytestcase(yyruleno==147);
1628  /* (148) multipolygon_text_m ::= WKT_LPAREN polygon_text_m polygon_text_m_repeated WKT_RPAREN */ yytestcase(yyruleno==148);
1629  /* (149) multipolygon_text_zm ::= WKT_LPAREN polygon_text_zm polygon_text_zm_repeated WKT_RPAREN */ yytestcase(yyruleno==149);
1630  /* (158) geometry_text ::= point */ yytestcase(yyruleno==158);
1631  /* (159) geometry_text ::= multipoint */ yytestcase(yyruleno==159);
1632  /* (160) geometry_text ::= linestring */ yytestcase(yyruleno==160);
1633  /* (161) geometry_text ::= multilinestring */ yytestcase(yyruleno==161);
1634  /* (162) geometry_text ::= polygon */ yytestcase(yyruleno==162);
1635  /* (163) geometry_text ::= multipolygon */ yytestcase(yyruleno==163);
1636  /* (164) geometry_text_repeated ::= */ yytestcase(yyruleno==164);
1637  /* (165) geometry_text_repeated ::= WKT_COMMA geometry_text geometry_text_repeated */ yytestcase(yyruleno==165);
1638  /* (166) geometry_text_z ::= point_z */ yytestcase(yyruleno==166);
1639  /* (167) geometry_text_z ::= multipoint_z */ yytestcase(yyruleno==167);
1640  /* (168) geometry_text_z ::= linestring_z */ yytestcase(yyruleno==168);
1641  /* (169) geometry_text_z ::= multilinestring_z */ yytestcase(yyruleno==169);
1642  /* (170) geometry_text_z ::= polygon_z */ yytestcase(yyruleno==170);
1643  /* (171) geometry_text_z ::= multipolygon_z */ yytestcase(yyruleno==171);
1644  /* (172) geometry_text_z_repeated ::= */ yytestcase(yyruleno==172);
1645  /* (173) geometry_text_z_repeated ::= WKT_COMMA geometry_text_z geometry_text_z_repeated */ yytestcase(yyruleno==173);
1646  /* (174) geometry_text_m ::= point_m */ yytestcase(yyruleno==174);
1647  /* (175) geometry_text_m ::= multipoint_m */ yytestcase(yyruleno==175);
1648  /* (176) geometry_text_m ::= linestring_m */ yytestcase(yyruleno==176);
1649  /* (177) geometry_text_m ::= multilinestring_m */ yytestcase(yyruleno==177);
1650  /* (178) geometry_text_m ::= polygon_m */ yytestcase(yyruleno==178);
1651  /* (179) geometry_text_m ::= multipolygon_m */ yytestcase(yyruleno==179);
1652  /* (180) geometry_text_m_repeated ::= */ yytestcase(yyruleno==180);
1653  /* (181) geometry_text_m_repeated ::= WKT_COMMA geometry_text_m geometry_text_m_repeated */ yytestcase(yyruleno==181);
1654  /* (182) geometry_text_zm ::= point_zm */ yytestcase(yyruleno==182);
1655  /* (183) geometry_text_zm ::= multipoint_zm */ yytestcase(yyruleno==183);
1656  /* (184) geometry_text_zm ::= linestring_zm */ yytestcase(yyruleno==184);
1657  /* (185) geometry_text_zm ::= multilinestring_zm */ yytestcase(yyruleno==185);
1658  /* (186) geometry_text_zm ::= polygon_zm */ yytestcase(yyruleno==186);
1659  /* (187) geometry_text_zm ::= multipolygon_zm */ yytestcase(yyruleno==187);
1660  /* (188) geometry_text_zm_repeated ::= */ yytestcase(yyruleno==188);
1661  /* (189) geometry_text_zm_repeated ::= WKT_COMMA geometry_text_zm geometry_text_zm_repeated */ yytestcase(yyruleno==189);
1662  /* (190) geometrycollection_text ::= WKT_LPAREN geometry_text geometry_text_repeated WKT_RPAREN */ yytestcase(yyruleno==190);
1663  /* (191) geometrycollection_text_z ::= WKT_LPAREN geometry_text_z geometry_text_z_repeated WKT_RPAREN */ yytestcase(yyruleno==191);
1664  /* (192) geometrycollection_text_m ::= WKT_LPAREN geometry_text_m geometry_text_m_repeated WKT_RPAREN */ yytestcase(yyruleno==192);
1665  /* (193) geometrycollection_text_zm ::= WKT_LPAREN geometry_text_zm geometry_text_zm_repeated WKT_RPAREN */ yytestcase(yyruleno==193);
1666  break;
1667  };
1668  yygoto = yyRuleInfo[yyruleno].lhs;
1669  yysize = yyRuleInfo[yyruleno].nrhs;
1670  yypParser->yyidx -= yysize;
1671  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
1672  if( yyact < YYNSTATE ){
1673 #ifdef NDEBUG
1674  /* If we are not debugging and the reduce action popped at least
1675  ** one element off the stack, then we can push the new element back
1676  ** onto the stack here, and skip the stack overflow test in yy_shift().
1677  ** That gives a significant speed improvement. */
1678  if( yysize ){
1679  yypParser->yyidx++;
1680  yymsp -= yysize-1;
1681  yymsp->stateno = (YYACTIONTYPE)yyact;
1682  yymsp->major = (YYCODETYPE)yygoto;
1683  yymsp->minor = yygotominor;
1684  }else
1685 #endif
1686  {
1687  yy_shift(yypParser,yyact,yygoto,&yygotominor);
1688  }
1689  }else{
1690  assert( yyact == YYNSTATE + YYNRULE + 1 );
1691  yy_accept(yypParser);
1692  }
1693 }
1694 
1695 /*
1696 ** The following code executes when the parse fails
1697 */
1698 #ifndef YYNOERRORRECOVERY
1699 static void yy_parse_failed(
1700  yyParser *yypParser /* The parser */
1701 ){
1702  ParseARG_FETCH;
1703 #ifndef NDEBUG
1704  if( yyTraceFILE ){
1705  fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
1706  }
1707 #endif
1708  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
1709  /* Here code is inserted which will be executed whenever the
1710  ** parser fails */
1711  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
1712 }
1713 #endif /* YYNOERRORRECOVERY */
1714 
1715 /*
1716 ** The following code executes when a syntax error first occurs.
1717 */
1718 static void yy_syntax_error(
1719  yyParser *yypParser, /* The parser */
1720  int yymajor, /* The major type of the error token */
1721  YYMINORTYPE yyminor /* The minor type of the error token */
1722 ){
1723  ParseARG_FETCH;
1724 #define TOKEN (yyminor.yy0)
1725 
1726  result->parser_error = true;
1727 #ifdef SHAPES_VERBOSE
1728  int n = sizeof(yyTokenName) / sizeof(yyTokenName[0]);
1729  for (int i = 0; i < n; ++i) {
1730  int a = yy_find_shift_action(yypParser, (YYCODETYPE)i);
1731  if (a < YYNSTATE + YYNRULE) {
1732  printf("possible token: %s\n", yyTokenName[i]);
1733  }
1734  }
1735 #endif
1736  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
1737 }
1738 
1739 /*
1740 ** The following is executed when the parser accepts
1741 */
1742 static void yy_accept(
1743  yyParser *yypParser /* The parser */
1744 ){
1745  ParseARG_FETCH;
1746 #ifndef NDEBUG
1747  if( yyTraceFILE ){
1748  fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
1749  }
1750 #endif
1751  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
1752  /* Here code is inserted which will be executed whenever the
1753  ** parser accepts */
1754  ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
1755 }
1756 
1757 /* The main parser program.
1758 ** The first argument is a pointer to a structure obtained from
1759 ** "ParseAlloc" which describes the current state of the parser.
1760 ** The second argument is the major token number. The third is
1761 ** the minor token. The fourth optional argument is whatever the
1762 ** user wants (and specified in the grammar) and is available for
1763 ** use by the action routines.
1764 **
1765 ** Inputs:
1766 ** <ul>
1767 ** <li> A pointer to the parser (an opaque structure.)
1768 ** <li> The major token number.
1769 ** <li> The minor token number.
1770 ** <li> An option argument of a grammar-specified type.
1771 ** </ul>
1772 **
1773 ** Outputs:
1774 ** None.
1775 */
1776 void Parse(
1777  void *yyp, /* The parser */
1778  int yymajor, /* The major token code number */
1779  ParseTOKENTYPE yyminor /* The value for the token */
1780  ParseARG_PDECL /* Optional %extra_argument parameter */
1781 ){
1782  YYMINORTYPE yyminorunion;
1783  int yyact; /* The parser action. */
1784  int yyendofinput; /* True if we are at the end of input */
1785 #ifdef YYERRORSYMBOL
1786  int yyerrorhit = 0; /* True if yymajor has invoked an error */
1787 #endif
1788  yyParser *yypParser; /* The parser */
1789 
1790  /* (re)initialize the parser, if necessary */
1791  yypParser = (yyParser*)yyp;
1792  if( yypParser->yyidx<0 ){
1793 #if YYSTACKDEPTH<=0
1794  if( yypParser->yystksz <=0 ){
1795  /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/
1796  yyminorunion = yyzerominor;
1797  yyStackOverflow(yypParser, &yyminorunion);
1798  return;
1799  }
1800 #endif
1801  yypParser->yyidx = 0;
1802  yypParser->yyerrcnt = -1;
1803  yypParser->yystack[0].stateno = 0;
1804  yypParser->yystack[0].major = 0;
1805  }
1806  yyminorunion.yy0 = yyminor;
1807  yyendofinput = (yymajor==0);
1808  ParseARG_STORE;
1809 
1810 #ifndef NDEBUG
1811  if( yyTraceFILE ){
1812  fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
1813  }
1814 #endif
1815 
1816  do{
1817  yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
1818  if( yyact<YYNSTATE ){
1819  assert( !yyendofinput ); /* Impossible to shift the $ token */
1820  yy_shift(yypParser,yyact,yymajor,&yyminorunion);
1821  yypParser->yyerrcnt--;
1822  yymajor = YYNOCODE;
1823  }else if( yyact < YYNSTATE + YYNRULE ){
1824  yy_reduce(yypParser,yyact-YYNSTATE);
1825  }else{
1826  assert( yyact == YY_ERROR_ACTION );
1827 #ifdef YYERRORSYMBOL
1828  int yymx;
1829 #endif
1830 #ifndef NDEBUG
1831  if( yyTraceFILE ){
1832  fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
1833  }
1834 #endif
1835 #ifdef YYERRORSYMBOL
1836  /* A syntax error has occurred.
1837  ** The response to an error depends upon whether or not the
1838  ** grammar defines an error token "ERROR".
1839  **
1840  ** This is what we do if the grammar does define ERROR:
1841  **
1842  ** * Call the %syntax_error function.
1843  **
1844  ** * Begin popping the stack until we enter a state where
1845  ** it is legal to shift the error symbol, then shift
1846  ** the error symbol.
1847  **
1848  ** * Set the error count to three.
1849  **
1850  ** * Begin accepting and shifting new tokens. No new error
1851  ** processing will occur until three tokens have been
1852  ** shifted successfully.
1853  **
1854  */
1855  if( yypParser->yyerrcnt<0 ){
1856  yy_syntax_error(yypParser,yymajor,yyminorunion);
1857  }
1858  yymx = yypParser->yystack[yypParser->yyidx].major;
1859  if( yymx==YYERRORSYMBOL || yyerrorhit ){
1860 #ifndef NDEBUG
1861  if( yyTraceFILE ){
1862  fprintf(yyTraceFILE,"%sDiscard input token %s\n",
1863  yyTracePrompt,yyTokenName[yymajor]);
1864  }
1865 #endif
1866  yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion);
1867  yymajor = YYNOCODE;
1868  }else{
1869  while(
1870  yypParser->yyidx >= 0 &&
1871  yymx != YYERRORSYMBOL &&
1872  (yyact = yy_find_reduce_action(
1873  yypParser->yystack[yypParser->yyidx].stateno,
1874  YYERRORSYMBOL)) >= YYNSTATE
1875  ){
1876  yy_pop_parser_stack(yypParser);
1877  }
1878  if( yypParser->yyidx < 0 || yymajor==0 ){
1879  yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
1880  yy_parse_failed(yypParser);
1881  yymajor = YYNOCODE;
1882  }else if( yymx!=YYERRORSYMBOL ){
1883  YYMINORTYPE u2;
1884  u2.YYERRSYMDT = 0;
1885  yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
1886  }
1887  }
1888  yypParser->yyerrcnt = 3;
1889  yyerrorhit = 1;
1890 #elif defined(YYNOERRORRECOVERY)
1891  /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
1892  ** do any kind of error recovery. Instead, simply invoke the syntax
1893  ** error routine and continue going as if nothing had happened.
1894  **
1895  ** Applications can set this macro (for example inside %include) if
1896  ** they intend to abandon the parse upon the first syntax error seen.
1897  */
1898  yy_syntax_error(yypParser,yymajor,yyminorunion);
1899  yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
1900  yymajor = YYNOCODE;
1901 
1902 #else /* YYERRORSYMBOL is not defined */
1903  /* This is what we do if the grammar does not define ERROR:
1904  **
1905  ** * Report an error message, and throw away the input token.
1906  **
1907  ** * If the input token is $, then fail the parse.
1908  **
1909  ** As before, subsequent error messages are suppressed until
1910  ** three input tokens have been successfully shifted.
1911  */
1912  if( yypParser->yyerrcnt<=0 ){
1913  yy_syntax_error(yypParser,yymajor,yyminorunion);
1914  }
1915  yypParser->yyerrcnt = 3;
1916  yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
1917  if( yyendofinput ){
1918  yy_parse_failed(yypParser);
1919  }
1920  yymajor = YYNOCODE;
1921 #endif
1922  }
1923  }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
1924  return;
1925 }
1926 
1927 
1928 #ifdef __GNUC__
1929 #pragma GCC diagnostic pop
1930 #endif
1931 
1932 #ifdef __clang__
1933 #pragma clang diagnostic pop
1934 #endif
1935 
1936 #ifdef _MSC_VER
1937 #pragma warning(pop)
1938 #endif
1939 
1940 
1941 } // namespace shapes
1942 } // namespace simo
geometry_type geom_type
the dimension type of the geometry
Definition: wkt_parser.hpp:23
wkt_data data
the parser result data
Definition: wkt_parser.hpp:44
std::vector< std::size_t > offsets
the offsets in the coordinates sequence
Definition: wkt_parser.hpp:29
std::vector< double > coords
the coordinates as a sequence of numbers
Definition: wkt_parser.hpp:26
A Well-known text (WKT) markup language parser results.
Definition: wkt_parser.hpp:38
Definition: wkt_parser.hpp:432
A Well-known text (WKT) markup language parser result data.
Definition: wkt_parser.hpp:20