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