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