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