]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/deprecated/cwlex_yy.c
glibc's vswprintf doesn't nul terminate on truncation.
[wxWidgets.git] / contrib / src / deprecated / cwlex_yy.c
1 /* A lexical scanner generated by flex */
2 /* Copyright: (c) Julian Smart */
3 /* Licence: wxWindows Licence */
4
5 /* scanner skeleton version:
6 * $Header$
7 Last change: JS 13 Jul 97 6:17 pm
8 */
9
10 #define FLEX_SCANNER
11
12 #include <stdio.h>
13
14
15 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
16 #ifdef c_plusplus
17 #ifndef __cplusplus
18 #define __cplusplus
19 #endif
20 #endif
21
22
23 #ifdef __cplusplus
24
25 #include <stdlib.h>
26 #include <osfcn.h>
27
28 /* use prototypes in function declarations */
29 #define YY_USE_PROTOS
30
31 /* the "const" storage-class-modifier is valid */
32 #define YY_USE_CONST
33
34 #else /* ! __cplusplus */
35
36 #ifdef __STDC__
37
38 #ifdef __GNUC__
39 #include <stddef.h>
40 #else
41 #include <stdlib.h>
42 #endif /* __GNUC__ */
43
44 #define YY_USE_PROTOS
45 #define YY_USE_CONST
46
47 #endif /* __STDC__ */
48 #endif /* ! __cplusplus */
49
50
51 #ifdef __TURBOC__
52 #define YY_USE_CONST
53 #endif
54
55
56 #ifndef YY_USE_CONST
57 #define const
58 #endif
59
60
61 #ifdef YY_USE_PROTOS
62 #define YY_PROTO(proto) proto
63 #else
64 #define YY_PROTO(proto) ()
65 /* we can't get here if it's an ANSI C compiler, or a C++ compiler,
66 * so it's got to be a K&R compiler, and therefore there's no standard
67 * place from which to include these definitions
68 */
69 /*
70 char *malloc();
71 int free();
72 */
73
74 //int read();
75 #endif
76
77
78 /* amount of stuff to slurp up with each read */
79 #ifndef YY_READ_BUF_SIZE
80 #define YY_READ_BUF_SIZE 8192
81 #endif
82
83 /* returned upon end-of-file */
84 #define YY_END_TOK 0
85
86 /* copy whatever the last rule matched to the standard output */
87
88 /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
89 /* this used to be an fputs(), but since the string might contain NUL's,
90 * we now use fwrite()
91 */
92 #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
93
94 /* gets input and stuffs it into "buf". number of characters read, or YY_NULL,
95 * is returned in "result".
96 */
97 #define YY_INPUT(buf,result,max_size) \
98 if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
99 YY_FATAL_ERROR( "read() in flex scanner failed" );
100 #define YY_NULL 0
101
102 /* no semi-colon after return; correct usage is to write "yyterminate();" -
103 * we don't want an extra ';' after the "return" because that will cause
104 * some compilers to complain about unreachable statements.
105 */
106 #define yyterminate() return ( YY_NULL )
107
108 /* report a fatal error */
109
110 /* The funky do-while is used to turn this macro definition into
111 * a single C statement (which needs a semi-colon terminator).
112 * This avoids problems with code like:
113 *
114 * if ( something_happens )
115 * YY_FATAL_ERROR( "oops, the something happened" );
116 * else
117 * everything_okay();
118 *
119 * Prior to using the do-while the compiler would get upset at the
120 * "else" because it interpreted the "if" statement as being all
121 * done when it reached the ';' after the YY_FATAL_ERROR() call.
122 */
123
124 #define YY_FATAL_ERROR(msg) \
125 do \
126 { \
127 (void) fputs( msg, stderr ); \
128 (void) putc( '\n', stderr ); \
129 exit( 1 ); \
130 } \
131 while ( 0 )
132
133 /* default yywrap function - always treat EOF as an EOF */
134 int yywrap(void) { return 1; }
135
136
137 /* enter a start condition. This macro really ought to take a parameter,
138 * but we do it the disgusting crufty way forced on us by the ()-less
139 * definition of BEGIN
140 */
141 #define BEGIN yy_start = 1 + 2 *
142
143 /* action number for EOF rule of a given start state */
144 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
145
146 /* special action meaning "start processing a new file" */
147 #define YY_NEW_FILE \
148 do \
149 { \
150 yy_init_buffer( yy_current_buffer, yyin ); \
151 yy_load_buffer_state(); \
152 } \
153 while ( 0 )
154
155 /* default declaration of generated scanner - a define so the user can
156 * easily add parameters
157 */
158 #define YY_DECL int yylex YY_PROTO(( void ))
159
160 /* code executed at the end of each rule */
161 #define YY_BREAK break;
162
163 #define YY_END_OF_BUFFER_CHAR 0
164
165 #ifndef YY_BUF_SIZE
166 #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
167 #endif
168
169 typedef struct yy_buffer_state *YY_BUFFER_STATE;
170
171 #define YY_CHAR unsigned char
172 # line 1 "lexer.l"
173 #define INITIAL 0
174 # line 9 "lexer.l"
175 /*
176 * File: lexer.l
177 * Description: Lexical analyser for PROLOGIO; can be used with
178 * either lex and flex.
179 */
180 #include <string.h>
181
182 /* +++steve162e: added, otherwise, PROIO_input will be undefined (at least under LINUX)
183 please check, if this is also TRUE under other UNIXes.
184 */
185
186 #if defined(FLEX_SCANNER) && defined(_LINUX)
187 #define PROIO_input my_input
188 #endif
189 /* ---steve162e */
190
191 #include "wx/expr.h"
192 #ifdef wx_x
193 extern char *malloc();
194 #endif
195 #define Return(x) return x;
196
197 #if defined(VMS) && ( __VMS_VER < 70000000 )
198 #define strdup(s) (strcpy((char *)malloc(strlen(s)+1), s));
199 #endif
200
201 static size_t lex_buffer_length = 0;
202 static const char *lex_buffer = NULL;
203 static size_t lex_string_ptr = 0;
204 static int lex_read_from_string = 0;
205
206 static int my_input(void);
207 static int my_unput(char);
208
209 #ifdef FLEX_SCANNER
210 #undef YY_INPUT
211 # define YY_INPUT(buf,result,max_size) \
212 if (lex_read_from_string) \
213 { int c = my_input(); result = (c == 0) ? YY_NULL : ((buf)[0]=(c), 1); } \
214 else \
215 if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
216 YY_FATAL_ERROR( "read() in flex scanner failed" );
217 #else
218 # undef unput
219 # define unput(_c) my_unput(_c)
220 #endif
221
222 # line 58 "lexer.l"
223
224 /* done after the current pattern has been matched and before the
225 * corresponding action - sets up yytext
226 */
227 #define YY_DO_BEFORE_ACTION \
228 yytext = yy_bp; \
229 yyleng = yy_cp - yy_bp; \
230 yy_hold_char = *yy_cp; \
231 *yy_cp = '\0'; \
232 yy_c_buf_p = yy_cp;
233
234 #define EOB_ACT_CONTINUE_SCAN 0
235 #define EOB_ACT_END_OF_FILE 1
236 #define EOB_ACT_LAST_MATCH 2
237
238 /* return all but the first 'n' matched characters back to the input stream */
239 #define yyless(n) \
240 do \
241 { \
242 /* undo effects of setting up yytext */ \
243 *yy_cp = yy_hold_char; \
244 yy_c_buf_p = yy_cp = yy_bp + n; \
245 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
246 } \
247 while ( 0 )
248
249 #undef unput
250 #define unput(c) yyunput( c, yytext )
251
252
253 struct yy_buffer_state
254 {
255 FILE *yy_input_file;
256
257 YY_CHAR *yy_ch_buf; /* input buffer */
258 YY_CHAR *yy_buf_pos; /* current position in input buffer */
259
260 /* size of input buffer in bytes, not including room for EOB characters*/
261 int yy_buf_size;
262
263 /* number of characters read into yy_ch_buf, not including EOB characters */
264 int yy_n_chars;
265
266 int yy_eof_status; /* whether we've seen an EOF on this buffer */
267 #define EOF_NOT_SEEN 0
268 /* "pending" happens when the EOF has been seen but there's still
269 * some text process
270 */
271 #define EOF_PENDING 1
272 #define EOF_DONE 2
273 };
274
275 static YY_BUFFER_STATE yy_current_buffer;
276
277 /* we provide macros for accessing buffer states in case in the
278 * future we want to put the buffer states in a more general
279 * "scanner state"
280 */
281 #define YY_CURRENT_BUFFER yy_current_buffer
282
283
284 /* yy_hold_char holds the character lost when yytext is formed */
285 static YY_CHAR yy_hold_char;
286
287 static int yy_n_chars; /* number of characters read into yy_ch_buf */
288
289
290
291 #ifndef YY_USER_ACTION
292 #define YY_USER_ACTION
293 #endif
294
295 #ifndef YY_USER_INIT
296 #define YY_USER_INIT
297 #endif
298
299 extern YY_CHAR *yytext;
300 extern int yyleng;
301 extern FILE *yyin, *yyout;
302
303 YY_CHAR *yytext;
304 int yyleng;
305
306 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
307
308 #define YY_END_OF_BUFFER 18
309 typedef int yy_state_type;
310 static const short int yy_accept[34] =
311 { 0,
312 0, 0, 18, 16, 13, 14, 16, 16, 6, 7,
313 16, 8, 12, 16, 1, 11, 3, 9, 10, 2,
314 0, 5, 0, 0, 0, 4, 1, 15, 3, 5,
315 0, 0, 0
316 } ;
317
318 static const YY_CHAR yy_ec[256] =
319 { 0,
320 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
321 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
322 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
323 1, 2, 1, 4, 1, 1, 1, 1, 5, 6,
324 7, 8, 9, 10, 9, 11, 12, 13, 13, 13,
325 13, 13, 13, 13, 13, 13, 13, 1, 1, 1,
326 14, 1, 1, 1, 15, 15, 15, 15, 15, 15,
327 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
328 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
329 16, 17, 18, 1, 15, 1, 15, 15, 15, 15,
330
331 19, 15, 15, 15, 15, 15, 15, 15, 15, 15,
332 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
333 15, 15, 1, 20, 1, 1, 1, 1, 1, 1,
334 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
335 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
336 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
337 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
338 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
339 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
340 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
341
342 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
343 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
344 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
345 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
346 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
347 1, 1, 1, 1, 1
348 } ;
349
350 static const YY_CHAR yy_meta[21] =
351 { 0,
352 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
353 1, 1, 2, 1, 2, 1, 3, 1, 2, 1
354 } ;
355
356 static const short int yy_base[37] =
357 { 0,
358 0, 0, 48, 55, 55, 55, 17, 42, 55, 55,
359 19, 55, 55, 23, 17, 55, 0, 55, 55, 0,
360 18, 55, 19, 23, 21, 55, 12, 55, 0, 24,
361 25, 29, 55, 49, 52, 22
362 } ;
363
364 static const short int yy_def[37] =
365 { 0,
366 33, 1, 33, 33, 33, 33, 34, 35, 33, 33,
367 33, 33, 33, 33, 33, 33, 36, 33, 33, 36,
368 34, 33, 34, 34, 35, 33, 33, 33, 36, 34,
369 34, 34, 0, 33, 33, 33
370 } ;
371
372 static const short int yy_nxt[76] =
373 { 0,
374 4, 5, 6, 7, 8, 9, 10, 4, 11, 12,
375 13, 14, 15, 16, 17, 18, 4, 19, 20, 4,
376 22, 22, 30, 29, 27, 26, 22, 22, 30, 27,
377 28, 27, 30, 23, 23, 23, 24, 24, 24, 31,
378 23, 32, 24, 24, 24, 23, 26, 33, 24, 21,
379 21, 21, 25, 25, 3, 33, 33, 33, 33, 33,
380 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
381 33, 33, 33, 33, 33
382 } ;
383
384 static const short int yy_chk[76] =
385 { 0,
386 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
387 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
388 7, 21, 23, 36, 27, 25, 24, 30, 31, 15,
389 14, 11, 32, 7, 21, 23, 7, 21, 23, 24,
390 30, 31, 24, 30, 31, 32, 8, 3, 32, 34,
391 34, 34, 35, 35, 33, 33, 33, 33, 33, 33,
392 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
393 33, 33, 33, 33, 33
394 } ;
395
396 static yy_state_type yy_last_accepting_state;
397 static YY_CHAR *yy_last_accepting_cpos;
398
399 /* the intent behind this definition is that it'll catch
400 * any uses of REJECT which flex missed
401 */
402 #define REJECT reject_used_but_not_detected
403 #define yymore() yymore_used_but_not_detected
404 #define YY_MORE_ADJ 0
405
406 /* these variables are all declared out here so that section 3 code can
407 * manipulate them
408 */
409 /* points to current character in buffer */
410 static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
411 static int yy_init = 1; /* whether we need to initialize */
412 static int yy_start = 0; /* start state number */
413
414 /* flag which is used to allow yywrap()'s to do buffer switches
415 * instead of setting up a fresh yyin. A bit of a hack ...
416 */
417 static int yy_did_buffer_switch_on_eof;
418
419 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
420 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
421 static int yy_get_next_buffer YY_PROTO(( void ));
422 static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
423 void yyrestart YY_PROTO(( FILE *input_file ));
424 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
425 void yy_load_buffer_state YY_PROTO(( void ));
426 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
427 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
428 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
429
430 #define yy_new_buffer yy_create_buffer
431
432 #ifdef __cplusplus
433 static int yyinput YY_PROTO(( void ));
434 #else
435 static int input YY_PROTO(( void ));
436 #endif
437
438 YY_DECL
439 {
440 register yy_state_type yy_current_state;
441 register YY_CHAR *yy_cp, *yy_bp;
442 register int yy_act;
443
444
445
446
447 if ( yy_init )
448 {
449 YY_USER_INIT;
450
451 if ( ! yy_start )
452 yy_start = 1; /* first start state */
453
454 if ( ! yyin )
455 yyin = stdin;
456
457 if ( ! yyout )
458 yyout = stdout;
459
460 if ( yy_current_buffer )
461 yy_init_buffer( yy_current_buffer, yyin );
462 else
463 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
464
465 yy_load_buffer_state();
466
467 yy_init = 0;
468 }
469
470 while ( 1 ) /* loops until end-of-file is reached */
471 {
472 yy_cp = yy_c_buf_p;
473
474 /* support of yytext */
475 *yy_cp = yy_hold_char;
476
477 /* yy_bp points to the position in yy_ch_buf of the start of the
478 * current run.
479 */
480 yy_bp = yy_cp;
481
482 yy_current_state = yy_start;
483 yy_match:
484 do
485 {
486 register YY_CHAR yy_c = yy_ec[*yy_cp];
487 if ( yy_accept[yy_current_state] )
488 {
489 yy_last_accepting_state = yy_current_state;
490 yy_last_accepting_cpos = yy_cp;
491 }
492 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
493 {
494 yy_current_state = yy_def[yy_current_state];
495 if ( yy_current_state >= 34 )
496 yy_c = yy_meta[yy_c];
497 }
498 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
499 ++yy_cp;
500 }
501 while ( yy_current_state != 33 );
502 yy_cp = yy_last_accepting_cpos;
503 yy_current_state = yy_last_accepting_state;
504
505 yy_find_action:
506 yy_act = yy_accept[yy_current_state];
507
508 YY_DO_BEFORE_ACTION;
509 YY_USER_ACTION;
510
511 do_action: /* this label is used only to access EOF actions */
512
513
514 switch ( yy_act )
515 {
516 case 0: /* must backtrack */
517 /* undo the effects of YY_DO_BEFORE_ACTION */
518 *yy_cp = yy_hold_char;
519 yy_cp = yy_last_accepting_cpos;
520 yy_current_state = yy_last_accepting_state;
521 goto yy_find_action;
522
523 case 1:
524 # line 60 "lexer.l"
525 {yylval.s = strdup(yytext); Return(INTEGER);}
526 YY_BREAK
527 case 2:
528 # line 62 "lexer.l"
529 Return(EXP);
530 YY_BREAK
531 case 3:
532 # line 64 "lexer.l"
533 {yylval.s = strdup(yytext); Return(WORD);}
534 YY_BREAK
535 case 4:
536 # line 66 "lexer.l"
537 {int len = strlen(yytext);
538 yytext[len-1] = 0;
539 yylval.s = strdup(yytext+1);
540 Return(WORD);}
541 YY_BREAK
542 case 5:
543 # line 71 "lexer.l"
544 {yylval.s = strdup(yytext); Return(STRING);}
545 YY_BREAK
546 case 6:
547 # line 73 "lexer.l"
548 Return(OPEN);
549 YY_BREAK
550 case 7:
551 # line 75 "lexer.l"
552 Return(CLOSE);
553 YY_BREAK
554 case 8:
555 # line 77 "lexer.l"
556 Return(COMMA);
557 YY_BREAK
558 case 9:
559 # line 79 "lexer.l"
560 Return(OPEN_SQUARE);
561 YY_BREAK
562 case 10:
563 # line 81 "lexer.l"
564 Return(CLOSE_SQUARE);
565 YY_BREAK
566 case 11:
567 # line 83 "lexer.l"
568 Return(EQUALS);
569 YY_BREAK
570 case 12:
571 # line 85 "lexer.l"
572 Return(PERIOD);
573 YY_BREAK
574 case 13:
575 # line 87 "lexer.l"
576 ;
577 YY_BREAK
578 case 14:
579 # line 89 "lexer.l"
580 ;
581 YY_BREAK
582 case 15:
583 # line 91 "lexer.l"
584 { loop:
585 #ifdef __cplusplus
586 while (yyinput() != '*');
587 switch (yyinput())
588 #else
589 while (input() != '*');
590 switch (input())
591 #endif
592 {
593 case '/': break;
594 case '*': unput('*');
595 default: goto loop;
596 }
597 }
598 YY_BREAK
599 case 16:
600 # line 106 "lexer.l"
601 Return(ERROR);
602 YY_BREAK
603 case 17:
604 # line 108 "lexer.l"
605 ECHO;
606 YY_BREAK
607 case YY_STATE_EOF(INITIAL):
608 yyterminate();
609
610 case YY_END_OF_BUFFER:
611 {
612 /* amount of text matched not including the EOB char */
613 int yy_amount_of_matched_text = yy_cp - yytext - 1;
614
615 /* undo the effects of YY_DO_BEFORE_ACTION */
616 *yy_cp = yy_hold_char;
617
618 /* note that here we test for yy_c_buf_p "<=" to the position
619 * of the first EOB in the buffer, since yy_c_buf_p will
620 * already have been incremented past the NUL character
621 * (since all states make transitions on EOB to the end-
622 * of-buffer state). Contrast this with the test in yyinput().
623 */
624 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
625 /* this was really a NUL */
626 {
627 yy_state_type yy_next_state;
628
629 yy_c_buf_p = yytext + yy_amount_of_matched_text;
630
631 yy_current_state = yy_get_previous_state();
632
633 /* okay, we're now positioned to make the
634 * NUL transition. We couldn't have
635 * yy_get_previous_state() go ahead and do it
636 * for us because it doesn't know how to deal
637 * with the possibility of jamming (and we
638 * don't want to build jamming into it because
639 * then it will run more slowly)
640 */
641
642 yy_next_state = yy_try_NUL_trans( yy_current_state );
643
644 yy_bp = yytext + YY_MORE_ADJ;
645
646 if ( yy_next_state )
647 {
648 /* consume the NUL */
649 yy_cp = ++yy_c_buf_p;
650 yy_current_state = yy_next_state;
651 goto yy_match;
652 }
653
654 else
655 {
656 yy_cp = yy_last_accepting_cpos;
657 yy_current_state = yy_last_accepting_state;
658 goto yy_find_action;
659 }
660 }
661
662 else switch ( yy_get_next_buffer() )
663 {
664 case EOB_ACT_END_OF_FILE:
665 {
666 yy_did_buffer_switch_on_eof = 0;
667
668 if ( yywrap() )
669 {
670 /* note: because we've taken care in
671 * yy_get_next_buffer() to have set up yytext,
672 * we can now set up yy_c_buf_p so that if some
673 * total hoser (like flex itself) wants
674 * to call the scanner after we return the
675 * YY_NULL, it'll still work - another YY_NULL
676 * will get returned.
677 */
678 yy_c_buf_p = yytext + YY_MORE_ADJ;
679
680 yy_act = YY_STATE_EOF((yy_start - 1) / 2);
681 goto do_action;
682 }
683
684 else
685 {
686 if ( ! yy_did_buffer_switch_on_eof )
687 YY_NEW_FILE;
688 }
689 }
690 break;
691
692 case EOB_ACT_CONTINUE_SCAN:
693 yy_c_buf_p = yytext + yy_amount_of_matched_text;
694
695 yy_current_state = yy_get_previous_state();
696
697 yy_cp = yy_c_buf_p;
698 yy_bp = yytext + YY_MORE_ADJ;
699 goto yy_match;
700
701 case EOB_ACT_LAST_MATCH:
702 yy_c_buf_p =
703 &yy_current_buffer->yy_ch_buf[yy_n_chars];
704
705 yy_current_state = yy_get_previous_state();
706
707 yy_cp = yy_c_buf_p;
708 yy_bp = yytext + YY_MORE_ADJ;
709 goto yy_find_action;
710 }
711 break;
712 }
713
714 default:
715 #ifdef FLEX_DEBUG
716 printf( "action # %d\n", yy_act );
717 #endif
718 YY_FATAL_ERROR(
719 "fatal flex scanner internal error--no action found" );
720 }
721 }
722 }
723
724
725 /* yy_get_next_buffer - try to read in a new buffer
726 *
727 * synopsis
728 * int yy_get_next_buffer();
729 *
730 * returns a code representing an action
731 * EOB_ACT_LAST_MATCH -
732 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
733 * EOB_ACT_END_OF_FILE - end of file
734 */
735
736 static int yy_get_next_buffer()
737
738 {
739 register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
740 register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
741 register int number_to_move, i;
742 int ret_val;
743
744 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
745 YY_FATAL_ERROR(
746 "fatal flex scanner internal error--end of buffer missed" );
747
748 /* try to read more data */
749
750 /* first move last chars to start of buffer */
751 number_to_move = yy_c_buf_p - yytext;
752
753 for ( i = 0; i < number_to_move; ++i )
754 *(dest++) = *(source++);
755
756 if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
757 /* don't do the read, it's not guaranteed to return an EOF,
758 * just force an EOF
759 */
760 yy_n_chars = 0;
761
762 else
763 {
764 int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
765
766 if ( num_to_read > YY_READ_BUF_SIZE )
767 num_to_read = YY_READ_BUF_SIZE;
768
769 else if ( num_to_read <= 0 )
770 YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
771
772 /* read in more data */
773 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
774 yy_n_chars, num_to_read );
775 }
776
777 if ( yy_n_chars == 0 )
778 {
779 if ( number_to_move == 1 )
780 {
781 ret_val = EOB_ACT_END_OF_FILE;
782 yy_current_buffer->yy_eof_status = EOF_DONE;
783 }
784
785 else
786 {
787 ret_val = EOB_ACT_LAST_MATCH;
788 yy_current_buffer->yy_eof_status = EOF_PENDING;
789 }
790 }
791
792 else
793 ret_val = EOB_ACT_CONTINUE_SCAN;
794
795 yy_n_chars += number_to_move;
796 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
797 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
798
799 /* yytext begins at the second character in yy_ch_buf; the first
800 * character is the one which preceded it before reading in the latest
801 * buffer; it needs to be kept around in case it's a newline, so
802 * yy_get_previous_state() will have with '^' rules active
803 */
804
805 yytext = &yy_current_buffer->yy_ch_buf[1];
806
807 return ( ret_val );
808 }
809
810
811 /* yy_get_previous_state - get the state just before the EOB char was reached
812 *
813 * synopsis
814 * yy_state_type yy_get_previous_state();
815 */
816
817 static yy_state_type yy_get_previous_state()
818
819 {
820 register yy_state_type yy_current_state;
821 register YY_CHAR *yy_cp;
822
823 yy_current_state = yy_start;
824
825 for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
826 {
827 register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1);
828 if ( yy_accept[yy_current_state] )
829 {
830 yy_last_accepting_state = yy_current_state;
831 yy_last_accepting_cpos = yy_cp;
832 }
833 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
834 {
835 yy_current_state = yy_def[yy_current_state];
836 if ( yy_current_state >= 34 )
837 yy_c = yy_meta[yy_c];
838 }
839 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
840 }
841
842 return ( yy_current_state );
843 }
844
845
846 /* yy_try_NUL_trans - try to make a transition on the NUL character
847 *
848 * synopsis
849 * next_state = yy_try_NUL_trans( current_state );
850 */
851
852 #ifdef YY_USE_PROTOS
853 static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
854 #else
855 static yy_state_type yy_try_NUL_trans( yy_current_state )
856 register yy_state_type yy_current_state;
857 #endif
858
859 {
860 register int yy_is_jam;
861 register YY_CHAR *yy_cp = yy_c_buf_p;
862
863 register YY_CHAR yy_c = 1;
864 if ( yy_accept[yy_current_state] )
865 {
866 yy_last_accepting_state = yy_current_state;
867 yy_last_accepting_cpos = yy_cp;
868 }
869 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
870 {
871 yy_current_state = yy_def[yy_current_state];
872 if ( yy_current_state >= 34 )
873 yy_c = yy_meta[yy_c];
874 }
875 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
876 yy_is_jam = (yy_current_state == 33);
877
878 return ( yy_is_jam ? 0 : yy_current_state );
879 }
880
881
882 #ifdef YY_USE_PROTOS
883 static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
884 #else
885 static void yyunput( c, yy_bp )
886 YY_CHAR c;
887 register YY_CHAR *yy_bp;
888 #endif
889
890 {
891 register YY_CHAR *yy_cp = yy_c_buf_p;
892
893 /* undo effects of setting up yytext */
894 *yy_cp = yy_hold_char;
895
896 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
897 { /* need to shift things up to make room */
898 register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
899 register YY_CHAR *dest =
900 &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
901 register YY_CHAR *source =
902 &yy_current_buffer->yy_ch_buf[number_to_move];
903
904 while ( source > yy_current_buffer->yy_ch_buf )
905 *--dest = *--source;
906
907 yy_cp += dest - source;
908 yy_bp += dest - source;
909 yy_n_chars = yy_current_buffer->yy_buf_size;
910
911 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
912 YY_FATAL_ERROR( "flex scanner push-back overflow" );
913 }
914
915 if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
916 yy_cp[-2] = '\n';
917
918 *--yy_cp = c;
919
920 /* note: the formal parameter *must* be called "yy_bp" for this
921 * macro to now work correctly
922 */
923 YY_DO_BEFORE_ACTION; /* set up yytext again */
924 }
925
926
927 #ifdef __cplusplus
928 static int yyinput()
929 #else
930 static int input()
931 #endif
932
933 {
934 int c;
935 YY_CHAR *yy_cp = yy_c_buf_p;
936
937 *yy_cp = yy_hold_char;
938
939 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
940 {
941 /* yy_c_buf_p now points to the character we want to return.
942 * If this occurs *before* the EOB characters, then it's a
943 * valid NUL; if not, then we've hit the end of the buffer.
944 */
945 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
946 /* this was really a NUL */
947 *yy_c_buf_p = '\0';
948
949 else
950 { /* need more input */
951 yytext = yy_c_buf_p;
952 ++yy_c_buf_p;
953
954 switch ( yy_get_next_buffer() )
955 {
956 case EOB_ACT_END_OF_FILE:
957 {
958 if ( yywrap() )
959 {
960 yy_c_buf_p = yytext + YY_MORE_ADJ;
961 return ( EOF );
962 }
963
964 YY_NEW_FILE;
965
966 #ifdef __cplusplus
967 return ( yyinput() );
968 #else
969 return ( input() );
970 #endif
971 }
972 break;
973
974 case EOB_ACT_CONTINUE_SCAN:
975 yy_c_buf_p = yytext + YY_MORE_ADJ;
976 break;
977
978 case EOB_ACT_LAST_MATCH:
979 #ifdef __cplusplus
980 YY_FATAL_ERROR( "unexpected last match in yyinput()" );
981 #else
982 YY_FATAL_ERROR( "unexpected last match in input()" );
983 #endif
984 }
985 }
986 }
987
988 c = *yy_c_buf_p;
989 yy_hold_char = *++yy_c_buf_p;
990
991 return ( c );
992 }
993
994
995 #ifdef YY_USE_PROTOS
996 void yyrestart( FILE *input_file )
997 #else
998 void yyrestart( input_file )
999 FILE *input_file;
1000 #endif
1001
1002 {
1003 yy_init_buffer( yy_current_buffer, input_file );
1004 yy_load_buffer_state();
1005 }
1006
1007
1008 #ifdef YY_USE_PROTOS
1009 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1010 #else
1011 void yy_switch_to_buffer( new_buffer )
1012 YY_BUFFER_STATE new_buffer;
1013 #endif
1014
1015 {
1016 if ( yy_current_buffer == new_buffer )
1017 return;
1018
1019 if ( yy_current_buffer )
1020 {
1021 /* flush out information for old buffer */
1022 *yy_c_buf_p = yy_hold_char;
1023 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1024 yy_current_buffer->yy_n_chars = yy_n_chars;
1025 }
1026
1027 yy_current_buffer = new_buffer;
1028 yy_load_buffer_state();
1029
1030 /* we don't actually know whether we did this switch during
1031 * EOF (yywrap()) processing, but the only time this flag
1032 * is looked at is after yywrap() is called, so it's safe
1033 * to go ahead and always set it.
1034 */
1035 yy_did_buffer_switch_on_eof = 1;
1036 }
1037
1038
1039 #ifdef YY_USE_PROTOS
1040 void yy_load_buffer_state( void )
1041 #else
1042 void yy_load_buffer_state()
1043 #endif
1044
1045 {
1046 yy_n_chars = yy_current_buffer->yy_n_chars;
1047 yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1048 yyin = yy_current_buffer->yy_input_file;
1049 yy_hold_char = *yy_c_buf_p;
1050 }
1051
1052
1053 #ifdef YY_USE_PROTOS
1054 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1055 #else
1056 YY_BUFFER_STATE yy_create_buffer( file, size )
1057 FILE *file;
1058 int size;
1059 #endif
1060
1061 {
1062 YY_BUFFER_STATE b;
1063
1064 b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
1065
1066 if ( ! b )
1067 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1068
1069 b->yy_buf_size = size;
1070
1071 /* yy_ch_buf has to be 2 characters longer than the size given because
1072 * we need to put in 2 end-of-buffer characters.
1073 */
1074 b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
1075
1076 if ( ! b->yy_ch_buf )
1077 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1078
1079 yy_init_buffer( b, file );
1080
1081 return ( b );
1082 }
1083
1084
1085 #ifdef YY_USE_PROTOS
1086 void yy_delete_buffer( YY_BUFFER_STATE b )
1087 #else
1088 void yy_delete_buffer( b )
1089 YY_BUFFER_STATE b;
1090 #endif
1091
1092 {
1093 if ( b == yy_current_buffer )
1094 yy_current_buffer = (YY_BUFFER_STATE) 0;
1095
1096 free( (char *) b->yy_ch_buf );
1097 free( (char *) b );
1098 }
1099
1100
1101 #ifdef YY_USE_PROTOS
1102 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1103 #else
1104 void yy_init_buffer( b, file )
1105 YY_BUFFER_STATE b;
1106 FILE *file;
1107 #endif
1108
1109 {
1110 b->yy_input_file = file;
1111
1112 /* we put in the '\n' and start reading from [1] so that an
1113 * initial match-at-newline will be true.
1114 */
1115
1116 b->yy_ch_buf[0] = '\n';
1117 b->yy_n_chars = 1;
1118
1119 /* we always need two end-of-buffer characters. The first causes
1120 * a transition to the end-of-buffer state. The second causes
1121 * a jam in that state.
1122 */
1123 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1124 b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
1125
1126 b->yy_buf_pos = &b->yy_ch_buf[1];
1127
1128 b->yy_eof_status = EOF_NOT_SEEN;
1129 }
1130 # line 108 "lexer.l"
1131
1132
1133
1134 #ifdef FLEX_SCANNER
1135 static int lex_input() {
1136 return input();
1137 }
1138 #else /* BSD/AT&T lex */
1139 #ifndef input
1140 # error "Sorry, but need either flex or AT&T lex"
1141 #endif
1142 static int lex_input() {
1143 return input();
1144 }
1145 /* # undef unput
1146 # define unput(_c) my_unput(_c)
1147 */
1148
1149 # undef input
1150 # define input() my_input()
1151 static int my_unput(char c)
1152 {
1153 if (lex_read_from_string) {
1154 /* Make sure we have something */
1155 if (lex_string_ptr) {
1156 if (c == '\n') yylineno--;
1157 lex_string_ptr--;
1158 }
1159 } else {
1160 yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;
1161 /* unput(c); Causes infinite recursion! */
1162 }
1163 return c;
1164 }
1165
1166 #endif
1167
1168 /* Public */
1169 void LexFromFile(FILE *fd)
1170 {
1171 lex_read_from_string = 0;
1172 yyin = fd;
1173 /* Don't know why this is necessary, but otherwise
1174 * lex only works _once_!
1175 */
1176 #ifdef FLEX_SCANNER
1177 yy_init = 1;
1178 #endif
1179 }
1180
1181 void LexFromString(char *buffer)
1182 {
1183 lex_read_from_string = 1;
1184 lex_buffer = buffer;
1185 lex_buffer_length = strlen(buffer);
1186 lex_string_ptr = 0;
1187 /* Don't know why this is necessary, but otherwise
1188 * lex only works _once_!
1189 */
1190 #ifdef FLEX_SCANNER
1191 yy_init = 1;
1192 #endif
1193 }
1194
1195 static int my_input( void )
1196 {
1197 if (lex_read_from_string) {
1198 if (lex_string_ptr == lex_buffer_length)
1199 return 0;
1200 else {
1201 char c = lex_buffer[lex_string_ptr++];
1202 #ifndef FLEX_SCANNER
1203 if (c == '\n') yylineno++;
1204 #endif
1205 return c;
1206 }
1207 } else {
1208 return lex_input();
1209 }
1210 }
1211
1212 void wxExprCleanUp()
1213 {
1214 if (yy_current_buffer)
1215 yy_delete_buffer(yy_current_buffer);
1216 }