Mercurial > vba-linux
comparison src/sdl/expr-lex.cpp @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:8ced16adf2e1 | 1:f9f4f1b99eed |
---|---|
1 #line 2 "expr-lex.cpp" | |
2 /* A lexical scanner generated by flex */ | |
3 | |
4 /* Scanner skeleton version: | |
5 * $Header: /cvsroot/vba/VisualBoyAdvance/src/expr-lex.cpp,v 1.2 2003/06/06 14:17:21 forgotten Exp $ | |
6 */ | |
7 | |
8 #define FLEX_SCANNER | |
9 #define YY_FLEX_MAJOR_VERSION 2 | |
10 #define YY_FLEX_MINOR_VERSION 5 | |
11 | |
12 #include <stdio.h> | |
13 #ifdef __GNUC__ | |
14 #include <unistd.h> | |
15 #endif | |
16 | |
17 | |
18 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ | |
19 #ifdef c_plusplus | |
20 #ifndef __cplusplus | |
21 #define __cplusplus | |
22 #endif | |
23 #endif | |
24 | |
25 | |
26 #ifdef __cplusplus | |
27 | |
28 #include <stdlib.h> | |
29 | |
30 /* Use prototypes in function declarations. */ | |
31 #define YY_USE_PROTOS | |
32 | |
33 /* The "const" storage-class-modifier is valid. */ | |
34 #define YY_USE_CONST | |
35 | |
36 #else /* ! __cplusplus */ | |
37 | |
38 #if __STDC__ | |
39 | |
40 #define YY_USE_PROTOS | |
41 #define YY_USE_CONST | |
42 | |
43 #endif /* __STDC__ */ | |
44 #endif /* ! __cplusplus */ | |
45 | |
46 #ifdef __TURBOC__ | |
47 #pragma warn -rch | |
48 #pragma warn -use | |
49 #include <io.h> | |
50 #include <stdlib.h> | |
51 #define YY_USE_CONST | |
52 #define YY_USE_PROTOS | |
53 #endif | |
54 | |
55 #ifdef YY_USE_CONST | |
56 #define yyconst const | |
57 #else | |
58 #define yyconst | |
59 #endif | |
60 | |
61 | |
62 #ifdef YY_USE_PROTOS | |
63 #define YY_PROTO(proto) proto | |
64 #else | |
65 #define YY_PROTO(proto) () | |
66 #endif | |
67 | |
68 /* Returned upon end-of-file. */ | |
69 #define YY_NULL 0 | |
70 | |
71 /* Promotes a possibly negative, possibly signed char to an unsigned | |
72 * integer for use as an array index. If the signed char is negative, | |
73 * we want to instead treat it as an 8-bit unsigned char, hence the | |
74 * double cast. | |
75 */ | |
76 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) | |
77 | |
78 /* Enter a start condition. This macro really ought to take a parameter, | |
79 * but we do it the disgusting crufty way forced on us by the ()-less | |
80 * definition of BEGIN. | |
81 */ | |
82 #define BEGIN yy_start = 1 + 2 * | |
83 | |
84 /* Translate the current start state into a value that can be later handed | |
85 * to BEGIN to return to the state. The YYSTATE alias is for lex | |
86 * compatibility. | |
87 */ | |
88 #define YY_START ((yy_start - 1) / 2) | |
89 #define YYSTATE YY_START | |
90 | |
91 /* Action number for EOF rule of a given start state. */ | |
92 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) | |
93 | |
94 /* Special action meaning "start processing a new file". */ | |
95 #define YY_NEW_FILE yyrestart( yyin ) | |
96 | |
97 #define YY_END_OF_BUFFER_CHAR 0 | |
98 | |
99 /* Size of default input buffer. */ | |
100 #define YY_BUF_SIZE 16384 | |
101 | |
102 typedef struct yy_buffer_state *YY_BUFFER_STATE; | |
103 | |
104 extern int yyleng; | |
105 extern FILE *yyin, *yyout; | |
106 | |
107 #define EOB_ACT_CONTINUE_SCAN 0 | |
108 #define EOB_ACT_END_OF_FILE 1 | |
109 #define EOB_ACT_LAST_MATCH 2 | |
110 | |
111 /* The funky do-while in the following #define is used to turn the definition | |
112 * int a single C statement (which needs a semi-colon terminator). This | |
113 * avoids problems with code like: | |
114 * | |
115 * if ( condition_holds ) | |
116 * yyless( 5 ); | |
117 * else | |
118 * do_something_else(); | |
119 * | |
120 * Prior to using the do-while the compiler would get upset at the | |
121 * "else" because it interpreted the "if" statement as being all | |
122 * done when it reached the ';' after the yyless() call. | |
123 */ | |
124 | |
125 /* Return all but the first 'n' matched characters back to the input stream. */ | |
126 | |
127 #define yyless(n) \ | |
128 do \ | |
129 { \ | |
130 /* Undo effects of setting up yytext. */ \ | |
131 *yy_cp = yy_hold_char; \ | |
132 YY_RESTORE_YY_MORE_OFFSET \ | |
133 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ | |
134 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ | |
135 } \ | |
136 while ( 0 ) | |
137 | |
138 #define unput(c) yyunput( c, yytext_ptr ) | |
139 | |
140 /* The following is because we cannot portably get our hands on size_t | |
141 * (without autoconf's help, which isn't available because we want | |
142 * flex-generated scanners to compile on their own). | |
143 */ | |
144 typedef unsigned int yy_size_t; | |
145 | |
146 | |
147 struct yy_buffer_state | |
148 { | |
149 FILE *yy_input_file; | |
150 | |
151 char *yy_ch_buf; /* input buffer */ | |
152 char *yy_buf_pos; /* current position in input buffer */ | |
153 | |
154 /* Size of input buffer in bytes, not including room for EOB | |
155 * characters. | |
156 */ | |
157 yy_size_t yy_buf_size; | |
158 | |
159 /* Number of characters read into yy_ch_buf, not including EOB | |
160 * characters. | |
161 */ | |
162 int yy_n_chars; | |
163 | |
164 /* Whether we "own" the buffer - i.e., we know we created it, | |
165 * and can realloc() it to grow it, and should free() it to | |
166 * delete it. | |
167 */ | |
168 int yy_is_our_buffer; | |
169 | |
170 /* Whether this is an "interactive" input source; if so, and | |
171 * if we're using stdio for input, then we want to use getc() | |
172 * instead of fread(), to make sure we stop fetching input after | |
173 * each newline. | |
174 */ | |
175 int yy_is_interactive; | |
176 | |
177 /* Whether we're considered to be at the beginning of a line. | |
178 * If so, '^' rules will be active on the next match, otherwise | |
179 * not. | |
180 */ | |
181 int yy_at_bol; | |
182 | |
183 /* Whether to try to fill the input buffer when we reach the | |
184 * end of it. | |
185 */ | |
186 int yy_fill_buffer; | |
187 | |
188 int yy_buffer_status; | |
189 #define YY_BUFFER_NEW 0 | |
190 #define YY_BUFFER_NORMAL 1 | |
191 /* When an EOF's been seen but there's still some text to process | |
192 * then we mark the buffer as YY_EOF_PENDING, to indicate that we | |
193 * shouldn't try reading from the input source any more. We might | |
194 * still have a bunch of tokens to match, though, because of | |
195 * possible backing-up. | |
196 * | |
197 * When we actually see the EOF, we change the status to "new" | |
198 * (via yyrestart()), so that the user can continue scanning by | |
199 * just pointing yyin at a new input file. | |
200 */ | |
201 #define YY_BUFFER_EOF_PENDING 2 | |
202 }; | |
203 | |
204 static YY_BUFFER_STATE yy_current_buffer = 0; | |
205 | |
206 /* We provide macros for accessing buffer states in case in the | |
207 * future we want to put the buffer states in a more general | |
208 * "scanner state". | |
209 */ | |
210 #define YY_CURRENT_BUFFER yy_current_buffer | |
211 | |
212 | |
213 /* yy_hold_char holds the character lost when yytext is formed. */ | |
214 static char yy_hold_char; | |
215 | |
216 static int yy_n_chars; /* number of characters read into yy_ch_buf */ | |
217 | |
218 | |
219 int yyleng; | |
220 | |
221 /* Points to current character in buffer. */ | |
222 static char *yy_c_buf_p = (char *) 0; | |
223 static int yy_init = 1; /* whether we need to initialize */ | |
224 static int yy_start = 0; /* start state number */ | |
225 | |
226 /* Flag which is used to allow yywrap()'s to do buffer switches | |
227 * instead of setting up a fresh yyin. A bit of a hack ... | |
228 */ | |
229 static int yy_did_buffer_switch_on_eof; | |
230 | |
231 void yyrestart YY_PROTO(( FILE *input_file )); | |
232 | |
233 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); | |
234 void yy_load_buffer_state YY_PROTO(( void )); | |
235 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); | |
236 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); | |
237 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); | |
238 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); | |
239 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) | |
240 | |
241 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); | |
242 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); | |
243 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); | |
244 | |
245 static void *yy_flex_alloc YY_PROTO(( yy_size_t )); | |
246 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); | |
247 static void yy_flex_free YY_PROTO(( void * )); | |
248 | |
249 #define yy_new_buffer yy_create_buffer | |
250 | |
251 #define yy_set_interactive(is_interactive) \ | |
252 { \ | |
253 if ( ! yy_current_buffer ) \ | |
254 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ | |
255 yy_current_buffer->yy_is_interactive = is_interactive; \ | |
256 } | |
257 | |
258 #define yy_set_bol(at_bol) \ | |
259 { \ | |
260 if ( ! yy_current_buffer ) \ | |
261 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ | |
262 yy_current_buffer->yy_at_bol = at_bol; \ | |
263 } | |
264 | |
265 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) | |
266 | |
267 | |
268 #define yywrap() 1 | |
269 #define YY_SKIP_YYWRAP | |
270 typedef unsigned char YY_CHAR; | |
271 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; | |
272 typedef int yy_state_type; | |
273 extern char *yytext; | |
274 #define yytext_ptr yytext | |
275 | |
276 static yy_state_type yy_get_previous_state YY_PROTO(( void )); | |
277 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); | |
278 static int yy_get_next_buffer YY_PROTO(( void )); | |
279 static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); | |
280 | |
281 /* Done after the current pattern has been matched and before the | |
282 * corresponding action - sets up yytext. | |
283 */ | |
284 #define YY_DO_BEFORE_ACTION \ | |
285 yytext_ptr = yy_bp; \ | |
286 yyleng = (int) (yy_cp - yy_bp); \ | |
287 yy_hold_char = *yy_cp; \ | |
288 *yy_cp = '\0'; \ | |
289 yy_c_buf_p = yy_cp; | |
290 | |
291 #define YY_NUM_RULES 10 | |
292 #define YY_END_OF_BUFFER 11 | |
293 static yyconst short int yy_accept[24] = | |
294 { 0, | |
295 0, 0, 11, 9, 8, 8, 6, 7, 9, 4, | |
296 3, 2, 2, 8, 5, 3, 2, 2, 2, 2, | |
297 2, 1, 0 | |
298 } ; | |
299 | |
300 static yyconst int yy_ec[256] = | |
301 { 0, | |
302 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, | |
303 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
304 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
305 1, 2, 1, 1, 1, 1, 1, 4, 1, 1, | |
306 1, 5, 1, 1, 6, 7, 1, 8, 8, 8, | |
307 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, | |
308 1, 9, 1, 1, 10, 10, 10, 10, 10, 10, | |
309 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, | |
310 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, | |
311 1, 1, 1, 1, 10, 1, 10, 10, 10, 10, | |
312 | |
313 11, 12, 10, 10, 13, 10, 10, 10, 10, 10, | |
314 14, 10, 10, 10, 15, 10, 10, 10, 10, 10, | |
315 10, 16, 1, 1, 1, 1, 1, 1, 1, 1, | |
316 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
317 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
318 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
319 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
320 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
321 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
322 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
323 | |
324 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
325 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
326 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
327 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
328 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
329 1, 1, 1, 1, 1 | |
330 } ; | |
331 | |
332 static yyconst int yy_meta[17] = | |
333 { 0, | |
334 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, | |
335 2, 2, 2, 2, 2, 2 | |
336 } ; | |
337 | |
338 static yyconst short int yy_base[25] = | |
339 { 0, | |
340 0, 0, 32, 33, 15, 17, 33, 33, 22, 33, | |
341 22, 0, 16, 19, 33, 20, 0, 11, 15, 11, | |
342 12, 0, 33, 21 | |
343 } ; | |
344 | |
345 static yyconst short int yy_def[25] = | |
346 { 0, | |
347 23, 1, 23, 23, 23, 23, 23, 23, 23, 23, | |
348 23, 24, 24, 23, 23, 23, 24, 24, 24, 24, | |
349 24, 24, 0, 23 | |
350 } ; | |
351 | |
352 static yyconst short int yy_nxt[50] = | |
353 { 0, | |
354 4, 5, 6, 7, 8, 9, 10, 11, 4, 12, | |
355 12, 12, 12, 12, 13, 12, 14, 14, 14, 14, | |
356 14, 14, 17, 22, 21, 20, 19, 16, 18, 16, | |
357 15, 23, 3, 23, 23, 23, 23, 23, 23, 23, | |
358 23, 23, 23, 23, 23, 23, 23, 23, 23 | |
359 } ; | |
360 | |
361 static yyconst short int yy_chk[50] = | |
362 { 0, | |
363 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
364 1, 1, 1, 1, 1, 1, 5, 5, 6, 6, | |
365 14, 14, 24, 21, 20, 19, 18, 16, 13, 11, | |
366 9, 3, 23, 23, 23, 23, 23, 23, 23, 23, | |
367 23, 23, 23, 23, 23, 23, 23, 23, 23 | |
368 } ; | |
369 | |
370 static yy_state_type yy_last_accepting_state; | |
371 static char *yy_last_accepting_cpos; | |
372 | |
373 /* The intent behind this definition is that it'll catch | |
374 * any uses of REJECT which flex missed. | |
375 */ | |
376 #define REJECT reject_used_but_not_detected | |
377 #define yymore() yymore_used_but_not_detected | |
378 #define YY_MORE_ADJ 0 | |
379 #define YY_RESTORE_YY_MORE_OFFSET | |
380 char *yytext; | |
381 #line 1 "expr.l" | |
382 #define INITIAL 0 | |
383 #line 2 "expr.l" | |
384 #include "expr.cpp.h" | |
385 | |
386 #ifndef __GNUC__ | |
387 #include <io.h> | |
388 #define isatty _isatty | |
389 #endif | |
390 | |
391 char *exprString; | |
392 int exprCol; | |
393 | |
394 #define YY_INPUT(buf,result,max_size) \ | |
395 { \ | |
396 int c = *exprString++; \ | |
397 exprCol++;\ | |
398 result = (c == 0) ? YY_NULL : (buf[0] = c, 1); \ | |
399 } | |
400 #define YY_MAIN 0 | |
401 #line 400 "expr-lex.cpp" | |
402 | |
403 /* Macros after this point can all be overridden by user definitions in | |
404 * section 1. | |
405 */ | |
406 | |
407 #ifndef YY_SKIP_YYWRAP | |
408 #ifdef __cplusplus | |
409 extern "C" int yywrap YY_PROTO(( void )); | |
410 #else | |
411 extern int yywrap YY_PROTO(( void )); | |
412 #endif | |
413 #endif | |
414 | |
415 #ifndef YY_NO_UNPUT | |
416 static void yyunput YY_PROTO(( int c, char *buf_ptr )); | |
417 #endif | |
418 | |
419 #ifndef yytext_ptr | |
420 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); | |
421 #endif | |
422 | |
423 #ifdef YY_NEED_STRLEN | |
424 static int yy_flex_strlen YY_PROTO(( yyconst char * )); | |
425 #endif | |
426 | |
427 #ifndef YY_NO_INPUT | |
428 #ifdef __cplusplus | |
429 static int yyinput YY_PROTO(( void )); | |
430 #else | |
431 static int input YY_PROTO(( void )); | |
432 #endif | |
433 #endif | |
434 | |
435 #if YY_STACK_USED | |
436 static int yy_start_stack_ptr = 0; | |
437 static int yy_start_stack_depth = 0; | |
438 static int *yy_start_stack = 0; | |
439 #ifndef YY_NO_PUSH_STATE | |
440 static void yy_push_state YY_PROTO(( int new_state )); | |
441 #endif | |
442 #ifndef YY_NO_POP_STATE | |
443 static void yy_pop_state YY_PROTO(( void )); | |
444 #endif | |
445 #ifndef YY_NO_TOP_STATE | |
446 static int yy_top_state YY_PROTO(( void )); | |
447 #endif | |
448 | |
449 #else | |
450 #define YY_NO_PUSH_STATE 1 | |
451 #define YY_NO_POP_STATE 1 | |
452 #define YY_NO_TOP_STATE 1 | |
453 #endif | |
454 | |
455 #ifdef YY_MALLOC_DECL | |
456 YY_MALLOC_DECL | |
457 #else | |
458 #if __STDC__ | |
459 #ifndef __cplusplus | |
460 #include <stdlib.h> | |
461 #endif | |
462 #else | |
463 /* Just try to get by without declaring the routines. This will fail | |
464 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) | |
465 * or sizeof(void*) != sizeof(int). | |
466 */ | |
467 #endif | |
468 #endif | |
469 | |
470 /* Amount of stuff to slurp up with each read. */ | |
471 #ifndef YY_READ_BUF_SIZE | |
472 #define YY_READ_BUF_SIZE 8192 | |
473 #endif | |
474 | |
475 /* Copy whatever the last rule matched to the standard output. */ | |
476 | |
477 #ifndef ECHO | |
478 /* This used to be an fputs(), but since the string might contain NUL's, | |
479 * we now use fwrite(). | |
480 */ | |
481 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) | |
482 #endif | |
483 | |
484 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | |
485 * is returned in "result". | |
486 */ | |
487 #ifndef YY_INPUT | |
488 #define YY_INPUT(buf,result,max_size) \ | |
489 if ( yy_current_buffer->yy_is_interactive ) \ | |
490 { \ | |
491 int c = '*', n; \ | |
492 for ( n = 0; n < max_size && \ | |
493 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ | |
494 buf[n] = (char) c; \ | |
495 if ( c == '\n' ) \ | |
496 buf[n++] = (char) c; \ | |
497 if ( c == EOF && ferror( yyin ) ) \ | |
498 YY_FATAL_ERROR( "input in flex scanner failed" ); \ | |
499 result = n; \ | |
500 } \ | |
501 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ | |
502 && ferror( yyin ) ) \ | |
503 YY_FATAL_ERROR( "input in flex scanner failed" ); | |
504 #endif | |
505 | |
506 /* No semi-colon after return; correct usage is to write "yyterminate();" - | |
507 * we don't want an extra ';' after the "return" because that will cause | |
508 * some compilers to complain about unreachable statements. | |
509 */ | |
510 #ifndef yyterminate | |
511 #define yyterminate() return YY_NULL | |
512 #endif | |
513 | |
514 /* Number of entries by which start-condition stack grows. */ | |
515 #ifndef YY_START_STACK_INCR | |
516 #define YY_START_STACK_INCR 25 | |
517 #endif | |
518 | |
519 /* Report a fatal error. */ | |
520 #ifndef YY_FATAL_ERROR | |
521 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) | |
522 #endif | |
523 | |
524 /* Default declaration of generated scanner - a define so the user can | |
525 * easily add parameters. | |
526 */ | |
527 #ifndef YY_DECL | |
528 #define YY_DECL int yylex YY_PROTO(( void )) | |
529 #endif | |
530 | |
531 /* Code executed at the beginning of each rule, after yytext and yyleng | |
532 * have been set up. | |
533 */ | |
534 #ifndef YY_USER_ACTION | |
535 #define YY_USER_ACTION | |
536 #endif | |
537 | |
538 /* Code executed at the end of each rule. */ | |
539 #ifndef YY_BREAK | |
540 #define YY_BREAK break; | |
541 #endif | |
542 | |
543 #define YY_RULE_SETUP \ | |
544 YY_USER_ACTION | |
545 | |
546 YY_DECL | |
547 { | |
548 register yy_state_type yy_current_state; | |
549 register char *yy_cp = NULL, *yy_bp = NULL; | |
550 register int yy_act; | |
551 | |
552 #line 31 "expr.l" | |
553 | |
554 | |
555 #line 554 "expr-lex.cpp" | |
556 | |
557 if ( yy_init ) | |
558 { | |
559 yy_init = 0; | |
560 | |
561 #ifdef YY_USER_INIT | |
562 YY_USER_INIT; | |
563 #endif | |
564 | |
565 if ( ! yy_start ) | |
566 yy_start = 1; /* first start state */ | |
567 | |
568 if ( ! yyin ) | |
569 yyin = stdin; | |
570 | |
571 if ( ! yyout ) | |
572 yyout = stdout; | |
573 | |
574 if ( ! yy_current_buffer ) | |
575 yy_current_buffer = | |
576 yy_create_buffer( yyin, YY_BUF_SIZE ); | |
577 | |
578 yy_load_buffer_state(); | |
579 } | |
580 | |
581 while ( 1 ) /* loops until end-of-file is reached */ | |
582 { | |
583 yy_cp = yy_c_buf_p; | |
584 | |
585 /* Support of yytext. */ | |
586 *yy_cp = yy_hold_char; | |
587 | |
588 /* yy_bp points to the position in yy_ch_buf of the start of | |
589 * the current run. | |
590 */ | |
591 yy_bp = yy_cp; | |
592 | |
593 yy_current_state = yy_start; | |
594 yy_match: | |
595 do | |
596 { | |
597 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; | |
598 if ( yy_accept[yy_current_state] ) | |
599 { | |
600 yy_last_accepting_state = yy_current_state; | |
601 yy_last_accepting_cpos = yy_cp; | |
602 } | |
603 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | |
604 { | |
605 yy_current_state = (int) yy_def[yy_current_state]; | |
606 if ( yy_current_state >= 24 ) | |
607 yy_c = yy_meta[(unsigned int) yy_c]; | |
608 } | |
609 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | |
610 ++yy_cp; | |
611 } | |
612 while ( yy_base[yy_current_state] != 33 ); | |
613 | |
614 yy_find_action: | |
615 yy_act = yy_accept[yy_current_state]; | |
616 if ( yy_act == 0 ) | |
617 { /* have to back up */ | |
618 yy_cp = yy_last_accepting_cpos; | |
619 yy_current_state = yy_last_accepting_state; | |
620 yy_act = yy_accept[yy_current_state]; | |
621 } | |
622 | |
623 YY_DO_BEFORE_ACTION; | |
624 | |
625 | |
626 do_action: /* This label is used only to access EOF actions. */ | |
627 | |
628 | |
629 switch ( yy_act ) | |
630 { /* beginning of action switch */ | |
631 case 0: /* must back up */ | |
632 /* undo the effects of YY_DO_BEFORE_ACTION */ | |
633 *yy_cp = yy_hold_char; | |
634 yy_cp = yy_last_accepting_cpos; | |
635 yy_current_state = yy_last_accepting_state; | |
636 goto yy_find_action; | |
637 | |
638 case 1: | |
639 YY_RULE_SETUP | |
640 #line 33 "expr.l" | |
641 { | |
642 return TOKEN_SIZEOF; | |
643 } | |
644 YY_BREAK | |
645 case 2: | |
646 YY_RULE_SETUP | |
647 #line 37 "expr.l" | |
648 { | |
649 return TOKEN_IDENTIFIER; | |
650 } | |
651 YY_BREAK | |
652 case 3: | |
653 YY_RULE_SETUP | |
654 #line 41 "expr.l" | |
655 { | |
656 return TOKEN_NUMBER; | |
657 } | |
658 YY_BREAK | |
659 case 4: | |
660 YY_RULE_SETUP | |
661 #line 45 "expr.l" | |
662 { | |
663 return TOKEN_DOT; | |
664 } | |
665 YY_BREAK | |
666 case 5: | |
667 YY_RULE_SETUP | |
668 #line 49 "expr.l" | |
669 { | |
670 return TOKEN_ARROW; | |
671 } | |
672 YY_BREAK | |
673 case 6: | |
674 YY_RULE_SETUP | |
675 #line 53 "expr.l" | |
676 { | |
677 return TOKEN_ADDR; | |
678 } | |
679 YY_BREAK | |
680 case 7: | |
681 YY_RULE_SETUP | |
682 #line 57 "expr.l" | |
683 { | |
684 return TOKEN_STAR; | |
685 } | |
686 YY_BREAK | |
687 case 8: | |
688 YY_RULE_SETUP | |
689 #line 61 "expr.l" | |
690 | |
691 YY_BREAK | |
692 case 9: | |
693 YY_RULE_SETUP | |
694 #line 63 "expr.l" | |
695 return *yytext; | |
696 YY_BREAK | |
697 case 10: | |
698 YY_RULE_SETUP | |
699 #line 65 "expr.l" | |
700 ECHO; | |
701 YY_BREAK | |
702 #line 701 "expr-lex.cpp" | |
703 case YY_STATE_EOF(INITIAL): | |
704 yyterminate(); | |
705 | |
706 case YY_END_OF_BUFFER: | |
707 { | |
708 /* Amount of text matched not including the EOB char. */ | |
709 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; | |
710 | |
711 /* Undo the effects of YY_DO_BEFORE_ACTION. */ | |
712 *yy_cp = yy_hold_char; | |
713 YY_RESTORE_YY_MORE_OFFSET | |
714 | |
715 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) | |
716 { | |
717 /* We're scanning a new file or input source. It's | |
718 * possible that this happened because the user | |
719 * just pointed yyin at a new source and called | |
720 * yylex(). If so, then we have to assure | |
721 * consistency between yy_current_buffer and our | |
722 * globals. Here is the right place to do so, because | |
723 * this is the first action (other than possibly a | |
724 * back-up) that will match for the new input source. | |
725 */ | |
726 yy_n_chars = yy_current_buffer->yy_n_chars; | |
727 yy_current_buffer->yy_input_file = yyin; | |
728 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; | |
729 } | |
730 | |
731 /* Note that here we test for yy_c_buf_p "<=" to the position | |
732 * of the first EOB in the buffer, since yy_c_buf_p will | |
733 * already have been incremented past the NUL character | |
734 * (since all states make transitions on EOB to the | |
735 * end-of-buffer state). Contrast this with the test | |
736 * in input(). | |
737 */ | |
738 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) | |
739 { /* This was really a NUL. */ | |
740 yy_state_type yy_next_state; | |
741 | |
742 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; | |
743 | |
744 yy_current_state = yy_get_previous_state(); | |
745 | |
746 /* Okay, we're now positioned to make the NUL | |
747 * transition. We couldn't have | |
748 * yy_get_previous_state() go ahead and do it | |
749 * for us because it doesn't know how to deal | |
750 * with the possibility of jamming (and we don't | |
751 * want to build jamming into it because then it | |
752 * will run more slowly). | |
753 */ | |
754 | |
755 yy_next_state = yy_try_NUL_trans( yy_current_state ); | |
756 | |
757 yy_bp = yytext_ptr + YY_MORE_ADJ; | |
758 | |
759 if ( yy_next_state ) | |
760 { | |
761 /* Consume the NUL. */ | |
762 yy_cp = ++yy_c_buf_p; | |
763 yy_current_state = yy_next_state; | |
764 goto yy_match; | |
765 } | |
766 | |
767 else | |
768 { | |
769 yy_cp = yy_c_buf_p; | |
770 goto yy_find_action; | |
771 } | |
772 } | |
773 | |
774 else switch ( yy_get_next_buffer() ) | |
775 { | |
776 case EOB_ACT_END_OF_FILE: | |
777 { | |
778 yy_did_buffer_switch_on_eof = 0; | |
779 | |
780 if ( yywrap() ) | |
781 { | |
782 /* Note: because we've taken care in | |
783 * yy_get_next_buffer() to have set up | |
784 * yytext, we can now set up | |
785 * yy_c_buf_p so that if some total | |
786 * hoser (like flex itself) wants to | |
787 * call the scanner after we return the | |
788 * YY_NULL, it'll still work - another | |
789 * YY_NULL will get returned. | |
790 */ | |
791 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; | |
792 | |
793 yy_act = YY_STATE_EOF(YY_START); | |
794 goto do_action; | |
795 } | |
796 | |
797 else | |
798 { | |
799 if ( ! yy_did_buffer_switch_on_eof ) | |
800 YY_NEW_FILE; | |
801 } | |
802 break; | |
803 } | |
804 | |
805 case EOB_ACT_CONTINUE_SCAN: | |
806 yy_c_buf_p = | |
807 yytext_ptr + yy_amount_of_matched_text; | |
808 | |
809 yy_current_state = yy_get_previous_state(); | |
810 | |
811 yy_cp = yy_c_buf_p; | |
812 yy_bp = yytext_ptr + YY_MORE_ADJ; | |
813 goto yy_match; | |
814 | |
815 case EOB_ACT_LAST_MATCH: | |
816 yy_c_buf_p = | |
817 &yy_current_buffer->yy_ch_buf[yy_n_chars]; | |
818 | |
819 yy_current_state = yy_get_previous_state(); | |
820 | |
821 yy_cp = yy_c_buf_p; | |
822 yy_bp = yytext_ptr + YY_MORE_ADJ; | |
823 goto yy_find_action; | |
824 } | |
825 break; | |
826 } | |
827 | |
828 default: | |
829 YY_FATAL_ERROR( | |
830 "fatal flex scanner internal error--no action found" ); | |
831 } /* end of action switch */ | |
832 } /* end of scanning one token */ | |
833 } /* end of yylex */ | |
834 | |
835 | |
836 /* yy_get_next_buffer - try to read in a new buffer | |
837 * | |
838 * Returns a code representing an action: | |
839 * EOB_ACT_LAST_MATCH - | |
840 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position | |
841 * EOB_ACT_END_OF_FILE - end of file | |
842 */ | |
843 | |
844 static int yy_get_next_buffer() | |
845 { | |
846 register char *dest = yy_current_buffer->yy_ch_buf; | |
847 register char *source = yytext_ptr; | |
848 register int number_to_move, i; | |
849 int ret_val; | |
850 | |
851 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) | |
852 YY_FATAL_ERROR( | |
853 "fatal flex scanner internal error--end of buffer missed" ); | |
854 | |
855 if ( yy_current_buffer->yy_fill_buffer == 0 ) | |
856 { /* Don't try to fill the buffer, so this is an EOF. */ | |
857 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) | |
858 { | |
859 /* We matched a single character, the EOB, so | |
860 * treat this as a final EOF. | |
861 */ | |
862 return EOB_ACT_END_OF_FILE; | |
863 } | |
864 | |
865 else | |
866 { | |
867 /* We matched some text prior to the EOB, first | |
868 * process it. | |
869 */ | |
870 return EOB_ACT_LAST_MATCH; | |
871 } | |
872 } | |
873 | |
874 /* Try to read more data. */ | |
875 | |
876 /* First move last chars to start of buffer. */ | |
877 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; | |
878 | |
879 for ( i = 0; i < number_to_move; ++i ) | |
880 *(dest++) = *(source++); | |
881 | |
882 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) | |
883 /* don't do the read, it's not guaranteed to return an EOF, | |
884 * just force an EOF | |
885 */ | |
886 yy_current_buffer->yy_n_chars = yy_n_chars = 0; | |
887 | |
888 else | |
889 { | |
890 int num_to_read = | |
891 yy_current_buffer->yy_buf_size - number_to_move - 1; | |
892 | |
893 while ( num_to_read <= 0 ) | |
894 { /* Not enough room in the buffer - grow it. */ | |
895 #ifdef YY_USES_REJECT | |
896 YY_FATAL_ERROR( | |
897 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); | |
898 #else | |
899 | |
900 /* just a shorter name for the current buffer */ | |
901 YY_BUFFER_STATE b = yy_current_buffer; | |
902 | |
903 int yy_c_buf_p_offset = | |
904 (int) (yy_c_buf_p - b->yy_ch_buf); | |
905 | |
906 if ( b->yy_is_our_buffer ) | |
907 { | |
908 int new_size = b->yy_buf_size * 2; | |
909 | |
910 if ( new_size <= 0 ) | |
911 b->yy_buf_size += b->yy_buf_size / 8; | |
912 else | |
913 b->yy_buf_size *= 2; | |
914 | |
915 b->yy_ch_buf = (char *) | |
916 /* Include room in for 2 EOB chars. */ | |
917 yy_flex_realloc( (void *) b->yy_ch_buf, | |
918 b->yy_buf_size + 2 ); | |
919 } | |
920 else | |
921 /* Can't grow it, we don't own it. */ | |
922 b->yy_ch_buf = 0; | |
923 | |
924 if ( ! b->yy_ch_buf ) | |
925 YY_FATAL_ERROR( | |
926 "fatal error - scanner input buffer overflow" ); | |
927 | |
928 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; | |
929 | |
930 num_to_read = yy_current_buffer->yy_buf_size - | |
931 number_to_move - 1; | |
932 #endif | |
933 } | |
934 | |
935 if ( num_to_read > YY_READ_BUF_SIZE ) | |
936 num_to_read = YY_READ_BUF_SIZE; | |
937 | |
938 /* Read in more data. */ | |
939 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), | |
940 yy_n_chars, num_to_read ); | |
941 | |
942 yy_current_buffer->yy_n_chars = yy_n_chars; | |
943 } | |
944 | |
945 if ( yy_n_chars == 0 ) | |
946 { | |
947 if ( number_to_move == YY_MORE_ADJ ) | |
948 { | |
949 ret_val = EOB_ACT_END_OF_FILE; | |
950 yyrestart( yyin ); | |
951 } | |
952 | |
953 else | |
954 { | |
955 ret_val = EOB_ACT_LAST_MATCH; | |
956 yy_current_buffer->yy_buffer_status = | |
957 YY_BUFFER_EOF_PENDING; | |
958 } | |
959 } | |
960 | |
961 else | |
962 ret_val = EOB_ACT_CONTINUE_SCAN; | |
963 | |
964 yy_n_chars += number_to_move; | |
965 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; | |
966 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; | |
967 | |
968 yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; | |
969 | |
970 return ret_val; | |
971 } | |
972 | |
973 | |
974 /* yy_get_previous_state - get the state just before the EOB char was reached */ | |
975 | |
976 static yy_state_type yy_get_previous_state() | |
977 { | |
978 register yy_state_type yy_current_state; | |
979 register char *yy_cp; | |
980 | |
981 yy_current_state = yy_start; | |
982 | |
983 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) | |
984 { | |
985 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); | |
986 if ( yy_accept[yy_current_state] ) | |
987 { | |
988 yy_last_accepting_state = yy_current_state; | |
989 yy_last_accepting_cpos = yy_cp; | |
990 } | |
991 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | |
992 { | |
993 yy_current_state = (int) yy_def[yy_current_state]; | |
994 if ( yy_current_state >= 24 ) | |
995 yy_c = yy_meta[(unsigned int) yy_c]; | |
996 } | |
997 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | |
998 } | |
999 | |
1000 return yy_current_state; | |
1001 } | |
1002 | |
1003 | |
1004 /* yy_try_NUL_trans - try to make a transition on the NUL character | |
1005 * | |
1006 * synopsis | |
1007 * next_state = yy_try_NUL_trans( current_state ); | |
1008 */ | |
1009 | |
1010 #ifdef YY_USE_PROTOS | |
1011 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) | |
1012 #else | |
1013 static yy_state_type yy_try_NUL_trans( yy_current_state ) | |
1014 yy_state_type yy_current_state; | |
1015 #endif | |
1016 { | |
1017 register int yy_is_jam; | |
1018 register char *yy_cp = yy_c_buf_p; | |
1019 | |
1020 register YY_CHAR yy_c = 1; | |
1021 if ( yy_accept[yy_current_state] ) | |
1022 { | |
1023 yy_last_accepting_state = yy_current_state; | |
1024 yy_last_accepting_cpos = yy_cp; | |
1025 } | |
1026 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | |
1027 { | |
1028 yy_current_state = (int) yy_def[yy_current_state]; | |
1029 if ( yy_current_state >= 24 ) | |
1030 yy_c = yy_meta[(unsigned int) yy_c]; | |
1031 } | |
1032 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | |
1033 yy_is_jam = (yy_current_state == 23); | |
1034 | |
1035 return yy_is_jam ? 0 : yy_current_state; | |
1036 } | |
1037 | |
1038 | |
1039 #ifndef YY_NO_UNPUT | |
1040 #ifdef YY_USE_PROTOS | |
1041 static void yyunput( int c, register char *yy_bp ) | |
1042 #else | |
1043 static void yyunput( c, yy_bp ) | |
1044 int c; | |
1045 register char *yy_bp; | |
1046 #endif | |
1047 { | |
1048 register char *yy_cp = yy_c_buf_p; | |
1049 | |
1050 /* undo effects of setting up yytext */ | |
1051 *yy_cp = yy_hold_char; | |
1052 | |
1053 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) | |
1054 { /* need to shift things up to make room */ | |
1055 /* +2 for EOB chars. */ | |
1056 register int number_to_move = yy_n_chars + 2; | |
1057 register char *dest = &yy_current_buffer->yy_ch_buf[ | |
1058 yy_current_buffer->yy_buf_size + 2]; | |
1059 register char *source = | |
1060 &yy_current_buffer->yy_ch_buf[number_to_move]; | |
1061 | |
1062 while ( source > yy_current_buffer->yy_ch_buf ) | |
1063 *--dest = *--source; | |
1064 | |
1065 yy_cp += (int) (dest - source); | |
1066 yy_bp += (int) (dest - source); | |
1067 yy_current_buffer->yy_n_chars = | |
1068 yy_n_chars = yy_current_buffer->yy_buf_size; | |
1069 | |
1070 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) | |
1071 YY_FATAL_ERROR( "flex scanner push-back overflow" ); | |
1072 } | |
1073 | |
1074 *--yy_cp = (char) c; | |
1075 | |
1076 | |
1077 yytext_ptr = yy_bp; | |
1078 yy_hold_char = *yy_cp; | |
1079 yy_c_buf_p = yy_cp; | |
1080 } | |
1081 #endif /* ifndef YY_NO_UNPUT */ | |
1082 | |
1083 | |
1084 #ifdef __cplusplus | |
1085 static int yyinput() | |
1086 #else | |
1087 static int input() | |
1088 #endif | |
1089 { | |
1090 int c; | |
1091 | |
1092 *yy_c_buf_p = yy_hold_char; | |
1093 | |
1094 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) | |
1095 { | |
1096 /* yy_c_buf_p now points to the character we want to return. | |
1097 * If this occurs *before* the EOB characters, then it's a | |
1098 * valid NUL; if not, then we've hit the end of the buffer. | |
1099 */ | |
1100 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) | |
1101 /* This was really a NUL. */ | |
1102 *yy_c_buf_p = '\0'; | |
1103 | |
1104 else | |
1105 { /* need more input */ | |
1106 int offset = yy_c_buf_p - yytext_ptr; | |
1107 ++yy_c_buf_p; | |
1108 | |
1109 switch ( yy_get_next_buffer() ) | |
1110 { | |
1111 case EOB_ACT_LAST_MATCH: | |
1112 /* This happens because yy_g_n_b() | |
1113 * sees that we've accumulated a | |
1114 * token and flags that we need to | |
1115 * try matching the token before | |
1116 * proceeding. But for input(), | |
1117 * there's no matching to consider. | |
1118 * So convert the EOB_ACT_LAST_MATCH | |
1119 * to EOB_ACT_END_OF_FILE. | |
1120 */ | |
1121 | |
1122 /* Reset buffer status. */ | |
1123 yyrestart( yyin ); | |
1124 | |
1125 /* fall through */ | |
1126 | |
1127 case EOB_ACT_END_OF_FILE: | |
1128 { | |
1129 if ( yywrap() ) | |
1130 return EOF; | |
1131 | |
1132 if ( ! yy_did_buffer_switch_on_eof ) | |
1133 YY_NEW_FILE; | |
1134 #ifdef __cplusplus | |
1135 return yyinput(); | |
1136 #else | |
1137 return input(); | |
1138 #endif | |
1139 } | |
1140 | |
1141 case EOB_ACT_CONTINUE_SCAN: | |
1142 yy_c_buf_p = yytext_ptr + offset; | |
1143 break; | |
1144 } | |
1145 } | |
1146 } | |
1147 | |
1148 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ | |
1149 *yy_c_buf_p = '\0'; /* preserve yytext */ | |
1150 yy_hold_char = *++yy_c_buf_p; | |
1151 | |
1152 | |
1153 return c; | |
1154 } | |
1155 | |
1156 | |
1157 #ifdef YY_USE_PROTOS | |
1158 void yyrestart( FILE *input_file ) | |
1159 #else | |
1160 void yyrestart( input_file ) | |
1161 FILE *input_file; | |
1162 #endif | |
1163 { | |
1164 if ( ! yy_current_buffer ) | |
1165 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); | |
1166 | |
1167 yy_init_buffer( yy_current_buffer, input_file ); | |
1168 yy_load_buffer_state(); | |
1169 } | |
1170 | |
1171 | |
1172 #ifdef YY_USE_PROTOS | |
1173 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) | |
1174 #else | |
1175 void yy_switch_to_buffer( new_buffer ) | |
1176 YY_BUFFER_STATE new_buffer; | |
1177 #endif | |
1178 { | |
1179 if ( yy_current_buffer == new_buffer ) | |
1180 return; | |
1181 | |
1182 if ( yy_current_buffer ) | |
1183 { | |
1184 /* Flush out information for old buffer. */ | |
1185 *yy_c_buf_p = yy_hold_char; | |
1186 yy_current_buffer->yy_buf_pos = yy_c_buf_p; | |
1187 yy_current_buffer->yy_n_chars = yy_n_chars; | |
1188 } | |
1189 | |
1190 yy_current_buffer = new_buffer; | |
1191 yy_load_buffer_state(); | |
1192 | |
1193 /* We don't actually know whether we did this switch during | |
1194 * EOF (yywrap()) processing, but the only time this flag | |
1195 * is looked at is after yywrap() is called, so it's safe | |
1196 * to go ahead and always set it. | |
1197 */ | |
1198 yy_did_buffer_switch_on_eof = 1; | |
1199 } | |
1200 | |
1201 | |
1202 #ifdef YY_USE_PROTOS | |
1203 void yy_load_buffer_state( void ) | |
1204 #else | |
1205 void yy_load_buffer_state() | |
1206 #endif | |
1207 { | |
1208 yy_n_chars = yy_current_buffer->yy_n_chars; | |
1209 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; | |
1210 yyin = yy_current_buffer->yy_input_file; | |
1211 yy_hold_char = *yy_c_buf_p; | |
1212 } | |
1213 | |
1214 | |
1215 #ifdef YY_USE_PROTOS | |
1216 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) | |
1217 #else | |
1218 YY_BUFFER_STATE yy_create_buffer( file, size ) | |
1219 FILE *file; | |
1220 int size; | |
1221 #endif | |
1222 { | |
1223 YY_BUFFER_STATE b; | |
1224 | |
1225 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); | |
1226 if ( ! b ) | |
1227 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); | |
1228 | |
1229 b->yy_buf_size = size; | |
1230 | |
1231 /* yy_ch_buf has to be 2 characters longer than the size given because | |
1232 * we need to put in 2 end-of-buffer characters. | |
1233 */ | |
1234 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); | |
1235 if ( ! b->yy_ch_buf ) | |
1236 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); | |
1237 | |
1238 b->yy_is_our_buffer = 1; | |
1239 | |
1240 yy_init_buffer( b, file ); | |
1241 | |
1242 return b; | |
1243 } | |
1244 | |
1245 | |
1246 #ifdef YY_USE_PROTOS | |
1247 void yy_delete_buffer( YY_BUFFER_STATE b ) | |
1248 #else | |
1249 void yy_delete_buffer( b ) | |
1250 YY_BUFFER_STATE b; | |
1251 #endif | |
1252 { | |
1253 if ( ! b ) | |
1254 return; | |
1255 | |
1256 if ( b == yy_current_buffer ) | |
1257 yy_current_buffer = (YY_BUFFER_STATE) 0; | |
1258 | |
1259 if ( b->yy_is_our_buffer ) | |
1260 yy_flex_free( (void *) b->yy_ch_buf ); | |
1261 | |
1262 yy_flex_free( (void *) b ); | |
1263 } | |
1264 | |
1265 | |
1266 | |
1267 #ifdef YY_USE_PROTOS | |
1268 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) | |
1269 #else | |
1270 void yy_init_buffer( b, file ) | |
1271 YY_BUFFER_STATE b; | |
1272 FILE *file; | |
1273 #endif | |
1274 | |
1275 | |
1276 { | |
1277 yy_flush_buffer( b ); | |
1278 | |
1279 b->yy_input_file = file; | |
1280 b->yy_fill_buffer = 1; | |
1281 | |
1282 #if YY_ALWAYS_INTERACTIVE | |
1283 b->yy_is_interactive = 1; | |
1284 #else | |
1285 #if YY_NEVER_INTERACTIVE | |
1286 b->yy_is_interactive = 0; | |
1287 #else | |
1288 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; | |
1289 #endif | |
1290 #endif | |
1291 } | |
1292 | |
1293 | |
1294 #ifdef YY_USE_PROTOS | |
1295 void yy_flush_buffer( YY_BUFFER_STATE b ) | |
1296 #else | |
1297 void yy_flush_buffer( b ) | |
1298 YY_BUFFER_STATE b; | |
1299 #endif | |
1300 | |
1301 { | |
1302 if ( ! b ) | |
1303 return; | |
1304 | |
1305 b->yy_n_chars = 0; | |
1306 | |
1307 /* We always need two end-of-buffer characters. The first causes | |
1308 * a transition to the end-of-buffer state. The second causes | |
1309 * a jam in that state. | |
1310 */ | |
1311 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; | |
1312 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; | |
1313 | |
1314 b->yy_buf_pos = &b->yy_ch_buf[0]; | |
1315 | |
1316 b->yy_at_bol = 1; | |
1317 b->yy_buffer_status = YY_BUFFER_NEW; | |
1318 | |
1319 if ( b == yy_current_buffer ) | |
1320 yy_load_buffer_state(); | |
1321 } | |
1322 | |
1323 | |
1324 #ifndef YY_NO_SCAN_BUFFER | |
1325 #ifdef YY_USE_PROTOS | |
1326 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) | |
1327 #else | |
1328 YY_BUFFER_STATE yy_scan_buffer( base, size ) | |
1329 char *base; | |
1330 yy_size_t size; | |
1331 #endif | |
1332 { | |
1333 YY_BUFFER_STATE b; | |
1334 | |
1335 if ( size < 2 || | |
1336 base[size-2] != YY_END_OF_BUFFER_CHAR || | |
1337 base[size-1] != YY_END_OF_BUFFER_CHAR ) | |
1338 /* They forgot to leave room for the EOB's. */ | |
1339 return 0; | |
1340 | |
1341 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); | |
1342 if ( ! b ) | |
1343 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); | |
1344 | |
1345 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ | |
1346 b->yy_buf_pos = b->yy_ch_buf = base; | |
1347 b->yy_is_our_buffer = 0; | |
1348 b->yy_input_file = 0; | |
1349 b->yy_n_chars = b->yy_buf_size; | |
1350 b->yy_is_interactive = 0; | |
1351 b->yy_at_bol = 1; | |
1352 b->yy_fill_buffer = 0; | |
1353 b->yy_buffer_status = YY_BUFFER_NEW; | |
1354 | |
1355 yy_switch_to_buffer( b ); | |
1356 | |
1357 return b; | |
1358 } | |
1359 #endif | |
1360 | |
1361 | |
1362 #ifndef YY_NO_SCAN_STRING | |
1363 #ifdef YY_USE_PROTOS | |
1364 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) | |
1365 #else | |
1366 YY_BUFFER_STATE yy_scan_string( yy_str ) | |
1367 yyconst char *yy_str; | |
1368 #endif | |
1369 { | |
1370 int len; | |
1371 for ( len = 0; yy_str[len]; ++len ) | |
1372 ; | |
1373 | |
1374 return yy_scan_bytes( yy_str, len ); | |
1375 } | |
1376 #endif | |
1377 | |
1378 | |
1379 #ifndef YY_NO_SCAN_BYTES | |
1380 #ifdef YY_USE_PROTOS | |
1381 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) | |
1382 #else | |
1383 YY_BUFFER_STATE yy_scan_bytes( bytes, len ) | |
1384 yyconst char *bytes; | |
1385 int len; | |
1386 #endif | |
1387 { | |
1388 YY_BUFFER_STATE b; | |
1389 char *buf; | |
1390 yy_size_t n; | |
1391 int i; | |
1392 | |
1393 /* Get memory for full buffer, including space for trailing EOB's. */ | |
1394 n = len + 2; | |
1395 buf = (char *) yy_flex_alloc( n ); | |
1396 if ( ! buf ) | |
1397 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); | |
1398 | |
1399 for ( i = 0; i < len; ++i ) | |
1400 buf[i] = bytes[i]; | |
1401 | |
1402 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; | |
1403 | |
1404 b = yy_scan_buffer( buf, n ); | |
1405 if ( ! b ) | |
1406 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); | |
1407 | |
1408 /* It's okay to grow etc. this buffer, and we should throw it | |
1409 * away when we're done. | |
1410 */ | |
1411 b->yy_is_our_buffer = 1; | |
1412 | |
1413 return b; | |
1414 } | |
1415 #endif | |
1416 | |
1417 | |
1418 #ifndef YY_NO_PUSH_STATE | |
1419 #ifdef YY_USE_PROTOS | |
1420 static void yy_push_state( int new_state ) | |
1421 #else | |
1422 static void yy_push_state( new_state ) | |
1423 int new_state; | |
1424 #endif | |
1425 { | |
1426 if ( yy_start_stack_ptr >= yy_start_stack_depth ) | |
1427 { | |
1428 yy_size_t new_size; | |
1429 | |
1430 yy_start_stack_depth += YY_START_STACK_INCR; | |
1431 new_size = yy_start_stack_depth * sizeof( int ); | |
1432 | |
1433 if ( ! yy_start_stack ) | |
1434 yy_start_stack = (int *) yy_flex_alloc( new_size ); | |
1435 | |
1436 else | |
1437 yy_start_stack = (int *) yy_flex_realloc( | |
1438 (void *) yy_start_stack, new_size ); | |
1439 | |
1440 if ( ! yy_start_stack ) | |
1441 YY_FATAL_ERROR( | |
1442 "out of memory expanding start-condition stack" ); | |
1443 } | |
1444 | |
1445 yy_start_stack[yy_start_stack_ptr++] = YY_START; | |
1446 | |
1447 BEGIN(new_state); | |
1448 } | |
1449 #endif | |
1450 | |
1451 | |
1452 #ifndef YY_NO_POP_STATE | |
1453 static void yy_pop_state() | |
1454 { | |
1455 if ( --yy_start_stack_ptr < 0 ) | |
1456 YY_FATAL_ERROR( "start-condition stack underflow" ); | |
1457 | |
1458 BEGIN(yy_start_stack[yy_start_stack_ptr]); | |
1459 } | |
1460 #endif | |
1461 | |
1462 | |
1463 #ifndef YY_NO_TOP_STATE | |
1464 static int yy_top_state() | |
1465 { | |
1466 return yy_start_stack[yy_start_stack_ptr - 1]; | |
1467 } | |
1468 #endif | |
1469 | |
1470 #ifndef YY_EXIT_FAILURE | |
1471 #define YY_EXIT_FAILURE 2 | |
1472 #endif | |
1473 | |
1474 #ifdef YY_USE_PROTOS | |
1475 static void yy_fatal_error( yyconst char msg[] ) | |
1476 #else | |
1477 static void yy_fatal_error( msg ) | |
1478 char msg[]; | |
1479 #endif | |
1480 { | |
1481 (void) fprintf( stderr, "%s\n", msg ); | |
1482 exit( YY_EXIT_FAILURE ); | |
1483 } | |
1484 | |
1485 | |
1486 | |
1487 /* Redefine yyless() so it works in section 3 code. */ | |
1488 | |
1489 #undef yyless | |
1490 #define yyless(n) \ | |
1491 do \ | |
1492 { \ | |
1493 /* Undo effects of setting up yytext. */ \ | |
1494 yytext[yyleng] = yy_hold_char; \ | |
1495 yy_c_buf_p = yytext + n; \ | |
1496 yy_hold_char = *yy_c_buf_p; \ | |
1497 *yy_c_buf_p = '\0'; \ | |
1498 yyleng = n; \ | |
1499 } \ | |
1500 while ( 0 ) | |
1501 | |
1502 | |
1503 /* Internal utility routines. */ | |
1504 | |
1505 #ifndef yytext_ptr | |
1506 #ifdef YY_USE_PROTOS | |
1507 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) | |
1508 #else | |
1509 static void yy_flex_strncpy( s1, s2, n ) | |
1510 char *s1; | |
1511 yyconst char *s2; | |
1512 int n; | |
1513 #endif | |
1514 { | |
1515 register int i; | |
1516 for ( i = 0; i < n; ++i ) | |
1517 s1[i] = s2[i]; | |
1518 } | |
1519 #endif | |
1520 | |
1521 #ifdef YY_NEED_STRLEN | |
1522 #ifdef YY_USE_PROTOS | |
1523 static int yy_flex_strlen( yyconst char *s ) | |
1524 #else | |
1525 static int yy_flex_strlen( s ) | |
1526 yyconst char *s; | |
1527 #endif | |
1528 { | |
1529 register int n; | |
1530 for ( n = 0; s[n]; ++n ) | |
1531 ; | |
1532 | |
1533 return n; | |
1534 } | |
1535 #endif | |
1536 | |
1537 | |
1538 #ifdef YY_USE_PROTOS | |
1539 static void *yy_flex_alloc( yy_size_t size ) | |
1540 #else | |
1541 static void *yy_flex_alloc( size ) | |
1542 yy_size_t size; | |
1543 #endif | |
1544 { | |
1545 return (void *) malloc( size ); | |
1546 } | |
1547 | |
1548 #ifdef YY_USE_PROTOS | |
1549 static void *yy_flex_realloc( void *ptr, yy_size_t size ) | |
1550 #else | |
1551 static void *yy_flex_realloc( ptr, size ) | |
1552 void *ptr; | |
1553 yy_size_t size; | |
1554 #endif | |
1555 { | |
1556 /* The cast to (char *) in the following accommodates both | |
1557 * implementations that use char* generic pointers, and those | |
1558 * that use void* generic pointers. It works with the latter | |
1559 * because both ANSI C and C++ allow castless assignment from | |
1560 * any pointer type to void*, and deal with argument conversions | |
1561 * as though doing an assignment. | |
1562 */ | |
1563 return (void *) realloc( (char *) ptr, size ); | |
1564 } | |
1565 | |
1566 #ifdef YY_USE_PROTOS | |
1567 static void yy_flex_free( void *ptr ) | |
1568 #else | |
1569 static void yy_flex_free( ptr ) | |
1570 void *ptr; | |
1571 #endif | |
1572 { | |
1573 free( ptr ); | |
1574 } | |
1575 | |
1576 #if YY_MAIN | |
1577 int main() | |
1578 { | |
1579 yylex(); | |
1580 return 0; | |
1581 } | |
1582 #endif | |
1583 #line 65 "expr.l" | |
1584 | |
1585 | |
1586 void exprCleanBuffer() | |
1587 { | |
1588 yy_delete_buffer(yy_current_buffer); | |
1589 yy_init = 1; | |
1590 } |