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