geo_coder 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. data/Gemfile +12 -0
  2. data/Gemfile.lock +32 -0
  3. data/History.txt +6 -0
  4. data/Makefile +13 -0
  5. data/Manifest.txt +18 -0
  6. data/README.rdoc +197 -0
  7. data/Rakefile +53 -0
  8. data/TODO.txt +8 -0
  9. data/VERSION +1 -0
  10. data/bin/build_indexes +8 -0
  11. data/bin/rebuild_cluster +22 -0
  12. data/bin/rebuild_metaphones +23 -0
  13. data/bin/tiger_import +59 -0
  14. data/demos/demo/app/ext/geocodewrap.rb +84 -0
  15. data/demos/demo/app/views/index.builder +13 -0
  16. data/demos/demo/app/views/index.erb +71 -0
  17. data/demos/demo/config.ru +12 -0
  18. data/demos/demo/config/bootstraps.rb +130 -0
  19. data/demos/demo/config/geoenvironment.rb +25 -0
  20. data/demos/demo/geocoder_helper.rb +12 -0
  21. data/demos/demo/geocom_geocode.rb +10 -0
  22. data/demos/demo/main.rb +3 -0
  23. data/demos/demo/rakefile.rb +17 -0
  24. data/demos/demo/tmp/restart.txt +0 -0
  25. data/demos/simpledemo/views/index.builder +13 -0
  26. data/demos/simpledemo/views/index.erb +69 -0
  27. data/demos/simpledemo/ws.rb +83 -0
  28. data/doc/Makefile +7 -0
  29. data/doc/html4css1.css +279 -0
  30. data/doc/lookup.rst +193 -0
  31. data/doc/parsing.rst +125 -0
  32. data/doc/voidspace.css +147 -0
  33. data/geo_coder.gemspec +172 -0
  34. data/lib/geocoder/us.rb +21 -0
  35. data/lib/geocoder/us/address.rb +290 -0
  36. data/lib/geocoder/us/constants.rb +670 -0
  37. data/lib/geocoder/us/database.rb +745 -0
  38. data/lib/geocoder/us/import.rb +181 -0
  39. data/lib/geocoder/us/import/tiger.rb +13 -0
  40. data/lib/geocoder/us/numbers.rb +58 -0
  41. data/navteq/README +4 -0
  42. data/navteq/convert.sql +37 -0
  43. data/navteq/navteq_import +39 -0
  44. data/navteq/prepare.sql +92 -0
  45. data/sql/cluster.sql +16 -0
  46. data/sql/convert.sql +80 -0
  47. data/sql/create.sql +37 -0
  48. data/sql/index.sql +12 -0
  49. data/sql/place.csv +104944 -0
  50. data/sql/place.sql +104948 -0
  51. data/sql/setup.sql +78 -0
  52. data/src/Makefile +13 -0
  53. data/src/README +14 -0
  54. data/src/liblwgeom/Makefile +75 -0
  55. data/src/liblwgeom/box2d.c +54 -0
  56. data/src/liblwgeom/lex.yy.c +4799 -0
  57. data/src/liblwgeom/liblwgeom.h +1405 -0
  58. data/src/liblwgeom/lwalgorithm.c +946 -0
  59. data/src/liblwgeom/lwalgorithm.h +52 -0
  60. data/src/liblwgeom/lwcircstring.c +759 -0
  61. data/src/liblwgeom/lwcollection.c +541 -0
  62. data/src/liblwgeom/lwcompound.c +118 -0
  63. data/src/liblwgeom/lwcurvepoly.c +86 -0
  64. data/src/liblwgeom/lwgeom.c +886 -0
  65. data/src/liblwgeom/lwgeom_api.c +2201 -0
  66. data/src/liblwgeom/lwgparse.c +1219 -0
  67. data/src/liblwgeom/lwgunparse.c +1054 -0
  68. data/src/liblwgeom/lwline.c +525 -0
  69. data/src/liblwgeom/lwmcurve.c +125 -0
  70. data/src/liblwgeom/lwmline.c +137 -0
  71. data/src/liblwgeom/lwmpoint.c +138 -0
  72. data/src/liblwgeom/lwmpoly.c +141 -0
  73. data/src/liblwgeom/lwmsurface.c +129 -0
  74. data/src/liblwgeom/lwpoint.c +439 -0
  75. data/src/liblwgeom/lwpoly.c +579 -0
  76. data/src/liblwgeom/lwsegmentize.c +1047 -0
  77. data/src/liblwgeom/lwutil.c +369 -0
  78. data/src/liblwgeom/measures.c +861 -0
  79. data/src/liblwgeom/postgis_config.h +93 -0
  80. data/src/liblwgeom/ptarray.c +847 -0
  81. data/src/liblwgeom/vsprintf.c +179 -0
  82. data/src/liblwgeom/wktparse.h +126 -0
  83. data/src/liblwgeom/wktparse.lex +74 -0
  84. data/src/liblwgeom/wktparse.tab.c +2353 -0
  85. data/src/liblwgeom/wktparse.tab.h +145 -0
  86. data/src/liblwgeom/wktparse.y +385 -0
  87. data/src/libsqlite3_geocoder/Makefile +22 -0
  88. data/src/libsqlite3_geocoder/Makefile.nix +15 -0
  89. data/src/libsqlite3_geocoder/Makefile.redhat +15 -0
  90. data/src/libsqlite3_geocoder/extension.c +121 -0
  91. data/src/libsqlite3_geocoder/extension.h +13 -0
  92. data/src/libsqlite3_geocoder/levenshtein.c +42 -0
  93. data/src/libsqlite3_geocoder/metaphon.c +278 -0
  94. data/src/libsqlite3_geocoder/util.c +37 -0
  95. data/src/libsqlite3_geocoder/wkb_compress.c +54 -0
  96. data/src/metaphone/Makefile +7 -0
  97. data/src/metaphone/README +49 -0
  98. data/src/metaphone/extension.c +37 -0
  99. data/src/metaphone/metaphon.c +251 -0
  100. data/src/shp2sqlite/Makefile +37 -0
  101. data/src/shp2sqlite/Makefile.nix +36 -0
  102. data/src/shp2sqlite/Makefile.redhat +35 -0
  103. data/src/shp2sqlite/dbfopen.c +1595 -0
  104. data/src/shp2sqlite/getopt.c +695 -0
  105. data/src/shp2sqlite/getopt.h +127 -0
  106. data/src/shp2sqlite/shapefil.h +500 -0
  107. data/src/shp2sqlite/shp2sqlite.c +1974 -0
  108. data/src/shp2sqlite/shpopen.c +1894 -0
  109. data/tests/address.rb +236 -0
  110. data/tests/benchmark.rb +20 -0
  111. data/tests/constants.rb +57 -0
  112. data/tests/data/address-sample.csv +52 -0
  113. data/tests/data/db-test.csv +57 -0
  114. data/tests/data/locations.csv +4 -0
  115. data/tests/database.rb +137 -0
  116. data/tests/generate.rb +34 -0
  117. data/tests/numbers.rb +46 -0
  118. data/tests/run.rb +11 -0
  119. metadata +237 -0
