1
2 #define YY_INT_ALIGNED short int
3
4 /* A lexical scanner generated by flex */
5
6 #define FLEX_SCANNER
7 #define YY_FLEX_MAJOR_VERSION 2
8 #define YY_FLEX_MINOR_VERSION 6
9 #define YY_FLEX_SUBMINOR_VERSION 4
10 #if YY_FLEX_SUBMINOR_VERSION > 0
11 #define FLEX_BETA
12 #endif
13
14 #ifdef yy_create_buffer
15 #define Kml_create_buffer_ALREADY_DEFINED
16 #else
17 #define yy_create_buffer Kml_create_buffer
18 #endif
19
20 #ifdef yy_delete_buffer
21 #define Kml_delete_buffer_ALREADY_DEFINED
22 #else
23 #define yy_delete_buffer Kml_delete_buffer
24 #endif
25
26 #ifdef yy_scan_buffer
27 #define Kml_scan_buffer_ALREADY_DEFINED
28 #else
29 #define yy_scan_buffer Kml_scan_buffer
30 #endif
31
32 #ifdef yy_scan_string
33 #define Kml_scan_string_ALREADY_DEFINED
34 #else
35 #define yy_scan_string Kml_scan_string
36 #endif
37
38 #ifdef yy_scan_bytes
39 #define Kml_scan_bytes_ALREADY_DEFINED
40 #else
41 #define yy_scan_bytes Kml_scan_bytes
42 #endif
43
44 #ifdef yy_init_buffer
45 #define Kml_init_buffer_ALREADY_DEFINED
46 #else
47 #define yy_init_buffer Kml_init_buffer
48 #endif
49
50 #ifdef yy_flush_buffer
51 #define Kml_flush_buffer_ALREADY_DEFINED
52 #else
53 #define yy_flush_buffer Kml_flush_buffer
54 #endif
55
56 #ifdef yy_load_buffer_state
57 #define Kml_load_buffer_state_ALREADY_DEFINED
58 #else
59 #define yy_load_buffer_state Kml_load_buffer_state
60 #endif
61
62 #ifdef yy_switch_to_buffer
63 #define Kml_switch_to_buffer_ALREADY_DEFINED
64 #else
65 #define yy_switch_to_buffer Kml_switch_to_buffer
66 #endif
67
68 #ifdef yypush_buffer_state
69 #define Kmlpush_buffer_state_ALREADY_DEFINED
70 #else
71 #define yypush_buffer_state Kmlpush_buffer_state
72 #endif
73
74 #ifdef yypop_buffer_state
75 #define Kmlpop_buffer_state_ALREADY_DEFINED
76 #else
77 #define yypop_buffer_state Kmlpop_buffer_state
78 #endif
79
80 #ifdef yyensure_buffer_stack
81 #define Kmlensure_buffer_stack_ALREADY_DEFINED
82 #else
83 #define yyensure_buffer_stack Kmlensure_buffer_stack
84 #endif
85
86 #ifdef yylex
87 #define Kmllex_ALREADY_DEFINED
88 #else
89 #define yylex Kmllex
90 #endif
91
92 #ifdef yyrestart
93 #define Kmlrestart_ALREADY_DEFINED
94 #else
95 #define yyrestart Kmlrestart
96 #endif
97
98 #ifdef yylex_init
99 #define Kmllex_init_ALREADY_DEFINED
100 #else
101 #define yylex_init Kmllex_init
102 #endif
103
104 #ifdef yylex_init_extra
105 #define Kmllex_init_extra_ALREADY_DEFINED
106 #else
107 #define yylex_init_extra Kmllex_init_extra
108 #endif
109
110 #ifdef yylex_destroy
111 #define Kmllex_destroy_ALREADY_DEFINED
112 #else
113 #define yylex_destroy Kmllex_destroy
114 #endif
115
116 #ifdef yyget_debug
117 #define Kmlget_debug_ALREADY_DEFINED
118 #else
119 #define yyget_debug Kmlget_debug
120 #endif
121
122 #ifdef yyset_debug
123 #define Kmlset_debug_ALREADY_DEFINED
124 #else
125 #define yyset_debug Kmlset_debug
126 #endif
127
128 #ifdef yyget_extra
129 #define Kmlget_extra_ALREADY_DEFINED
130 #else
131 #define yyget_extra Kmlget_extra
132 #endif
133
134 #ifdef yyset_extra
135 #define Kmlset_extra_ALREADY_DEFINED
136 #else
137 #define yyset_extra Kmlset_extra
138 #endif
139
140 #ifdef yyget_in
141 #define Kmlget_in_ALREADY_DEFINED
142 #else
143 #define yyget_in Kmlget_in
144 #endif
145
146 #ifdef yyset_in
147 #define Kmlset_in_ALREADY_DEFINED
148 #else
149 #define yyset_in Kmlset_in
150 #endif
151
152 #ifdef yyget_out
153 #define Kmlget_out_ALREADY_DEFINED
154 #else
155 #define yyget_out Kmlget_out
156 #endif
157
158 #ifdef yyset_out
159 #define Kmlset_out_ALREADY_DEFINED
160 #else
161 #define yyset_out Kmlset_out
162 #endif
163
164 #ifdef yyget_leng
165 #define Kmlget_leng_ALREADY_DEFINED
166 #else
167 #define yyget_leng Kmlget_leng
168 #endif
169
170 #ifdef yyget_text
171 #define Kmlget_text_ALREADY_DEFINED
172 #else
173 #define yyget_text Kmlget_text
174 #endif
175
176 #ifdef yyget_lineno
177 #define Kmlget_lineno_ALREADY_DEFINED
178 #else
179 #define yyget_lineno Kmlget_lineno
180 #endif
181
182 #ifdef yyset_lineno
183 #define Kmlset_lineno_ALREADY_DEFINED
184 #else
185 #define yyset_lineno Kmlset_lineno
186 #endif
187
188 #ifdef yyget_column
189 #define Kmlget_column_ALREADY_DEFINED
190 #else
191 #define yyget_column Kmlget_column
192 #endif
193
194 #ifdef yyset_column
195 #define Kmlset_column_ALREADY_DEFINED
196 #else
197 #define yyset_column Kmlset_column
198 #endif
199
200 #ifdef yywrap
201 #define Kmlwrap_ALREADY_DEFINED
202 #else
203 #define yywrap Kmlwrap
204 #endif
205
206 #ifdef yyalloc
207 #define Kmlalloc_ALREADY_DEFINED
208 #else
209 #define yyalloc Kmlalloc
210 #endif
211
212 #ifdef yyrealloc
213 #define Kmlrealloc_ALREADY_DEFINED
214 #else
215 #define yyrealloc Kmlrealloc
216 #endif
217
218 #ifdef yyfree
219 #define Kmlfree_ALREADY_DEFINED
220 #else
221 #define yyfree Kmlfree
222 #endif
223
224 /* First, we deal with platform-specific or compiler-specific issues. */
225
226 /* begin standard C headers. */
227 #include <stdio.h>
228 #include <string.h>
229 #include <errno.h>
230 #include <stdlib.h>
231
232 /* end standard C headers. */
233
234 /* flex integer type definitions */
235
236 #ifndef FLEXINT_H
237 #define FLEXINT_H
238
239 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
240
241 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
242
243 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
244 * if you want the limit (max/min) macros for int types.
245 */
246 #ifndef __STDC_LIMIT_MACROS
247 #define __STDC_LIMIT_MACROS 1
248 #endif
249
250 #include <inttypes.h>
251 typedef int8_t flex_int8_t;
252 typedef uint8_t flex_uint8_t;
253 typedef int16_t flex_int16_t;
254 typedef uint16_t flex_uint16_t;
255 typedef int32_t flex_int32_t;
256 typedef uint32_t flex_uint32_t;
257 #else
258 typedef signed char flex_int8_t;
259 typedef short int flex_int16_t;
260 typedef int flex_int32_t;
261 typedef unsigned char flex_uint8_t;
262 typedef unsigned short int flex_uint16_t;
263 typedef unsigned int flex_uint32_t;
264
265 /* Limits of integral types. */
266 #ifndef INT8_MIN
267 #define INT8_MIN (-128)
268 #endif
269 #ifndef INT16_MIN
270 #define INT16_MIN (-32767-1)
271 #endif
272 #ifndef INT32_MIN
273 #define INT32_MIN (-2147483647-1)
274 #endif
275 #ifndef INT8_MAX
276 #define INT8_MAX (127)
277 #endif
278 #ifndef INT16_MAX
279 #define INT16_MAX (32767)
280 #endif
281 #ifndef INT32_MAX
282 #define INT32_MAX (2147483647)
283 #endif
284 #ifndef UINT8_MAX
285 #define UINT8_MAX (255U)
286 #endif
287 #ifndef UINT16_MAX
288 #define UINT16_MAX (65535U)
289 #endif
290 #ifndef UINT32_MAX
291 #define UINT32_MAX (4294967295U)
292 #endif
293
294 #ifndef SIZE_MAX
295 #define SIZE_MAX (~(size_t)0)
296 #endif
297
298 #endif /* ! C99 */
299
300 #endif /* ! FLEXINT_H */
301
302 /* begin standard C++ headers. */
303
304 /* TODO: this is always defined, so inline it */
305 #define yyconst const
306
307 #if defined(__GNUC__) && __GNUC__ >= 3
308 #define yynoreturn __attribute__((__noreturn__))
309 #else
310 #define yynoreturn
311 #endif
312
313 /* Returned upon end-of-file. */
314 #define YY_NULL 0
315
316 /* Promotes a possibly negative, possibly signed char to an
317 * integer in range [0..255] for use as an array index.
318 */
319 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
320
321 /* An opaque pointer. */
322 #ifndef YY_TYPEDEF_YY_SCANNER_T
323 #define YY_TYPEDEF_YY_SCANNER_T
324 typedef void* yyscan_t;
325 #endif
326
327 /* For convenience, these vars (plus the bison vars far below)
328 are macros in the reentrant scanner. */
329 #define yyin yyg->yyin_r
330 #define yyout yyg->yyout_r
331 #define yyextra yyg->yyextra_r
332 #define yyleng yyg->yyleng_r
333 #define yytext yyg->yytext_r
334 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
335 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
336 #define yy_flex_debug yyg->yy_flex_debug_r
337
338 /* Enter a start condition. This macro really ought to take a parameter,
339 * but we do it the disgusting crufty way forced on us by the ()-less
340 * definition of BEGIN.
341 */
342 #define BEGIN yyg->yy_start = 1 + 2 *
343 /* Translate the current start state into a value that can be later handed
344 * to BEGIN to return to the state. The YYSTATE alias is for lex
345 * compatibility.
346 */
347 #define YY_START ((yyg->yy_start - 1) / 2)
348 #define YYSTATE YY_START
349 /* Action number for EOF rule of a given start state. */
350 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
351 /* Special action meaning "start processing a new file". */
352 #define YY_NEW_FILE yyrestart( yyin , yyscanner )
353 #define YY_END_OF_BUFFER_CHAR 0
354
355 /* Size of default input buffer. */
356 #ifndef YY_BUF_SIZE
357 #ifdef __ia64__
358 /* On IA-64, the buffer size is 16k, not 8k.
359 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
360 * Ditto for the __ia64__ case accordingly.
361 */
362 #define YY_BUF_SIZE 32768
363 #else
364 #define YY_BUF_SIZE 16384
365 #endif /* __ia64__ */
366 #endif
367
368 /* The state buf must be large enough to hold one state per character in the main buffer.
369 */
370 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
371
372 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
373 #define YY_TYPEDEF_YY_BUFFER_STATE
374 typedef struct yy_buffer_state *YY_BUFFER_STATE;
375 #endif
376
377 #ifndef YY_TYPEDEF_YY_SIZE_T
378 #define YY_TYPEDEF_YY_SIZE_T
379 typedef size_t yy_size_t;
380 #endif
381
382 #define EOB_ACT_CONTINUE_SCAN 0
383 #define EOB_ACT_END_OF_FILE 1
384 #define EOB_ACT_LAST_MATCH 2
385
386 #define YY_LESS_LINENO(n)
387 #define YY_LINENO_REWIND_TO(ptr)
388
389 /* Return all but the first "n" matched characters back to the input stream. */
390 #define yyless(n) \
391 do \
392 { \
393 /* Undo effects of setting up yytext. */ \
394 int yyless_macro_arg = (n); \
395 YY_LESS_LINENO(yyless_macro_arg);\
396 *yy_cp = yyg->yy_hold_char; \
397 YY_RESTORE_YY_MORE_OFFSET \
398 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
399 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
400 } \
401 while ( 0 )
402 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
403
404 #ifndef YY_STRUCT_YY_BUFFER_STATE
405 #define YY_STRUCT_YY_BUFFER_STATE
406 struct yy_buffer_state
407 {
408 FILE *yy_input_file;
409
410 char *yy_ch_buf; /* input buffer */
411 char *yy_buf_pos; /* current position in input buffer */
412
413 /* Size of input buffer in bytes, not including room for EOB
414 * characters.
415 */
416 int yy_buf_size;
417
418 /* Number of characters read into yy_ch_buf, not including EOB
419 * characters.
420 */
421 int yy_n_chars;
422
423 /* Whether we "own" the buffer - i.e., we know we created it,
424 * and can realloc() it to grow it, and should free() it to
425 * delete it.
426 */
427 int yy_is_our_buffer;
428
429 /* Whether this is an "interactive" input source; if so, and
430 * if we're using stdio for input, then we want to use getc()
431 * instead of fread(), to make sure we stop fetching input after
432 * each newline.
433 */
434 int yy_is_interactive;
435
436 /* Whether we're considered to be at the beginning of a line.
437 * If so, '^' rules will be active on the next match, otherwise
438 * not.
439 */
440 int yy_at_bol;
441
442 int yy_bs_lineno; /**< The line count. */
443 int yy_bs_column; /**< The column count. */
444
445 /* Whether to try to fill the input buffer when we reach the
446 * end of it.
447 */
448 int yy_fill_buffer;
449
450 int yy_buffer_status;
451
452 #define YY_BUFFER_NEW 0
453 #define YY_BUFFER_NORMAL 1
454 /* When an EOF's been seen but there's still some text to process
455 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
456 * shouldn't try reading from the input source any more. We might
457 * still have a bunch of tokens to match, though, because of
458 * possible backing-up.
459 *
460 * When we actually see the EOF, we change the status to "new"
461 * (via yyrestart()), so that the user can continue scanning by
462 * just pointing yyin at a new input file.
463 */
464 #define YY_BUFFER_EOF_PENDING 2
465
466 };
467 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
468
469 /* We provide macros for accessing buffer states in case in the
470 * future we want to put the buffer states in a more general
471 * "scanner state".
472 *
473 * Returns the top of the stack, or NULL.
474 */
475 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
476 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
477 : NULL)
478 /* Same as previous macro, but useful when we know that the buffer stack is not
479 * NULL or when we need an lvalue. For internal use only.
480 */
481 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
482
483 void yyrestart ( FILE *input_file , yyscan_t yyscanner );
484 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
485 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
486 void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
487 void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
488 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
489 void yypop_buffer_state ( yyscan_t yyscanner );
490
491 static void yyensure_buffer_stack ( yyscan_t yyscanner );
492 static void yy_load_buffer_state ( yyscan_t yyscanner );
493 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
494 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
495
496 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
497 YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
498 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
499
500 void *yyalloc ( yy_size_t , yyscan_t yyscanner );
501 void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
502 void yyfree ( void * , yyscan_t yyscanner );
503
504 #define yy_new_buffer yy_create_buffer
505 #define yy_set_interactive(is_interactive) \
506 { \
507 if ( ! YY_CURRENT_BUFFER ){ \
508 yyensure_buffer_stack (yyscanner); \
509 YY_CURRENT_BUFFER_LVALUE = \
510 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
511 } \
512 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
513 }
514 #define yy_set_bol(at_bol) \
515 { \
516 if ( ! YY_CURRENT_BUFFER ){\
517 yyensure_buffer_stack (yyscanner); \
518 YY_CURRENT_BUFFER_LVALUE = \
519 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
520 } \
521 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
522 }
523 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
524
525 /* Begin user sect3 */
526 typedef flex_uint8_t YY_CHAR;
527
528 typedef int yy_state_type;
529
530 #define yytext_ptr yytext_r
531
532 static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
533 static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner);
534 static int yy_get_next_buffer ( yyscan_t yyscanner );
535 static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
536
537 /* Done after the current pattern has been matched and before the
538 * corresponding action - sets up yytext.
539 */
540 #define YY_DO_BEFORE_ACTION \
541 yyg->yytext_ptr = yy_bp; \
542 yyleng = (int) (yy_cp - yy_bp); \
543 yyg->yy_hold_char = *yy_cp; \
544 *yy_cp = '\0'; \
545 yyg->yy_c_buf_p = yy_cp;
546 #define YY_NUM_RULES 11
547 #define YY_END_OF_BUFFER 12
548 /* This struct is not used in this scanner,
549 but its presence is necessary. */
550 struct yy_trans_info
551 {
552 flex_int32_t yy_verify;
553 flex_int32_t yy_nxt;
554 };
555 static const flex_int16_t yy_accept[21] =
556 { 0,
557 5, 5, 12, 10, 8, 9, 10, 5, 1, 3,
558 2, 4, 7, 5, 0, 6, 5, 7, 5, 0
559 } ;
560
561 static const YY_CHAR yy_ec[256] =
562 { 0,
563 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
564 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
565 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
566 1, 2, 1, 4, 1, 1, 1, 1, 1, 1,
567 1, 1, 5, 5, 5, 5, 6, 7, 7, 7,
568 7, 7, 7, 7, 7, 7, 7, 8, 1, 9,
569 10, 11, 1, 1, 12, 12, 12, 12, 13, 12,
570 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
571 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
572 1, 1, 1, 1, 12, 1, 12, 12, 12, 12,
573
574 13, 12, 12, 12, 12, 12, 12, 12, 12, 12,
575 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
576 12, 12, 1, 1, 1, 1, 1, 1, 1, 1,
577 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
578 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
579 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
580 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
581 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
582 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
583 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
584
585 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
586 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
587 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
588 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
589 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
590 1, 1, 1, 1, 1
591 } ;
592
593 static const YY_CHAR yy_meta[14] =
594 { 0,
595 1, 1, 1, 1, 2, 1, 3, 4, 5, 1,
596 5, 4, 3
597 } ;
598
599 static const flex_int16_t yy_base[24] =
600 { 0,
601 0, 0, 19, 31, 31, 31, 14, 0, 31, 31,
602 31, 31, 0, 9, 11, 31, 0, 0, 0, 31,
603 22, 25, 26
604 } ;
605
606 static const flex_int16_t yy_def[24] =
607 { 0,
608 20, 1, 20, 20, 20, 20, 21, 22, 20, 20,
609 20, 20, 23, 20, 21, 20, 22, 23, 14, 0,
610 20, 20, 20
611 } ;
612
613 static const flex_int16_t yy_nxt[45] =
614 { 0,
615 4, 5, 6, 7, 8, 9, 8, 4, 10, 11,
616 12, 13, 14, 17, 16, 19, 18, 16, 20, 20,
617 18, 19, 15, 15, 15, 15, 17, 17, 18, 18,
618 3, 20, 20, 20, 20, 20, 20, 20, 20, 20,
619 20, 20, 20, 20
620 } ;
621
622 static const flex_int16_t yy_chk[45] =
623 { 0,
624 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
625 1, 1, 1, 14, 15, 14, 14, 7, 3, 0,
626 14, 14, 21, 21, 21, 21, 22, 22, 23, 23,
627 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
628 20, 20, 20, 20
629 } ;
630
631 /* The intent behind this definition is that it'll catch
632 * any uses of REJECT which flex missed.
633 */
634 #define REJECT reject_used_but_not_detected
635 #define yymore() yymore_used_but_not_detected
636 #define YY_MORE_ADJ 0
637 #define YY_RESTORE_YY_MORE_OFFSET
638 /*
639 kmlLexer.l -- KML parser - FLEX config
640
641 version 2.4, 2011 June 14
642
643 Author: Sandro Furieri a.furieri@lqt.it
644
645 ------------------------------------------------------------------------------
646
647 Version: MPL 1.1/GPL 2.0/LGPL 2.1
648
649 The contents of this file are subject to the Mozilla Public License Version
650 1.1 (the "License"); you may not use this file except in compliance with
651 the License. You may obtain a copy of the License at
652 http://www.mozilla.org/MPL/
653
654 Software distributed under the License is distributed on an "AS IS" basis,
655 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
656 for the specific language governing rights and limitations under the
657 License.
658
659 The Original Code is the SpatiaLite library
660
661 The Initial Developer of the Original Code is Alessandro Furieri
662
663 Portions created by the Initial Developer are Copyright (C) 2011
664 the Initial Developer. All Rights Reserved.
665
666 Alternatively, the contents of this file may be used under the terms of
667 either the GNU General Public License Version 2 or later (the "GPL"), or
668 the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
669 in which case the provisions of the GPL or the LGPL are applicable instead
670 of those above. If you wish to allow use of your version of this file only
671 under the terms of either the GPL or the LGPL, and not to allow others to
672 use your version of this file under the terms of the MPL, indicate your
673 decision by deleting the provisions above and replace them with the notice
674 and other provisions required by the GPL or the LGPL. If you do not delete
675 the provisions above, a recipient may use your version of this file under
676 the terms of any one of the MPL, the GPL or the LGPL.
677
678 */
679 #define YY_NO_INPUT 1
680 /**
681 * The main string-token matcher.
682 * The lower case part is probably not needed. We should really be converting
683 * The string to all uppercase/lowercase to make it case iNsEnSiTiVe.
684 * What Flex will do is, For the input string, beginning from the front, Flex
685 * will try to match with any of the defined tokens from below. Flex will
686 * then match the string of longest length. Suppose the string is: POINTM,
687 * Flex would match both POINT and POINTM, but since POINTM is the longer
688 * of the two tokens, FLEX will match POINTM.
689 */
690
691 #define INITIAL 0
692
693 #ifndef YY_NO_UNISTD_H
694 /* Special case for "unistd.h", since it is non-ANSI. We include it way
695 * down here because we want the user's section 1 to have been scanned first.
696 * The user has a chance to override it with an option.
697 */
698 #include <unistd.h>
699 #endif
700
701 #define YY_EXTRA_TYPE struct kml_data *
702
703 /* Holds the entire state of the reentrant scanner. */
704 struct yyguts_t
705 {
706
707 /* User-defined. Not touched by flex. */
708 YY_EXTRA_TYPE yyextra_r;
709
710 /* The rest are the same as the globals declared in the non-reentrant scanner. */
711 FILE *yyin_r, *yyout_r;
712 size_t yy_buffer_stack_top; /**< index of top of stack. */
713 size_t yy_buffer_stack_max; /**< capacity of stack. */
714 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
715 char yy_hold_char;
716 int yy_n_chars;
717 int yyleng_r;
718 char *yy_c_buf_p;
719 int yy_init;
720 int yy_start;
721 int yy_did_buffer_switch_on_eof;
722 int yy_start_stack_ptr;
723 int yy_start_stack_depth;
724 int *yy_start_stack;
725 yy_state_type yy_last_accepting_state;
726 char* yy_last_accepting_cpos;
727
728 int yylineno_r;
729 int yy_flex_debug_r;
730
731 char *yytext_r;
732 int yy_more_flag;
733 int yy_more_len;
734
735 }; /* end struct yyguts_t */
736
737 static int yy_init_globals ( yyscan_t yyscanner );
738
739 int yylex_init (yyscan_t* scanner);
740
741 int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
742
743 /* Accessor methods to globals.
744 These are made visible to non-reentrant scanners for convenience. */
745
746 int yylex_destroy ( yyscan_t yyscanner );
747
748 int yyget_debug ( yyscan_t yyscanner );
749
750 void yyset_debug ( int debug_flag , yyscan_t yyscanner );
751
752 YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
753
754 void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
755
756 FILE *yyget_in ( yyscan_t yyscanner );
757
758 void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
759
760 FILE *yyget_out ( yyscan_t yyscanner );
761
762 void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
763
764 int yyget_leng ( yyscan_t yyscanner );
765
766 char *yyget_text ( yyscan_t yyscanner );
767
768 int yyget_lineno ( yyscan_t yyscanner );
769
770 void yyset_lineno ( int _line_number , yyscan_t yyscanner );
771
772 int yyget_column ( yyscan_t yyscanner );
773
774 void yyset_column ( int _column_no , yyscan_t yyscanner );
775
776 /* Macros after this point can all be overridden by user definitions in
777 * section 1.
778 */
779
780 #ifndef YY_SKIP_YYWRAP
781 #ifdef __cplusplus
782 extern "C" int yywrap ( yyscan_t yyscanner );
783 #else
784 extern int yywrap ( yyscan_t yyscanner );
785 #endif
786 #endif
787
788 #ifndef YY_NO_UNPUT
789
790 #endif
791
792 #ifndef yytext_ptr
793 static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
794 #endif
795
796 #ifdef YY_NEED_STRLEN
797 static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
798 #endif
799
800 #ifndef YY_NO_INPUT
801 #ifdef __cplusplus
802 static int yyinput ( yyscan_t yyscanner );
803 #else
804 static int input ( yyscan_t yyscanner );
805 #endif
806
807 #endif
808
809 /* Amount of stuff to slurp up with each read. */
810 #ifndef YY_READ_BUF_SIZE
811 #ifdef __ia64__
812 /* On IA-64, the buffer size is 16k, not 8k */
813 #define YY_READ_BUF_SIZE 16384
814 #else
815 #define YY_READ_BUF_SIZE 8192
816 #endif /* __ia64__ */
817 #endif
818
819 /* Copy whatever the last rule matched to the standard output. */
820 #ifndef ECHO
821 /* This used to be an fputs(), but since the string might contain NUL's,
822 * we now use fwrite().
823 */
824 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
825 #endif
826
827 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
828 * is returned in "result".
829 */
830 #ifndef YY_INPUT
831 #define YY_INPUT(buf,result,max_size) \
832 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
833 { \
834 int c = '*'; \
835 int n; \
836 for ( n = 0; n < max_size && \
837 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
838 buf[n] = (char) c; \
839 if ( c == '\n' ) \
840 buf[n++] = (char) c; \
841 if ( c == EOF && ferror( yyin ) ) \
842 YY_FATAL_ERROR( "input in flex scanner failed" ); \
843 result = n; \
844 } \
845 else \
846 { \
847 errno=0; \
848 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
849 { \
850 if( errno != EINTR) \
851 { \
852 YY_FATAL_ERROR( "input in flex scanner failed" ); \
853 break; \
854 } \
855 errno=0; \
856 clearerr(yyin); \
857 } \
858 }\
859 \
860
861 #endif
862
863 /* No semi-colon after return; correct usage is to write "yyterminate();" -
864 * we don't want an extra ';' after the "return" because that will cause
865 * some compilers to complain about unreachable statements.
866 */
867 #ifndef yyterminate
868 #define yyterminate() return YY_NULL
869 #endif
870
871 /* Number of entries by which start-condition stack grows. */
872 #ifndef YY_START_STACK_INCR
873 #define YY_START_STACK_INCR 25
874 #endif
875
876 /* Report a fatal error. */
877 #ifndef YY_FATAL_ERROR
878 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
879 #endif
880
881 /* end tables serialization structures and prototypes */
882
883 /* Default declaration of generated scanner - a define so the user can
884 * easily add parameters.
885 */
886 #ifndef YY_DECL
887 #define YY_DECL_IS_OURS 1
888
889 extern int yylex (yyscan_t yyscanner);
890
891 #define YY_DECL int yylex (yyscan_t yyscanner)
892 #endif /* !YY_DECL */
893
894 /* Code executed at the beginning of each rule, after yytext and yyleng
895 * have been set up.
896 */
897 #ifndef YY_USER_ACTION
898 #define YY_USER_ACTION
899 #endif
900
901 /* Code executed at the end of each rule. */
902 #ifndef YY_BREAK
903 #define YY_BREAK /*LINTED*/break;
904 #endif
905
906 #define YY_RULE_SETUP \
907 YY_USER_ACTION
908
909 /** The main scanner function which does all the work.
910 */
911 YY_DECL
912 {
913 yy_state_type yy_current_state;
914 char *yy_cp, *yy_bp;
915 int yy_act;
916 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
917
918 if ( !yyg->yy_init )
919 {
920 yyg->yy_init = 1;
921
922 #ifdef YY_USER_INIT
923 YY_USER_INIT;
924 #endif
925
926 if ( ! yyg->yy_start )
927 yyg->yy_start = 1; /* first start state */
928
929 if ( ! yyin )
930 yyin = stdin;
931
932 if ( ! yyout )
933 yyout = stdout;
934
935 if ( ! YY_CURRENT_BUFFER ) {
936 yyensure_buffer_stack (yyscanner);
937 YY_CURRENT_BUFFER_LVALUE =
938 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
939 }
940
941 yy_load_buffer_state( yyscanner );
942 }
943
944 {
945
946 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
947 {
948 yy_cp = yyg->yy_c_buf_p;
949
950 /* Support of yytext. */
951 *yy_cp = yyg->yy_hold_char;
952
953 /* yy_bp points to the position in yy_ch_buf of the start of
954 * the current run.
955 */
956 yy_bp = yy_cp;
957
958 yy_current_state = yyg->yy_start;
959 yy_match:
960 do
961 {
962 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
963 if ( yy_accept[yy_current_state] )
964 {
965 yyg->yy_last_accepting_state = yy_current_state;
966 yyg->yy_last_accepting_cpos = yy_cp;
967 }
968 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
969 {
970 yy_current_state = (int) yy_def[yy_current_state];
971 if ( yy_current_state >= 21 )
972 yy_c = yy_meta[yy_c];
973 }
974 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
975 ++yy_cp;
976 }
977 while ( yy_base[yy_current_state] != 31 );
978
979 yy_find_action:
980 yy_act = yy_accept[yy_current_state];
981 if ( yy_act == 0 )
982 { /* have to back up */
983 yy_cp = yyg->yy_last_accepting_cpos;
984 yy_current_state = yyg->yy_last_accepting_state;
985 yy_act = yy_accept[yy_current_state];
986 }
987
988 YY_DO_BEFORE_ACTION;
989
990 do_action: /* This label is used only to access EOF actions. */
991
992 switch ( yy_act )
993 { /* beginning of action switch */
994 case 0: /* must back up */
995 /* undo the effects of YY_DO_BEFORE_ACTION */
996 *yy_cp = yyg->yy_hold_char;
997 yy_cp = yyg->yy_last_accepting_cpos;
998 yy_current_state = yyg->yy_last_accepting_state;
999 goto yy_find_action;
1000
1001 case 1:
1002 YY_RULE_SETUP
1003 { kml_freeString(&(Kmlget_extra(yyscanner)->KmlLval.pval)); return KML_END; }
1004 YY_BREAK
1005 case 2:
1006 YY_RULE_SETUP
1007 { kml_freeString(&(Kmlget_extra(yyscanner)->KmlLval.pval)); return KML_EQ; }
1008 YY_BREAK
1009 case 3:
1010 YY_RULE_SETUP
1011 { kml_freeString(&(Kmlget_extra(yyscanner)->KmlLval.pval)); return KML_OPEN; }
1012 YY_BREAK
1013 case 4:
1014 YY_RULE_SETUP
1015 { kml_freeString(&(Kmlget_extra(yyscanner)->KmlLval.pval)); return KML_CLOSE; }
1016 YY_BREAK
1017 case 5:
1018 YY_RULE_SETUP
1019 { kml_saveString(&(Kmlget_extra(yyscanner)->KmlLval.pval), yytext); return KML_COORD; }
1020 YY_BREAK
1021 case 6:
1022 /* rule 6 can match eol */
1023 YY_RULE_SETUP
1024 { kml_saveString(&(Kmlget_extra(yyscanner)->KmlLval.pval), yytext); return KML_VALUE; }
1025 YY_BREAK
1026 case 7:
1027 YY_RULE_SETUP
1028 { kml_saveString(&(Kmlget_extra(yyscanner)->KmlLval.pval), yytext); return KML_KEYWORD; }
1029 YY_BREAK
1030 case 8:
1031 YY_RULE_SETUP
1032 { kml_freeString(&(Kmlget_extra(yyscanner)->KmlLval.pval)); Kmlget_extra(yyscanner)->kml_col += (int) strlen(yytext); } /* ignore but count white space */
1033 YY_BREAK
1034 case 9:
1035 /* rule 9 can match eol */
1036 YY_RULE_SETUP
1037 { kml_freeString(&(Kmlget_extra(yyscanner)->KmlLval.pval)); Kmlget_extra(yyscanner)->kml_col = 0; Kmlget_extra(yyscanner)->kml_line++; }
1038 YY_BREAK
1039 case 10:
1040 YY_RULE_SETUP
1041 { kml_freeString(&(Kmlget_extra(yyscanner)->KmlLval.pval)); Kmlget_extra(yyscanner)->kml_col += (int) strlen(yytext); return -1; }
1042 YY_BREAK
1043 case 11:
1044 YY_RULE_SETUP
1045 ECHO;
1046 YY_BREAK
1047 case YY_STATE_EOF(INITIAL):
1048 yyterminate();
1049
1050 case YY_END_OF_BUFFER:
1051 {
1052 /* Amount of text matched not including the EOB char. */
1053 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1054
1055 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1056 *yy_cp = yyg->yy_hold_char;
1057 YY_RESTORE_YY_MORE_OFFSET
1058
1059 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1060 {
1061 /* We're scanning a new file or input source. It's
1062 * possible that this happened because the user
1063 * just pointed yyin at a new source and called
1064 * yylex(). If so, then we have to assure
1065 * consistency between YY_CURRENT_BUFFER and our
1066 * globals. Here is the right place to do so, because
1067 * this is the first action (other than possibly a
1068 * back-up) that will match for the new input source.
1069 */
1070 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1071 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1072 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1073 }
1074
1075 /* Note that here we test for yy_c_buf_p "<=" to the position
1076 * of the first EOB in the buffer, since yy_c_buf_p will
1077 * already have been incremented past the NUL character
1078 * (since all states make transitions on EOB to the
1079 * end-of-buffer state). Contrast this with the test
1080 * in input().
1081 */
1082 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1083 { /* This was really a NUL. */
1084 yy_state_type yy_next_state;
1085
1086 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1087
1088 yy_current_state = yy_get_previous_state( yyscanner );
1089
1090 /* Okay, we're now positioned to make the NUL
1091 * transition. We couldn't have
1092 * yy_get_previous_state() go ahead and do it
1093 * for us because it doesn't know how to deal
1094 * with the possibility of jamming (and we don't
1095 * want to build jamming into it because then it
1096 * will run more slowly).
1097 */
1098
1099 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1100
1101 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1102
1103 if ( yy_next_state )
1104 {
1105 /* Consume the NUL. */
1106 yy_cp = ++yyg->yy_c_buf_p;
1107 yy_current_state = yy_next_state;
1108 goto yy_match;
1109 }
1110
1111 else
1112 {
1113 yy_cp = yyg->yy_c_buf_p;
1114 goto yy_find_action;
1115 }
1116 }
1117
1118 else switch ( yy_get_next_buffer( yyscanner ) )
1119 {
1120 case EOB_ACT_END_OF_FILE:
1121 {
1122 yyg->yy_did_buffer_switch_on_eof = 0;
1123
1124 if ( yywrap( yyscanner ) )
1125 {
1126 /* Note: because we've taken care in
1127 * yy_get_next_buffer() to have set up
1128 * yytext, we can now set up
1129 * yy_c_buf_p so that if some total
1130 * hoser (like flex itself) wants to
1131 * call the scanner after we return the
1132 * YY_NULL, it'll still work - another
1133 * YY_NULL will get returned.
1134 */
1135 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1136
1137 yy_act = YY_STATE_EOF(YY_START);
1138 goto do_action;
1139 }
1140
1141 else
1142 {
1143 if ( ! yyg->yy_did_buffer_switch_on_eof )
1144 YY_NEW_FILE;
1145 }
1146 break;
1147 }
1148
1149 case EOB_ACT_CONTINUE_SCAN:
1150 yyg->yy_c_buf_p =
1151 yyg->yytext_ptr + yy_amount_of_matched_text;
1152
1153 yy_current_state = yy_get_previous_state( yyscanner );
1154
1155 yy_cp = yyg->yy_c_buf_p;
1156 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1157 goto yy_match;
1158
1159 case EOB_ACT_LAST_MATCH:
1160 yyg->yy_c_buf_p =
1161 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1162
1163 yy_current_state = yy_get_previous_state( yyscanner );
1164
1165 yy_cp = yyg->yy_c_buf_p;
1166 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1167 goto yy_find_action;
1168 }
1169 break;
1170 }
1171
1172 default:
1173 YY_FATAL_ERROR(
1174 "fatal flex scanner internal error--no action found" );
1175 } /* end of action switch */
1176 } /* end of scanning one token */
1177 } /* end of user's declarations */
1178 } /* end of yylex */
1179
1180 /* yy_get_next_buffer - try to read in a new buffer
1181 *
1182 * Returns a code representing an action:
1183 * EOB_ACT_LAST_MATCH -
1184 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1185 * EOB_ACT_END_OF_FILE - end of file
1186 */
yy_get_next_buffer(yyscan_t yyscanner)1187 static int yy_get_next_buffer (yyscan_t yyscanner)
1188 {
1189 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1190 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1191 char *source = yyg->yytext_ptr;
1192 int number_to_move, i;
1193 int ret_val;
1194
1195 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1196 YY_FATAL_ERROR(
1197 "fatal flex scanner internal error--end of buffer missed" );
1198
1199 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1200 { /* Don't try to fill the buffer, so this is an EOF. */
1201 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1202 {
1203 /* We matched a single character, the EOB, so
1204 * treat this as a final EOF.
1205 */
1206 return EOB_ACT_END_OF_FILE;
1207 }
1208
1209 else
1210 {
1211 /* We matched some text prior to the EOB, first
1212 * process it.
1213 */
1214 return EOB_ACT_LAST_MATCH;
1215 }
1216 }
1217
1218 /* Try to read more data. */
1219
1220 /* First move last chars to start of buffer. */
1221 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
1222
1223 for ( i = 0; i < number_to_move; ++i )
1224 *(dest++) = *(source++);
1225
1226 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1227 /* don't do the read, it's not guaranteed to return an EOF,
1228 * just force an EOF
1229 */
1230 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1231
1232 else
1233 {
1234 int num_to_read =
1235 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1236
1237 while ( num_to_read <= 0 )
1238 { /* Not enough room in the buffer - grow it. */
1239
1240 /* just a shorter name for the current buffer */
1241 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1242
1243 int yy_c_buf_p_offset =
1244 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1245
1246 if ( b->yy_is_our_buffer )
1247 {
1248 int new_size = b->yy_buf_size * 2;
1249
1250 if ( new_size <= 0 )
1251 b->yy_buf_size += b->yy_buf_size / 8;
1252 else
1253 b->yy_buf_size *= 2;
1254
1255 b->yy_ch_buf = (char *)
1256 /* Include room in for 2 EOB chars. */
1257 yyrealloc( (void *) b->yy_ch_buf,
1258 (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
1259 }
1260 else
1261 /* Can't grow it, we don't own it. */
1262 b->yy_ch_buf = NULL;
1263
1264 if ( ! b->yy_ch_buf )
1265 YY_FATAL_ERROR(
1266 "fatal error - scanner input buffer overflow" );
1267
1268 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1269
1270 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1271 number_to_move - 1;
1272
1273 }
1274
1275 if ( num_to_read > YY_READ_BUF_SIZE )
1276 num_to_read = YY_READ_BUF_SIZE;
1277
1278 /* Read in more data. */
1279 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1280 yyg->yy_n_chars, num_to_read );
1281
1282 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1283 }
1284
1285 if ( yyg->yy_n_chars == 0 )
1286 {
1287 if ( number_to_move == YY_MORE_ADJ )
1288 {
1289 ret_val = EOB_ACT_END_OF_FILE;
1290 yyrestart( yyin , yyscanner);
1291 }
1292
1293 else
1294 {
1295 ret_val = EOB_ACT_LAST_MATCH;
1296 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1297 YY_BUFFER_EOF_PENDING;
1298 }
1299 }
1300
1301 else
1302 ret_val = EOB_ACT_CONTINUE_SCAN;
1303
1304 if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1305 /* Extend the array by 50%, plus the number we really need. */
1306 int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1307 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1308 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
1309 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1310 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1311 /* "- 2" to take care of EOB's */
1312 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1313 }
1314
1315 yyg->yy_n_chars += number_to_move;
1316 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1317 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1318
1319 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1320
1321 return ret_val;
1322 }
1323
1324 /* yy_get_previous_state - get the state just before the EOB char was reached */
1325
yy_get_previous_state(yyscan_t yyscanner)1326 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1327 {
1328 yy_state_type yy_current_state;
1329 char *yy_cp;
1330 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1331
1332 yy_current_state = yyg->yy_start;
1333
1334 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1335 {
1336 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1337 if ( yy_accept[yy_current_state] )
1338 {
1339 yyg->yy_last_accepting_state = yy_current_state;
1340 yyg->yy_last_accepting_cpos = yy_cp;
1341 }
1342 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1343 {
1344 yy_current_state = (int) yy_def[yy_current_state];
1345 if ( yy_current_state >= 21 )
1346 yy_c = yy_meta[yy_c];
1347 }
1348 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1349 }
1350
1351 return yy_current_state;
1352 }
1353
1354 /* yy_try_NUL_trans - try to make a transition on the NUL character
1355 *
1356 * synopsis
1357 * next_state = yy_try_NUL_trans( current_state );
1358 */
yy_try_NUL_trans(yy_state_type yy_current_state,yyscan_t yyscanner)1359 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1360 {
1361 int yy_is_jam;
1362 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1363 char *yy_cp = yyg->yy_c_buf_p;
1364
1365 YY_CHAR yy_c = 1;
1366 if ( yy_accept[yy_current_state] )
1367 {
1368 yyg->yy_last_accepting_state = yy_current_state;
1369 yyg->yy_last_accepting_cpos = yy_cp;
1370 }
1371 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1372 {
1373 yy_current_state = (int) yy_def[yy_current_state];
1374 if ( yy_current_state >= 21 )
1375 yy_c = yy_meta[yy_c];
1376 }
1377 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1378 yy_is_jam = (yy_current_state == 20);
1379
1380 (void)yyg;
1381 return yy_is_jam ? 0 : yy_current_state;
1382 }
1383
1384 #ifndef YY_NO_UNPUT
1385
1386 #endif
1387
1388 #ifndef YY_NO_INPUT
1389 #ifdef __cplusplus
yyinput(yyscan_t yyscanner)1390 static int yyinput (yyscan_t yyscanner)
1391 #else
1392 static int input (yyscan_t yyscanner)
1393 #endif
1394
1395 {
1396 int c;
1397 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1398
1399 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1400
1401 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1402 {
1403 /* yy_c_buf_p now points to the character we want to return.
1404 * If this occurs *before* the EOB characters, then it's a
1405 * valid NUL; if not, then we've hit the end of the buffer.
1406 */
1407 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1408 /* This was really a NUL. */
1409 *yyg->yy_c_buf_p = '\0';
1410
1411 else
1412 { /* need more input */
1413 int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
1414 ++yyg->yy_c_buf_p;
1415
1416 switch ( yy_get_next_buffer( yyscanner ) )
1417 {
1418 case EOB_ACT_LAST_MATCH:
1419 /* This happens because yy_g_n_b()
1420 * sees that we've accumulated a
1421 * token and flags that we need to
1422 * try matching the token before
1423 * proceeding. But for input(),
1424 * there's no matching to consider.
1425 * So convert the EOB_ACT_LAST_MATCH
1426 * to EOB_ACT_END_OF_FILE.
1427 */
1428
1429 /* Reset buffer status. */
1430 yyrestart( yyin , yyscanner);
1431
1432 /*FALLTHROUGH*/
1433
1434 case EOB_ACT_END_OF_FILE:
1435 {
1436 if ( yywrap( yyscanner ) )
1437 return 0;
1438
1439 if ( ! yyg->yy_did_buffer_switch_on_eof )
1440 YY_NEW_FILE;
1441 #ifdef __cplusplus
1442 return yyinput(yyscanner);
1443 #else
1444 return input(yyscanner);
1445 #endif
1446 }
1447
1448 case EOB_ACT_CONTINUE_SCAN:
1449 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1450 break;
1451 }
1452 }
1453 }
1454
1455 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1456 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1457 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1458
1459 return c;
1460 }
1461 #endif /* ifndef YY_NO_INPUT */
1462
1463 /** Immediately switch to a different input stream.
1464 * @param input_file A readable stream.
1465 * @param yyscanner The scanner object.
1466 * @note This function does not reset the start condition to @c INITIAL .
1467 */
yyrestart(FILE * input_file,yyscan_t yyscanner)1468 void yyrestart (FILE * input_file , yyscan_t yyscanner)
1469 {
1470 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1471
1472 if ( ! YY_CURRENT_BUFFER ){
1473 yyensure_buffer_stack (yyscanner);
1474 YY_CURRENT_BUFFER_LVALUE =
1475 yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
1476 }
1477
1478 yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
1479 yy_load_buffer_state( yyscanner );
1480 }
1481
1482 /** Switch to a different input buffer.
1483 * @param new_buffer The new input buffer.
1484 * @param yyscanner The scanner object.
1485 */
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer,yyscan_t yyscanner)1486 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1487 {
1488 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1489
1490 /* TODO. We should be able to replace this entire function body
1491 * with
1492 * yypop_buffer_state();
1493 * yypush_buffer_state(new_buffer);
1494 */
1495 yyensure_buffer_stack (yyscanner);
1496 if ( YY_CURRENT_BUFFER == new_buffer )
1497 return;
1498
1499 if ( YY_CURRENT_BUFFER )
1500 {
1501 /* Flush out information for old buffer. */
1502 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1503 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1504 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1505 }
1506
1507 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1508 yy_load_buffer_state( yyscanner );
1509
1510 /* We don't actually know whether we did this switch during
1511 * EOF (yywrap()) processing, but the only time this flag
1512 * is looked at is after yywrap() is called, so it's safe
1513 * to go ahead and always set it.
1514 */
1515 yyg->yy_did_buffer_switch_on_eof = 1;
1516 }
1517
yy_load_buffer_state(yyscan_t yyscanner)1518 static void yy_load_buffer_state (yyscan_t yyscanner)
1519 {
1520 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1521 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1522 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1523 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1524 yyg->yy_hold_char = *yyg->yy_c_buf_p;
1525 }
1526
1527 /** Allocate and initialize an input buffer state.
1528 * @param file A readable stream.
1529 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1530 * @param yyscanner The scanner object.
1531 * @return the allocated buffer state.
1532 */
yy_create_buffer(FILE * file,int size,yyscan_t yyscanner)1533 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
1534 {
1535 YY_BUFFER_STATE b;
1536
1537 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
1538 if ( ! b )
1539 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1540
1541 b->yy_buf_size = size;
1542
1543 /* yy_ch_buf has to be 2 characters longer than the size given because
1544 * we need to put in 2 end-of-buffer characters.
1545 */
1546 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
1547 if ( ! b->yy_ch_buf )
1548 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1549
1550 b->yy_is_our_buffer = 1;
1551
1552 yy_init_buffer( b, file , yyscanner);
1553
1554 return b;
1555 }
1556
1557 /** Destroy the buffer.
1558 * @param b a buffer created with yy_create_buffer()
1559 * @param yyscanner The scanner object.
1560 */
yy_delete_buffer(YY_BUFFER_STATE b,yyscan_t yyscanner)1561 void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1562 {
1563 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1564
1565 if ( ! b )
1566 return;
1567
1568 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1569 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1570
1571 if ( b->yy_is_our_buffer )
1572 yyfree( (void *) b->yy_ch_buf , yyscanner );
1573
1574 yyfree( (void *) b , yyscanner );
1575 }
1576
1577 /* Initializes or reinitializes a buffer.
1578 * This function is sometimes called more than once on the same buffer,
1579 * such as during a yyrestart() or at EOF.
1580 */
yy_init_buffer(YY_BUFFER_STATE b,FILE * file,yyscan_t yyscanner)1581 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
1582
1583 {
1584 int oerrno = errno;
1585 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1586
1587 yy_flush_buffer( b , yyscanner);
1588
1589 b->yy_input_file = file;
1590 b->yy_fill_buffer = 1;
1591
1592 /* If b is the current buffer, then yy_init_buffer was _probably_
1593 * called from yyrestart() or through yy_get_next_buffer.
1594 * In that case, we don't want to reset the lineno or column.
1595 */
1596 if (b != YY_CURRENT_BUFFER){
1597 b->yy_bs_lineno = 1;
1598 b->yy_bs_column = 0;
1599 }
1600
1601 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1602
1603 errno = oerrno;
1604 }
1605
1606 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1607 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1608 * @param yyscanner The scanner object.
1609 */
yy_flush_buffer(YY_BUFFER_STATE b,yyscan_t yyscanner)1610 void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1611 {
1612 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1613 if ( ! b )
1614 return;
1615
1616 b->yy_n_chars = 0;
1617
1618 /* We always need two end-of-buffer characters. The first causes
1619 * a transition to the end-of-buffer state. The second causes
1620 * a jam in that state.
1621 */
1622 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1623 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1624
1625 b->yy_buf_pos = &b->yy_ch_buf[0];
1626
1627 b->yy_at_bol = 1;
1628 b->yy_buffer_status = YY_BUFFER_NEW;
1629
1630 if ( b == YY_CURRENT_BUFFER )
1631 yy_load_buffer_state( yyscanner );
1632 }
1633
1634 /** Pushes the new state onto the stack. The new state becomes
1635 * the current state. This function will allocate the stack
1636 * if necessary.
1637 * @param new_buffer The new state.
1638 * @param yyscanner The scanner object.
1639 */
yypush_buffer_state(YY_BUFFER_STATE new_buffer,yyscan_t yyscanner)1640 void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1641 {
1642 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1643 if (new_buffer == NULL)
1644 return;
1645
1646 yyensure_buffer_stack(yyscanner);
1647
1648 /* This block is copied from yy_switch_to_buffer. */
1649 if ( YY_CURRENT_BUFFER )
1650 {
1651 /* Flush out information for old buffer. */
1652 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1653 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1654 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1655 }
1656
1657 /* Only push if top exists. Otherwise, replace top. */
1658 if (YY_CURRENT_BUFFER)
1659 yyg->yy_buffer_stack_top++;
1660 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1661
1662 /* copied from yy_switch_to_buffer. */
1663 yy_load_buffer_state( yyscanner );
1664 yyg->yy_did_buffer_switch_on_eof = 1;
1665 }
1666
1667 /** Removes and deletes the top of the stack, if present.
1668 * The next element becomes the new top.
1669 * @param yyscanner The scanner object.
1670 */
yypop_buffer_state(yyscan_t yyscanner)1671 void yypop_buffer_state (yyscan_t yyscanner)
1672 {
1673 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1674 if (!YY_CURRENT_BUFFER)
1675 return;
1676
1677 yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
1678 YY_CURRENT_BUFFER_LVALUE = NULL;
1679 if (yyg->yy_buffer_stack_top > 0)
1680 --yyg->yy_buffer_stack_top;
1681
1682 if (YY_CURRENT_BUFFER) {
1683 yy_load_buffer_state( yyscanner );
1684 yyg->yy_did_buffer_switch_on_eof = 1;
1685 }
1686 }
1687
1688 /* Allocates the stack if it does not exist.
1689 * Guarantees space for at least one push.
1690 */
yyensure_buffer_stack(yyscan_t yyscanner)1691 static void yyensure_buffer_stack (yyscan_t yyscanner)
1692 {
1693 yy_size_t num_to_alloc;
1694 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1695
1696 if (!yyg->yy_buffer_stack) {
1697
1698 /* First allocation is just for 2 elements, since we don't know if this
1699 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1700 * immediate realloc on the next call.
1701 */
1702 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1703 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
1704 (num_to_alloc * sizeof(struct yy_buffer_state*)
1705 , yyscanner);
1706 if ( ! yyg->yy_buffer_stack )
1707 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1708
1709 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1710
1711 yyg->yy_buffer_stack_max = num_to_alloc;
1712 yyg->yy_buffer_stack_top = 0;
1713 return;
1714 }
1715
1716 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
1717
1718 /* Increase the buffer to prepare for a possible push. */
1719 yy_size_t grow_size = 8 /* arbitrary grow size */;
1720
1721 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
1722 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
1723 (yyg->yy_buffer_stack,
1724 num_to_alloc * sizeof(struct yy_buffer_state*)
1725 , yyscanner);
1726 if ( ! yyg->yy_buffer_stack )
1727 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1728
1729 /* zero only the new slots.*/
1730 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
1731 yyg->yy_buffer_stack_max = num_to_alloc;
1732 }
1733 }
1734
1735 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1736 * @param base the character buffer
1737 * @param size the size in bytes of the character buffer
1738 * @param yyscanner The scanner object.
1739 * @return the newly allocated buffer state object.
1740 */
yy_scan_buffer(char * base,yy_size_t size,yyscan_t yyscanner)1741 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
1742 {
1743 YY_BUFFER_STATE b;
1744
1745 if ( size < 2 ||
1746 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1747 base[size-1] != YY_END_OF_BUFFER_CHAR )
1748 /* They forgot to leave room for the EOB's. */
1749 return NULL;
1750
1751 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
1752 if ( ! b )
1753 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1754
1755 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
1756 b->yy_buf_pos = b->yy_ch_buf = base;
1757 b->yy_is_our_buffer = 0;
1758 b->yy_input_file = NULL;
1759 b->yy_n_chars = b->yy_buf_size;
1760 b->yy_is_interactive = 0;
1761 b->yy_at_bol = 1;
1762 b->yy_fill_buffer = 0;
1763 b->yy_buffer_status = YY_BUFFER_NEW;
1764
1765 yy_switch_to_buffer( b , yyscanner );
1766
1767 return b;
1768 }
1769
1770 /** Setup the input buffer state to scan a string. The next call to yylex() will
1771 * scan from a @e copy of @a str.
1772 * @param yystr a NUL-terminated string to scan
1773 * @param yyscanner The scanner object.
1774 * @return the newly allocated buffer state object.
1775 * @note If you want to scan bytes that may contain NUL values, then use
1776 * yy_scan_bytes() instead.
1777 */
yy_scan_string(const char * yystr,yyscan_t yyscanner)1778 YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
1779 {
1780
1781 return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
1782 }
1783
1784 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1785 * scan from a @e copy of @a bytes.
1786 * @param yybytes the byte buffer to scan
1787 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1788 * @param yyscanner The scanner object.
1789 * @return the newly allocated buffer state object.
1790 */
yy_scan_bytes(const char * yybytes,int _yybytes_len,yyscan_t yyscanner)1791 YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
1792 {
1793 YY_BUFFER_STATE b;
1794 char *buf;
1795 yy_size_t n;
1796 int i;
1797
1798 /* Get memory for full buffer, including space for trailing EOB's. */
1799 n = (yy_size_t) (_yybytes_len + 2);
1800 buf = (char *) yyalloc( n , yyscanner );
1801 if ( ! buf )
1802 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1803
1804 for ( i = 0; i < _yybytes_len; ++i )
1805 buf[i] = yybytes[i];
1806
1807 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1808
1809 b = yy_scan_buffer( buf, n , yyscanner);
1810 if ( ! b )
1811 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1812
1813 /* It's okay to grow etc. this buffer, and we should throw it
1814 * away when we're done.
1815 */
1816 b->yy_is_our_buffer = 1;
1817
1818 return b;
1819 }
1820
1821 #ifndef YY_EXIT_FAILURE
1822 #define YY_EXIT_FAILURE 2
1823 #endif
1824
yy_fatal_error(const char * msg,yyscan_t yyscanner)1825 static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
1826 {
1827 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1828 (void)yyg;
1829 spatialite_e("%s\n", msg );
1830 exit( YY_EXIT_FAILURE );
1831 }
1832
1833 /* Redefine yyless() so it works in section 3 code. */
1834
1835 #undef yyless
1836 #define yyless(n) \
1837 do \
1838 { \
1839 /* Undo effects of setting up yytext. */ \
1840 int yyless_macro_arg = (n); \
1841 YY_LESS_LINENO(yyless_macro_arg);\
1842 yytext[yyleng] = yyg->yy_hold_char; \
1843 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
1844 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
1845 *yyg->yy_c_buf_p = '\0'; \
1846 yyleng = yyless_macro_arg; \
1847 } \
1848 while ( 0 )
1849
1850 /* Accessor methods (get/set functions) to struct members. */
1851
1852 /** Get the user-defined data for this scanner.
1853 * @param yyscanner The scanner object.
1854 */
yyget_extra(yyscan_t yyscanner)1855 YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
1856 {
1857 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1858 return yyextra;
1859 }
1860
1861 /** Get the current line number.
1862 * @param yyscanner The scanner object.
1863 */
yyget_lineno(yyscan_t yyscanner)1864 int yyget_lineno (yyscan_t yyscanner)
1865 {
1866 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1867
1868 if (! YY_CURRENT_BUFFER)
1869 return 0;
1870
1871 return yylineno;
1872 }
1873
1874 /** Get the current column number.
1875 * @param yyscanner The scanner object.
1876 */
yyget_column(yyscan_t yyscanner)1877 int yyget_column (yyscan_t yyscanner)
1878 {
1879 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1880
1881 if (! YY_CURRENT_BUFFER)
1882 return 0;
1883
1884 return yycolumn;
1885 }
1886
1887 /** Get the input stream.
1888 * @param yyscanner The scanner object.
1889 */
yyget_in(yyscan_t yyscanner)1890 FILE *yyget_in (yyscan_t yyscanner)
1891 {
1892 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1893 return yyin;
1894 }
1895
1896 /** Get the output stream.
1897 * @param yyscanner The scanner object.
1898 */
yyget_out(yyscan_t yyscanner)1899 FILE *yyget_out (yyscan_t yyscanner)
1900 {
1901 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1902 return yyout;
1903 }
1904
1905 /** Get the length of the current token.
1906 * @param yyscanner The scanner object.
1907 */
yyget_leng(yyscan_t yyscanner)1908 int yyget_leng (yyscan_t yyscanner)
1909 {
1910 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1911 return yyleng;
1912 }
1913
1914 /** Get the current token.
1915 * @param yyscanner The scanner object.
1916 */
1917
yyget_text(yyscan_t yyscanner)1918 char *yyget_text (yyscan_t yyscanner)
1919 {
1920 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1921 return yytext;
1922 }
1923
1924 /** Set the user-defined data. This data is never touched by the scanner.
1925 * @param user_defined The data to be associated with this scanner.
1926 * @param yyscanner The scanner object.
1927 */
yyset_extra(YY_EXTRA_TYPE user_defined,yyscan_t yyscanner)1928 void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
1929 {
1930 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1931 yyextra = user_defined ;
1932 }
1933
1934 /** Set the current line number.
1935 * @param _line_number line number
1936 * @param yyscanner The scanner object.
1937 */
yyset_lineno(int _line_number,yyscan_t yyscanner)1938 void yyset_lineno (int _line_number , yyscan_t yyscanner)
1939 {
1940 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1941
1942 /* lineno is only valid if an input buffer exists. */
1943 if (! YY_CURRENT_BUFFER )
1944 YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
1945
1946 yylineno = _line_number;
1947 }
1948
1949 /** Set the current column.
1950 * @param _column_no column number
1951 * @param yyscanner The scanner object.
1952 */
yyset_column(int _column_no,yyscan_t yyscanner)1953 void yyset_column (int _column_no , yyscan_t yyscanner)
1954 {
1955 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1956
1957 /* column is only valid if an input buffer exists. */
1958 if (! YY_CURRENT_BUFFER )
1959 YY_FATAL_ERROR( "yyset_column called with no buffer" );
1960
1961 yycolumn = _column_no;
1962 }
1963
1964 /** Set the input stream. This does not discard the current
1965 * input buffer.
1966 * @param _in_str A readable stream.
1967 * @param yyscanner The scanner object.
1968 * @see yy_switch_to_buffer
1969 */
yyset_in(FILE * _in_str,yyscan_t yyscanner)1970 void yyset_in (FILE * _in_str , yyscan_t yyscanner)
1971 {
1972 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1973 yyin = _in_str ;
1974 }
1975
yyset_out(FILE * _out_str,yyscan_t yyscanner)1976 void yyset_out (FILE * _out_str , yyscan_t yyscanner)
1977 {
1978 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1979 yyout = _out_str ;
1980 }
1981
yyget_debug(yyscan_t yyscanner)1982 int yyget_debug (yyscan_t yyscanner)
1983 {
1984 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1985 return yy_flex_debug;
1986 }
1987
yyset_debug(int _bdebug,yyscan_t yyscanner)1988 void yyset_debug (int _bdebug , yyscan_t yyscanner)
1989 {
1990 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1991 yy_flex_debug = _bdebug ;
1992 }
1993
1994 /* Accessor methods for yylval and yylloc */
1995
1996 /* User-visible API */
1997
1998 /* yylex_init is special because it creates the scanner itself, so it is
1999 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2000 * That's why we explicitly handle the declaration, instead of using our macros.
2001 */
yylex_init(yyscan_t * ptr_yy_globals)2002 int yylex_init(yyscan_t* ptr_yy_globals)
2003 {
2004 if (ptr_yy_globals == NULL){
2005 errno = EINVAL;
2006 return 1;
2007 }
2008
2009 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
2010
2011 if (*ptr_yy_globals == NULL){
2012 errno = ENOMEM;
2013 return 1;
2014 }
2015
2016 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2017 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2018
2019 return yy_init_globals ( *ptr_yy_globals );
2020 }
2021
2022 /* yylex_init_extra has the same functionality as yylex_init, but follows the
2023 * convention of taking the scanner as the last argument. Note however, that
2024 * this is a *pointer* to a scanner, as it will be allocated by this call (and
2025 * is the reason, too, why this function also must handle its own declaration).
2026 * The user defined value in the first argument will be available to yyalloc in
2027 * the yyextra field.
2028 */
yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t * ptr_yy_globals)2029 int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
2030 {
2031 struct yyguts_t dummy_yyguts;
2032
2033 yyset_extra (yy_user_defined, &dummy_yyguts);
2034
2035 if (ptr_yy_globals == NULL){
2036 errno = EINVAL;
2037 return 1;
2038 }
2039
2040 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2041
2042 if (*ptr_yy_globals == NULL){
2043 errno = ENOMEM;
2044 return 1;
2045 }
2046
2047 /* By setting to 0xAA, we expose bugs in
2048 yy_init_globals. Leave at 0x00 for releases. */
2049 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2050
2051 yyset_extra (yy_user_defined, *ptr_yy_globals);
2052
2053 return yy_init_globals ( *ptr_yy_globals );
2054 }
2055
yy_init_globals(yyscan_t yyscanner)2056 static int yy_init_globals (yyscan_t yyscanner)
2057 {
2058 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2059 /* Initialization is the same as for the non-reentrant scanner.
2060 * This function is called from yylex_destroy(), so don't allocate here.
2061 */
2062
2063 yyg->yy_buffer_stack = NULL;
2064 yyg->yy_buffer_stack_top = 0;
2065 yyg->yy_buffer_stack_max = 0;
2066 yyg->yy_c_buf_p = NULL;
2067 yyg->yy_init = 0;
2068 yyg->yy_start = 0;
2069
2070 yyg->yy_start_stack_ptr = 0;
2071 yyg->yy_start_stack_depth = 0;
2072 yyg->yy_start_stack = NULL;
2073
2074 /* Defined in main.c */
2075 #ifdef YY_STDINIT
2076 yyin = stdin;
2077 yyout = stdout;
2078 #else
2079 yyin = NULL;
2080 yyout = NULL;
2081 #endif
2082
2083 /* For future reference: Set errno on error, since we are called by
2084 * yylex_init()
2085 */
2086 return 0;
2087 }
2088
2089 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
yylex_destroy(yyscan_t yyscanner)2090 int yylex_destroy (yyscan_t yyscanner)
2091 {
2092 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2093
2094 /* Pop the buffer stack, destroying each element. */
2095 while(YY_CURRENT_BUFFER){
2096 yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
2097 YY_CURRENT_BUFFER_LVALUE = NULL;
2098 yypop_buffer_state(yyscanner);
2099 }
2100
2101 /* Destroy the stack itself. */
2102 yyfree(yyg->yy_buffer_stack , yyscanner);
2103 yyg->yy_buffer_stack = NULL;
2104
2105 /* Destroy the start condition stack. */
2106 yyfree( yyg->yy_start_stack , yyscanner );
2107 yyg->yy_start_stack = NULL;
2108
2109 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2110 * yylex() is called, initialization will occur. */
2111 yy_init_globals( yyscanner);
2112
2113 /* Destroy the main struct (reentrant only). */
2114 yyfree ( yyscanner , yyscanner );
2115 yyscanner = NULL;
2116 return 0;
2117 }
2118
2119 /*
2120 * Internal utility routines.
2121 */
2122
2123 #ifndef yytext_ptr
yy_flex_strncpy(char * s1,const char * s2,int n,yyscan_t yyscanner)2124 static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
2125 {
2126 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2127 (void)yyg;
2128
2129 int i;
2130 for ( i = 0; i < n; ++i )
2131 s1[i] = s2[i];
2132 }
2133 #endif
2134
2135 #ifdef YY_NEED_STRLEN
yy_flex_strlen(const char * s,yyscan_t yyscanner)2136 static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
2137 {
2138 int n;
2139 for ( n = 0; s[n]; ++n )
2140 ;
2141
2142 return n;
2143 }
2144 #endif
2145
yyalloc(yy_size_t size,yyscan_t yyscanner)2146 void *yyalloc (yy_size_t size , yyscan_t yyscanner)
2147 {
2148 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2149 (void)yyg;
2150 return malloc(size);
2151 }
2152
yyrealloc(void * ptr,yy_size_t size,yyscan_t yyscanner)2153 void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2154 {
2155 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2156 (void)yyg;
2157
2158 /* The cast to (char *) in the following accommodates both
2159 * implementations that use char* generic pointers, and those
2160 * that use void* generic pointers. It works with the latter
2161 * because both ANSI C and C++ allow castless assignment from
2162 * any pointer type to void*, and deal with argument conversions
2163 * as though doing an assignment.
2164 */
2165 return realloc(ptr, size);
2166 }
2167
yyfree(void * ptr,yyscan_t yyscanner)2168 void yyfree (void * ptr , yyscan_t yyscanner)
2169 {
2170 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2171 (void)yyg;
2172 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2173 }
2174
2175 #define YYTABLES_NAME "yytables"
2176
yywrap(yyscan_t yyscanner)2177 int yywrap(yyscan_t yyscanner )
2178 {
2179 return 1;
2180 }
2181
2182