@@ -0,0 +1,179 @@
1
+ /* Like vsprintf but provides a pointer to malloc'd storage, which must
2
+ be freed by the caller.
3
+ Copyright (C) 1994, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2, or (at your option)
8
+ any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18
+
19
+ #ifdef HAVE_CONFIG_H
20
+ # include <config.h>
21
+ #endif
22
+
23
+ #include <stdio.h>
24
+ #include <string.h>
25
+ #include <stdlib.h>
26
+
27
+ #if __STDC__
28
+ # include <stdarg.h>
29
+ #else
30
+ # include <varargs.h>
31
+ #endif
32
+
33
+ #include <math.h>
34
+
35
+ #ifdef TEST
36
+ int global_total_width;
37
+ #endif
38
+
39
+
40
+ int lw_vasprintf (char **result, const char *format, va_list args);
41
+ int lw_asprintf
42
+ #if __STDC__
43
+ (char **result, const char *format, ...);
44
+ #else
45
+ (result, va_alist);
46
+ char **result;
47
+ va_dcl
48
+ #endif
49
+
50
+
51
+ static int
52
+ int_vasprintf (result, format, args)
53
+ char **result;
54
+ const char *format;
55
+ va_list *args;
56
+ {
57
+ const char *p = format;
58
+ /* Add one to make sure that it is never zero, which might cause malloc
59
+ to return NULL. */
60
+ int total_width = strlen (format) + 1;
61
+ va_list ap;
62
+
63
+ memcpy (&ap, args, sizeof (va_list));
64
+
65
+ while (*p != '\0')
66
+ {
67
+ if (*p++ == '%')
68
+ {
69
+ while (strchr ("-+ #0", *p))
70
+ ++p;
71
+ if (*p == '*')
72
+ {
73
+ ++p;
74
+ total_width += abs (va_arg (ap, int));
75
+ }
76
+ else
77
+ total_width += strtoul (p, (char **) &p, 10);
78
+ if (*p == '.')
79
+ {
80
+ ++p;
81
+ if (*p == '*')
82
+ {
83
+ ++p;
84
+ total_width += abs (va_arg (ap, int));
85
+ }
86
+ else
87
+ total_width += strtoul (p, (char **) &p, 10);
88
+ }
89
+ while (strchr ("hlLjtz", *p))
90
+ ++p;
91
+ /* Should be big enough for any format specifier except %s
92
+ and floats. */
93
+ total_width += 30;
94
+ switch (*p)
95
+ {
96
+ case 'd':
97
+ case 'i':
98
+ case 'o':
99
+ case 'u':
100
+ case 'x':
101
+ case 'X':
102
+ case 'c':
103
+ (void) va_arg (ap, int);
104
+ break;
105
+ case 'f':
106
+ {
107
+ double arg = va_arg (ap, double);
108
+ if (arg >= 1.0 || arg <= -1.0)
109
+ /* Since an ieee double can have an exponent of 307, we'll
110
+ make the buffer wide enough to cover the gross case. */
111
+ total_width += 307;
112
+ }
113
+ break;
114
+ case 'e':
115
+ case 'E':
116
+ case 'g':
117
+ case 'G':
118
+ (void) va_arg (ap, double);
119
+ break;
120
+ case 's':
121
+ total_width += strlen (va_arg (ap, char *));
122
+ break;
123
+ case 'p':
124
+ case 'n':
125
+ (void) va_arg (ap, char *);
126
+ break;
127
+ }
128
+ p++;
129
+ }
130
+ }
131
+ #ifdef TEST
132
+ global_total_width = total_width;
133
+ #endif
134
+ *result = malloc (total_width);
135
+ if (*result != NULL)
136
+ return vsprintf (*result, format, *args);
137
+ else
138
+ return 0;
139
+ }
140
+
141
+ int
142
+ lw_vasprintf (result, format, args)
143
+ char **result;
144
+ const char *format;
145
+ va_list args;
146
+ {
147
+ va_list temp;
148
+
149
+ /* Use va_copy for compatibility with both 32 and 64 bit args */
150
+ __va_copy(temp, args);
151
+
152
+ return int_vasprintf (result, format, &temp);
153
+ }
154
+
155
+ int
156
+ lw_asprintf
157
+ #if __STDC__
158
+ (char **result, const char *format, ...)
159
+ #else
160
+ (result, va_alist)
161
+ char **result;
162
+ va_dcl
163
+ #endif
164
+ {
165
+ va_list args;
166
+ int done;
167
+
168
+ #if __STDC__
169
+ va_start (args, format);
170
+ #else
171
+ char *format;
172
+ va_start (args);
173
+ format = va_arg (args, char *);
174
+ #endif
175
+ done = lw_vasprintf (result, format, args);
176
+ va_end (args);
177
+
178
+ return done;
179
+ }
@@ -0,0 +1,126 @@
1
+ /*
2
+ * Written by Ralph Mason ralph.mason<at>telogis.com
3
+ *
4
+ * Copyright Telogis 2004
5
+ * www.telogis.com
6
+ *
7
+ */
8
+
9
+ #ifndef _WKTPARSE_H
10
+ #define _WKTPARSE_H
11
+
12
+ #include <stdlib.h>
13
+
14
+
15
+ #ifndef _LIBLWGEOM_H
16
+ typedef unsigned char uchar;
17
+
18
+ typedef struct serialized_lwgeom {
19
+ uchar *lwgeom;
20
+ int size;
21
+ } SERIALIZED_LWGEOM;
22
+
23
+ typedef struct struct_lwgeom_parser_result
24
+ {
25
+ const char *wkinput;
26
+ SERIALIZED_LWGEOM *serialized_lwgeom;
27
+ int size;
28
+ const char *message;
29
+ int errlocation;
30
+ } LWGEOM_PARSER_RESULT;
31
+
32
+ typedef struct struct_lwgeom_unparser_result
33
+ {
34
+ uchar *serialized_lwgeom;
35
+ char *wkoutput;
36
+ int size;
37
+ const char *message;
38
+ int errlocation;
39
+ } LWGEOM_UNPARSER_RESULT;
40
+ #endif
41
+ typedef void* (*allocator)(size_t size);
42
+ typedef void (*freeor)(void* mem);
43
+ typedef void (*report_error)(const char* string, ...);
44
+
45
+ /*typedef unsigned long int4;*/
46
+
47
+ /* How much memory is allocated at a time(bytes) for tuples */
48
+ #define ALLOC_CHUNKS 8192
49
+
50
+ /* to shrink ints less than 0x7f to 1 byte */
51
+ /* #define SHRINK_INTS */
52
+
53
+ #define POINTTYPE 1
54
+ #define LINETYPE 2
55
+ #define POLYGONTYPE 3
56
+ #define MULTIPOINTTYPE 4
57
+ #define MULTILINETYPE 5
58
+ #define MULTIPOLYGONTYPE 6
59
+ #define COLLECTIONTYPE 7
60
+
61
+ /* Extended lwgeom integer types */
62
+ #define POINTTYPEI 10
63
+ #define LINETYPEI 11
64
+ #define POLYGONTYPEI 12
65
+
66
+ #define CIRCSTRINGTYPE 8
67
+ #define COMPOUNDTYPE 9
68
+ #define CURVEPOLYTYPE 13
69
+ #define MULTICURVETYPE 14
70
+ #define MULTISURFACETYPE 15
71
+
72
+ extern int srid;
73
+
74
+ /*
75
+
76
+ These functions are used by the
77
+ generated parser and are not meant
78
+ for public use
79
+
80
+ */
81
+
82
+ void set_srid(double srid);
83
+ void alloc_lwgeom(int srid);
84
+
85
+ void alloc_point_2d(double x,double y);
86
+ void alloc_point_3d(double x,double y,double z);
87
+ void alloc_point_4d(double x,double y,double z,double m);
88
+
89
+ void alloc_point(void);
90
+ void alloc_linestring(void);
91
+ void alloc_linestring_closed(void);
92
+ void alloc_circularstring(void);
93
+ void alloc_circularstring_closed(void);
94
+ void alloc_polygon(void);
95
+ void alloc_compoundcurve(void);
96
+ void alloc_curvepolygon(void);
97
+ void alloc_multipoint(void);
98
+ void alloc_multilinestring(void);
99
+ void alloc_multicurve(void);
100
+ void alloc_multipolygon(void);
101
+ void alloc_multisurface(void);
102
+ void alloc_geomertycollection(void);
103
+ void alloc_empty();
104
+ void alloc_counter(void);
105
+
106
+
107
+ void pop(void);
108
+ void popc(void);
109
+
110
+ void alloc_wkb(const char* parser);
111
+
112
+ /*
113
+ Use these functions to parse and unparse lwgeoms
114
+ You are responsible for freeing the returned memory.
115
+ */
116
+
117
+ int parse_lwg(LWGEOM_PARSER_RESULT *lwg_parser_result, const char* wkt, int flags, allocator allocfunc,report_error errfunc);
118
+ int parse_lwgi(LWGEOM_PARSER_RESULT *lwg_parser_result, const char* wkt, int flags, allocator allocfunc,report_error errfunc);
119
+ int unparse_WKT(LWGEOM_UNPARSER_RESULT *lwg_unparser_result, uchar* serialized, allocator alloc, freeor free, int flags);
120
+ int unparse_WKB(LWGEOM_UNPARSER_RESULT *lwg_unparser_result, uchar* serialized, allocator alloc, freeor free, int flags, char endian, uchar hexform);
121
+ int lwg_parse_yyparse(void);
122
+ int lwg_parse_yyerror(char* s);
123
+ void lwg_parse_yynotice(char* s);
124
+
125
+
126
+ #endif /* _WKTPARSE_H */
@@ -0,0 +1,74 @@
1
+ /*
2
+ * Written by Ralph Mason ralph.mason<at>telogis.com
3
+ *
4
+ * Copyright Telogis 2004
5
+ * www.telogis.com
6
+ *
7
+ */
8
+
9
+ %x vals_ok
10
+ %{
11
+ #include "wktparse.tab.h"
12
+ #include <unistd.h>
13
+ #include <stdlib.h> /* need stdlib for atof() definition */
14
+
15
+ void init_parser(const char *src);
16
+ void close_parser(void);
17
+ int lwg_parse_yywrap(void);
18
+ int lwg_parse_yylex(void);
19
+
20
+ static YY_BUFFER_STATE buf_state;
21
+ void init_parser(const char *src) { BEGIN(0);buf_state = lwg_parse_yy_scan_string(src); }
22
+ void close_parser() { lwg_parse_yy_delete_buffer(buf_state); }
23
+ int lwg_parse_yywrap(void){ return 1; }
24
+
25
+ /* Macro to keep track of the current parse position */
26
+ #define UPDATE_YYLLOC() (lwg_parse_yylloc.last_column += yyleng)
27
+
28
+ %}
29
+
30
+ %%
31
+
32
+ <vals_ok>[-|\+]?[0-9]+(\.[0-9]+)?([Ee](\+|-)?[0-9]+)? { lwg_parse_yylval.value=atof(lwg_parse_yytext); UPDATE_YYLLOC(); return VALUE; }
33
+ <vals_ok>[-|\+]?(\.[0-9]+)([Ee](\+|-)?[0-9]+)? { lwg_parse_yylval.value=atof(lwg_parse_yytext); UPDATE_YYLLOC(); return VALUE; }
34
+
35
+ <INITIAL>00[0-9A-F]* { lwg_parse_yylval.wkb=lwg_parse_yytext; return WKB;}
36
+ <INITIAL>01[0-9A-F]* { lwg_parse_yylval.wkb=lwg_parse_yytext; return WKB;}
37
+
38
+ <*>POINT { UPDATE_YYLLOC(); return POINT; }
39
+ <*>POINTM { UPDATE_YYLLOC(); return POINTM; }
40
+ <*>LINESTRING { UPDATE_YYLLOC(); return LINESTRING; }
41
+ <*>LINESTRINGM { UPDATE_YYLLOC(); return LINESTRINGM; }
42
+ <*>CIRCULARSTRING { UPDATE_YYLLOC(); return CIRCULARSTRING; }
43
+ <*>CIRCULARSTRINGM { UPDATE_YYLLOC(); return CIRCULARSTRINGM; }
44
+ <*>POLYGON { UPDATE_YYLLOC(); return POLYGON; }
45
+ <*>POLYGONM { UPDATE_YYLLOC(); return POLYGONM; }
46
+ <*>COMPOUNDCURVE { UPDATE_YYLLOC(); return COMPOUNDCURVE; }
47
+ <*>COMPOUNDCURVEM { UPDATE_YYLLOC(); return COMPOUNDCURVEM; }
48
+ <*>CURVEPOLYGON { UPDATE_YYLLOC(); return CURVEPOLYGON; }
49
+ <*>CURVEPOLYGONM { UPDATE_YYLLOC(); return CURVEPOLYGONM; }
50
+ <*>MULTIPOINT { UPDATE_YYLLOC(); return MULTIPOINT; }
51
+ <*>MULTIPOINTM { UPDATE_YYLLOC(); return MULTIPOINTM; }
52
+ <*>MULTILINESTRING { UPDATE_YYLLOC(); return MULTILINESTRING; }
53
+ <*>MULTILINESTRINGM { UPDATE_YYLLOC(); return MULTILINESTRINGM; }
54
+ <*>MULTICURVE { UPDATE_YYLLOC(); return MULTICURVE; }
55
+ <*>MULTICURVEM { UPDATE_YYLLOC(); return MULTICURVEM; }
56
+ <*>MULTIPOLYGON { UPDATE_YYLLOC(); return MULTIPOLYGON; }
57
+ <*>MULTIPOLYGONM { UPDATE_YYLLOC(); return MULTIPOLYGONM; }
58
+ <*>MULTISURFACE { UPDATE_YYLLOC(); return MULTISURFACE; }
59
+ <*>MULTISURFACEM { UPDATE_YYLLOC(); return MULTISURFACEM; }
60
+ <*>GEOMETRYCOLLECTION { UPDATE_YYLLOC(); return GEOMETRYCOLLECTION; }
61
+ <*>GEOMETRYCOLLECTIONM { UPDATE_YYLLOC(); return GEOMETRYCOLLECTIONM; }
62
+ <*>SRID { BEGIN(vals_ok); UPDATE_YYLLOC(); return SRID; }
63
+ <*>EMPTY { UPDATE_YYLLOC(); return EMPTY; }
64
+
65
+ <*>\( { BEGIN(vals_ok); UPDATE_YYLLOC(); return LPAREN; }
66
+ <*>\) { UPDATE_YYLLOC(); return RPAREN; }
67
+ <*>, { UPDATE_YYLLOC(); return COMMA ; }
68
+ <*>= { UPDATE_YYLLOC(); return EQUALS ; }
69
+ <*>; { BEGIN(0); UPDATE_YYLLOC(); return SEMICOLON; }
70
+ <*>[ \t\n\r]+ /*eat whitespace*/ { UPDATE_YYLLOC(); }
71
+ <*>. { return lwg_parse_yytext[0]; }
72
+
73
+ %%
74
+
@@ -0,0 +1,2353 @@
1
+ /* A Bison parser, made by GNU Bison 2.3. */
2
+
3
+ /* Skeleton implementation for Bison's Yacc-like parsers in C
4
+
5
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6
+ Free Software Foundation, Inc.
7
+
8
+ This program is free software; you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation; either version 2, or (at your option)
11
+ any later version.
12
+
13
+ This program is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with this program; if not, write to the Free Software
20
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
+ Boston, MA 02110-1301, USA. */
22
+
23
+ /* As a special exception, you may create a larger work that contains
24
+ part or all of the Bison parser skeleton and distribute that work
25
+ under terms of your choice, so long as that work isn't itself a
26
+ parser generator using the skeleton or a modified version thereof
27
+ as a parser skeleton. Alternatively, if you modify or redistribute
28
+ the parser skeleton itself, you may (at your option) remove this
29
+ special exception, which will cause the skeleton and the resulting
30
+ Bison output files to be licensed under the GNU General Public
31
+ License without this special exception.
32
+
33
+ This special exception was added by the Free Software Foundation in
34
+ version 2.2 of Bison. */
35
+
36
+ /* C LALR(1) parser skeleton written by Richard Stallman, by
37
+ simplifying the original so-called "semantic" parser. */
38
+
39
+ /* All symbols defined below should begin with yy or YY, to avoid
40
+ infringing on user name space. This should be done even for local
41
+ variables, as they might otherwise be expanded by user macros.
42
+ There are some unavoidable exceptions within include files to
43
+ define necessary library symbols; they are noted "INFRINGES ON
44
+ USER NAME SPACE" below. */
45
+
46
+ /* Identify Bison output. */
47
+ #define YYBISON 1
48
+
49
+ /* Bison version. */
50
+ #define YYBISON_VERSION "2.3"
51
+
52
+ /* Skeleton name. */
53
+ #define YYSKELETON_NAME "yacc.c"
54
+
55
+ /* Pure parsers. */
56
+ #define YYPURE 0
57
+
58
+ /* Using locations. */
59
+ #define YYLSP_NEEDED 1
60
+
61
+ /* Substitute the variable and function names. */
62
+ #define yyparse lwg_parse_yyparse
63
+ #define yylex lwg_parse_yylex
64
+ #define yyerror lwg_parse_yyerror
65
+ #define yylval lwg_parse_yylval
66
+ #define yychar lwg_parse_yychar
67
+ #define yydebug lwg_parse_yydebug
68
+ #define yynerrs lwg_parse_yynerrs
69
+ #define yylloc lwg_parse_yylloc
70
+
71
+ /* Tokens. */
72
+ #ifndef YYTOKENTYPE
73
+ # define YYTOKENTYPE
74
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
75
+ know about them. */
76
+ enum yytokentype {
77
+ POINT = 258,
78
+ LINESTRING = 259,
79
+ POLYGON = 260,
80
+ MULTIPOINT = 261,
81
+ MULTILINESTRING = 262,
82
+ MULTIPOLYGON = 263,
83
+ GEOMETRYCOLLECTION = 264,
84
+ CIRCULARSTRING = 265,
85
+ COMPOUNDCURVE = 266,
86
+ CURVEPOLYGON = 267,
87
+ MULTICURVE = 268,
88
+ MULTISURFACE = 269,
89
+ POINTM = 270,
90
+ LINESTRINGM = 271,
91
+ POLYGONM = 272,
92
+ MULTIPOINTM = 273,
93
+ MULTILINESTRINGM = 274,
94
+ MULTIPOLYGONM = 275,
95
+ GEOMETRYCOLLECTIONM = 276,
96
+ CIRCULARSTRINGM = 277,
97
+ COMPOUNDCURVEM = 278,
98
+ CURVEPOLYGONM = 279,
99
+ MULTICURVEM = 280,
100
+ MULTISURFACEM = 281,
101
+ SRID = 282,
102
+ EMPTY = 283,
103
+ VALUE = 284,
104
+ LPAREN = 285,
105
+ RPAREN = 286,
106
+ COMMA = 287,
107
+ EQUALS = 288,
108
+ SEMICOLON = 289,
109
+ WKB = 290
110
+ };
111
+ #endif
112
+ /* Tokens. */
113
+ #define POINT 258
114
+ #define LINESTRING 259
115
+ #define POLYGON 260
116
+ #define MULTIPOINT 261
117
+ #define MULTILINESTRING 262
118
+ #define MULTIPOLYGON 263
119
+ #define GEOMETRYCOLLECTION 264
120
+ #define CIRCULARSTRING 265
121
+ #define COMPOUNDCURVE 266
122
+ #define CURVEPOLYGON 267
123
+ #define MULTICURVE 268
124
+ #define MULTISURFACE 269
125
+ #define POINTM 270
126
+ #define LINESTRINGM 271
127
+ #define POLYGONM 272
128
+ #define MULTIPOINTM 273
129
+ #define MULTILINESTRINGM 274
130
+ #define MULTIPOLYGONM 275
131
+ #define GEOMETRYCOLLECTIONM 276
132
+ #define CIRCULARSTRINGM 277
133
+ #define COMPOUNDCURVEM 278
134
+ #define CURVEPOLYGONM 279
135
+ #define MULTICURVEM 280
136
+ #define MULTISURFACEM 281
137
+ #define SRID 282
138
+ #define EMPTY 283
139
+ #define VALUE 284
140
+ #define LPAREN 285
141
+ #define RPAREN 286
142
+ #define COMMA 287
143
+ #define EQUALS 288
144
+ #define SEMICOLON 289
145
+ #define WKB 290
146
+
147
+
148
+
149
+
150
+ /* Copy the first part of user declarations. */
151
+ #line 9 "wktparse.y"
152
+
153
+ #include "wktparse.h"
154
+ #include <unistd.h>
155
+ #include <stdio.h>
156
+
157
+ void set_zm(char z, char m);
158
+ int lwg_parse_yylex(void);
159
+
160
+
161
+ /* Enabling traces. */
162
+ #ifndef YYDEBUG
163
+ # define YYDEBUG 0
164
+ #endif
165
+
166
+ /* Enabling verbose error messages. */
167
+ #ifdef YYERROR_VERBOSE
168
+ # undef YYERROR_VERBOSE
169
+ # define YYERROR_VERBOSE 1
170
+ #else
171
+ # define YYERROR_VERBOSE 0
172
+ #endif
173
+
174
+ /* Enabling the token table. */
175
+ #ifndef YYTOKEN_TABLE
176
+ # define YYTOKEN_TABLE 0
177
+ #endif
178
+
179
+ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
180
+ typedef union YYSTYPE
181
+ #line 22 "wktparse.y"
182
+ {
183
+ double value;
184
+ const char* wkb;
185
+ }
186
+ /* Line 187 of yacc.c. */
187
+ #line 188 "y.tab.c"
188
+ YYSTYPE;
189
+ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
190
+ # define YYSTYPE_IS_DECLARED 1
191
+ # define YYSTYPE_IS_TRIVIAL 1
192
+ #endif
193
+
194
+ #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
195
+ typedef struct YYLTYPE
196
+ {
197
+ int first_line;
198
+ int first_column;
199
+ int last_line;
200
+ int last_column;
201
+ } YYLTYPE;
202
+ # define yyltype YYLTYPE /* obsolescent; will be withdrawn */
203
+ # define YYLTYPE_IS_DECLARED 1
204
+ # define YYLTYPE_IS_TRIVIAL 1
205
+ #endif
206
+
207
+
208
+ /* Copy the second part of user declarations. */
209
+
210
+
211
+ /* Line 216 of yacc.c. */
212
+ #line 213 "y.tab.c"
213
+
214
+ #ifdef short
215
+ # undef short
216
+ #endif
217
+
218
+ #ifdef YYTYPE_UINT8
219
+ typedef YYTYPE_UINT8 yytype_uint8;
220
+ #else
221
+ typedef unsigned char yytype_uint8;
222
+ #endif
223
+
224
+ #ifdef YYTYPE_INT8
225
+ typedef YYTYPE_INT8 yytype_int8;
226
+ #elif (defined __STDC__ || defined __C99__FUNC__ \
227
+ || defined __cplusplus || defined _MSC_VER)
228
+ typedef signed char yytype_int8;
229
+ #else
230
+ typedef short int yytype_int8;
231
+ #endif
232
+
233
+ #ifdef YYTYPE_UINT16
234
+ typedef YYTYPE_UINT16 yytype_uint16;
235
+ #else
236
+ typedef unsigned short int yytype_uint16;
237
+ #endif
238
+
239
+ #ifdef YYTYPE_INT16
240
+ typedef YYTYPE_INT16 yytype_int16;
241
+ #else
242
+ typedef short int yytype_int16;
243
+ #endif
244
+
245
+ #ifndef YYSIZE_T
246
+ # ifdef __SIZE_TYPE__
247
+ # define YYSIZE_T __SIZE_TYPE__
248
+ # elif defined size_t
249
+ # define YYSIZE_T size_t
250
+ # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
251
+ || defined __cplusplus || defined _MSC_VER)
252
+ # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
253
+ # define YYSIZE_T size_t
254
+ # else
255
+ # define YYSIZE_T unsigned int
256
+ # endif
257
+ #endif
258
+
259
+ #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
260
+
261
+ #ifndef YY_
262
+ # if YYENABLE_NLS
263
+ # if ENABLE_NLS
264
+ # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
265
+ # define YY_(msgid) dgettext ("bison-runtime", msgid)
266
+ # endif
267
+ # endif
268
+ # ifndef YY_
269
+ # define YY_(msgid) msgid
270
+ # endif
271
+ #endif
272
+
273
+ /* Suppress unused-variable warnings by "using" E. */
274
+ #if ! defined lint || defined __GNUC__
275
+ # define YYUSE(e) ((void) (e))
276
+ #else
277
+ # define YYUSE(e) /* empty */
278
+ #endif
279
+
280
+ /* Identity function, used to suppress warnings about constant conditions. */
281
+ #ifndef lint
282
+ # define YYID(n) (n)
283
+ #else
284
+ #if (defined __STDC__ || defined __C99__FUNC__ \
285
+ || defined __cplusplus || defined _MSC_VER)
286
+ static int
287
+ YYID (int i)
288
+ #else
289
+ static int
290
+ YYID (i)
291
+ int i;
292
+ #endif
293
+ {
294
+ return i;
295
+ }
296
+ #endif
297
+
298
+ #if ! defined yyoverflow || YYERROR_VERBOSE
299
+
300
+ /* The parser invokes alloca or malloc; define the necessary symbols. */
301
+
302
+ # ifdef YYSTACK_USE_ALLOCA
303
+ # if YYSTACK_USE_ALLOCA
304
+ # ifdef __GNUC__
305
+ # define YYSTACK_ALLOC __builtin_alloca
306
+ # elif defined __BUILTIN_VA_ARG_INCR
307
+ # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
308
+ # elif defined _AIX
309
+ # define YYSTACK_ALLOC __alloca
310
+ # elif defined _MSC_VER
311
+ # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
312
+ # define alloca _alloca
313
+ # else
314
+ # define YYSTACK_ALLOC alloca
315
+ # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
316
+ || defined __cplusplus || defined _MSC_VER)
317
+ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
318
+ # ifndef _STDLIB_H
319
+ # define _STDLIB_H 1
320
+ # endif
321
+ # endif
322
+ # endif
323
+ # endif
324
+ # endif
325
+
326
+ # ifdef YYSTACK_ALLOC
327
+ /* Pacify GCC's `empty if-body' warning. */
328
+ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
329
+ # ifndef YYSTACK_ALLOC_MAXIMUM
330
+ /* The OS might guarantee only one guard page at the bottom of the stack,
331
+ and a page size can be as small as 4096 bytes. So we cannot safely
332
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
333
+ to allow for a few compiler-allocated temporary stack slots. */
334
+ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
335
+ # endif
336
+ # else
337
+ # define YYSTACK_ALLOC YYMALLOC
338
+ # define YYSTACK_FREE YYFREE
339
+ # ifndef YYSTACK_ALLOC_MAXIMUM
340
+ # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
341
+ # endif
342
+ # if (defined __cplusplus && ! defined _STDLIB_H \
343
+ && ! ((defined YYMALLOC || defined malloc) \
344
+ && (defined YYFREE || defined free)))
345
+ # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
346
+ # ifndef _STDLIB_H
347
+ # define _STDLIB_H 1
348
+ # endif
349
+ # endif
350
+ # ifndef YYMALLOC
351
+ # define YYMALLOC malloc
352
+ # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
353
+ || defined __cplusplus || defined _MSC_VER)
354
+ void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
355
+ # endif
356
+ # endif
357
+ # ifndef YYFREE
358
+ # define YYFREE free
359
+ # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
360
+ || defined __cplusplus || defined _MSC_VER)
361
+ void free (void *); /* INFRINGES ON USER NAME SPACE */
362
+ # endif
363
+ # endif
364
+ # endif
365
+ #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
366
+
367
+
368
+ #if (! defined yyoverflow \
369
+ && (! defined __cplusplus \
370
+ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
371
+ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
372
+
373
+ /* A type that is properly aligned for any stack member. */
374
+ union yyalloc
375
+ {
376
+ yytype_int16 yyss;
377
+ YYSTYPE yyvs;
378
+ YYLTYPE yyls;
379
+ };
380
+
381
+ /* The size of the maximum gap between one aligned stack and the next. */
382
+ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
383
+
384
+ /* The size of an array large to enough to hold all stacks, each with
385
+ N elements. */
386
+ # define YYSTACK_BYTES(N) \
387
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
388
+ + 2 * YYSTACK_GAP_MAXIMUM)
389
+
390
+ /* Copy COUNT objects from FROM to TO. The source and destination do
391
+ not overlap. */
392
+ # ifndef YYCOPY
393
+ # if defined __GNUC__ && 1 < __GNUC__
394
+ # define YYCOPY(To, From, Count) \
395
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
396
+ # else
397
+ # define YYCOPY(To, From, Count) \
398
+ do \
399
+ { \
400
+ YYSIZE_T yyi; \
401
+ for (yyi = 0; yyi < (Count); yyi++) \
402
+ (To)[yyi] = (From)[yyi]; \
403
+ } \
404
+ while (YYID (0))
405
+ # endif
406
+ # endif
407
+
408
+ /* Relocate STACK from its old location to the new one. The
409
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
410
+ elements in the stack, and YYPTR gives the new location of the
411
+ stack. Advance YYPTR to a properly aligned location for the next
412
+ stack. */
413
+ # define YYSTACK_RELOCATE(Stack) \
414
+ do \
415
+ { \
416
+ YYSIZE_T yynewbytes; \
417
+ YYCOPY (&yyptr->Stack, Stack, yysize); \
418
+ Stack = &yyptr->Stack; \
419
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
420
+ yyptr += yynewbytes / sizeof (*yyptr); \
421
+ } \
422
+ while (YYID (0))
423
+
424
+ #endif
425
+
426
+ /* YYFINAL -- State number of the termination state. */
427
+ #define YYFINAL 6
428
+ /* YYLAST -- Last index in YYTABLE. */
429
+ #define YYLAST 180
430
+
431
+ /* YYNTOKENS -- Number of terminals. */
432
+ #define YYNTOKENS 36
433
+ /* YYNNTS -- Number of nonterminals. */
434
+ #define YYNNTS 107
435
+ /* YYNRULES -- Number of rules. */
436
+ #define YYNRULES 169
437
+ /* YYNRULES -- Number of states. */
438
+ #define YYNSTATES 237
439
+
440
+ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
441
+ #define YYUNDEFTOK 2
442
+ #define YYMAXUTOK 290
443
+
444
+ #define YYTRANSLATE(YYX) \
445
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
446
+
447
+ /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
448
+ static const yytype_uint8 yytranslate[] =
449
+ {
450
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
464
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
472
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
474
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
475
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
476
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
477
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
478
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
479
+ 35
480
+ };
481
+
482
+ #if YYDEBUG
483
+ /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
484
+ YYRHS. */
485
+ static const yytype_uint16 yyprhs[] =
486
+ {
487
+ 0, 0, 3, 4, 9, 10, 13, 15, 17, 19,
488
+ 21, 23, 25, 27, 29, 31, 33, 35, 37, 39,
489
+ 43, 45, 48, 49, 53, 55, 57, 58, 61, 62,
490
+ 65, 69, 70, 74, 75, 79, 81, 82, 87, 89,
491
+ 93, 95, 96, 99, 102, 103, 107, 109, 111, 112,
492
+ 115, 116, 119, 120, 123, 124, 129, 131, 135, 138,
493
+ 139, 143, 146, 147, 151, 153, 155, 157, 159, 160,
494
+ 163, 164, 167, 168, 171, 172, 177, 179, 183, 184,
495
+ 188, 189, 193, 195, 196, 201, 203, 205, 209, 213,
496
+ 214, 218, 219, 223, 225, 226, 231, 233, 237, 238,
497
+ 242, 243, 247, 249, 250, 255, 257, 259, 263, 267,
498
+ 270, 271, 275, 277, 279, 280, 283, 284, 287, 288,
499
+ 293, 295, 299, 300, 304, 305, 309, 311, 312, 317,
500
+ 319, 321, 325, 329, 330, 334, 335, 339, 341, 342,
501
+ 347, 349, 353, 354, 358, 359, 363, 365, 366, 371,
502
+ 373, 375, 379, 383, 384, 388, 389, 393, 395, 396,
503
+ 401, 403, 405, 409, 411, 413, 415, 418, 422, 427
504
+ };
505
+
506
+ /* YYRHS -- A `-1'-separated list of the rules' RHS. */
507
+ static const yytype_int16 yyrhs[] =
508
+ {
509
+ 37, 0, -1, -1, 41, 34, 38, 40, -1, -1,
510
+ 39, 40, -1, 42, -1, 43, -1, 59, -1, 71,
511
+ -1, 104, -1, 86, -1, 114, -1, 51, -1, 92,
512
+ -1, 98, -1, 120, -1, 126, -1, 132, -1, 27,
513
+ 33, 29, -1, 35, -1, 3, 45, -1, -1, 15,
514
+ 44, 45, -1, 46, -1, 48, -1, -1, 47, 142,
515
+ -1, -1, 49, 50, -1, 30, 138, 31, -1, -1,
516
+ 6, 52, 54, -1, -1, 18, 53, 54, -1, 142,
517
+ -1, -1, 55, 30, 56, 31, -1, 57, -1, 56,
518
+ 32, 57, -1, 48, -1, -1, 58, 138, -1, 4,
519
+ 61, -1, -1, 16, 60, 61, -1, 62, -1, 64,
520
+ -1, -1, 63, 142, -1, -1, 65, 68, -1, -1,
521
+ 67, 68, -1, -1, 69, 30, 70, 31, -1, 138,
522
+ -1, 70, 32, 138, -1, 10, 75, -1, -1, 22,
523
+ 72, 75, -1, 10, 76, -1, -1, 22, 74, 76,
524
+ -1, 77, -1, 79, -1, 77, -1, 81, -1, -1,
525
+ 78, 142, -1, -1, 80, 83, -1, -1, 82, 83,
526
+ -1, -1, 84, 30, 85, 31, -1, 138, -1, 85,
527
+ 32, 138, -1, -1, 11, 87, 89, -1, -1, 23,
528
+ 88, 89, -1, 142, -1, -1, 90, 30, 91, 31,
529
+ -1, 64, -1, 71, -1, 91, 32, 64, -1, 91,
530
+ 32, 71, -1, -1, 7, 93, 95, -1, -1, 19,
531
+ 94, 95, -1, 142, -1, -1, 96, 30, 97, 31,
532
+ -1, 64, -1, 97, 32, 64, -1, -1, 13, 99,
533
+ 101, -1, -1, 25, 100, 101, -1, 142, -1, -1,
534
+ 102, 30, 103, 31, -1, 64, -1, 71, -1, 103,
535
+ 32, 64, -1, 103, 32, 71, -1, 5, 106, -1,
536
+ -1, 17, 105, 106, -1, 107, -1, 109, -1, -1,
537
+ 108, 142, -1, -1, 110, 111, -1, -1, 112, 30,
538
+ 113, 31, -1, 68, -1, 113, 32, 68, -1, -1,
539
+ 12, 115, 117, -1, -1, 24, 116, 117, -1, 142,
540
+ -1, -1, 118, 30, 119, 31, -1, 66, -1, 73,
541
+ -1, 119, 32, 66, -1, 119, 32, 73, -1, -1,
542
+ 8, 121, 123, -1, -1, 20, 122, 123, -1, 142,
543
+ -1, -1, 124, 30, 125, 31, -1, 109, -1, 125,
544
+ 32, 109, -1, -1, 14, 127, 129, -1, -1, 26,
545
+ 128, 129, -1, 142, -1, -1, 130, 30, 131, 31,
546
+ -1, 109, -1, 114, -1, 131, 32, 109, -1, 131,
547
+ 32, 114, -1, -1, 9, 133, 135, -1, -1, 21,
548
+ 134, 135, -1, 142, -1, -1, 136, 30, 137, 31,
549
+ -1, 142, -1, 40, -1, 137, 32, 40, -1, 139,
550
+ -1, 140, -1, 141, -1, 29, 29, -1, 29, 29,
551
+ 29, -1, 29, 29, 29, 29, -1, 28, -1
552
+ };
553
+
554
+ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
555
+ static const yytype_uint16 yyrline[] =
556
+ {
557
+ 0, 38, 38, 38, 40, 40, 43, 45, 47, 49,
558
+ 51, 53, 55, 57, 59, 61, 63, 65, 67, 70,
559
+ 73, 79, 81, 81, 84, 86, 89, 89, 92, 92,
560
+ 95, 100, 100, 102, 102, 105, 107, 107, 110, 112,
561
+ 115, 118, 118, 124, 126, 126, 129, 131, 134, 134,
562
+ 137, 137, 140, 140, 143, 143, 146, 148, 153, 155,
563
+ 155, 158, 160, 160, 163, 165, 168, 170, 173, 173,
564
+ 176, 176, 179, 179, 182, 182, 185, 187, 192, 192,
565
+ 194, 194, 197, 199, 199, 202, 204, 206, 208, 213,
566
+ 213, 216, 216, 220, 222, 222, 225, 227, 232, 232,
567
+ 235, 235, 239, 241, 241, 244, 246, 248, 250, 255,
568
+ 257, 257, 260, 262, 265, 265, 268, 268, 271, 271,
569
+ 274, 276, 281, 281, 283, 283, 287, 289, 289, 292,
570
+ 294, 296, 298, 303, 303, 305, 305, 309, 311, 311,
571
+ 314, 316, 321, 321, 323, 323, 327, 329, 329, 332,
572
+ 334, 336, 338, 343, 343, 346, 346, 350, 352, 352,
573
+ 356, 358, 360, 364, 366, 368, 371, 374, 377, 380
574
+ };
575
+ #endif
576
+
577
+ #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
578
+ /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
579
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
580
+ static const char *const yytname[] =
581
+ {
582
+ "$end", "error", "$undefined", "POINT", "LINESTRING", "POLYGON",
583
+ "MULTIPOINT", "MULTILINESTRING", "MULTIPOLYGON", "GEOMETRYCOLLECTION",
584
+ "CIRCULARSTRING", "COMPOUNDCURVE", "CURVEPOLYGON", "MULTICURVE",
585
+ "MULTISURFACE", "POINTM", "LINESTRINGM", "POLYGONM", "MULTIPOINTM",
586
+ "MULTILINESTRINGM", "MULTIPOLYGONM", "GEOMETRYCOLLECTIONM",
587
+ "CIRCULARSTRINGM", "COMPOUNDCURVEM", "CURVEPOLYGONM", "MULTICURVEM",
588
+ "MULTISURFACEM", "SRID", "EMPTY", "VALUE", "LPAREN", "RPAREN", "COMMA",
589
+ "EQUALS", "SEMICOLON", "WKB", "$accept", "geometry", "@1", "@2",
590
+ "geometry_int", "srid", "geom_wkb", "geom_point", "@3", "point",
591
+ "empty_point", "@4", "nonempty_point", "@5", "point_int",
592
+ "geom_multipoint", "@6", "@7", "multipoint", "@8", "multipoint_int",
593
+ "mpoint_element", "@9", "geom_linestring", "@10", "linestring",
594
+ "empty_linestring", "@11", "nonempty_linestring", "@12",
595
+ "nonempty_linestring_closed", "@13", "linestring_1", "@14",
596
+ "linestring_int", "geom_circularstring", "@15",
597
+ "geom_circularstring_closed", "@16", "circularstring",
598
+ "circularstring_closed", "empty_circularstring", "@17",
599
+ "nonempty_circularstring", "@18", "nonempty_circularstring_closed",
600
+ "@19", "circularstring_1", "@20", "circularstring_int",
601
+ "geom_compoundcurve", "@21", "@22", "compoundcurve", "@23",
602
+ "compoundcurve_int", "geom_multilinestring", "@24", "@25",
603
+ "multilinestring", "@26", "multilinestring_int", "geom_multicurve",
604
+ "@27", "@28", "multicurve", "@29", "multicurve_int", "geom_polygon",
605
+ "@30", "polygon", "empty_polygon", "@31", "nonempty_polygon", "@32",
606
+ "polygon_1", "@33", "polygon_int", "geom_curvepolygon", "@34", "@35",
607
+ "curvepolygon", "@36", "curvepolygon_int", "geom_multipolygon", "@37",
608
+ "@38", "multipolygon", "@39", "multipolygon_int", "geom_multisurface",
609
+ "@40", "@41", "multisurface", "@42", "multisurface_int",
610
+ "geom_geometrycollection", "@43", "@44", "geometrycollection", "@45",
611
+ "geometrycollection_int", "a_point", "point_2d", "point_3d", "point_4d",
612
+ "empty", 0
613
+ };
614
+ #endif
615
+
616
+ # ifdef YYPRINT
617
+ /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
618
+ token YYLEX-NUM. */
619
+ static const yytype_uint16 yytoknum[] =
620
+ {
621
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
622
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
623
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
624
+ 285, 286, 287, 288, 289, 290
625
+ };
626
+ # endif
627
+
628
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
629
+ static const yytype_uint8 yyr1[] =
630
+ {
631
+ 0, 36, 38, 37, 39, 37, 40, 40, 40, 40,
632
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 41,
633
+ 42, 43, 44, 43, 45, 45, 47, 46, 49, 48,
634
+ 50, 52, 51, 53, 51, 54, 55, 54, 56, 56,
635
+ 57, 58, 57, 59, 60, 59, 61, 61, 63, 62,
636
+ 65, 64, 67, 66, 69, 68, 70, 70, 71, 72,
637
+ 71, 73, 74, 73, 75, 75, 76, 76, 78, 77,
638
+ 80, 79, 82, 81, 84, 83, 85, 85, 87, 86,
639
+ 88, 86, 89, 90, 89, 91, 91, 91, 91, 93,
640
+ 92, 94, 92, 95, 96, 95, 97, 97, 99, 98,
641
+ 100, 98, 101, 102, 101, 103, 103, 103, 103, 104,
642
+ 105, 104, 106, 106, 108, 107, 110, 109, 112, 111,
643
+ 113, 113, 115, 114, 116, 114, 117, 118, 117, 119,
644
+ 119, 119, 119, 121, 120, 122, 120, 123, 124, 123,
645
+ 125, 125, 127, 126, 128, 126, 129, 130, 129, 131,
646
+ 131, 131, 131, 133, 132, 134, 132, 135, 136, 135,
647
+ 137, 137, 137, 138, 138, 138, 139, 140, 141, 142
648
+ };
649
+
650
+ /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
651
+ static const yytype_uint8 yyr2[] =
652
+ {
653
+ 0, 2, 0, 4, 0, 2, 1, 1, 1, 1,
654
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
655
+ 1, 2, 0, 3, 1, 1, 0, 2, 0, 2,
656
+ 3, 0, 3, 0, 3, 1, 0, 4, 1, 3,
657
+ 1, 0, 2, 2, 0, 3, 1, 1, 0, 2,
658
+ 0, 2, 0, 2, 0, 4, 1, 3, 2, 0,
659
+ 3, 2, 0, 3, 1, 1, 1, 1, 0, 2,
660
+ 0, 2, 0, 2, 0, 4, 1, 3, 0, 3,
661
+ 0, 3, 1, 0, 4, 1, 1, 3, 3, 0,
662
+ 3, 0, 3, 1, 0, 4, 1, 3, 0, 3,
663
+ 0, 3, 1, 0, 4, 1, 1, 3, 3, 2,
664
+ 0, 3, 1, 1, 0, 2, 0, 2, 0, 4,
665
+ 1, 3, 0, 3, 0, 3, 1, 0, 4, 1,
666
+ 1, 3, 3, 0, 3, 0, 3, 1, 0, 4,
667
+ 1, 3, 0, 3, 0, 3, 1, 0, 4, 1,
668
+ 1, 3, 3, 0, 3, 0, 3, 1, 0, 4,
669
+ 1, 1, 3, 1, 1, 1, 2, 3, 4, 1
670
+ };
671
+
672
+ /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
673
+ STATE-NUM when YYTABLE doesn't specify something else to do. Zero
674
+ means the default is an error. */
675
+ static const yytype_uint8 yydefact[] =
676
+ {
677
+ 4, 0, 0, 0, 0, 0, 1, 26, 48, 114,
678
+ 31, 89, 133, 153, 68, 78, 122, 98, 142, 22,
679
+ 44, 110, 33, 91, 135, 155, 59, 80, 124, 100,
680
+ 144, 20, 5, 6, 7, 13, 8, 9, 11, 14,
681
+ 15, 10, 12, 16, 17, 18, 2, 19, 21, 24,
682
+ 0, 25, 0, 43, 46, 0, 47, 54, 109, 112,
683
+ 0, 113, 118, 36, 94, 138, 158, 58, 64, 0,
684
+ 65, 74, 83, 127, 103, 147, 26, 48, 114, 36,
685
+ 94, 138, 158, 68, 83, 127, 103, 147, 0, 169,
686
+ 27, 0, 29, 49, 51, 0, 115, 117, 0, 32,
687
+ 0, 35, 90, 0, 93, 134, 0, 137, 154, 0,
688
+ 157, 69, 71, 0, 79, 0, 82, 123, 0, 126,
689
+ 99, 0, 102, 143, 0, 146, 23, 45, 111, 34,
690
+ 92, 136, 156, 60, 81, 125, 101, 145, 3, 0,
691
+ 0, 163, 164, 165, 0, 54, 28, 50, 116, 0,
692
+ 0, 50, 52, 50, 116, 166, 30, 0, 56, 120,
693
+ 0, 40, 0, 38, 0, 96, 0, 140, 0, 161,
694
+ 0, 160, 0, 76, 85, 86, 0, 68, 62, 129,
695
+ 54, 130, 0, 105, 106, 0, 149, 150, 0, 167,
696
+ 55, 0, 119, 54, 37, 28, 42, 95, 50, 139,
697
+ 116, 159, 0, 75, 0, 84, 50, 61, 66, 67,
698
+ 74, 68, 53, 128, 52, 104, 50, 148, 116, 168,
699
+ 57, 121, 39, 97, 141, 162, 77, 87, 88, 73,
700
+ 63, 131, 132, 107, 108, 151, 152
701
+ };
702
+
703
+ /* YYDEFGOTO[NTERM-NUM]. */
704
+ static const yytype_int16 yydefgoto[] =
705
+ {
706
+ -1, 2, 88, 3, 32, 4, 33, 34, 76, 48,
707
+ 49, 50, 51, 52, 92, 35, 63, 79, 99, 100,
708
+ 162, 163, 164, 36, 77, 53, 54, 55, 56, 57,
709
+ 179, 180, 94, 95, 157, 37, 83, 181, 211, 67,
710
+ 207, 68, 69, 70, 71, 209, 210, 112, 113, 172,
711
+ 38, 72, 84, 114, 115, 176, 39, 64, 80, 102,
712
+ 103, 166, 40, 74, 86, 120, 121, 185, 41, 78,
713
+ 58, 59, 60, 61, 62, 97, 98, 160, 42, 73,
714
+ 85, 117, 118, 182, 43, 65, 81, 105, 106, 168,
715
+ 44, 75, 87, 123, 124, 188, 45, 66, 82, 108,
716
+ 109, 170, 140, 141, 142, 143, 101
717
+ };
718
+
719
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
720
+ STATE-NUM. */
721
+ #define YYPACT_NINF -166
722
+ static const yytype_int16 yypact[] =
723
+ {
724
+ -17, -14, 21, 145, -7, 5, -166, 29, 30, 40,
725
+ -166, -166, -166, -166, 51, -166, -166, -166, -166, -166,
726
+ -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
727
+ -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
728
+ -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
729
+ 23, -166, 53, -166, -166, 23, -166, -166, -166, -166,
730
+ 23, -166, -166, 23, 23, 23, 23, -166, -166, 23,
731
+ -166, -166, 23, 23, 23, 23, 29, 30, 40, 23,
732
+ 23, 23, 23, 51, 23, 23, 23, 23, 145, -166,
733
+ -166, 55, -166, -166, -166, 56, -166, -166, 57, -166,
734
+ 58, -166, -166, 59, -166, -166, 61, -166, -166, 62,
735
+ -166, -166, -166, 63, -166, 64, -166, -166, 65, -166,
736
+ -166, 66, -166, -166, 67, -166, -166, -166, -166, -166,
737
+ -166, -166, -166, -166, -166, -166, -166, -166, -166, 70,
738
+ 54, -166, -166, -166, 55, -166, 72, -166, -166, 112,
739
+ 55, 8, 19, 8, 28, 73, -166, -18, -166, -166,
740
+ 16, -166, 18, -166, 55, -166, 24, -166, 31, -166,
741
+ 33, -166, 35, -166, -166, -166, 42, 74, -166, -166,
742
+ -166, -166, 44, -166, -166, 46, -166, -166, 48, 76,
743
+ -166, 55, -166, -166, -166, 72, -166, -166, -166, -166,
744
+ -166, -166, 145, -166, 55, -166, 8, -166, -166, -166,
745
+ -166, 74, -166, -166, 19, -166, 8, -166, 28, -166,
746
+ -166, -166, -166, -166, -166, -166, -166, -166, -166, -166,
747
+ -166, -166, -166, -166, -166, -166, -166
748
+ };
749
+
750
+ /* YYPGOTO[NTERM-NUM]. */
751
+ static const yytype_int16 yypgoto[] =
752
+ {
753
+ -166, -166, -166, -166, -88, -166, -166, -166, -166, 27,
754
+ -166, -166, -142, -166, -166, -166, -166, -166, 32, -166,
755
+ -166, -89, -166, -166, -166, 36, -166, -166, -108, -166,
756
+ -107, -166, -136, -166, -166, -148, -166, -105, -166, 60,
757
+ -101, -165, -166, -166, -166, -166, -166, -98, -166, -166,
758
+ -166, -166, -166, 88, -166, -166, -166, -166, -166, 93,
759
+ -166, -166, -166, -166, -166, 89, -166, -166, -166, -166,
760
+ 68, -166, -166, -146, -166, -166, -166, -166, -147, -166,
761
+ -166, 91, -166, -166, -166, -166, -166, 96, -166, -166,
762
+ -166, -166, -166, 52, -166, -166, -166, -166, -166, 92,
763
+ -166, -166, -122, -166, -166, -166, -49
764
+ };
765
+
766
+ /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
767
+ positive, shift that token. If negative, reduce the rule which
768
+ number is the opposite. If zero, do what YYDEFACT says.
769
+ If YYTABLE_NINF, syntax error. */
770
+ #define YYTABLE_NINF -117
771
+ static const yytype_int16 yytable[] =
772
+ {
773
+ 138, 90, 167, 175, 161, 184, 93, 187, 186, 159,
774
+ 1, 96, 208, 190, 191, 104, 107, 110, 14, 5,
775
+ 111, 6, 158, 116, 119, 122, 125, 46, 173, 177,
776
+ 26, 104, 107, 110, 47, 116, 119, 122, 125, 165,
777
+ 16, 178, 196, 174, 212, 183, 208, 192, 193, 194,
778
+ 195, 89, 28, 161, 224, 197, 198, 221, 228, -28,
779
+ -50, 169, 199, 200, 201, 202, 203, 204, 234, 220,
780
+ -116, 236, 235, 205, 206, 213, 214, 215, 216, 217,
781
+ 218, -70, 226, 91, 139, 156, 144, 145, 146, 147,
782
+ 223, 148, 149, 150, 151, 152, 153, 154, 227, 155,
783
+ 171, -41, 189, 126, -72, 219, 222, 231, 233, 232,
784
+ 230, 129, 229, 127, 225, 7, 8, 9, 10, 11,
785
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
786
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 137,
787
+ 89, 0, 0, 133, 0, 0, 128, 31, 7, 8,
788
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
789
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
790
+ 29, 30, 134, 130, 132, 136, 135, 131, 0, 0,
791
+ 31
792
+ };
793
+
794
+ static const yytype_int16 yycheck[] =
795
+ {
796
+ 88, 50, 148, 151, 146, 153, 55, 154, 154, 145,
797
+ 27, 60, 177, 31, 32, 64, 65, 66, 10, 33,
798
+ 69, 0, 144, 72, 73, 74, 75, 34, 150, 10,
799
+ 22, 80, 81, 82, 29, 84, 85, 86, 87, 147,
800
+ 12, 22, 164, 151, 180, 153, 211, 31, 32, 31,
801
+ 32, 28, 24, 195, 200, 31, 32, 193, 206, 30,
802
+ 30, 149, 31, 32, 31, 32, 31, 32, 216, 191,
803
+ 30, 218, 218, 31, 32, 31, 32, 31, 32, 31,
804
+ 32, 30, 204, 30, 29, 31, 30, 30, 30, 30,
805
+ 198, 30, 30, 30, 30, 30, 30, 30, 206, 29,
806
+ 149, 29, 29, 76, 30, 29, 195, 214, 216, 214,
807
+ 211, 79, 210, 77, 202, 3, 4, 5, 6, 7,
808
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
809
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 87,
810
+ 28, -1, -1, 83, -1, -1, 78, 35, 3, 4,
811
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
812
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
813
+ 25, 26, 84, 80, 82, 86, 85, 81, -1, -1,
814
+ 35
815
+ };
816
+
817
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
818
+ symbol of state STATE-NUM. */
819
+ static const yytype_uint8 yystos[] =
820
+ {
821
+ 0, 27, 37, 39, 41, 33, 0, 3, 4, 5,
822
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
823
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
824
+ 26, 35, 40, 42, 43, 51, 59, 71, 86, 92,
825
+ 98, 104, 114, 120, 126, 132, 34, 29, 45, 46,
826
+ 47, 48, 49, 61, 62, 63, 64, 65, 106, 107,
827
+ 108, 109, 110, 52, 93, 121, 133, 75, 77, 78,
828
+ 79, 80, 87, 115, 99, 127, 44, 60, 105, 53,
829
+ 94, 122, 134, 72, 88, 116, 100, 128, 38, 28,
830
+ 142, 30, 50, 142, 68, 69, 142, 111, 112, 54,
831
+ 55, 142, 95, 96, 142, 123, 124, 142, 135, 136,
832
+ 142, 142, 83, 84, 89, 90, 142, 117, 118, 142,
833
+ 101, 102, 142, 129, 130, 142, 45, 61, 106, 54,
834
+ 95, 123, 135, 75, 89, 117, 101, 129, 40, 29,
835
+ 138, 139, 140, 141, 30, 30, 30, 30, 30, 30,
836
+ 30, 30, 30, 30, 30, 29, 31, 70, 138, 68,
837
+ 113, 48, 56, 57, 58, 64, 97, 109, 125, 40,
838
+ 137, 142, 85, 138, 64, 71, 91, 10, 22, 66,
839
+ 67, 73, 119, 64, 71, 103, 109, 114, 131, 29,
840
+ 31, 32, 31, 32, 31, 32, 138, 31, 32, 31,
841
+ 32, 31, 32, 31, 32, 31, 32, 76, 77, 81,
842
+ 82, 74, 68, 31, 32, 31, 32, 31, 32, 29,
843
+ 138, 68, 57, 64, 109, 40, 138, 64, 71, 83,
844
+ 76, 66, 73, 64, 71, 109, 114
845
+ };
846
+
847
+ #define yyerrok (yyerrstatus = 0)
848
+ #define yyclearin (yychar = YYEMPTY)
849
+ #define YYEMPTY (-2)
850
+ #define YYEOF 0
851
+
852
+ #define YYACCEPT goto yyacceptlab
853
+ #define YYABORT goto yyabortlab
854
+ #define YYERROR goto yyerrorlab
855
+
856
+
857
+ /* Like YYERROR except do call yyerror. This remains here temporarily
858
+ to ease the transition to the new meaning of YYERROR, for GCC.
859
+ Once GCC version 2 has supplanted version 1, this can go. */
860
+
861
+ #define YYFAIL goto yyerrlab
862
+
863
+ #define YYRECOVERING() (!!yyerrstatus)
864
+
865
+ #define YYBACKUP(Token, Value) \
866
+ do \
867
+ if (yychar == YYEMPTY && yylen == 1) \
868
+ { \
869
+ yychar = (Token); \
870
+ yylval = (Value); \
871
+ yytoken = YYTRANSLATE (yychar); \
872
+ YYPOPSTACK (1); \
873
+ goto yybackup; \
874
+ } \
875
+ else \
876
+ { \
877
+ yyerror (YY_("syntax error: cannot back up")); \
878
+ YYERROR; \
879
+ } \
880
+ while (YYID (0))
881
+
882
+
883
+ #define YYTERROR 1
884
+ #define YYERRCODE 256
885
+
886
+
887
+ /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
888
+ If N is 0, then set CURRENT to the empty location which ends
889
+ the previous symbol: RHS[0] (always defined). */
890
+
891
+ #define YYRHSLOC(Rhs, K) ((Rhs)[K])
892
+ #ifndef YYLLOC_DEFAULT
893
+ # define YYLLOC_DEFAULT(Current, Rhs, N) \
894
+ do \
895
+ if (YYID (N)) \
896
+ { \
897
+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
898
+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
899
+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
900
+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
901
+ } \
902
+ else \
903
+ { \
904
+ (Current).first_line = (Current).last_line = \
905
+ YYRHSLOC (Rhs, 0).last_line; \
906
+ (Current).first_column = (Current).last_column = \
907
+ YYRHSLOC (Rhs, 0).last_column; \
908
+ } \
909
+ while (YYID (0))
910
+ #endif
911
+
912
+
913
+ /* YY_LOCATION_PRINT -- Print the location on the stream.
914
+ This macro was not mandated originally: define only if we know
915
+ we won't break user code: when these are the locations we know. */
916
+
917
+ #ifndef YY_LOCATION_PRINT
918
+ # if YYLTYPE_IS_TRIVIAL
919
+ # define YY_LOCATION_PRINT(File, Loc) \
920
+ fprintf (File, "%d.%d-%d.%d", \
921
+ (Loc).first_line, (Loc).first_column, \
922
+ (Loc).last_line, (Loc).last_column)
923
+ # else
924
+ # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
925
+ # endif
926
+ #endif
927
+
928
+
929
+ /* YYLEX -- calling `yylex' with the right arguments. */
930
+
931
+ #ifdef YYLEX_PARAM
932
+ # define YYLEX yylex (YYLEX_PARAM)
933
+ #else
934
+ # define YYLEX yylex ()
935
+ #endif
936
+
937
+ /* Enable debugging if requested. */
938
+ #if YYDEBUG
939
+
940
+ # ifndef YYFPRINTF
941
+ # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
942
+ # define YYFPRINTF fprintf
943
+ # endif
944
+
945
+ # define YYDPRINTF(Args) \
946
+ do { \
947
+ if (yydebug) \
948
+ YYFPRINTF Args; \
949
+ } while (YYID (0))
950
+
951
+ # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
952
+ do { \
953
+ if (yydebug) \
954
+ { \
955
+ YYFPRINTF (stderr, "%s ", Title); \
956
+ yy_symbol_print (stderr, \
957
+ Type, Value, Location); \
958
+ YYFPRINTF (stderr, "\n"); \
959
+ } \
960
+ } while (YYID (0))
961
+
962
+
963
+ /*--------------------------------.
964
+ | Print this symbol on YYOUTPUT. |
965
+ `--------------------------------*/
966
+
967
+ /*ARGSUSED*/
968
+ #if (defined __STDC__ || defined __C99__FUNC__ \
969
+ || defined __cplusplus || defined _MSC_VER)
970
+ static void
971
+ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
972
+ #else
973
+ static void
974
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
975
+ FILE *yyoutput;
976
+ int yytype;
977
+ YYSTYPE const * const yyvaluep;
978
+ YYLTYPE const * const yylocationp;
979
+ #endif
980
+ {
981
+ if (!yyvaluep)
982
+ return;
983
+ YYUSE (yylocationp);
984
+ # ifdef YYPRINT
985
+ if (yytype < YYNTOKENS)
986
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
987
+ # else
988
+ YYUSE (yyoutput);
989
+ # endif
990
+ switch (yytype)
991
+ {
992
+ default:
993
+ break;
994
+ }
995
+ }
996
+
997
+
998
+ /*--------------------------------.
999
+ | Print this symbol on YYOUTPUT. |
1000
+ `--------------------------------*/
1001
+
1002
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1003
+ || defined __cplusplus || defined _MSC_VER)
1004
+ static void
1005
+ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
1006
+ #else
1007
+ static void
1008
+ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
1009
+ FILE *yyoutput;
1010
+ int yytype;
1011
+ YYSTYPE const * const yyvaluep;
1012
+ YYLTYPE const * const yylocationp;
1013
+ #endif
1014
+ {
1015
+ if (yytype < YYNTOKENS)
1016
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1017
+ else
1018
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1019
+
1020
+ YY_LOCATION_PRINT (yyoutput, *yylocationp);
1021
+ YYFPRINTF (yyoutput, ": ");
1022
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
1023
+ YYFPRINTF (yyoutput, ")");
1024
+ }
1025
+
1026
+ /*------------------------------------------------------------------.
1027
+ | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1028
+ | TOP (included). |
1029
+ `------------------------------------------------------------------*/
1030
+
1031
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1032
+ || defined __cplusplus || defined _MSC_VER)
1033
+ static void
1034
+ yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1035
+ #else
1036
+ static void
1037
+ yy_stack_print (bottom, top)
1038
+ yytype_int16 *bottom;
1039
+ yytype_int16 *top;
1040
+ #endif
1041
+ {
1042
+ YYFPRINTF (stderr, "Stack now");
1043
+ for (; bottom <= top; ++bottom)
1044
+ YYFPRINTF (stderr, " %d", *bottom);
1045
+ YYFPRINTF (stderr, "\n");
1046
+ }
1047
+
1048
+ # define YY_STACK_PRINT(Bottom, Top) \
1049
+ do { \
1050
+ if (yydebug) \
1051
+ yy_stack_print ((Bottom), (Top)); \
1052
+ } while (YYID (0))
1053
+
1054
+
1055
+ /*------------------------------------------------.
1056
+ | Report that the YYRULE is going to be reduced. |
1057
+ `------------------------------------------------*/
1058
+
1059
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1060
+ || defined __cplusplus || defined _MSC_VER)
1061
+ static void
1062
+ yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
1063
+ #else
1064
+ static void
1065
+ yy_reduce_print (yyvsp, yylsp, yyrule)
1066
+ YYSTYPE *yyvsp;
1067
+ YYLTYPE *yylsp;
1068
+ int yyrule;
1069
+ #endif
1070
+ {
1071
+ int yynrhs = yyr2[yyrule];
1072
+ int yyi;
1073
+ unsigned long int yylno = yyrline[yyrule];
1074
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1075
+ yyrule - 1, yylno);
1076
+ /* The symbols being reduced. */
1077
+ for (yyi = 0; yyi < yynrhs; yyi++)
1078
+ {
1079
+ fprintf (stderr, " $%d = ", yyi + 1);
1080
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1081
+ &(yyvsp[(yyi + 1) - (yynrhs)])
1082
+ , &(yylsp[(yyi + 1) - (yynrhs)]) );
1083
+ fprintf (stderr, "\n");
1084
+ }
1085
+ }
1086
+
1087
+ # define YY_REDUCE_PRINT(Rule) \
1088
+ do { \
1089
+ if (yydebug) \
1090
+ yy_reduce_print (yyvsp, yylsp, Rule); \
1091
+ } while (YYID (0))
1092
+
1093
+ /* Nonzero means print parse trace. It is left uninitialized so that
1094
+ multiple parsers can coexist. */
1095
+ int yydebug;
1096
+ #else /* !YYDEBUG */
1097
+ # define YYDPRINTF(Args)
1098
+ # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1099
+ # define YY_STACK_PRINT(Bottom, Top)
1100
+ # define YY_REDUCE_PRINT(Rule)
1101
+ #endif /* !YYDEBUG */
1102
+
1103
+
1104
+ /* YYINITDEPTH -- initial size of the parser's stacks. */
1105
+ #ifndef YYINITDEPTH
1106
+ # define YYINITDEPTH 200
1107
+ #endif
1108
+
1109
+ /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1110
+ if the built-in stack extension method is used).
1111
+
1112
+ Do not make this value too large; the results are undefined if
1113
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1114
+ evaluated with infinite-precision integer arithmetic. */
1115
+
1116
+ #ifndef YYMAXDEPTH
1117
+ # define YYMAXDEPTH 10000
1118
+ #endif
1119
+
1120
+
1121
+
1122
+ #if YYERROR_VERBOSE
1123
+
1124
+ # ifndef yystrlen
1125
+ # if defined __GLIBC__ && defined _STRING_H
1126
+ # define yystrlen strlen
1127
+ # else
1128
+ /* Return the length of YYSTR. */
1129
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1130
+ || defined __cplusplus || defined _MSC_VER)
1131
+ static YYSIZE_T
1132
+ yystrlen (const char *yystr)
1133
+ #else
1134
+ static YYSIZE_T
1135
+ yystrlen (yystr)
1136
+ const char *yystr;
1137
+ #endif
1138
+ {
1139
+ YYSIZE_T yylen;
1140
+ for (yylen = 0; yystr[yylen]; yylen++)
1141
+ continue;
1142
+ return yylen;
1143
+ }
1144
+ # endif
1145
+ # endif
1146
+
1147
+ # ifndef yystpcpy
1148
+ # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1149
+ # define yystpcpy stpcpy
1150
+ # else
1151
+ /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1152
+ YYDEST. */
1153
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1154
+ || defined __cplusplus || defined _MSC_VER)
1155
+ static char *
1156
+ yystpcpy (char *yydest, const char *yysrc)
1157
+ #else
1158
+ static char *
1159
+ yystpcpy (yydest, yysrc)
1160
+ char *yydest;
1161
+ const char *yysrc;
1162
+ #endif
1163
+ {
1164
+ char *yyd = yydest;
1165
+ const char *yys = yysrc;
1166
+
1167
+ while ((*yyd++ = *yys++) != '\0')
1168
+ continue;
1169
+
1170
+ return yyd - 1;
1171
+ }
1172
+ # endif
1173
+ # endif
1174
+
1175
+ # ifndef yytnamerr
1176
+ /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1177
+ quotes and backslashes, so that it's suitable for yyerror. The
1178
+ heuristic is that double-quoting is unnecessary unless the string
1179
+ contains an apostrophe, a comma, or backslash (other than
1180
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
1181
+ null, do not copy; instead, return the length of what the result
1182
+ would have been. */
1183
+ static YYSIZE_T
1184
+ yytnamerr (char *yyres, const char *yystr)
1185
+ {
1186
+ if (*yystr == '"')
1187
+ {
1188
+ YYSIZE_T yyn = 0;
1189
+ char const *yyp = yystr;
1190
+
1191
+ for (;;)
1192
+ switch (*++yyp)
1193
+ {
1194
+ case '\'':
1195
+ case ',':
1196
+ goto do_not_strip_quotes;
1197
+
1198
+ case '\\':
1199
+ if (*++yyp != '\\')
1200
+ goto do_not_strip_quotes;
1201
+ /* Fall through. */
1202
+ default:
1203
+ if (yyres)
1204
+ yyres[yyn] = *yyp;
1205
+ yyn++;
1206
+ break;
1207
+
1208
+ case '"':
1209
+ if (yyres)
1210
+ yyres[yyn] = '\0';
1211
+ return yyn;
1212
+ }
1213
+ do_not_strip_quotes: ;
1214
+ }
1215
+
1216
+ if (! yyres)
1217
+ return yystrlen (yystr);
1218
+
1219
+ return yystpcpy (yyres, yystr) - yyres;
1220
+ }
1221
+ # endif
1222
+
1223
+ /* Copy into YYRESULT an error message about the unexpected token
1224
+ YYCHAR while in state YYSTATE. Return the number of bytes copied,
1225
+ including the terminating null byte. If YYRESULT is null, do not
1226
+ copy anything; just return the number of bytes that would be
1227
+ copied. As a special case, return 0 if an ordinary "syntax error"
1228
+ message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1229
+ size calculation. */
1230
+ static YYSIZE_T
1231
+ yysyntax_error (char *yyresult, int yystate, int yychar)
1232
+ {
1233
+ int yyn = yypact[yystate];
1234
+
1235
+ if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1236
+ return 0;
1237
+ else
1238
+ {
1239
+ int yytype = YYTRANSLATE (yychar);
1240
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1241
+ YYSIZE_T yysize = yysize0;
1242
+ YYSIZE_T yysize1;
1243
+ int yysize_overflow = 0;
1244
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1245
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1246
+ int yyx;
1247
+
1248
+ # if 0
1249
+ /* This is so xgettext sees the translatable formats that are
1250
+ constructed on the fly. */
1251
+ YY_("syntax error, unexpected %s");
1252
+ YY_("syntax error, unexpected %s, expecting %s");
1253
+ YY_("syntax error, unexpected %s, expecting %s or %s");
1254
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1255
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1256
+ # endif
1257
+ char *yyfmt;
1258
+ char const *yyf;
1259
+ static char const yyunexpected[] = "syntax error, unexpected %s";
1260
+ static char const yyexpecting[] = ", expecting %s";
1261
+ static char const yyor[] = " or %s";
1262
+ char yyformat[sizeof yyunexpected
1263
+ + sizeof yyexpecting - 1
1264
+ + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1265
+ * (sizeof yyor - 1))];
1266
+ char const *yyprefix = yyexpecting;
1267
+
1268
+ /* Start YYX at -YYN if negative to avoid negative indexes in
1269
+ YYCHECK. */
1270
+ int yyxbegin = yyn < 0 ? -yyn : 0;
1271
+
1272
+ /* Stay within bounds of both yycheck and yytname. */
1273
+ int yychecklim = YYLAST - yyn + 1;
1274
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1275
+ int yycount = 1;
1276
+
1277
+ yyarg[0] = yytname[yytype];
1278
+ yyfmt = yystpcpy (yyformat, yyunexpected);
1279
+
1280
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1281
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1282
+ {
1283
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1284
+ {
1285
+ yycount = 1;
1286
+ yysize = yysize0;
1287
+ yyformat[sizeof yyunexpected - 1] = '\0';
1288
+ break;
1289
+ }
1290
+ yyarg[yycount++] = yytname[yyx];
1291
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1292
+ yysize_overflow |= (yysize1 < yysize);
1293
+ yysize = yysize1;
1294
+ yyfmt = yystpcpy (yyfmt, yyprefix);
1295
+ yyprefix = yyor;
1296
+ }
1297
+
1298
+ yyf = YY_(yyformat);
1299
+ yysize1 = yysize + yystrlen (yyf);
1300
+ yysize_overflow |= (yysize1 < yysize);
1301
+ yysize = yysize1;
1302
+
1303
+ if (yysize_overflow)
1304
+ return YYSIZE_MAXIMUM;
1305
+
1306
+ if (yyresult)
1307
+ {
1308
+ /* Avoid sprintf, as that infringes on the user's name space.
1309
+ Don't have undefined behavior even if the translation
1310
+ produced a string with the wrong number of "%s"s. */
1311
+ char *yyp = yyresult;
1312
+ int yyi = 0;
1313
+ while ((*yyp = *yyf) != '\0')
1314
+ {
1315
+ if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1316
+ {
1317
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
1318
+ yyf += 2;
1319
+ }
1320
+ else
1321
+ {
1322
+ yyp++;
1323
+ yyf++;
1324
+ }
1325
+ }
1326
+ }
1327
+ return yysize;
1328
+ }
1329
+ }
1330
+ #endif /* YYERROR_VERBOSE */
1331
+
1332
+
1333
+ /*-----------------------------------------------.
1334
+ | Release the memory associated to this symbol. |
1335
+ `-----------------------------------------------*/
1336
+
1337
+ /*ARGSUSED*/
1338
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1339
+ || defined __cplusplus || defined _MSC_VER)
1340
+ static void
1341
+ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
1342
+ #else
1343
+ static void
1344
+ yydestruct (yymsg, yytype, yyvaluep, yylocationp)
1345
+ const char *yymsg;
1346
+ int yytype;
1347
+ YYSTYPE *yyvaluep;
1348
+ YYLTYPE *yylocationp;
1349
+ #endif
1350
+ {
1351
+ YYUSE (yyvaluep);
1352
+ YYUSE (yylocationp);
1353
+
1354
+ if (!yymsg)
1355
+ yymsg = "Deleting";
1356
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1357
+
1358
+ switch (yytype)
1359
+ {
1360
+
1361
+ default:
1362
+ break;
1363
+ }
1364
+ }
1365
+
1366
+
1367
+ /* Prevent warnings from -Wmissing-prototypes. */
1368
+
1369
+ #ifdef YYPARSE_PARAM
1370
+ #if defined __STDC__ || defined __cplusplus
1371
+ int yyparse (void *YYPARSE_PARAM);
1372
+ #else
1373
+ int yyparse ();
1374
+ #endif
1375
+ #else /* ! YYPARSE_PARAM */
1376
+ #if defined __STDC__ || defined __cplusplus
1377
+ int yyparse (void);
1378
+ #else
1379
+ int yyparse ();
1380
+ #endif
1381
+ #endif /* ! YYPARSE_PARAM */
1382
+
1383
+
1384
+
1385
+ /* The look-ahead symbol. */
1386
+ int yychar;
1387
+
1388
+ /* The semantic value of the look-ahead symbol. */
1389
+ YYSTYPE yylval;
1390
+
1391
+ /* Number of syntax errors so far. */
1392
+ int yynerrs;
1393
+ /* Location data for the look-ahead symbol. */
1394
+ YYLTYPE yylloc;
1395
+
1396
+
1397
+
1398
+ /*----------.
1399
+ | yyparse. |
1400
+ `----------*/
1401
+
1402
+ #ifdef YYPARSE_PARAM
1403
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1404
+ || defined __cplusplus || defined _MSC_VER)
1405
+ int
1406
+ yyparse (void *YYPARSE_PARAM)
1407
+ #else
1408
+ int
1409
+ yyparse (YYPARSE_PARAM)
1410
+ void *YYPARSE_PARAM;
1411
+ #endif
1412
+ #else /* ! YYPARSE_PARAM */
1413
+ #if (defined __STDC__ || defined __C99__FUNC__ \
1414
+ || defined __cplusplus || defined _MSC_VER)
1415
+ int
1416
+ yyparse (void)
1417
+ #else
1418
+ int
1419
+ yyparse ()
1420
+
1421
+ #endif
1422
+ #endif
1423
+ {
1424
+
1425
+ int yystate;
1426
+ int yyn;
1427
+ int yyresult;
1428
+ /* Number of tokens to shift before error messages enabled. */
1429
+ int yyerrstatus;
1430
+ /* Look-ahead token as an internal (translated) token number. */
1431
+ int yytoken = 0;
1432
+ #if YYERROR_VERBOSE
1433
+ /* Buffer for error messages, and its allocated size. */
1434
+ char yymsgbuf[128];
1435
+ char *yymsg = yymsgbuf;
1436
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1437
+ #endif
1438
+
1439
+ /* Three stacks and their tools:
1440
+ `yyss': related to states,
1441
+ `yyvs': related to semantic values,
1442
+ `yyls': related to locations.
1443
+
1444
+ Refer to the stacks thru separate pointers, to allow yyoverflow
1445
+ to reallocate them elsewhere. */
1446
+
1447
+ /* The state stack. */
1448
+ yytype_int16 yyssa[YYINITDEPTH];
1449
+ yytype_int16 *yyss = yyssa;
1450
+ yytype_int16 *yyssp;
1451
+
1452
+ /* The semantic value stack. */
1453
+ YYSTYPE yyvsa[YYINITDEPTH];
1454
+ YYSTYPE *yyvs = yyvsa;
1455
+ YYSTYPE *yyvsp;
1456
+
1457
+ /* The location stack. */
1458
+ YYLTYPE yylsa[YYINITDEPTH];
1459
+ YYLTYPE *yyls = yylsa;
1460
+ YYLTYPE *yylsp;
1461
+ /* The locations where the error started and ended. */
1462
+ YYLTYPE yyerror_range[2];
1463
+
1464
+ #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1465
+
1466
+ YYSIZE_T yystacksize = YYINITDEPTH;
1467
+
1468
+ /* The variables used to return semantic value and location from the
1469
+ action routines. */
1470
+ YYSTYPE yyval;
1471
+ YYLTYPE yyloc;
1472
+
1473
+ /* The number of symbols on the RHS of the reduced rule.
1474
+ Keep to zero when no symbol should be popped. */
1475
+ int yylen = 0;
1476
+
1477
+ YYDPRINTF ((stderr, "Starting parse\n"));
1478
+
1479
+ yystate = 0;
1480
+ yyerrstatus = 0;
1481
+ yynerrs = 0;
1482
+ yychar = YYEMPTY; /* Cause a token to be read. */
1483
+
1484
+ /* Initialize stack pointers.
1485
+ Waste one element of value and location stack
1486
+ so that they stay on the same level as the state stack.
1487
+ The wasted elements are never initialized. */
1488
+
1489
+ yyssp = yyss;
1490
+ yyvsp = yyvs;
1491
+ yylsp = yyls;
1492
+ #if YYLTYPE_IS_TRIVIAL
1493
+ /* Initialize the default location before parsing starts. */
1494
+ yylloc.first_line = yylloc.last_line = 1;
1495
+ yylloc.first_column = yylloc.last_column = 0;
1496
+ #endif
1497
+
1498
+ goto yysetstate;
1499
+
1500
+ /*------------------------------------------------------------.
1501
+ | yynewstate -- Push a new state, which is found in yystate. |
1502
+ `------------------------------------------------------------*/
1503
+ yynewstate:
1504
+ /* In all cases, when you get here, the value and location stacks
1505
+ have just been pushed. So pushing a state here evens the stacks. */
1506
+ yyssp++;
1507
+
1508
+ yysetstate:
1509
+ *yyssp = yystate;
1510
+
1511
+ if (yyss + yystacksize - 1 <= yyssp)
1512
+ {
1513
+ /* Get the current used size of the three stacks, in elements. */
1514
+ YYSIZE_T yysize = yyssp - yyss + 1;
1515
+
1516
+ #ifdef yyoverflow
1517
+ {
1518
+ /* Give user a chance to reallocate the stack. Use copies of
1519
+ these so that the &'s don't force the real ones into
1520
+ memory. */
1521
+ YYSTYPE *yyvs1 = yyvs;
1522
+ yytype_int16 *yyss1 = yyss;
1523
+ YYLTYPE *yyls1 = yyls;
1524
+
1525
+ /* Each stack pointer address is followed by the size of the
1526
+ data in use in that stack, in bytes. This used to be a
1527
+ conditional around just the two extra args, but that might
1528
+ be undefined if yyoverflow is a macro. */
1529
+ yyoverflow (YY_("memory exhausted"),
1530
+ &yyss1, yysize * sizeof (*yyssp),
1531
+ &yyvs1, yysize * sizeof (*yyvsp),
1532
+ &yyls1, yysize * sizeof (*yylsp),
1533
+ &yystacksize);
1534
+ yyls = yyls1;
1535
+ yyss = yyss1;
1536
+ yyvs = yyvs1;
1537
+ }
1538
+ #else /* no yyoverflow */
1539
+ # ifndef YYSTACK_RELOCATE
1540
+ goto yyexhaustedlab;
1541
+ # else
1542
+ /* Extend the stack our own way. */
1543
+ if (YYMAXDEPTH <= yystacksize)
1544
+ goto yyexhaustedlab;
1545
+ yystacksize *= 2;
1546
+ if (YYMAXDEPTH < yystacksize)
1547
+ yystacksize = YYMAXDEPTH;
1548
+
1549
+ {
1550
+ yytype_int16 *yyss1 = yyss;
1551
+ union yyalloc *yyptr =
1552
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1553
+ if (! yyptr)
1554
+ goto yyexhaustedlab;
1555
+ YYSTACK_RELOCATE (yyss);
1556
+ YYSTACK_RELOCATE (yyvs);
1557
+ YYSTACK_RELOCATE (yyls);
1558
+ # undef YYSTACK_RELOCATE
1559
+ if (yyss1 != yyssa)
1560
+ YYSTACK_FREE (yyss1);
1561
+ }
1562
+ # endif
1563
+ #endif /* no yyoverflow */
1564
+
1565
+ yyssp = yyss + yysize - 1;
1566
+ yyvsp = yyvs + yysize - 1;
1567
+ yylsp = yyls + yysize - 1;
1568
+
1569
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1570
+ (unsigned long int) yystacksize));
1571
+
1572
+ if (yyss + yystacksize - 1 <= yyssp)
1573
+ YYABORT;
1574
+ }
1575
+
1576
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1577
+
1578
+ goto yybackup;
1579
+
1580
+ /*-----------.
1581
+ | yybackup. |
1582
+ `-----------*/
1583
+ yybackup:
1584
+
1585
+ /* Do appropriate processing given the current state. Read a
1586
+ look-ahead token if we need one and don't already have one. */
1587
+
1588
+ /* First try to decide what to do without reference to look-ahead token. */
1589
+ yyn = yypact[yystate];
1590
+ if (yyn == YYPACT_NINF)
1591
+ goto yydefault;
1592
+
1593
+ /* Not known => get a look-ahead token if don't already have one. */
1594
+
1595
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1596
+ if (yychar == YYEMPTY)
1597
+ {
1598
+ YYDPRINTF ((stderr, "Reading a token: "));
1599
+ yychar = YYLEX;
1600
+ }
1601
+
1602
+ if (yychar <= YYEOF)
1603
+ {
1604
+ yychar = yytoken = YYEOF;
1605
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
1606
+ }
1607
+ else
1608
+ {
1609
+ yytoken = YYTRANSLATE (yychar);
1610
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1611
+ }
1612
+
1613
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
1614
+ detect an error, take that action. */
1615
+ yyn += yytoken;
1616
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1617
+ goto yydefault;
1618
+ yyn = yytable[yyn];
1619
+ if (yyn <= 0)
1620
+ {
1621
+ if (yyn == 0 || yyn == YYTABLE_NINF)
1622
+ goto yyerrlab;
1623
+ yyn = -yyn;
1624
+ goto yyreduce;
1625
+ }
1626
+
1627
+ if (yyn == YYFINAL)
1628
+ YYACCEPT;
1629
+
1630
+ /* Count tokens shifted since error; after three, turn off error
1631
+ status. */
1632
+ if (yyerrstatus)
1633
+ yyerrstatus--;
1634
+
1635
+ /* Shift the look-ahead token. */
1636
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1637
+
1638
+ /* Discard the shifted token unless it is eof. */
1639
+ if (yychar != YYEOF)
1640
+ yychar = YYEMPTY;
1641
+
1642
+ yystate = yyn;
1643
+ *++yyvsp = yylval;
1644
+ *++yylsp = yylloc;
1645
+ goto yynewstate;
1646
+
1647
+
1648
+ /*-----------------------------------------------------------.
1649
+ | yydefault -- do the default action for the current state. |
1650
+ `-----------------------------------------------------------*/
1651
+ yydefault:
1652
+ yyn = yydefact[yystate];
1653
+ if (yyn == 0)
1654
+ goto yyerrlab;
1655
+ goto yyreduce;
1656
+
1657
+
1658
+ /*-----------------------------.
1659
+ | yyreduce -- Do a reduction. |
1660
+ `-----------------------------*/
1661
+ yyreduce:
1662
+ /* yyn is the number of a rule to reduce with. */
1663
+ yylen = yyr2[yyn];
1664
+
1665
+ /* If YYLEN is nonzero, implement the default value of the action:
1666
+ `$$ = $1'.
1667
+
1668
+ Otherwise, the following line sets YYVAL to garbage.
1669
+ This behavior is undocumented and Bison
1670
+ users should not rely upon it. Assigning to YYVAL
1671
+ unconditionally makes the parser a bit smaller, and it avoids a
1672
+ GCC warning that YYVAL may be used uninitialized. */
1673
+ yyval = yyvsp[1-yylen];
1674
+
1675
+ /* Default location. */
1676
+ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1677
+ YY_REDUCE_PRINT (yyn);
1678
+ switch (yyn)
1679
+ {
1680
+ case 2:
1681
+ #line 38 "wktparse.y"
1682
+ { alloc_lwgeom(srid); }
1683
+ break;
1684
+
1685
+ case 4:
1686
+ #line 40 "wktparse.y"
1687
+ { alloc_lwgeom(-1); }
1688
+ break;
1689
+
1690
+ case 19:
1691
+ #line 70 "wktparse.y"
1692
+ { set_srid((yyvsp[(3) - (3)].value)); }
1693
+ break;
1694
+
1695
+ case 20:
1696
+ #line 73 "wktparse.y"
1697
+ { alloc_wkb((yyvsp[(1) - (1)].wkb)); }
1698
+ break;
1699
+
1700
+ case 22:
1701
+ #line 81 "wktparse.y"
1702
+ { set_zm(0, 1); }
1703
+ break;
1704
+
1705
+ case 26:
1706
+ #line 89 "wktparse.y"
1707
+ { alloc_point(); }
1708
+ break;
1709
+
1710
+ case 27:
1711
+ #line 89 "wktparse.y"
1712
+ { pop(); }
1713
+ break;
1714
+
1715
+ case 28:
1716
+ #line 92 "wktparse.y"
1717
+ { alloc_point(); }
1718
+ break;
1719
+
1720
+ case 29:
1721
+ #line 92 "wktparse.y"
1722
+ { pop(); }
1723
+ break;
1724
+
1725
+ case 31:
1726
+ #line 100 "wktparse.y"
1727
+ { alloc_multipoint(); }
1728
+ break;
1729
+
1730
+ case 32:
1731
+ #line 100 "wktparse.y"
1732
+ { pop(); }
1733
+ break;
1734
+
1735
+ case 33:
1736
+ #line 102 "wktparse.y"
1737
+ { set_zm(0, 1); alloc_multipoint(); }
1738
+ break;
1739
+
1740
+ case 34:
1741
+ #line 102 "wktparse.y"
1742
+ {pop(); }
1743
+ break;
1744
+
1745
+ case 36:
1746
+ #line 107 "wktparse.y"
1747
+ { alloc_counter(); }
1748
+ break;
1749
+
1750
+ case 37:
1751
+ #line 107 "wktparse.y"
1752
+ { pop(); }
1753
+ break;
1754
+
1755
+ case 41:
1756
+ #line 118 "wktparse.y"
1757
+ { alloc_point(); }
1758
+ break;
1759
+
1760
+ case 42:
1761
+ #line 118 "wktparse.y"
1762
+ { pop(); }
1763
+ break;
1764
+
1765
+ case 44:
1766
+ #line 126 "wktparse.y"
1767
+ { set_zm(0, 1); }
1768
+ break;
1769
+
1770
+ case 48:
1771
+ #line 134 "wktparse.y"
1772
+ { alloc_linestring(); }
1773
+ break;
1774
+
1775
+ case 49:
1776
+ #line 134 "wktparse.y"
1777
+ { pop(); }
1778
+ break;
1779
+
1780
+ case 50:
1781
+ #line 137 "wktparse.y"
1782
+ { alloc_linestring(); }
1783
+ break;
1784
+
1785
+ case 51:
1786
+ #line 137 "wktparse.y"
1787
+ { pop(); }
1788
+ break;
1789
+
1790
+ case 52:
1791
+ #line 140 "wktparse.y"
1792
+ { alloc_linestring_closed(); }
1793
+ break;
1794
+
1795
+ case 53:
1796
+ #line 140 "wktparse.y"
1797
+ { pop(); }
1798
+ break;
1799
+
1800
+ case 54:
1801
+ #line 143 "wktparse.y"
1802
+ { alloc_counter(); }
1803
+ break;
1804
+
1805
+ case 55:
1806
+ #line 143 "wktparse.y"
1807
+ { popc(); }
1808
+ break;
1809
+
1810
+ case 59:
1811
+ #line 155 "wktparse.y"
1812
+ {set_zm(0, 1); }
1813
+ break;
1814
+
1815
+ case 62:
1816
+ #line 160 "wktparse.y"
1817
+ {set_zm(0, 1); }
1818
+ break;
1819
+
1820
+ case 68:
1821
+ #line 173 "wktparse.y"
1822
+ { alloc_circularstring(); }
1823
+ break;
1824
+
1825
+ case 69:
1826
+ #line 173 "wktparse.y"
1827
+ { pop(); }
1828
+ break;
1829
+
1830
+ case 70:
1831
+ #line 176 "wktparse.y"
1832
+ { alloc_circularstring(); }
1833
+ break;
1834
+
1835
+ case 71:
1836
+ #line 176 "wktparse.y"
1837
+ { pop(); }
1838
+ break;
1839
+
1840
+ case 72:
1841
+ #line 179 "wktparse.y"
1842
+ { alloc_circularstring_closed(); }
1843
+ break;
1844
+
1845
+ case 73:
1846
+ #line 179 "wktparse.y"
1847
+ { pop(); }
1848
+ break;
1849
+
1850
+ case 74:
1851
+ #line 182 "wktparse.y"
1852
+ { alloc_counter(); }
1853
+ break;
1854
+
1855
+ case 75:
1856
+ #line 182 "wktparse.y"
1857
+ { popc(); }
1858
+ break;
1859
+
1860
+ case 78:
1861
+ #line 192 "wktparse.y"
1862
+ { alloc_compoundcurve(); }
1863
+ break;
1864
+
1865
+ case 79:
1866
+ #line 192 "wktparse.y"
1867
+ { pop(); }
1868
+ break;
1869
+
1870
+ case 80:
1871
+ #line 194 "wktparse.y"
1872
+ {set_zm(0, 1); alloc_compoundcurve(); }
1873
+ break;
1874
+
1875
+ case 81:
1876
+ #line 194 "wktparse.y"
1877
+ { pop(); }
1878
+ break;
1879
+
1880
+ case 83:
1881
+ #line 199 "wktparse.y"
1882
+ { alloc_counter(); }
1883
+ break;
1884
+
1885
+ case 84:
1886
+ #line 199 "wktparse.y"
1887
+ { pop(); }
1888
+ break;
1889
+
1890
+ case 89:
1891
+ #line 213 "wktparse.y"
1892
+ { alloc_multilinestring(); }
1893
+ break;
1894
+
1895
+ case 90:
1896
+ #line 214 "wktparse.y"
1897
+ { pop(); }
1898
+ break;
1899
+
1900
+ case 91:
1901
+ #line 216 "wktparse.y"
1902
+ { set_zm(0, 1); alloc_multilinestring(); }
1903
+ break;
1904
+
1905
+ case 92:
1906
+ #line 217 "wktparse.y"
1907
+ { pop(); }
1908
+ break;
1909
+
1910
+ case 94:
1911
+ #line 222 "wktparse.y"
1912
+ { alloc_counter(); }
1913
+ break;
1914
+
1915
+ case 95:
1916
+ #line 222 "wktparse.y"
1917
+ { pop();}
1918
+ break;
1919
+
1920
+ case 98:
1921
+ #line 232 "wktparse.y"
1922
+ { alloc_multicurve(); }
1923
+ break;
1924
+
1925
+ case 99:
1926
+ #line 233 "wktparse.y"
1927
+ { pop(); }
1928
+ break;
1929
+
1930
+ case 100:
1931
+ #line 235 "wktparse.y"
1932
+ { set_zm(0, 1); alloc_multicurve(); }
1933
+ break;
1934
+
1935
+ case 101:
1936
+ #line 236 "wktparse.y"
1937
+ { pop(); }
1938
+ break;
1939
+
1940
+ case 103:
1941
+ #line 241 "wktparse.y"
1942
+ { alloc_counter(); }
1943
+ break;
1944
+
1945
+ case 104:
1946
+ #line 241 "wktparse.y"
1947
+ { pop(); }
1948
+ break;
1949
+
1950
+ case 110:
1951
+ #line 257 "wktparse.y"
1952
+ { set_zm(0, 1); }
1953
+ break;
1954
+
1955
+ case 114:
1956
+ #line 265 "wktparse.y"
1957
+ { alloc_polygon(); }
1958
+ break;
1959
+
1960
+ case 115:
1961
+ #line 265 "wktparse.y"
1962
+ { pop(); }
1963
+ break;
1964
+
1965
+ case 116:
1966
+ #line 268 "wktparse.y"
1967
+ { alloc_polygon(); }
1968
+ break;
1969
+
1970
+ case 117:
1971
+ #line 268 "wktparse.y"
1972
+ { pop(); }
1973
+ break;
1974
+
1975
+ case 118:
1976
+ #line 271 "wktparse.y"
1977
+ { alloc_counter(); }
1978
+ break;
1979
+
1980
+ case 119:
1981
+ #line 271 "wktparse.y"
1982
+ { pop();}
1983
+ break;
1984
+
1985
+ case 122:
1986
+ #line 281 "wktparse.y"
1987
+ { alloc_curvepolygon(); }
1988
+ break;
1989
+
1990
+ case 123:
1991
+ #line 281 "wktparse.y"
1992
+ { pop(); }
1993
+ break;
1994
+
1995
+ case 124:
1996
+ #line 283 "wktparse.y"
1997
+ { set_zm(0, 1); alloc_curvepolygon(); }
1998
+ break;
1999
+
2000
+ case 125:
2001
+ #line 284 "wktparse.y"
2002
+ { pop(); }
2003
+ break;
2004
+
2005
+ case 127:
2006
+ #line 289 "wktparse.y"
2007
+ { alloc_counter(); }
2008
+ break;
2009
+
2010
+ case 128:
2011
+ #line 289 "wktparse.y"
2012
+ { pop(); }
2013
+ break;
2014
+
2015
+ case 133:
2016
+ #line 303 "wktparse.y"
2017
+ { alloc_multipolygon(); }
2018
+ break;
2019
+
2020
+ case 134:
2021
+ #line 303 "wktparse.y"
2022
+ { pop(); }
2023
+ break;
2024
+
2025
+ case 135:
2026
+ #line 305 "wktparse.y"
2027
+ { set_zm(0, 1); alloc_multipolygon(); }
2028
+ break;
2029
+
2030
+ case 136:
2031
+ #line 306 "wktparse.y"
2032
+ { pop();}
2033
+ break;
2034
+
2035
+ case 138:
2036
+ #line 311 "wktparse.y"
2037
+ { alloc_counter(); }
2038
+ break;
2039
+
2040
+ case 139:
2041
+ #line 311 "wktparse.y"
2042
+ { pop(); }
2043
+ break;
2044
+
2045
+ case 142:
2046
+ #line 321 "wktparse.y"
2047
+ {alloc_multisurface(); }
2048
+ break;
2049
+
2050
+ case 143:
2051
+ #line 321 "wktparse.y"
2052
+ { pop(); }
2053
+ break;
2054
+
2055
+ case 144:
2056
+ #line 323 "wktparse.y"
2057
+ { set_zm(0, 1); alloc_multisurface(); }
2058
+ break;
2059
+
2060
+ case 145:
2061
+ #line 324 "wktparse.y"
2062
+ { pop(); }
2063
+ break;
2064
+
2065
+ case 147:
2066
+ #line 329 "wktparse.y"
2067
+ { alloc_counter(); }
2068
+ break;
2069
+
2070
+ case 148:
2071
+ #line 329 "wktparse.y"
2072
+ { pop(); }
2073
+ break;
2074
+
2075
+ case 153:
2076
+ #line 343 "wktparse.y"
2077
+ { alloc_geomertycollection(); }
2078
+ break;
2079
+
2080
+ case 154:
2081
+ #line 344 "wktparse.y"
2082
+ { pop(); }
2083
+ break;
2084
+
2085
+ case 155:
2086
+ #line 346 "wktparse.y"
2087
+ { set_zm(0, 1); alloc_geomertycollection(); }
2088
+ break;
2089
+
2090
+ case 156:
2091
+ #line 347 "wktparse.y"
2092
+ { pop();}
2093
+ break;
2094
+
2095
+ case 158:
2096
+ #line 352 "wktparse.y"
2097
+ { alloc_counter(); }
2098
+ break;
2099
+
2100
+ case 159:
2101
+ #line 352 "wktparse.y"
2102
+ { pop(); }
2103
+ break;
2104
+
2105
+ case 166:
2106
+ #line 371 "wktparse.y"
2107
+ {alloc_point_2d((yyvsp[(1) - (2)].value),(yyvsp[(2) - (2)].value)); }
2108
+ break;
2109
+
2110
+ case 167:
2111
+ #line 374 "wktparse.y"
2112
+ {alloc_point_3d((yyvsp[(1) - (3)].value),(yyvsp[(2) - (3)].value),(yyvsp[(3) - (3)].value)); }
2113
+ break;
2114
+
2115
+ case 168:
2116
+ #line 377 "wktparse.y"
2117
+ {alloc_point_4d((yyvsp[(1) - (4)].value),(yyvsp[(2) - (4)].value),(yyvsp[(3) - (4)].value),(yyvsp[(4) - (4)].value)); }
2118
+ break;
2119
+
2120
+ case 169:
2121
+ #line 380 "wktparse.y"
2122
+ { alloc_empty(); }
2123
+ break;
2124
+
2125
+
2126
+ /* Line 1267 of yacc.c. */
2127
+ #line 2128 "y.tab.c"
2128
+ default: break;
2129
+ }
2130
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2131
+
2132
+ YYPOPSTACK (yylen);
2133
+ yylen = 0;
2134
+ YY_STACK_PRINT (yyss, yyssp);
2135
+
2136
+ *++yyvsp = yyval;
2137
+ *++yylsp = yyloc;
2138
+
2139
+ /* Now `shift' the result of the reduction. Determine what state
2140
+ that goes to, based on the state we popped back to and the rule
2141
+ number reduced by. */
2142
+
2143
+ yyn = yyr1[yyn];
2144
+
2145
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2146
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2147
+ yystate = yytable[yystate];
2148
+ else
2149
+ yystate = yydefgoto[yyn - YYNTOKENS];
2150
+
2151
+ goto yynewstate;
2152
+
2153
+
2154
+ /*------------------------------------.
2155
+ | yyerrlab -- here on detecting error |
2156
+ `------------------------------------*/
2157
+ yyerrlab:
2158
+ /* If not already recovering from an error, report this error. */
2159
+ if (!yyerrstatus)
2160
+ {
2161
+ ++yynerrs;
2162
+ #if ! YYERROR_VERBOSE
2163
+ yyerror (YY_("syntax error"));
2164
+ #else
2165
+ {
2166
+ YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2167
+ if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2168
+ {
2169
+ YYSIZE_T yyalloc = 2 * yysize;
2170
+ if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2171
+ yyalloc = YYSTACK_ALLOC_MAXIMUM;
2172
+ if (yymsg != yymsgbuf)
2173
+ YYSTACK_FREE (yymsg);
2174
+ yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2175
+ if (yymsg)
2176
+ yymsg_alloc = yyalloc;
2177
+ else
2178
+ {
2179
+ yymsg = yymsgbuf;
2180
+ yymsg_alloc = sizeof yymsgbuf;
2181
+ }
2182
+ }
2183
+
2184
+ if (0 < yysize && yysize <= yymsg_alloc)
2185
+ {
2186
+ (void) yysyntax_error (yymsg, yystate, yychar);
2187
+ yyerror (yymsg);
2188
+ }
2189
+ else
2190
+ {
2191
+ yyerror (YY_("syntax error"));
2192
+ if (yysize != 0)
2193
+ goto yyexhaustedlab;
2194
+ }
2195
+ }
2196
+ #endif
2197
+ }
2198
+
2199
+ yyerror_range[0] = yylloc;
2200
+
2201
+ if (yyerrstatus == 3)
2202
+ {
2203
+ /* If just tried and failed to reuse look-ahead token after an
2204
+ error, discard it. */
2205
+
2206
+ if (yychar <= YYEOF)
2207
+ {
2208
+ /* Return failure if at end of input. */
2209
+ if (yychar == YYEOF)
2210
+ YYABORT;
2211
+ }
2212
+ else
2213
+ {
2214
+ yydestruct ("Error: discarding",
2215
+ yytoken, &yylval, &yylloc);
2216
+ yychar = YYEMPTY;
2217
+ }
2218
+ }
2219
+
2220
+ /* Else will try to reuse look-ahead token after shifting the error
2221
+ token. */
2222
+ goto yyerrlab1;
2223
+
2224
+
2225
+ /*---------------------------------------------------.
2226
+ | yyerrorlab -- error raised explicitly by YYERROR. |
2227
+ `---------------------------------------------------*/
2228
+ yyerrorlab:
2229
+
2230
+ /* Pacify compilers like GCC when the user code never invokes
2231
+ YYERROR and the label yyerrorlab therefore never appears in user
2232
+ code. */
2233
+ if (/*CONSTCOND*/ 0)
2234
+ goto yyerrorlab;
2235
+
2236
+ yyerror_range[0] = yylsp[1-yylen];
2237
+ /* Do not reclaim the symbols of the rule which action triggered
2238
+ this YYERROR. */
2239
+ YYPOPSTACK (yylen);
2240
+ yylen = 0;
2241
+ YY_STACK_PRINT (yyss, yyssp);
2242
+ yystate = *yyssp;
2243
+ goto yyerrlab1;
2244
+
2245
+
2246
+ /*-------------------------------------------------------------.
2247
+ | yyerrlab1 -- common code for both syntax error and YYERROR. |
2248
+ `-------------------------------------------------------------*/
2249
+ yyerrlab1:
2250
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
2251
+
2252
+ for (;;)
2253
+ {
2254
+ yyn = yypact[yystate];
2255
+ if (yyn != YYPACT_NINF)
2256
+ {
2257
+ yyn += YYTERROR;
2258
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2259
+ {
2260
+ yyn = yytable[yyn];
2261
+ if (0 < yyn)
2262
+ break;
2263
+ }
2264
+ }
2265
+
2266
+ /* Pop the current state because it cannot handle the error token. */
2267
+ if (yyssp == yyss)
2268
+ YYABORT;
2269
+
2270
+ yyerror_range[0] = *yylsp;
2271
+ yydestruct ("Error: popping",
2272
+ yystos[yystate], yyvsp, yylsp);
2273
+ YYPOPSTACK (1);
2274
+ yystate = *yyssp;
2275
+ YY_STACK_PRINT (yyss, yyssp);
2276
+ }
2277
+
2278
+ if (yyn == YYFINAL)
2279
+ YYACCEPT;
2280
+
2281
+ *++yyvsp = yylval;
2282
+
2283
+ yyerror_range[1] = yylloc;
2284
+ /* Using YYLLOC is tempting, but would change the location of
2285
+ the look-ahead. YYLOC is available though. */
2286
+ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
2287
+ *++yylsp = yyloc;
2288
+
2289
+ /* Shift the error token. */
2290
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2291
+
2292
+ yystate = yyn;
2293
+ goto yynewstate;
2294
+
2295
+
2296
+ /*-------------------------------------.
2297
+ | yyacceptlab -- YYACCEPT comes here. |
2298
+ `-------------------------------------*/
2299
+ yyacceptlab:
2300
+ yyresult = 0;
2301
+ goto yyreturn;
2302
+
2303
+ /*-----------------------------------.
2304
+ | yyabortlab -- YYABORT comes here. |
2305
+ `-----------------------------------*/
2306
+ yyabortlab:
2307
+ yyresult = 1;
2308
+ goto yyreturn;
2309
+
2310
+ #ifndef yyoverflow
2311
+ /*-------------------------------------------------.
2312
+ | yyexhaustedlab -- memory exhaustion comes here. |
2313
+ `-------------------------------------------------*/
2314
+ yyexhaustedlab:
2315
+ yyerror (YY_("memory exhausted"));
2316
+ yyresult = 2;
2317
+ /* Fall through. */
2318
+ #endif
2319
+
2320
+ yyreturn:
2321
+ if (yychar != YYEOF && yychar != YYEMPTY)
2322
+ yydestruct ("Cleanup: discarding lookahead",
2323
+ yytoken, &yylval, &yylloc);
2324
+ /* Do not reclaim the symbols of the rule which action triggered
2325
+ this YYABORT or YYACCEPT. */
2326
+ YYPOPSTACK (yylen);
2327
+ YY_STACK_PRINT (yyss, yyssp);
2328
+ while (yyssp != yyss)
2329
+ {
2330
+ yydestruct ("Cleanup: popping",
2331
+ yystos[*yyssp], yyvsp, yylsp);
2332
+ YYPOPSTACK (1);
2333
+ }
2334
+ #ifndef yyoverflow
2335
+ if (yyss != yyssa)
2336
+ YYSTACK_FREE (yyss);
2337
+ #endif
2338
+ #if YYERROR_VERBOSE
2339
+ if (yymsg != yymsgbuf)
2340
+ YYSTACK_FREE (yymsg);
2341
+ #endif
2342
+ /* Make sure YYID is used. */
2343
+ return YYID (yyresult);
2344
+ }
2345
+
2346
+
2347
+ #line 381 "wktparse.y"
2348
+
2349
+
2350
+
2351
+
2352
+
2353
+