1 |
|
2 |
#line 3 "<stdout>" |
3 |
|
4 |
#define YY_INT_ALIGNED short int |
5 |
|
6 |
/* A lexical scanner generated by flex */ |
7 |
|
8 |
#define yy_create_buffer typ__create_buffer |
9 |
#define yy_delete_buffer typ__delete_buffer |
10 |
#define yy_scan_buffer typ__scan_buffer |
11 |
#define yy_scan_string typ__scan_string |
12 |
#define yy_scan_bytes typ__scan_bytes |
13 |
#define yy_init_buffer typ__init_buffer |
14 |
#define yy_flush_buffer typ__flush_buffer |
15 |
#define yy_load_buffer_state typ__load_buffer_state |
16 |
#define yy_switch_to_buffer typ__switch_to_buffer |
17 |
#define yypush_buffer_state typ_push_buffer_state |
18 |
#define yypop_buffer_state typ_pop_buffer_state |
19 |
#define yyensure_buffer_stack typ_ensure_buffer_stack |
20 |
#define yy_flex_debug typ__flex_debug |
21 |
#define yyin typ_in |
22 |
#define yyleng typ_leng |
23 |
#define yylex typ_lex |
24 |
#define yylineno typ_lineno |
25 |
#define yyout typ_out |
26 |
#define yyrestart typ_restart |
27 |
#define yytext typ_text |
28 |
#define yywrap typ_wrap |
29 |
#define yyalloc typ_alloc |
30 |
#define yyrealloc typ_realloc |
31 |
#define yyfree typ_free |
32 |
|
33 |
#define FLEX_SCANNER |
34 |
#define YY_FLEX_MAJOR_VERSION 2 |
35 |
#define YY_FLEX_MINOR_VERSION 6 |
36 |
#define YY_FLEX_SUBMINOR_VERSION 4 |
37 |
#if YY_FLEX_SUBMINOR_VERSION > 0 |
38 |
#define FLEX_BETA |
39 |
#endif |
40 |
|
41 |
#ifdef yy_create_buffer |
42 |
#define typ__create_buffer_ALREADY_DEFINED |
43 |
#else |
44 |
#define yy_create_buffer typ__create_buffer |
45 |
#endif |
46 |
|
47 |
#ifdef yy_delete_buffer |
48 |
#define typ__delete_buffer_ALREADY_DEFINED |
49 |
#else |
50 |
#define yy_delete_buffer typ__delete_buffer |
51 |
#endif |
52 |
|
53 |
#ifdef yy_scan_buffer |
54 |
#define typ__scan_buffer_ALREADY_DEFINED |
55 |
#else |
56 |
#define yy_scan_buffer typ__scan_buffer |
57 |
#endif |
58 |
|
59 |
#ifdef yy_scan_string |
60 |
#define typ__scan_string_ALREADY_DEFINED |
61 |
#else |
62 |
#define yy_scan_string typ__scan_string |
63 |
#endif |
64 |
|
65 |
#ifdef yy_scan_bytes |
66 |
#define typ__scan_bytes_ALREADY_DEFINED |
67 |
#else |
68 |
#define yy_scan_bytes typ__scan_bytes |
69 |
#endif |
70 |
|
71 |
#ifdef yy_init_buffer |
72 |
#define typ__init_buffer_ALREADY_DEFINED |
73 |
#else |
74 |
#define yy_init_buffer typ__init_buffer |
75 |
#endif |
76 |
|
77 |
#ifdef yy_flush_buffer |
78 |
#define typ__flush_buffer_ALREADY_DEFINED |
79 |
#else |
80 |
#define yy_flush_buffer typ__flush_buffer |
81 |
#endif |
82 |
|
83 |
#ifdef yy_load_buffer_state |
84 |
#define typ__load_buffer_state_ALREADY_DEFINED |
85 |
#else |
86 |
#define yy_load_buffer_state typ__load_buffer_state |
87 |
#endif |
88 |
|
89 |
#ifdef yy_switch_to_buffer |
90 |
#define typ__switch_to_buffer_ALREADY_DEFINED |
91 |
#else |
92 |
#define yy_switch_to_buffer typ__switch_to_buffer |
93 |
#endif |
94 |
|
95 |
#ifdef yypush_buffer_state |
96 |
#define typ_push_buffer_state_ALREADY_DEFINED |
97 |
#else |
98 |
#define yypush_buffer_state typ_push_buffer_state |
99 |
#endif |
100 |
|
101 |
#ifdef yypop_buffer_state |
102 |
#define typ_pop_buffer_state_ALREADY_DEFINED |
103 |
#else |
104 |
#define yypop_buffer_state typ_pop_buffer_state |
105 |
#endif |
106 |
|
107 |
#ifdef yyensure_buffer_stack |
108 |
#define typ_ensure_buffer_stack_ALREADY_DEFINED |
109 |
#else |
110 |
#define yyensure_buffer_stack typ_ensure_buffer_stack |
111 |
#endif |
112 |
|
113 |
#ifdef yylex |
114 |
#define typ_lex_ALREADY_DEFINED |
115 |
#else |
116 |
#define yylex typ_lex |
117 |
#endif |
118 |
|
119 |
#ifdef yyrestart |
120 |
#define typ_restart_ALREADY_DEFINED |
121 |
#else |
122 |
#define yyrestart typ_restart |
123 |
#endif |
124 |
|
125 |
#ifdef yylex_init |
126 |
#define typ_lex_init_ALREADY_DEFINED |
127 |
#else |
128 |
#define yylex_init typ_lex_init |
129 |
#endif |
130 |
|
131 |
#ifdef yylex_init_extra |
132 |
#define typ_lex_init_extra_ALREADY_DEFINED |
133 |
#else |
134 |
#define yylex_init_extra typ_lex_init_extra |
135 |
#endif |
136 |
|
137 |
#ifdef yylex_destroy |
138 |
#define typ_lex_destroy_ALREADY_DEFINED |
139 |
#else |
140 |
#define yylex_destroy typ_lex_destroy |
141 |
#endif |
142 |
|
143 |
#ifdef yyget_debug |
144 |
#define typ_get_debug_ALREADY_DEFINED |
145 |
#else |
146 |
#define yyget_debug typ_get_debug |
147 |
#endif |
148 |
|
149 |
#ifdef yyset_debug |
150 |
#define typ_set_debug_ALREADY_DEFINED |
151 |
#else |
152 |
#define yyset_debug typ_set_debug |
153 |
#endif |
154 |
|
155 |
#ifdef yyget_extra |
156 |
#define typ_get_extra_ALREADY_DEFINED |
157 |
#else |
158 |
#define yyget_extra typ_get_extra |
159 |
#endif |
160 |
|
161 |
#ifdef yyset_extra |
162 |
#define typ_set_extra_ALREADY_DEFINED |
163 |
#else |
164 |
#define yyset_extra typ_set_extra |
165 |
#endif |
166 |
|
167 |
#ifdef yyget_in |
168 |
#define typ_get_in_ALREADY_DEFINED |
169 |
#else |
170 |
#define yyget_in typ_get_in |
171 |
#endif |
172 |
|
173 |
#ifdef yyset_in |
174 |
#define typ_set_in_ALREADY_DEFINED |
175 |
#else |
176 |
#define yyset_in typ_set_in |
177 |
#endif |
178 |
|
179 |
#ifdef yyget_out |
180 |
#define typ_get_out_ALREADY_DEFINED |
181 |
#else |
182 |
#define yyget_out typ_get_out |
183 |
#endif |
184 |
|
185 |
#ifdef yyset_out |
186 |
#define typ_set_out_ALREADY_DEFINED |
187 |
#else |
188 |
#define yyset_out typ_set_out |
189 |
#endif |
190 |
|
191 |
#ifdef yyget_leng |
192 |
#define typ_get_leng_ALREADY_DEFINED |
193 |
#else |
194 |
#define yyget_leng typ_get_leng |
195 |
#endif |
196 |
|
197 |
#ifdef yyget_text |
198 |
#define typ_get_text_ALREADY_DEFINED |
199 |
#else |
200 |
#define yyget_text typ_get_text |
201 |
#endif |
202 |
|
203 |
#ifdef yyget_lineno |
204 |
#define typ_get_lineno_ALREADY_DEFINED |
205 |
#else |
206 |
#define yyget_lineno typ_get_lineno |
207 |
#endif |
208 |
|
209 |
#ifdef yyset_lineno |
210 |
#define typ_set_lineno_ALREADY_DEFINED |
211 |
#else |
212 |
#define yyset_lineno typ_set_lineno |
213 |
#endif |
214 |
|
215 |
#ifdef yywrap |
216 |
#define typ_wrap_ALREADY_DEFINED |
217 |
#else |
218 |
#define yywrap typ_wrap |
219 |
#endif |
220 |
|
221 |
#ifdef yyalloc |
222 |
#define typ_alloc_ALREADY_DEFINED |
223 |
#else |
224 |
#define yyalloc typ_alloc |
225 |
#endif |
226 |
|
227 |
#ifdef yyrealloc |
228 |
#define typ_realloc_ALREADY_DEFINED |
229 |
#else |
230 |
#define yyrealloc typ_realloc |
231 |
#endif |
232 |
|
233 |
#ifdef yyfree |
234 |
#define typ_free_ALREADY_DEFINED |
235 |
#else |
236 |
#define yyfree typ_free |
237 |
#endif |
238 |
|
239 |
#ifdef yytext |
240 |
#define typ_text_ALREADY_DEFINED |
241 |
#else |
242 |
#define yytext typ_text |
243 |
#endif |
244 |
|
245 |
#ifdef yyleng |
246 |
#define typ_leng_ALREADY_DEFINED |
247 |
#else |
248 |
#define yyleng typ_leng |
249 |
#endif |
250 |
|
251 |
#ifdef yyin |
252 |
#define typ_in_ALREADY_DEFINED |
253 |
#else |
254 |
#define yyin typ_in |
255 |
#endif |
256 |
|
257 |
#ifdef yyout |
258 |
#define typ_out_ALREADY_DEFINED |
259 |
#else |
260 |
#define yyout typ_out |
261 |
#endif |
262 |
|
263 |
#ifdef yy_flex_debug |
264 |
#define typ__flex_debug_ALREADY_DEFINED |
265 |
#else |
266 |
#define yy_flex_debug typ__flex_debug |
267 |
#endif |
268 |
|
269 |
#ifdef yylineno |
270 |
#define typ_lineno_ALREADY_DEFINED |
271 |
#else |
272 |
#define yylineno typ_lineno |
273 |
#endif |
274 |
|
275 |
/* First, we deal with platform-specific or compiler-specific issues. */ |
276 |
|
277 |
/* begin standard C headers. */ |
278 |
#include <stdio.h> |
279 |
#include <string.h> |
280 |
#include <errno.h> |
281 |
#include <stdlib.h> |
282 |
|
283 |
/* end standard C headers. */ |
284 |
|
285 |
/* flex integer type definitions */ |
286 |
|
287 |
#ifndef FLEXINT_H |
288 |
#define FLEXINT_H |
289 |
|
290 |
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ |
291 |
|
292 |
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
293 |
|
294 |
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, |
295 |
* if you want the limit (max/min) macros for int types. |
296 |
*/ |
297 |
#ifndef __STDC_LIMIT_MACROS |
298 |
#define __STDC_LIMIT_MACROS 1 |
299 |
#endif |
300 |
|
301 |
#include <inttypes.h> |
302 |
typedef int8_t flex_int8_t; |
303 |
typedef uint8_t flex_uint8_t; |
304 |
typedef int16_t flex_int16_t; |
305 |
typedef uint16_t flex_uint16_t; |
306 |
typedef int32_t flex_int32_t; |
307 |
typedef uint32_t flex_uint32_t; |
308 |
#else |
309 |
typedef signed char flex_int8_t; |
310 |
typedef short int flex_int16_t; |
311 |
typedef int flex_int32_t; |
312 |
typedef unsigned char flex_uint8_t; |
313 |
typedef unsigned short int flex_uint16_t; |
314 |
typedef unsigned int flex_uint32_t; |
315 |
|
316 |
/* Limits of integral types. */ |
317 |
#ifndef INT8_MIN |
318 |
#define INT8_MIN (-128) |
319 |
#endif |
320 |
#ifndef INT16_MIN |
321 |
#define INT16_MIN (-32767-1) |
322 |
#endif |
323 |
#ifndef INT32_MIN |
324 |
#define INT32_MIN (-2147483647-1) |
325 |
#endif |
326 |
#ifndef INT8_MAX |
327 |
#define INT8_MAX (127) |
328 |
#endif |
329 |
#ifndef INT16_MAX |
330 |
#define INT16_MAX (32767) |
331 |
#endif |
332 |
#ifndef INT32_MAX |
333 |
#define INT32_MAX (2147483647) |
334 |
#endif |
335 |
#ifndef UINT8_MAX |
336 |
#define UINT8_MAX (255U) |
337 |
#endif |
338 |
#ifndef UINT16_MAX |
339 |
#define UINT16_MAX (65535U) |
340 |
#endif |
341 |
#ifndef UINT32_MAX |
342 |
#define UINT32_MAX (4294967295U) |
343 |
#endif |
344 |
|
345 |
#ifndef SIZE_MAX |
346 |
#define SIZE_MAX (~(size_t)0) |
347 |
#endif |
348 |
|
349 |
#endif /* ! C99 */ |
350 |
|
351 |
#endif /* ! FLEXINT_H */ |
352 |
|
353 |
/* begin standard C++ headers. */ |
354 |
|
355 |
/* TODO: this is always defined, so inline it */ |
356 |
#define yyconst const |
357 |
|
358 |
#if defined(__GNUC__) && __GNUC__ >= 3 |
359 |
#define yynoreturn __attribute__((__noreturn__)) |
360 |
#else |
361 |
#define yynoreturn |
362 |
#endif |
363 |
|
364 |
/* Returned upon end-of-file. */ |
365 |
#define YY_NULL 0 |
366 |
|
367 |
/* Promotes a possibly negative, possibly signed char to an |
368 |
* integer in range [0..255] for use as an array index. |
369 |
*/ |
370 |
#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) |
371 |
|
372 |
/* Enter a start condition. This macro really ought to take a parameter, |
373 |
* but we do it the disgusting crufty way forced on us by the ()-less |
374 |
* definition of BEGIN. |
375 |
*/ |
376 |
#define BEGIN (yy_start) = 1 + 2 * |
377 |
/* Translate the current start state into a value that can be later handed |
378 |
* to BEGIN to return to the state. The YYSTATE alias is for lex |
379 |
* compatibility. |
380 |
*/ |
381 |
#define YY_START (((yy_start) - 1) / 2) |
382 |
#define YYSTATE YY_START |
383 |
/* Action number for EOF rule of a given start state. */ |
384 |
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
385 |
/* Special action meaning "start processing a new file". */ |
386 |
#define YY_NEW_FILE yyrestart( yyin ) |
387 |
#define YY_END_OF_BUFFER_CHAR 0 |
388 |
|
389 |
/* Size of default input buffer. */ |
390 |
#ifndef YY_BUF_SIZE |
391 |
#ifdef __ia64__ |
392 |
/* On IA-64, the buffer size is 16k, not 8k. |
393 |
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. |
394 |
* Ditto for the __ia64__ case accordingly. |
395 |
*/ |
396 |
#define YY_BUF_SIZE 32768 |
397 |
#else |
398 |
#define YY_BUF_SIZE 16384 |
399 |
#endif /* __ia64__ */ |
400 |
#endif |
401 |
|
402 |
/* The state buf must be large enough to hold one state per character in the main buffer. |
403 |
*/ |
404 |
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) |
405 |
|
406 |
#ifndef YY_TYPEDEF_YY_BUFFER_STATE |
407 |
#define YY_TYPEDEF_YY_BUFFER_STATE |
408 |
typedef struct yy_buffer_state *YY_BUFFER_STATE; |
409 |
#endif |
410 |
|
411 |
#ifndef YY_TYPEDEF_YY_SIZE_T |
412 |
#define YY_TYPEDEF_YY_SIZE_T |
413 |
typedef size_t yy_size_t; |
414 |
#endif |
415 |
|
416 |
extern int yyleng; |
417 |
|
418 |
extern FILE *yyin, *yyout; |
419 |
|
420 |
#define EOB_ACT_CONTINUE_SCAN 0 |
421 |
#define EOB_ACT_END_OF_FILE 1 |
422 |
#define EOB_ACT_LAST_MATCH 2 |
423 |
|
424 |
/* Note: We specifically omit the test for yy_rule_can_match_eol because it requires |
425 |
* access to the local variable yy_act. Since yyless() is a macro, it would break |
426 |
* existing scanners that call yyless() from OUTSIDE yylex. |
427 |
* One obvious solution it to make yy_act a global. I tried that, and saw |
428 |
* a 5% performance hit in a non-yylineno scanner, because yy_act is |
429 |
* normally declared as a register variable-- so it is not worth it. |
430 |
*/ |
431 |
#define YY_LESS_LINENO(n) \ |
432 |
do { \ |
433 |
int yyl;\ |
434 |
for ( yyl = n; yyl < yyleng; ++yyl )\ |
435 |
if ( yytext[yyl] == '\n' )\ |
436 |
--yylineno;\ |
437 |
}while(0) |
438 |
#define YY_LINENO_REWIND_TO(dst) \ |
439 |
do {\ |
440 |
const char *p;\ |
441 |
for ( p = yy_cp-1; p >= (dst); --p)\ |
442 |
if ( *p == '\n' )\ |
443 |
--yylineno;\ |
444 |
}while(0) |
445 |
|
446 |
/* Return all but the first "n" matched characters back to the input stream. */ |
447 |
#define yyless(n) \ |
448 |
do \ |
449 |
{ \ |
450 |
/* Undo effects of setting up yytext. */ \ |
451 |
int yyless_macro_arg = (n); \ |
452 |
YY_LESS_LINENO(yyless_macro_arg);\ |
453 |
*yy_cp = (yy_hold_char); \ |
454 |
YY_RESTORE_YY_MORE_OFFSET \ |
455 |
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ |
456 |
YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
457 |
} \ |
458 |
while ( 0 ) |
459 |
#define unput(c) yyunput( c, (yytext_ptr) ) |
460 |
|
461 |
#ifndef YY_STRUCT_YY_BUFFER_STATE |
462 |
#define YY_STRUCT_YY_BUFFER_STATE |
463 |
struct yy_buffer_state |
464 |
{ |
465 |
FILE *yy_input_file; |
466 |
|
467 |
char *yy_ch_buf; /* input buffer */ |
468 |
char *yy_buf_pos; /* current position in input buffer */ |
469 |
|
470 |
/* Size of input buffer in bytes, not including room for EOB |
471 |
* characters. |
472 |
*/ |
473 |
int yy_buf_size; |
474 |
|
475 |
/* Number of characters read into yy_ch_buf, not including EOB |
476 |
* characters. |
477 |
*/ |
478 |
int yy_n_chars; |
479 |
|
480 |
/* Whether we "own" the buffer - i.e., we know we created it, |
481 |
* and can realloc() it to grow it, and should free() it to |
482 |
* delete it. |
483 |
*/ |
484 |
int yy_is_our_buffer; |
485 |
|
486 |
/* Whether this is an "interactive" input source; if so, and |
487 |
* if we're using stdio for input, then we want to use getc() |
488 |
* instead of fread(), to make sure we stop fetching input after |
489 |
* each newline. |
490 |
*/ |
491 |
int yy_is_interactive; |
492 |
|
493 |
/* Whether we're considered to be at the beginning of a line. |
494 |
* If so, '^' rules will be active on the next match, otherwise |
495 |
* not. |
496 |
*/ |
497 |
int yy_at_bol; |
498 |
|
499 |
int yy_bs_lineno; /**< The line count. */ |
500 |
int yy_bs_column; /**< The column count. */ |
501 |
|
502 |
/* Whether to try to fill the input buffer when we reach the |
503 |
* end of it. |
504 |
*/ |
505 |
int yy_fill_buffer; |
506 |
|
507 |
int yy_buffer_status; |
508 |
|
509 |
#define YY_BUFFER_NEW 0 |
510 |
#define YY_BUFFER_NORMAL 1 |
511 |
/* When an EOF's been seen but there's still some text to process |
512 |
* then we mark the buffer as YY_EOF_PENDING, to indicate that we |
513 |
* shouldn't try reading from the input source any more. We might |
514 |
* still have a bunch of tokens to match, though, because of |
515 |
* possible backing-up. |
516 |
* |
517 |
* When we actually see the EOF, we change the status to "new" |
518 |
* (via yyrestart()), so that the user can continue scanning by |
519 |
* just pointing yyin at a new input file. |
520 |
*/ |
521 |
#define YY_BUFFER_EOF_PENDING 2 |
522 |
|
523 |
}; |
524 |
#endif /* !YY_STRUCT_YY_BUFFER_STATE */ |
525 |
|
526 |
/* Stack of input buffers. */ |
527 |
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ |
528 |
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ |
529 |
static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ |
530 |
|
531 |
/* We provide macros for accessing buffer states in case in the |
532 |
* future we want to put the buffer states in a more general |
533 |
* "scanner state". |
534 |
* |
535 |
* Returns the top of the stack, or NULL. |
536 |
*/ |
537 |
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ |
538 |
? (yy_buffer_stack)[(yy_buffer_stack_top)] \ |
539 |
: NULL) |
540 |
/* Same as previous macro, but useful when we know that the buffer stack is not |
541 |
* NULL or when we need an lvalue. For internal use only. |
542 |
*/ |
543 |
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] |
544 |
|
545 |
/* yy_hold_char holds the character lost when yytext is formed. */ |
546 |
static char yy_hold_char; |
547 |
static int yy_n_chars; /* number of characters read into yy_ch_buf */ |
548 |
int yyleng; |
549 |
|
550 |
/* Points to current character in buffer. */ |
551 |
static char *yy_c_buf_p = NULL; |
552 |
static int yy_init = 0; /* whether we need to initialize */ |
553 |
static int yy_start = 0; /* start state number */ |
554 |
|
555 |
/* Flag which is used to allow yywrap()'s to do buffer switches |
556 |
* instead of setting up a fresh yyin. A bit of a hack ... |
557 |
*/ |
558 |
static int yy_did_buffer_switch_on_eof; |
559 |
|
560 |
void yyrestart ( FILE *input_file ); |
561 |
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); |
562 |
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); |
563 |
void yy_delete_buffer ( YY_BUFFER_STATE b ); |
564 |
void yy_flush_buffer ( YY_BUFFER_STATE b ); |
565 |
void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); |
566 |
void yypop_buffer_state ( void ); |
567 |
|
568 |
static void yyensure_buffer_stack ( void ); |
569 |
static void yy_load_buffer_state ( void ); |
570 |
static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); |
571 |
#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) |
572 |
|
573 |
YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); |
574 |
YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); |
575 |
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); |
576 |
|
577 |
void *yyalloc ( yy_size_t ); |
578 |
void *yyrealloc ( void *, yy_size_t ); |
579 |
void yyfree ( void * ); |
580 |
|
581 |
#define yy_new_buffer yy_create_buffer |
582 |
#define yy_set_interactive(is_interactive) \ |
583 |
{ \ |
584 |
if ( ! YY_CURRENT_BUFFER ){ \ |
585 |
yyensure_buffer_stack (); \ |
586 |
YY_CURRENT_BUFFER_LVALUE = \ |
587 |
yy_create_buffer( yyin, YY_BUF_SIZE ); \ |
588 |
} \ |
589 |
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ |
590 |
} |
591 |
#define yy_set_bol(at_bol) \ |
592 |
{ \ |
593 |
if ( ! YY_CURRENT_BUFFER ){\ |
594 |
yyensure_buffer_stack (); \ |
595 |
YY_CURRENT_BUFFER_LVALUE = \ |
596 |
yy_create_buffer( yyin, YY_BUF_SIZE ); \ |
597 |
} \ |
598 |
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ |
599 |
} |
600 |
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) |
601 |
|
602 |
/* Begin user sect3 */ |
603 |
typedef flex_uint8_t YY_CHAR; |
604 |
|
605 |
FILE *yyin = NULL, *yyout = NULL; |
606 |
|
607 |
typedef int yy_state_type; |
608 |
|
609 |
#define YY_FLEX_LEX_COMPAT |
610 |
extern int yylineno; |
611 |
int yylineno = 1; |
612 |
|
613 |
extern char yytext[]; |
614 |
|
615 |
static yy_state_type yy_get_previous_state ( void ); |
616 |
static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); |
617 |
static int yy_get_next_buffer ( void ); |
618 |
static void yynoreturn yy_fatal_error ( const char* msg ); |
619 |
|
620 |
/* Done after the current pattern has been matched and before the |
621 |
* corresponding action - sets up yytext. |
622 |
*/ |
623 |
#define YY_DO_BEFORE_ACTION \ |
624 |
(yytext_ptr) = yy_bp; \ |
625 |
yyleng = (int) (yy_cp - yy_bp); \ |
626 |
(yy_hold_char) = *yy_cp; \ |
627 |
*yy_cp = '\0'; \ |
628 |
if ( yyleng + (yy_more_offset) >= YYLMAX ) \ |
629 |
YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \ |
630 |
yy_flex_strncpy( &yytext[(yy_more_offset)], (yytext_ptr), yyleng + 1 ); \ |
631 |
yyleng += (yy_more_offset); \ |
632 |
(yy_prev_more_offset) = (yy_more_offset); \ |
633 |
(yy_more_offset) = 0; \ |
634 |
(yy_c_buf_p) = yy_cp; |
635 |
#define YY_NUM_RULES 34 |
636 |
#define YY_END_OF_BUFFER 35 |
637 |
/* This struct is not used in this scanner, |
638 |
but its presence is necessary. */ |
639 |
struct yy_trans_info |
640 |
{ |
641 |
flex_int32_t yy_verify; |
642 |
flex_int32_t yy_nxt; |
643 |
}; |
644 |
static const flex_int16_t yy_accept[124] = |
645 |
{ 0, |
646 |
0, 0, 6, 6, 16, 16, 0, 0, 0, 0, |
647 |
0, 0, 35, 31, 32, 33, 33, 33, 33, 33, |
648 |
33, 31, 9, 6, 7, 8, 16, 34, 14, 15, |
649 |
20, 21, 22, 22, 20, 10, 24, 25, 23, 11, |
650 |
18, 34, 17, 31, 32, 32, 1, 33, 33, 33, |
651 |
33, 33, 33, 33, 33, 31, 31, 31, 6, 0, |
652 |
7, 7, 4, 8, 5, 8, 16, 0, 15, 12, |
653 |
13, 14, 20, 21, 21, 2, 22, 22, 22, 22, |
654 |
20, 20, 20, 24, 25, 25, 3, 17, 33, 33, |
655 |
33, 33, 33, 4, 22, 33, 33, 33, 33, 33, |
656 |
|
657 |
19, 28, 33, 33, 33, 33, 33, 33, 27, 33, |
658 |
33, 33, 33, 33, 33, 33, 30, 33, 33, 33, |
659 |
26, 29, 0 |
660 |
} ; |
661 |
|
662 |
static const YY_CHAR yy_ec[256] = |
663 |
{ 0, |
664 |
1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
665 |
2, 2, 2, 1, 1, 1, 1, 1, 1, 1, |
666 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
667 |
1, 2, 1, 1, 1, 1, 1, 1, 1, 4, |
668 |
5, 6, 1, 1, 1, 1, 1, 7, 7, 7, |
669 |
7, 7, 7, 7, 7, 7, 7, 1, 8, 1, |
670 |
1, 1, 1, 1, 9, 10, 11, 12, 13, 14, |
671 |
10, 10, 15, 10, 10, 16, 17, 18, 19, 10, |
672 |
10, 20, 21, 22, 23, 24, 10, 10, 10, 10, |
673 |
1, 25, 1, 1, 26, 1, 27, 27, 27, 27, |
674 |
|
675 |
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, |
676 |
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, |
677 |
27, 27, 28, 1, 29, 1, 1, 1, 1, 1, |
678 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
679 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
680 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
681 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
682 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
683 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
684 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
685 |
|
686 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
687 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
688 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
689 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
690 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
691 |
1, 1, 1, 1, 1 |
692 |
} ; |
693 |
|
694 |
static const YY_CHAR yy_meta[30] = |
695 |
{ 0, |
696 |
1, 2, 1, 3, 1, 4, 5, 6, 7, 7, |
697 |
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
698 |
7, 7, 7, 7, 8, 9, 5, 10, 8 |
699 |
} ; |
700 |
|
701 |
static const flex_int16_t yy_base[143] = |
702 |
{ 0, |
703 |
0, 0, 26, 27, 9, 11, 40, 0, 66, 67, |
704 |
95, 0, 343, 0, 72, 71, 75, 123, 78, 124, |
705 |
126, 144, 467, 333, 78, 82, 56, 327, 0, 467, |
706 |
0, 86, 125, 146, 173, 467, 0, 131, 467, 467, |
707 |
467, 467, 0, 0, 132, 322, 467, 289, 287, 151, |
708 |
153, 175, 154, 155, 180, 286, 285, 0, 280, 124, |
709 |
135, 154, 0, 160, 467, 179, 161, 277, 467, 467, |
710 |
467, 0, 0, 183, 264, 467, 261, 256, 189, 199, |
711 |
254, 229, 0, 0, 188, 199, 467, 0, 202, 204, |
712 |
206, 207, 214, 0, 215, 216, 224, 225, 226, 227, |
713 |
|
714 |
211, 194, 228, 237, 239, 242, 246, 247, 138, 249, |
715 |
251, 259, 263, 258, 273, 274, 87, 275, 276, 277, |
716 |
70, 33, 467, 293, 303, 313, 323, 332, 340, 349, |
717 |
359, 369, 379, 388, 398, 407, 416, 424, 433, 442, |
718 |
447, 456 |
719 |
} ; |
720 |
|
721 |
static const flex_int16_t yy_def[143] = |
722 |
{ 0, |
723 |
123, 1, 124, 124, 125, 125, 123, 7, 126, 126, |
724 |
123, 11, 123, 127, 128, 129, 129, 129, 129, 129, |
725 |
129, 129, 123, 130, 131, 132, 133, 134, 135, 123, |
726 |
136, 137, 138, 138, 138, 123, 139, 140, 123, 123, |
727 |
123, 123, 141, 127, 128, 45, 123, 123, 123, 129, |
728 |
129, 129, 129, 129, 129, 127, 127, 22, 130, 123, |
729 |
131, 131, 142, 132, 123, 132, 133, 134, 123, 123, |
730 |
123, 135, 136, 137, 74, 123, 123, 123, 138, 138, |
731 |
136, 136, 35, 139, 140, 140, 123, 141, 129, 129, |
732 |
129, 129, 129, 142, 138, 129, 129, 129, 129, 129, |
733 |
|
734 |
123, 123, 129, 129, 129, 129, 129, 129, 123, 129, |
735 |
129, 129, 129, 129, 129, 129, 123, 129, 129, 129, |
736 |
123, 123, 0, 123, 123, 123, 123, 123, 123, 123, |
737 |
123, 123, 123, 123, 123, 123, 123, 123, 123, 123, |
738 |
123, 123 |
739 |
} ; |
740 |
|
741 |
static const flex_int16_t yy_nxt[497] = |
742 |
{ 0, |
743 |
14, 14, 14, 15, 14, 14, 14, 14, 16, 17, |
744 |
18, 19, 17, 17, 17, 17, 20, 17, 17, 17, |
745 |
17, 17, 21, 17, 14, 22, 14, 23, 14, 25, |
746 |
25, 26, 26, 28, 122, 28, 29, 30, 29, 30, |
747 |
31, 31, 31, 32, 31, 31, 31, 31, 33, 33, |
748 |
33, 33, 34, 33, 33, 33, 33, 33, 33, 33, |
749 |
33, 33, 33, 33, 31, 35, 31, 36, 31, 38, |
750 |
38, 121, 48, 39, 39, 46, 48, 47, 49, 48, |
751 |
68, 62, 49, 63, 69, 49, 65, 66, 117, 75, |
752 |
53, 76, 51, 40, 40, 41, 41, 42, 41, 41, |
753 |
|
754 |
41, 41, 41, 43, 43, 43, 43, 43, 43, 43, |
755 |
43, 43, 43, 43, 43, 43, 43, 43, 43, 41, |
756 |
41, 43, 41, 41, 48, 48, 77, 48, 65, 60, |
757 |
49, 49, 78, 49, 86, 123, 87, 123, 123, 109, |
758 |
123, 52, 54, 55, 44, 56, 44, 77, 44, 44, |
759 |
44, 57, 48, 78, 48, 48, 48, 62, 49, 123, |
760 |
49, 49, 49, 80, 123, 123, 92, 91, 44, 58, |
761 |
44, 89, 44, 73, 81, 73, 48, 73, 73, 73, |
762 |
82, 48, 49, 65, 66, 68, 123, 49, 123, 69, |
763 |
77, 123, 90, 123, 93, 102, 78, 73, 83, 73, |
764 |
|
765 |
77, 73, 86, 48, 123, 48, 78, 48, 48, 49, |
766 |
95, 49, 101, 49, 49, 48, 101, 102, 96, 99, |
767 |
98, 49, 78, 49, 97, 48, 48, 48, 48, 48, |
768 |
81, 49, 49, 49, 49, 49, 107, 100, 48, 106, |
769 |
109, 105, 104, 48, 49, 103, 49, 48, 48, 49, |
770 |
48, 108, 48, 49, 49, 81, 49, 77, 49, 117, |
771 |
48, 110, 77, 111, 48, 49, 49, 75, 112, 113, |
772 |
49, 116, 114, 115, 48, 48, 48, 121, 122, 71, |
773 |
49, 49, 49, 49, 49, 60, 56, 56, 48, 119, |
774 |
48, 118, 120, 24, 24, 24, 24, 24, 24, 24, |
775 |
|
776 |
24, 24, 24, 27, 27, 27, 27, 27, 27, 27, |
777 |
27, 27, 27, 37, 37, 37, 37, 37, 37, 37, |
778 |
37, 37, 37, 44, 44, 46, 44, 44, 44, 71, |
779 |
44, 44, 45, 45, 45, 45, 45, 45, 60, 45, |
780 |
45, 50, 123, 123, 123, 50, 50, 123, 50, 59, |
781 |
59, 123, 59, 59, 59, 59, 59, 59, 59, 61, |
782 |
61, 61, 61, 61, 61, 61, 61, 61, 61, 64, |
783 |
64, 123, 64, 64, 64, 64, 64, 64, 64, 67, |
784 |
67, 67, 67, 67, 67, 67, 67, 67, 70, 70, |
785 |
70, 70, 70, 70, 70, 70, 70, 70, 72, 72, |
786 |
|
787 |
72, 72, 72, 72, 72, 123, 72, 73, 73, 123, |
788 |
73, 73, 73, 123, 73, 73, 74, 74, 74, 74, |
789 |
74, 74, 123, 74, 74, 79, 123, 123, 123, 79, |
790 |
79, 123, 79, 84, 84, 123, 84, 84, 123, 84, |
791 |
84, 84, 85, 85, 85, 85, 85, 123, 85, 85, |
792 |
85, 88, 123, 88, 123, 88, 94, 94, 123, 123, |
793 |
94, 94, 94, 94, 94, 94, 13, 123, 123, 123, |
794 |
123, 123, 123, 123, 123, 123, 123, 123, 123, 123, |
795 |
123, 123, 123, 123, 123, 123, 123, 123, 123, 123, |
796 |
123, 123, 123, 123, 123, 123 |
797 |
|
798 |
} ; |
799 |
|
800 |
static const flex_int16_t yy_chk[497] = |
801 |
{ 0, |
802 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
803 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
804 |
1, 1, 1, 1, 1, 1, 1, 1, 1, 3, |
805 |
4, 3, 4, 5, 122, 6, 5, 5, 6, 6, |
806 |
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
807 |
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
808 |
7, 7, 7, 7, 7, 7, 7, 7, 7, 9, |
809 |
10, 121, 16, 9, 10, 15, 17, 15, 16, 19, |
810 |
27, 25, 17, 25, 27, 19, 26, 26, 117, 32, |
811 |
19, 32, 16, 9, 10, 11, 11, 11, 11, 11, |
812 |
|
813 |
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, |
814 |
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, |
815 |
11, 11, 11, 11, 18, 20, 33, 21, 60, 60, |
816 |
18, 20, 33, 21, 38, 45, 38, 45, 61, 109, |
817 |
61, 18, 20, 21, 22, 22, 22, 34, 22, 22, |
818 |
22, 22, 50, 34, 51, 53, 54, 62, 50, 62, |
819 |
51, 53, 54, 34, 64, 64, 54, 53, 22, 22, |
820 |
22, 51, 22, 35, 35, 35, 52, 35, 35, 35, |
821 |
35, 55, 52, 66, 66, 67, 74, 55, 74, 67, |
822 |
79, 85, 52, 85, 55, 102, 79, 35, 35, 35, |
823 |
|
824 |
80, 35, 86, 89, 86, 90, 80, 91, 92, 89, |
825 |
80, 90, 101, 91, 92, 93, 95, 96, 89, 92, |
826 |
91, 93, 95, 96, 90, 97, 98, 99, 100, 103, |
827 |
82, 97, 98, 99, 100, 103, 103, 93, 104, 100, |
828 |
105, 99, 98, 106, 104, 97, 105, 107, 108, 106, |
829 |
110, 104, 111, 107, 108, 81, 110, 78, 111, 114, |
830 |
112, 106, 77, 107, 113, 114, 112, 75, 108, 110, |
831 |
113, 113, 111, 112, 115, 116, 118, 119, 120, 68, |
832 |
115, 116, 118, 119, 120, 59, 57, 56, 49, 116, |
833 |
48, 115, 118, 124, 124, 124, 124, 124, 124, 124, |
834 |
|
835 |
124, 124, 124, 125, 125, 125, 125, 125, 125, 125, |
836 |
125, 125, 125, 126, 126, 126, 126, 126, 126, 126, |
837 |
126, 126, 126, 127, 127, 46, 127, 127, 127, 28, |
838 |
127, 127, 128, 128, 128, 128, 128, 128, 24, 128, |
839 |
128, 129, 13, 0, 0, 129, 129, 0, 129, 130, |
840 |
130, 0, 130, 130, 130, 130, 130, 130, 130, 131, |
841 |
131, 131, 131, 131, 131, 131, 131, 131, 131, 132, |
842 |
132, 0, 132, 132, 132, 132, 132, 132, 132, 133, |
843 |
133, 133, 133, 133, 133, 133, 133, 133, 134, 134, |
844 |
134, 134, 134, 134, 134, 134, 134, 134, 135, 135, |
845 |
|
846 |
135, 135, 135, 135, 135, 0, 135, 136, 136, 0, |
847 |
136, 136, 136, 0, 136, 136, 137, 137, 137, 137, |
848 |
137, 137, 0, 137, 137, 138, 0, 0, 0, 138, |
849 |
138, 0, 138, 139, 139, 0, 139, 139, 0, 139, |
850 |
139, 139, 140, 140, 140, 140, 140, 0, 140, 140, |
851 |
140, 141, 0, 141, 0, 141, 142, 142, 0, 0, |
852 |
142, 142, 142, 142, 142, 142, 123, 123, 123, 123, |
853 |
123, 123, 123, 123, 123, 123, 123, 123, 123, 123, |
854 |
123, 123, 123, 123, 123, 123, 123, 123, 123, 123, |
855 |
123, 123, 123, 123, 123, 123 |
856 |
|
857 |
} ; |
858 |
|
859 |
/* Table of booleans, true if rule could match eol. */ |
860 |
static const flex_int32_t yy_rule_can_match_eol[35] = |
861 |
{ 0, |
862 |
0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, |
863 |
1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, }; |
864 |
|
865 |
static yy_state_type yy_last_accepting_state; |
866 |
static char *yy_last_accepting_cpos; |
867 |
|
868 |
extern int yy_flex_debug; |
869 |
int yy_flex_debug = 0; |
870 |
|
871 |
/* The intent behind this definition is that it'll catch |
872 |
* any uses of REJECT which flex missed. |
873 |
*/ |
874 |
#define REJECT reject_used_but_not_detected |
875 |
static int yy_more_offset = 0; |
876 |
static int yy_prev_more_offset = 0; |
877 |
#define yymore() ((yy_more_offset) = yy_flex_strlen( yytext )) |
878 |
#define YY_NEED_STRLEN |
879 |
#define YY_MORE_ADJ 0 |
880 |
#define YY_RESTORE_YY_MORE_OFFSET \ |
881 |
{ \ |
882 |
(yy_more_offset) = (yy_prev_more_offset); \ |
883 |
yyleng -= (yy_more_offset); \ |
884 |
} |
885 |
#ifndef YYLMAX |
886 |
#define YYLMAX 8192 |
887 |
#endif |
888 |
|
889 |
char yytext[YYLMAX]; |
890 |
char *yytext_ptr; |
891 |
#line 1 "tcltk/interface/typelex.l" |
892 |
#line 2 "tcltk/interface/typelex.l" |
893 |
/* |
894 |
* TypeExtractor.l |
895 |
* by Kirk Abbott and Ben Allan |
896 |
* Created: 1/94 |
897 |
* Version: $Revision: 1.20 $ |
898 |
* Version control file: $RCSfile: typelex.l,v $ |
899 |
* Date last modified: $Date: 2003/08/23 18:43:09 $ |
900 |
* Last modified by: $Author: ballan $ |
901 |
* |
902 |
* This file is part of the ASCEND Tcl/Tk interface |
903 |
* |
904 |
* Copyright 1997, Carnegie Mellon University |
905 |
* |
906 |
* The ASCEND Tcl/Tk interface is free software; you can redistribute |
907 |
* it and/or modify it under the terms of the GNU General Public License as |
908 |
* published by the Free Software Foundation; either version 2 of the |
909 |
* License, or (at your option) any later version. |
910 |
* |
911 |
* The ASCEND Tcl/Tk interface is distributed in hope that it will be |
912 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
913 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
914 |
* General Public License for more details. |
915 |
* |
916 |
* You should have received a copy of the GNU General Public License |
917 |
* along with the program; if not, write to the Free Software Foundation, |
918 |
* Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named |
919 |
* COPYING. COPYING is found in ../compiler. |
920 |
*/ |
921 |
|
922 |
/* |
923 |
* ASCEND Type Retriever 1.2 |
924 |
* |
925 |
* Purpose: |
926 |
* To extract a type definition from an input file. |
927 |
* Usage: |
928 |
* See the header file for use from within ASCEND. |
929 |
* For stand-alone use: |
930 |
* typer [flags] ascend_type_name input_file output_file |
931 |
* flags: -c show comments |
932 |
* If no -c given, strip out comments. |
933 |
* Features: |
934 |
* --Does not descend into REQUIREd files. Only examines input_file |
935 |
* for definitions of ascend_type_name. |
936 |
* --This version DOES handle the UNIVERSAL quantifier. |
937 |
* |
938 |
*/ |
939 |
|
940 |
#define MY_YYMORE() yymore() |
941 |
|
942 |
#include <tcl.h> |
943 |
#include "config.h" |
944 |
#include <ascend/general/list.h> |
945 |
#ifndef TYPER_TEST |
946 |
/* for handling string modules and results in interp */ |
947 |
#include <ascend/compiler/compiler.h> |
948 |
#include <ascend/compiler/symtab.h> |
949 |
#include <ascend/compiler/fractions.h> |
950 |
#include <ascend/compiler/dimen.h> |
951 |
#include <ascend/compiler/child.h> |
952 |
#include <ascend/compiler/type_desc.h> |
953 |
#include <ascend/compiler/library.h> |
954 |
#include <ascend/compiler/module.h> |
955 |
#include "HelpProc.h" /* help is not necessary for test */ |
956 |
#endif /*!typertest*/ |
957 |
|
958 |
#include "typelex.h" |
959 |
|
960 |
#define YY_BREAK |
961 |
/* |
962 |
* Defining yybreak as above (empty) means that all of our matches must end |
963 |
* in break or return because the normal flex supplied yybreak will |
964 |
* be preempted by our empty one. |
965 |
* In cases where matches contain a conditional return, make sure a |
966 |
* break follows in the failure case. |
967 |
*/ |
968 |
|
969 |
static int CommentNestLevel = 0; |
970 |
/* |
971 |
* Nesting level of (* comments *) |
972 |
*/ |
973 |
|
974 |
static int BracesNestLevel = 0; |
975 |
/* |
976 |
* Nesting level of {braced} expressions |
977 |
*/ |
978 |
|
979 |
enum keyword_tokens { |
980 |
NONE, /* Nothing to match, we're in the initial state */ |
981 |
MODEL, /* We've just read a MODEL or ATOM keyword */ |
982 |
MODEL_END, /* We've just read an END keyword inside a MODEL, |
983 |
* an ATOM, or a DEFINITION. */ |
984 |
CONSTANT /* We've just read a CONSTANT keyword */ |
985 |
}; |
986 |
static enum keyword_tokens MatchedToken = NONE; |
987 |
/* |
988 |
* The recognized token we've most recently read. This usually implies |
989 |
* that we're either in that state or we need to check the next keyword |
990 |
* to see if we should enter (or leave, in the case of MODEL_END) that |
991 |
* state. MODEL, ATOM, and DEFINITION state are equivalent. |
992 |
*/ |
993 |
|
994 |
static int ShowComments = 0; |
995 |
/* |
996 |
* Should we print comments? (1 = yes, 0 = no) |
997 |
* This is set to 1 with `-c' on the command line |
998 |
*/ |
999 |
|
1000 |
static unsigned long StartId = 0; |
1001 |
/* |
1002 |
* The location in the `typ_text' array where the MODEL, ATOM, or CONSTANT |
1003 |
* identifierbegins. We save this value and call MY_YYMORE() when we find |
1004 |
* a MODEL, ATOM, or CONSTANT keyword; StartId tells us where the |
1005 |
* Identifier will go. |
1006 |
*/ |
1007 |
|
1008 |
static char *reqType = ""; |
1009 |
/* |
1010 |
* The type we are looking for. This is one of the arguments passed |
1011 |
* to Asc_ExtractType() in the argv vector. |
1012 |
*/ |
1013 |
|
1014 |
static void Asc_PutCode(char *s,FILE *fp); |
1015 |
|
1016 |
static Tcl_Interp *g_typ__interp; |
1017 |
/* during parse, set to caller's interp if string result is wanted |
1018 |
* instead of file. |
1019 |
*/ |
1020 |
|
1021 |
#ifdef TYPER_TEST |
1022 |
/* |
1023 |
* Specify ASCERR, ASCWAR when building stand alone. |
1024 |
*/ |
1025 |
#ifdef REIMPLEMENT_STREAM |
1026 |
FILE *ASCERR = stderr; |
1027 |
FILE *ASCWAR = stderr; |
1028 |
#endif |
1029 |
#endif /* TYPER_TEST */ |
1030 |
|
1031 |
#line 1032 "<stdout>" |
1032 |
|
1033 |
#line 1034 "<stdout>" |
1034 |
|
1035 |
#define INITIAL 0 |
1036 |
#define Comment 1 |
1037 |
#define BracedText 2 |
1038 |
#define Model 3 |
1039 |
#define Constant 4 |
1040 |
#define CheckID 5 |
1041 |
|
1042 |
#ifndef YY_NO_UNISTD_H |
1043 |
/* Special case for "unistd.h", since it is non-ANSI. We include it way |
1044 |
* down here because we want the user's section 1 to have been scanned first. |
1045 |
* The user has a chance to override it with an option. |
1046 |
*/ |
1047 |
#include <unistd.h> |
1048 |
#endif |
1049 |
|
1050 |
#ifndef YY_EXTRA_TYPE |
1051 |
#define YY_EXTRA_TYPE void * |
1052 |
#endif |
1053 |
|
1054 |
static int yy_init_globals ( void ); |
1055 |
|
1056 |
/* Accessor methods to globals. |
1057 |
These are made visible to non-reentrant scanners for convenience. */ |
1058 |
|
1059 |
int yylex_destroy ( void ); |
1060 |
|
1061 |
int yyget_debug ( void ); |
1062 |
|
1063 |
void yyset_debug ( int debug_flag ); |
1064 |
|
1065 |
YY_EXTRA_TYPE yyget_extra ( void ); |
1066 |
|
1067 |
void yyset_extra ( YY_EXTRA_TYPE user_defined ); |
1068 |
|
1069 |
FILE *yyget_in ( void ); |
1070 |
|
1071 |
void yyset_in ( FILE * _in_str ); |
1072 |
|
1073 |
FILE *yyget_out ( void ); |
1074 |
|
1075 |
void yyset_out ( FILE * _out_str ); |
1076 |
|
1077 |
int yyget_leng ( void ); |
1078 |
|
1079 |
char *yyget_text ( void ); |
1080 |
|
1081 |
int yyget_lineno ( void ); |
1082 |
|
1083 |
void yyset_lineno ( int _line_number ); |
1084 |
|
1085 |
/* Macros after this point can all be overridden by user definitions in |
1086 |
* section 1. |
1087 |
*/ |
1088 |
|
1089 |
#ifndef YY_SKIP_YYWRAP |
1090 |
#ifdef __cplusplus |
1091 |
extern "C" int yywrap ( void ); |
1092 |
#else |
1093 |
extern int yywrap ( void ); |
1094 |
#endif |
1095 |
#endif |
1096 |
|
1097 |
#ifndef YY_NO_UNPUT |
1098 |
|
1099 |
static void yyunput ( int c, char *buf_ptr ); |
1100 |
|
1101 |
#endif |
1102 |
|
1103 |
#ifndef yytext_ptr |
1104 |
static void yy_flex_strncpy ( char *, const char *, int ); |
1105 |
#endif |
1106 |
|
1107 |
#ifdef YY_NEED_STRLEN |
1108 |
static int yy_flex_strlen ( const char * ); |
1109 |
#endif |
1110 |
|
1111 |
#ifndef YY_NO_INPUT |
1112 |
#ifdef __cplusplus |
1113 |
static int yyinput ( void ); |
1114 |
#else |
1115 |
static int input ( void ); |
1116 |
#endif |
1117 |
|
1118 |
#endif |
1119 |
|
1120 |
/* Amount of stuff to slurp up with each read. */ |
1121 |
#ifndef YY_READ_BUF_SIZE |
1122 |
#ifdef __ia64__ |
1123 |
/* On IA-64, the buffer size is 16k, not 8k */ |
1124 |
#define YY_READ_BUF_SIZE 16384 |
1125 |
#else |
1126 |
#define YY_READ_BUF_SIZE 8192 |
1127 |
#endif /* __ia64__ */ |
1128 |
#endif |
1129 |
|
1130 |
/* Copy whatever the last rule matched to the standard output. */ |
1131 |
#ifndef ECHO |
1132 |
/* This used to be an fputs(), but since the string might contain NUL's, |
1133 |
* we now use fwrite(). |
1134 |
*/ |
1135 |
#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) |
1136 |
#endif |
1137 |
|
1138 |
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
1139 |
* is returned in "result". |
1140 |
*/ |
1141 |
#ifndef YY_INPUT |
1142 |
#define YY_INPUT(buf,result,max_size) \ |
1143 |
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
1144 |
{ \ |
1145 |
int c = '*'; \ |
1146 |
int n; \ |
1147 |
for ( n = 0; n < max_size && \ |
1148 |
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
1149 |
buf[n] = (char) c; \ |
1150 |
if ( c == '\n' ) \ |
1151 |
buf[n++] = (char) c; \ |
1152 |
if ( c == EOF && ferror( yyin ) ) \ |
1153 |
YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
1154 |
result = n; \ |
1155 |
} \ |
1156 |
else \ |
1157 |
{ \ |
1158 |
errno=0; \ |
1159 |
while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ |
1160 |
{ \ |
1161 |
if( errno != EINTR) \ |
1162 |
{ \ |
1163 |
YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
1164 |
break; \ |
1165 |
} \ |
1166 |
errno=0; \ |
1167 |
clearerr(yyin); \ |
1168 |
} \ |
1169 |
}\ |
1170 |
\ |
1171 |
|
1172 |
#endif |
1173 |
|
1174 |
/* No semi-colon after return; correct usage is to write "yyterminate();" - |
1175 |
* we don't want an extra ';' after the "return" because that will cause |
1176 |
* some compilers to complain about unreachable statements. |
1177 |
*/ |
1178 |
#ifndef yyterminate |
1179 |
#define yyterminate() return YY_NULL |
1180 |
#endif |
1181 |
|
1182 |
/* Number of entries by which start-condition stack grows. */ |
1183 |
#ifndef YY_START_STACK_INCR |
1184 |
#define YY_START_STACK_INCR 25 |
1185 |
#endif |
1186 |
|
1187 |
/* Report a fatal error. */ |
1188 |
#ifndef YY_FATAL_ERROR |
1189 |
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) |
1190 |
#endif |
1191 |
|
1192 |
/* end tables serialization structures and prototypes */ |
1193 |
|
1194 |
/* Default declaration of generated scanner - a define so the user can |
1195 |
* easily add parameters. |
1196 |
*/ |
1197 |
#ifndef YY_DECL |
1198 |
#define YY_DECL_IS_OURS 1 |
1199 |
|
1200 |
extern int yylex (void); |
1201 |
|
1202 |
#define YY_DECL int yylex (void) |
1203 |
#endif /* !YY_DECL */ |
1204 |
|
1205 |
/* Code executed at the beginning of each rule, after yytext and yyleng |
1206 |
* have been set up. |
1207 |
*/ |
1208 |
#ifndef YY_USER_ACTION |
1209 |
#define YY_USER_ACTION |
1210 |
#endif |
1211 |
|
1212 |
/* Code executed at the end of each rule. */ |
1213 |
#ifndef YY_BREAK |
1214 |
#define YY_BREAK /*LINTED*/break; |
1215 |
#endif |
1216 |
|
1217 |
#define YY_RULE_SETUP \ |
1218 |
YY_USER_ACTION |
1219 |
|
1220 |
/** The main scanner function which does all the work. |
1221 |
*/ |
1222 |
YY_DECL |
1223 |
{ |
1224 |
yy_state_type yy_current_state; |
1225 |
char *yy_cp, *yy_bp; |
1226 |
int yy_act; |
1227 |
|
1228 |
if ( !(yy_init) ) |
1229 |
{ |
1230 |
(yy_init) = 1; |
1231 |
|
1232 |
#ifdef YY_USER_INIT |
1233 |
YY_USER_INIT; |
1234 |
#endif |
1235 |
|
1236 |
if ( ! (yy_start) ) |
1237 |
(yy_start) = 1; /* first start state */ |
1238 |
|
1239 |
if ( ! yyin ) |
1240 |
yyin = stdin; |
1241 |
|
1242 |
if ( ! yyout ) |
1243 |
yyout = stdout; |
1244 |
|
1245 |
if ( ! YY_CURRENT_BUFFER ) { |
1246 |
yyensure_buffer_stack (); |
1247 |
YY_CURRENT_BUFFER_LVALUE = |
1248 |
yy_create_buffer( yyin, YY_BUF_SIZE ); |
1249 |
} |
1250 |
|
1251 |
yy_load_buffer_state( ); |
1252 |
} |
1253 |
|
1254 |
{ |
1255 |
#line 162 "tcltk/interface/typelex.l" |
1256 |
|
1257 |
|
1258 |
#line 165 "tcltk/interface/typelex.l" |
1259 |
/* |
1260 |
* Code to handle (* Comments *) |
1261 |
* |
1262 |
* "(*" puts us into the Comment state. Comments nest, so in the |
1263 |
* Comment state we need to look for "(*" that increases the nesting |
1264 |
* level and "*)" that will lower it. |
1265 |
* Do NOT try to match \(\*+ since that causes "(****)" to parse |
1266 |
* incorrectly. |
1267 |
*/ |
1268 |
|
1269 |
#line 1270 "<stdout>" |
1270 |
|
1271 |
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ |
1272 |
{ |
1273 |
yy_cp = (yy_c_buf_p); |
1274 |
|
1275 |
/* Support of yytext. */ |
1276 |
*yy_cp = (yy_hold_char); |
1277 |
|
1278 |
/* yy_bp points to the position in yy_ch_buf of the start of |
1279 |
* the current run. |
1280 |
*/ |
1281 |
yy_bp = yy_cp; |
1282 |
|
1283 |
yy_current_state = (yy_start); |
1284 |
yy_match: |
1285 |
do |
1286 |
{ |
1287 |
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; |
1288 |
if ( yy_accept[yy_current_state] ) |
1289 |
{ |
1290 |
(yy_last_accepting_state) = yy_current_state; |
1291 |
(yy_last_accepting_cpos) = yy_cp; |
1292 |
} |
1293 |
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1294 |
{ |
1295 |
yy_current_state = (int) yy_def[yy_current_state]; |
1296 |
if ( yy_current_state >= 124 ) |
1297 |
yy_c = yy_meta[yy_c]; |
1298 |
} |
1299 |
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
1300 |
++yy_cp; |
1301 |
} |
1302 |
while ( yy_base[yy_current_state] != 467 ); |
1303 |
|
1304 |
yy_find_action: |
1305 |
yy_act = yy_accept[yy_current_state]; |
1306 |
if ( yy_act == 0 ) |
1307 |
{ /* have to back up */ |
1308 |
yy_cp = (yy_last_accepting_cpos); |
1309 |
yy_current_state = (yy_last_accepting_state); |
1310 |
yy_act = yy_accept[yy_current_state]; |
1311 |
} |
1312 |
|
1313 |
YY_DO_BEFORE_ACTION; |
1314 |
|
1315 |
if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) |
1316 |
{ |
1317 |
int yyl; |
1318 |
for ( yyl = (yy_prev_more_offset); yyl < yyleng; ++yyl ) |
1319 |
if ( yytext[yyl] == '\n' ) |
1320 |
|
1321 |
yylineno++; |
1322 |
; |
1323 |
} |
1324 |
|
1325 |
do_action: /* This label is used only to access EOF actions. */ |
1326 |
|
1327 |
switch ( yy_act ) |
1328 |
{ /* beginning of action switch */ |
1329 |
case 0: /* must back up */ |
1330 |
/* undo the effects of YY_DO_BEFORE_ACTION */ |
1331 |
*yy_cp = (yy_hold_char); |
1332 |
yy_cp = (yy_last_accepting_cpos); |
1333 |
yy_current_state = (yy_last_accepting_state); |
1334 |
goto yy_find_action; |
1335 |
|
1336 |
case 1: |
1337 |
#line 176 "tcltk/interface/typelex.l" |
1338 |
case 2: |
1339 |
#line 177 "tcltk/interface/typelex.l" |
1340 |
case 3: |
1341 |
YY_RULE_SETUP |
1342 |
#line 177 "tcltk/interface/typelex.l" |
1343 |
{ |
1344 |
/* Match "(" followed by "*" puts us into |
1345 |
* the COMMENT state. Don't use \*+ since |
1346 |
* that will parse "(***)" incorrectly. |
1347 |
* Initialize the nesting level. |
1348 |
* Print if ShowComments is TRUE and |
1349 |
* MatchedToken is not NONE |
1350 |
*/ |
1351 |
BEGIN(Comment); |
1352 |
CommentNestLevel = 1; |
1353 |
if( ShowComments && MatchedToken!=NONE ) { |
1354 |
Asc_PutCode( typ_text, typ_out ); |
1355 |
} |
1356 |
break; |
1357 |
} |
1358 |
YY_BREAK |
1359 |
case 4: |
1360 |
/* rule 4 can match eol */ |
1361 |
YY_RULE_SETUP |
1362 |
#line 192 "tcltk/interface/typelex.l" |
1363 |
{ |
1364 |
/* Match "(" followed "*" followed by |
1365 |
* anything that's not "(" nor "*". |
1366 |
* `anything' includes newlines. |
1367 |
* Increase the commment nesting level. |
1368 |
* Print if ShowComments is TRUE and |
1369 |
* MatchedToken is not NONE. |
1370 |
*/ |
1371 |
CommentNestLevel++; |
1372 |
if( ShowComments && MatchedToken!=NONE ) { |
1373 |
Asc_PutCode( typ_text, typ_out ); |
1374 |
} |
1375 |
break; |
1376 |
} |
1377 |
YY_BREAK |
1378 |
case 5: |
1379 |
/* rule 5 can match eol */ |
1380 |
YY_RULE_SETUP |
1381 |
#line 206 "tcltk/interface/typelex.l" |
1382 |
{ |
1383 |
/* Match anything not "*" or "(" followed |
1384 |
* by one or more "*"s followed by ")". |
1385 |
* `anything' includes newlines. |
1386 |
* This decreases the comment nesting level |
1387 |
* and kicks us out if we're back to zero. |
1388 |
* Print if ShowComments is TRUE and |
1389 |
* MatchedToken is not NONE. |
1390 |
*/ |
1391 |
CommentNestLevel--; |
1392 |
if( CommentNestLevel > 0 ) { |
1393 |
/* more comments */ |
1394 |
break; |
1395 |
} |
1396 |
if( MatchedToken == NONE ) { |
1397 |
BEGIN(INITIAL); |
1398 |
break; |
1399 |
} |
1400 |
if( ShowComments ) { |
1401 |
Asc_PutCode( typ_text, typ_out ); |
1402 |
} |
1403 |
switch( MatchedToken ) { |
1404 |
case MODEL: |
1405 |
BEGIN(Model); |
1406 |
break; |
1407 |
case CONSTANT: |
1408 |
BEGIN(Constant); |
1409 |
break; |
1410 |
default: |
1411 |
BEGIN(INITIAL); |
1412 |
break; |
1413 |
} |
1414 |
break; |
1415 |
} |
1416 |
YY_BREAK |
1417 |
case 6: |
1418 |
/* rule 6 can match eol */ |
1419 |
#line 241 "tcltk/interface/typelex.l" |
1420 |
case 7: |
1421 |
/* rule 7 can match eol */ |
1422 |
#line 242 "tcltk/interface/typelex.l" |
1423 |
case 8: |
1424 |
/* rule 8 can match eol */ |
1425 |
YY_RULE_SETUP |
1426 |
#line 242 "tcltk/interface/typelex.l" |
1427 |
{ |
1428 |
/* |
1429 |
* These three rules eat: |
1430 |
* -- anything that's not a "*" or a "(" |
1431 |
* -- "("s not followed by "*" |
1432 |
* -- "*"s not followed by ")" |
1433 |
* `anything' includes newlines. |
1434 |
* Print if ShowComments is TRUE and |
1435 |
* MatchedToken is not NONE |
1436 |
*/ |
1437 |
if( ShowComments && MatchedToken!=NONE ) { |
1438 |
Asc_PutCode( typ_text, typ_out ); |
1439 |
} |
1440 |
break; |
1441 |
} |
1442 |
YY_BREAK |
1443 |
/* |
1444 |
* Code to handle { Text in Braces } |
1445 |
* |
1446 |
* "{" puts us into the BracedText state. Braces nest, so |
1447 |
* in the BracedText state we need to look for "{" that increases |
1448 |
* the nesting level and "}" that will lower it. |
1449 |
*/ |
1450 |
case 9: |
1451 |
#line 268 "tcltk/interface/typelex.l" |
1452 |
case 10: |
1453 |
#line 269 "tcltk/interface/typelex.l" |
1454 |
case 11: |
1455 |
YY_RULE_SETUP |
1456 |
#line 269 "tcltk/interface/typelex.l" |
1457 |
{ |
1458 |
/* A "{" puts us into the BracedText state. |
1459 |
* Initialize the nesting level. |
1460 |
* Print if MatchedToken is not NONE. |
1461 |
* |
1462 |
*/ |
1463 |
BEGIN(BracedText); |
1464 |
BracesNestLevel = 1; |
1465 |
if( MatchedToken != NONE ) { |
1466 |
Asc_PutCode( typ_text, typ_out ); |
1467 |
} |
1468 |
break; |
1469 |
} |
1470 |
YY_BREAK |
1471 |
case 12: |
1472 |
/* rule 12 can match eol */ |
1473 |
YY_RULE_SETUP |
1474 |
#line 282 "tcltk/interface/typelex.l" |
1475 |
{ |
1476 |
/* A backslash \ in the BracedText state |
1477 |
* protects any character---even a |
1478 |
* newline---and does not affect the |
1479 |
* Nesting Level. |
1480 |
* Print if MatchedToken is not NONE. |
1481 |
*/ |
1482 |
if( MatchedToken != NONE ) { |
1483 |
Asc_PutCode( typ_text, typ_out ); |
1484 |
} |
1485 |
break; |
1486 |
} |
1487 |
YY_BREAK |
1488 |
case 13: |
1489 |
/* rule 13 can match eol */ |
1490 |
YY_RULE_SETUP |
1491 |
#line 294 "tcltk/interface/typelex.l" |
1492 |
{ |
1493 |
/* A backslash \ in the BracedText state |
1494 |
* protects any character---even a |
1495 |
* newline---and does not affect the |
1496 |
* Nesting Level. |
1497 |
* Print if MatchedToken is not NONE. |
1498 |
*/ |
1499 |
if( MatchedToken != NONE ) { |
1500 |
Asc_PutCode( typ_text, typ_out ); |
1501 |
} |
1502 |
break; |
1503 |
} |
1504 |
YY_BREAK |
1505 |
case 14: |
1506 |
/* rule 14 can match eol */ |
1507 |
YY_RULE_SETUP |
1508 |
#line 306 "tcltk/interface/typelex.l" |
1509 |
{ |
1510 |
/* A "{" in the braces state gets added to |
1511 |
* the text and increase the nesting level. |
1512 |
* Match any non-brace character---including |
1513 |
* newlines---that follows the open brace. |
1514 |
* Print if MatchedToken is not NONE. |
1515 |
*/ |
1516 |
BracesNestLevel++; |
1517 |
if( MatchedToken != NONE ) { |
1518 |
Asc_PutCode( typ_text, typ_out ); |
1519 |
} |
1520 |
break; |
1521 |
} |
1522 |
YY_BREAK |
1523 |
case 15: |
1524 |
/* rule 15 can match eol */ |
1525 |
YY_RULE_SETUP |
1526 |
#line 319 "tcltk/interface/typelex.l" |
1527 |
{ |
1528 |
/* A "}" will reduce the nesting level. |
1529 |
* If the nesting level is zero, go back to |
1530 |
* the previous state. Match any |
1531 |
* non-brace character---including |
1532 |
* newlines---that precedes the close brace. |
1533 |
* Print if MatchedToken is not NONE. |
1534 |
*/ |
1535 |
BracesNestLevel--; |
1536 |
if (BracesNestLevel > 0) { |
1537 |
/* more braced text */ |
1538 |
break; |
1539 |
} |
1540 |
if( MatchedToken == NONE ) { |
1541 |
BEGIN(INITIAL); |
1542 |
break; |
1543 |
} |
1544 |
Asc_PutCode( typ_text, typ_out ); |
1545 |
switch( MatchedToken ) { |
1546 |
case MODEL: |
1547 |
BEGIN(Model); |
1548 |
break; |
1549 |
case CONSTANT: |
1550 |
BEGIN(Constant); |
1551 |
break; |
1552 |
default: |
1553 |
BEGIN(INITIAL); |
1554 |
break; |
1555 |
} |
1556 |
break; |
1557 |
} |
1558 |
YY_BREAK |
1559 |
case 16: |
1560 |
/* rule 16 can match eol */ |
1561 |
YY_RULE_SETUP |
1562 |
#line 350 "tcltk/interface/typelex.l" |
1563 |
{ |
1564 |
/* Match anything that is not "{" nor "}" |
1565 |
* nor "\\"(backslash). |
1566 |
* `anything' includes newlines. |
1567 |
* Print if MatchedToken is not NONE. |
1568 |
*/ |
1569 |
if( MatchedToken != NONE ) { |
1570 |
Asc_PutCode( typ_text, typ_out ); |
1571 |
} |
1572 |
break; |
1573 |
} |
1574 |
YY_BREAK |
1575 |
/* |
1576 |
* Code to check an identifier. |
1577 |
* |
1578 |
* When we are looking for a MODEL, ATOM, CONSTANT, or DEFIITION |
1579 |
* and we find the text [UNIVERSAL]{MODEL|ATOM|CONSTANT|DEFINITION}, |
1580 |
* we enter this state. |
1581 |
* |
1582 |
* When we are insided MODEL, ATOM, or DEFINITION and we find |
1583 |
* the text END, we enter this state. |
1584 |
* |
1585 |
* This state checks to see if the text following the MODEL, |
1586 |
* ATOM, CONSTANT, DEFINITION, or END keyword matches |
1587 |
* `reqType'---the type requested by the user. If so, we are |
1588 |
* at the beginning or end of a type, and should change states |
1589 |
* accordingly. If not, we should stay in our current state. |
1590 |
*/ |
1591 |
case 17: |
1592 |
YY_RULE_SETUP |
1593 |
#line 381 "tcltk/interface/typelex.l" |
1594 |
{ |
1595 |
/* |
1596 |
* Found an identifier. |
1597 |
* Identify the correct state. |
1598 |
*/ |
1599 |
if( MatchedToken == MODEL_END ) { |
1600 |
/* |
1601 |
* We're in the Model state, print the |
1602 |
* text and see if matches reqType, if |
1603 |
* so, we're at the end of the MODEL |
1604 |
* (or ATOM or DEFINITION) |
1605 |
* and should exit typ_lex()---return to |
1606 |
* our caller, else stay in the Model |
1607 |
* state. |
1608 |
*/ |
1609 |
Asc_PutCode( typ_text, typ_out ); |
1610 |
if(strcmp((typ_text+StartId),reqType) == 0) { |
1611 |
return 0; |
1612 |
} else { |
1613 |
MatchedToken = MODEL; |
1614 |
BEGIN(Model); |
1615 |
} |
1616 |
break; |
1617 |
} |
1618 |
if(strcmp((typ_text+StartId),reqType)==0){ |
1619 |
/* |
1620 |
* We're in the INITIAL state, and we |
1621 |
* found the beginning of the |
1622 |
* requested MODEL, ATOM, CONSTANT, |
1623 |
* or DEFINITION. |
1624 |
* Print the text and set OutputState to |
1625 |
* say we are printing. Start the |
1626 |
* appropriate State by checking |
1627 |
* MatchedToken. |
1628 |
*/ |
1629 |
Asc_PutCode( typ_text, typ_out ); |
1630 |
switch( MatchedToken ) { |
1631 |
case MODEL: |
1632 |
BEGIN(Model); |
1633 |
break; |
1634 |
case CONSTANT: |
1635 |
BEGIN(Constant); |
1636 |
break; |
1637 |
default: |
1638 |
/* something is wrong */ |
1639 |
BEGIN(INITIAL); |
1640 |
break; |
1641 |
} |
1642 |
break; |
1643 |
} |
1644 |
/* |
1645 |
* We're in the INITIAL state; we found |
1646 |
* an MODEL, ATOM, CONSTANT, or |
1647 |
* DEFINITION, but it wasn't the right |
1648 |
* one. Stay in the INITIAL state. |
1649 |
*/ |
1650 |
MatchedToken = NONE; |
1651 |
BEGIN(INITIAL); |
1652 |
break; |
1653 |
} |
1654 |
YY_BREAK |
1655 |
case 18: |
1656 |
YY_RULE_SETUP |
1657 |
#line 441 "tcltk/interface/typelex.l" |
1658 |
{ |
1659 |
/* |
1660 |
* Some text other than an identifier |
1661 |
* was found. Print the text if |
1662 |
* MatchedToken is not NONE, |
1663 |
* and return to the correct state. |
1664 |
*/ |
1665 |
if( MatchedToken == NONE ) { |
1666 |
BEGIN(INITIAL); |
1667 |
break; |
1668 |
} |
1669 |
Asc_PutCode( typ_text, typ_out ); |
1670 |
switch( MatchedToken ) { |
1671 |
case MODEL: |
1672 |
BEGIN(Model); |
1673 |
break; |
1674 |
case CONSTANT: |
1675 |
BEGIN(Constant); |
1676 |
break; |
1677 |
default: |
1678 |
/* something is wrong */ |
1679 |
BEGIN(INITIAL); |
1680 |
break; |
1681 |
} |
1682 |
break; |
1683 |
} |
1684 |
YY_BREAK |
1685 |
/* |
1686 |
* Code to handle the model/atom/definition we want. |
1687 |
* |
1688 |
* Once we've found the start of the matching MODEL, ATOM, or |
1689 |
* DEFINITION, print the text until we find the END token. |
1690 |
* When we find END, save the current length of typ_text and use |
1691 |
* MY_YYMORE() to append the identifier, then check the identifier |
1692 |
* (in the CheckID state) to see if it is what we want. If so, |
1693 |
* this is the end of this MODEL, ATOM, or DEFINITION. |
1694 |
*/ |
1695 |
case 19: |
1696 |
YY_RULE_SETUP |
1697 |
#line 481 "tcltk/interface/typelex.l" |
1698 |
{ |
1699 |
/* |
1700 |
* Found the END keyword. Save the |
1701 |
* current location in the typ_text array, |
1702 |
* then enter the CheckID state to see if |
1703 |
* the identifier matches what we want. |
1704 |
*/ |
1705 |
StartId = typ_leng; |
1706 |
MatchedToken = MODEL_END; |
1707 |
BEGIN(CheckID); |
1708 |
MY_YYMORE(); |
1709 |
break; |
1710 |
} |
1711 |
YY_BREAK |
1712 |
case 20: |
1713 |
/* rule 20 can match eol */ |
1714 |
#line 495 "tcltk/interface/typelex.l" |
1715 |
case 21: |
1716 |
/* rule 21 can match eol */ |
1717 |
#line 496 "tcltk/interface/typelex.l" |
1718 |
case 22: |
1719 |
/* rule 22 can match eol */ |
1720 |
YY_RULE_SETUP |
1721 |
#line 496 "tcltk/interface/typelex.l" |
1722 |
{ |
1723 |
/* |
1724 |
* These rules match |
1725 |
* -- any character except that which |
1726 |
* would cause us to change states |
1727 |
* -- "("s not followed by "*"s |
1728 |
* -- uppercase keywords and following |
1729 |
* semicolon or whitespace. |
1730 |
* Print the text. |
1731 |
*/ |
1732 |
Asc_PutCode( typ_text, typ_out ); |
1733 |
break; |
1734 |
} |
1735 |
YY_BREAK |
1736 |
/* |
1737 |
* Code to handle the constant definition we want. |
1738 |
* |
1739 |
* Once we've found the start of the matching CONSTANT, print |
1740 |
* the text until we find a semicolon ";". |
1741 |
*/ |
1742 |
case 23: |
1743 |
YY_RULE_SETUP |
1744 |
#line 519 "tcltk/interface/typelex.l" |
1745 |
{ |
1746 |
/* |
1747 |
* Found the ";" which ends the CONSTANT. |
1748 |
* Do NOT print it since that will be |
1749 |
* added below. Return 0. |
1750 |
*/ |
1751 |
return 0; |
1752 |
} |
1753 |
YY_BREAK |
1754 |
case 24: |
1755 |
/* rule 24 can match eol */ |
1756 |
#line 528 "tcltk/interface/typelex.l" |
1757 |
case 25: |
1758 |
/* rule 25 can match eol */ |
1759 |
YY_RULE_SETUP |
1760 |
#line 528 "tcltk/interface/typelex.l" |
1761 |
{ |
1762 |
/* |
1763 |
* These rules match |
1764 |
* -- any character except that which |
1765 |
* would cause us to change states |
1766 |
* -- "("s not followed by "*"s |
1767 |
* Print the text. |
1768 |
*/ |
1769 |
Asc_PutCode( typ_text, typ_out ); |
1770 |
break; |
1771 |
} |
1772 |
YY_BREAK |
1773 |
/* |
1774 |
* Code to look for [UNIVERSAL ]{MODEL|ATOM|CONSTANT|DEFINITION}. |
1775 |
* |
1776 |
* If we find UNIVERSAL, use yymore() to append the next |
1777 |
* keyword---probably MODEL, ATOM, or CONSTANT. |
1778 |
* If we find MODEL, ATOM, CONSTANT, or DEFINITION save the |
1779 |
* current length and use yymore() to append the identifier, |
1780 |
* then check the identifier (in the CheckID state) to see if |
1781 |
* it is what we're looking for. |
1782 |
*/ |
1783 |
case 26: |
1784 |
YY_RULE_SETUP |
1785 |
#line 553 "tcltk/interface/typelex.l" |
1786 |
{ |
1787 |
/* |
1788 |
* Found the UNIVERSAL keyword. Append |
1789 |
* the following ATOM/MODEL/CONSTANT |
1790 |
* keyword. |
1791 |
*/ |
1792 |
MY_YYMORE(); |
1793 |
break; |
1794 |
} |
1795 |
YY_BREAK |
1796 |
case 27: |
1797 |
#line 563 "tcltk/interface/typelex.l" |
1798 |
case 28: |
1799 |
#line 564 "tcltk/interface/typelex.l" |
1800 |
case 29: |
1801 |
YY_RULE_SETUP |
1802 |
#line 564 "tcltk/interface/typelex.l" |
1803 |
{ |
1804 |
/* |
1805 |
* Found an MODEL, ATOM, or DEFINITION |
1806 |
* keyword--perhaps with a UNIVERSAL |
1807 |
* modifier. Save the current location |
1808 |
* in the typ_text array, then enter the |
1809 |
* CheckID state to see if the identifier |
1810 |
* matches what we want. |
1811 |
*/ |
1812 |
StartId = typ_leng; |
1813 |
MatchedToken = MODEL; |
1814 |
BEGIN(CheckID); |
1815 |
MY_YYMORE(); |
1816 |
break; |
1817 |
} |
1818 |
YY_BREAK |
1819 |
case 30: |
1820 |
YY_RULE_SETUP |
1821 |
#line 579 "tcltk/interface/typelex.l" |
1822 |
{ |
1823 |
/* |
1824 |
* Found a CONSTANT keyword--perhaps |
1825 |
* with a UNIVERSAL modifier. Save the |
1826 |
* current location in the typ_text array, |
1827 |
* then enter the CheckID state to see if |
1828 |
* the identifier matches what we want. |
1829 |
*/ |
1830 |
StartId = typ_leng; |
1831 |
MatchedToken = CONSTANT; |
1832 |
BEGIN(CheckID); |
1833 |
MY_YYMORE(); |
1834 |
break; |
1835 |
} |
1836 |
YY_BREAK |
1837 |
/* |
1838 |
* Rules to match other text. |
1839 |
*/ |
1840 |
case 31: |
1841 |
/* rule 31 can match eol */ |
1842 |
#line 602 "tcltk/interface/typelex.l" |
1843 |
case 32: |
1844 |
/* rule 32 can match eol */ |
1845 |
#line 603 "tcltk/interface/typelex.l" |
1846 |
case 33: |
1847 |
/* rule 33 can match eol */ |
1848 |
YY_RULE_SETUP |
1849 |
#line 603 "tcltk/interface/typelex.l" |
1850 |
{ |
1851 |
/* |
1852 |
* These rules match |
1853 |
* -- any character except that which |
1854 |
* would cause us to change states |
1855 |
* -- "("s not followed by "*"s |
1856 |
* -- uppercase keywords and following |
1857 |
* semicolon or whitespace. |
1858 |
* Do nothing. |
1859 |
*/ |
1860 |
break; |
1861 |
} |
1862 |
YY_BREAK |
1863 |
case YY_STATE_EOF(INITIAL): |
1864 |
#line 615 "tcltk/interface/typelex.l" |
1865 |
{ |
1866 |
/* |
1867 |
* Reached End of file without a match |
1868 |
*/ |
1869 |
return 1; |
1870 |
} |
1871 |
YY_BREAK |
1872 |
case 34: |
1873 |
YY_RULE_SETUP |
1874 |
#line 623 "tcltk/interface/typelex.l" |
1875 |
ECHO; |
1876 |
YY_BREAK |
1877 |
#line 1878 "<stdout>" |
1878 |
case YY_STATE_EOF(Comment): |
1879 |
case YY_STATE_EOF(BracedText): |
1880 |
case YY_STATE_EOF(Model): |
1881 |
case YY_STATE_EOF(Constant): |
1882 |
case YY_STATE_EOF(CheckID): |
1883 |
yyterminate(); |
1884 |
|
1885 |
case YY_END_OF_BUFFER: |
1886 |
{ |
1887 |
/* Amount of text matched not including the EOB char. */ |
1888 |
int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; |
1889 |
|
1890 |
/* Undo the effects of YY_DO_BEFORE_ACTION. */ |
1891 |
*yy_cp = (yy_hold_char); |
1892 |
YY_RESTORE_YY_MORE_OFFSET |
1893 |
|
1894 |
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) |
1895 |
{ |
1896 |
/* We're scanning a new file or input source. It's |
1897 |
* possible that this happened because the user |
1898 |
* just pointed yyin at a new source and called |
1899 |
* yylex(). If so, then we have to assure |
1900 |
* consistency between YY_CURRENT_BUFFER and our |
1901 |
* globals. Here is the right place to do so, because |
1902 |
* this is the first action (other than possibly a |
1903 |
* back-up) that will match for the new input source. |
1904 |
*/ |
1905 |
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
1906 |
YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; |
1907 |
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; |
1908 |
} |
1909 |
|
1910 |
/* Note that here we test for yy_c_buf_p "<=" to the position |
1911 |
* of the first EOB in the buffer, since yy_c_buf_p will |
1912 |
* already have been incremented past the NUL character |
1913 |
* (since all states make transitions on EOB to the |
1914 |
* end-of-buffer state). Contrast this with the test |
1915 |
* in input(). |
1916 |
*/ |
1917 |
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) |
1918 |
{ /* This was really a NUL. */ |
1919 |
yy_state_type yy_next_state; |
1920 |
|
1921 |
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; |
1922 |
|
1923 |
yy_current_state = yy_get_previous_state( ); |
1924 |
|
1925 |
/* Okay, we're now positioned to make the NUL |
1926 |
* transition. We couldn't have |
1927 |
* yy_get_previous_state() go ahead and do it |
1928 |
* for us because it doesn't know how to deal |
1929 |
* with the possibility of jamming (and we don't |
1930 |
* want to build jamming into it because then it |
1931 |
* will run more slowly). |
1932 |
*/ |
1933 |
|
1934 |
yy_next_state = yy_try_NUL_trans( yy_current_state ); |
1935 |
|
1936 |
yy_bp = (yytext_ptr) + YY_MORE_ADJ; |
1937 |
|
1938 |
if ( yy_next_state ) |
1939 |
{ |
1940 |
/* Consume the NUL. */ |
1941 |
yy_cp = ++(yy_c_buf_p); |
1942 |
yy_current_state = yy_next_state; |
1943 |
goto yy_match; |
1944 |
} |
1945 |
|
1946 |
else |
1947 |
{ |
1948 |
yy_cp = (yy_c_buf_p); |
1949 |
goto yy_find_action; |
1950 |
} |
1951 |
} |
1952 |
|
1953 |
else switch ( yy_get_next_buffer( ) ) |
1954 |
{ |
1955 |
case EOB_ACT_END_OF_FILE: |
1956 |
{ |
1957 |
(yy_did_buffer_switch_on_eof) = 0; |
1958 |
|
1959 |
if ( yywrap( ) ) |
1960 |
{ |
1961 |
/* Note: because we've taken care in |
1962 |
* yy_get_next_buffer() to have set up |
1963 |
* yytext, we can now set up |
1964 |
* yy_c_buf_p so that if some total |
1965 |
* hoser (like flex itself) wants to |
1966 |
* call the scanner after we return the |
1967 |
* YY_NULL, it'll still work - another |
1968 |
* YY_NULL will get returned. |
1969 |
*/ |
1970 |
(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; |
1971 |
|
1972 |
yy_act = YY_STATE_EOF(YY_START); |
1973 |
goto do_action; |
1974 |
} |
1975 |
|
1976 |
else |
1977 |
{ |
1978 |
if ( ! (yy_did_buffer_switch_on_eof) ) |
1979 |
YY_NEW_FILE; |
1980 |
} |
1981 |
break; |
1982 |
} |
1983 |
|
1984 |
case EOB_ACT_CONTINUE_SCAN: |
1985 |
(yy_c_buf_p) = |
1986 |
(yytext_ptr) + yy_amount_of_matched_text; |
1987 |
|
1988 |
yy_current_state = yy_get_previous_state( ); |
1989 |
|
1990 |
yy_cp = (yy_c_buf_p); |
1991 |
yy_bp = (yytext_ptr) + YY_MORE_ADJ; |
1992 |
goto yy_match; |
1993 |
|
1994 |
case EOB_ACT_LAST_MATCH: |
1995 |
(yy_c_buf_p) = |
1996 |
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; |
1997 |
|
1998 |
yy_current_state = yy_get_previous_state( ); |
1999 |
|
2000 |
yy_cp = (yy_c_buf_p); |
2001 |
yy_bp = (yytext_ptr) + YY_MORE_ADJ; |
2002 |
goto yy_find_action; |
2003 |
} |
2004 |
break; |
2005 |
} |
2006 |
|
2007 |
default: |
2008 |
YY_FATAL_ERROR( |
2009 |
"fatal flex scanner internal error--no action found" ); |
2010 |
} /* end of action switch */ |
2011 |
} /* end of scanning one token */ |
2012 |
} /* end of user's declarations */ |
2013 |
} /* end of yylex */ |
2014 |
|
2015 |
/* yy_get_next_buffer - try to read in a new buffer |
2016 |
* |
2017 |
* Returns a code representing an action: |
2018 |
* EOB_ACT_LAST_MATCH - |
2019 |
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
2020 |
* EOB_ACT_END_OF_FILE - end of file |
2021 |
*/ |
2022 |
static int yy_get_next_buffer (void) |
2023 |
{ |
2024 |
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
2025 |
char *source = (yytext_ptr); |
2026 |
int number_to_move, i; |
2027 |
int ret_val; |
2028 |
|
2029 |
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) |
2030 |
YY_FATAL_ERROR( |
2031 |
"fatal flex scanner internal error--end of buffer missed" ); |
2032 |
|
2033 |
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) |
2034 |
{ /* Don't try to fill the buffer, so this is an EOF. */ |
2035 |
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) |
2036 |
{ |
2037 |
/* We matched a single character, the EOB, so |
2038 |
* treat this as a final EOF. |
2039 |
*/ |
2040 |
return EOB_ACT_END_OF_FILE; |
2041 |
} |
2042 |
|
2043 |
else |
2044 |
{ |
2045 |
/* We matched some text prior to the EOB, first |
2046 |
* process it. |
2047 |
*/ |
2048 |
return EOB_ACT_LAST_MATCH; |
2049 |
} |
2050 |
} |
2051 |
|
2052 |
/* Try to read more data. */ |
2053 |
|
2054 |
/* First move last chars to start of buffer. */ |
2055 |
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); |
2056 |
|
2057 |
for ( i = 0; i < number_to_move; ++i ) |
2058 |
*(dest++) = *(source++); |
2059 |
|
2060 |
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) |
2061 |
/* don't do the read, it's not guaranteed to return an EOF, |
2062 |
* just force an EOF |
2063 |
*/ |
2064 |
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; |
2065 |
|
2066 |
else |
2067 |
{ |
2068 |
int num_to_read = |
2069 |
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
2070 |
|
2071 |
while ( num_to_read <= 0 ) |
2072 |
{ /* Not enough room in the buffer - grow it. */ |
2073 |
|
2074 |
/* just a shorter name for the current buffer */ |
2075 |
YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; |
2076 |
|
2077 |
int yy_c_buf_p_offset = |
2078 |
(int) ((yy_c_buf_p) - b->yy_ch_buf); |
2079 |
|
2080 |
if ( b->yy_is_our_buffer ) |
2081 |
{ |
2082 |
int new_size = b->yy_buf_size * 2; |
2083 |
|
2084 |
if ( new_size <= 0 ) |
2085 |
b->yy_buf_size += b->yy_buf_size / 8; |
2086 |
else |
2087 |
b->yy_buf_size *= 2; |
2088 |
|
2089 |
b->yy_ch_buf = (char *) |
2090 |
/* Include room in for 2 EOB chars. */ |
2091 |
yyrealloc( (void *) b->yy_ch_buf, |
2092 |
(yy_size_t) (b->yy_buf_size + 2) ); |
2093 |
} |
2094 |
else |
2095 |
/* Can't grow it, we don't own it. */ |
2096 |
b->yy_ch_buf = NULL; |
2097 |
|
2098 |
if ( ! b->yy_ch_buf ) |
2099 |
YY_FATAL_ERROR( |
2100 |
"fatal error - scanner input buffer overflow" ); |
2101 |
|
2102 |
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; |
2103 |
|
2104 |
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - |
2105 |
number_to_move - 1; |
2106 |
|
2107 |
} |
2108 |
|
2109 |
if ( num_to_read > YY_READ_BUF_SIZE ) |
2110 |
num_to_read = YY_READ_BUF_SIZE; |
2111 |
|
2112 |
/* Read in more data. */ |
2113 |
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), |
2114 |
(yy_n_chars), num_to_read ); |
2115 |
|
2116 |
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); |
2117 |
} |
2118 |
|
2119 |
if ( (yy_n_chars) == 0 ) |
2120 |
{ |
2121 |
if ( number_to_move == YY_MORE_ADJ ) |
2122 |
{ |
2123 |
ret_val = EOB_ACT_END_OF_FILE; |
2124 |
yyrestart( yyin ); |
2125 |
} |
2126 |
|
2127 |
else |
2128 |
{ |
2129 |
ret_val = EOB_ACT_LAST_MATCH; |
2130 |
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = |
2131 |
YY_BUFFER_EOF_PENDING; |
2132 |
} |
2133 |
} |
2134 |
|
2135 |
else |
2136 |
ret_val = EOB_ACT_CONTINUE_SCAN; |
2137 |
|
2138 |
if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { |
2139 |
/* Extend the array by 50%, plus the number we really need. */ |
2140 |
int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); |
2141 |
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( |
2142 |
(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); |
2143 |
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) |
2144 |
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); |
2145 |
/* "- 2" to take care of EOB's */ |
2146 |
YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); |
2147 |
} |
2148 |
|
2149 |
(yy_n_chars) += number_to_move; |
2150 |
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; |
2151 |
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; |
2152 |
|
2153 |
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; |
2154 |
|
2155 |
return ret_val; |
2156 |
} |
2157 |
|
2158 |
/* yy_get_previous_state - get the state just before the EOB char was reached */ |
2159 |
|
2160 |
static yy_state_type yy_get_previous_state (void) |
2161 |
{ |
2162 |
yy_state_type yy_current_state; |
2163 |
char *yy_cp; |
2164 |
|
2165 |
yy_current_state = (yy_start); |
2166 |
|
2167 |
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) |
2168 |
{ |
2169 |
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
2170 |
if ( yy_accept[yy_current_state] ) |
2171 |
{ |
2172 |
(yy_last_accepting_state) = yy_current_state; |
2173 |
(yy_last_accepting_cpos) = yy_cp; |
2174 |
} |
2175 |
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
2176 |
{ |
2177 |
yy_current_state = (int) yy_def[yy_current_state]; |
2178 |
if ( yy_current_state >= 124 ) |
2179 |
yy_c = yy_meta[yy_c]; |
2180 |
} |
2181 |
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
2182 |
} |
2183 |
|
2184 |
return yy_current_state; |
2185 |
} |
2186 |
|
2187 |
/* yy_try_NUL_trans - try to make a transition on the NUL character |
2188 |
* |
2189 |
* synopsis |
2190 |
* next_state = yy_try_NUL_trans( current_state ); |
2191 |
*/ |
2192 |
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) |
2193 |
{ |
2194 |
int yy_is_jam; |
2195 |
char *yy_cp = (yy_c_buf_p); |
2196 |
|
2197 |
YY_CHAR yy_c = 1; |
2198 |
if ( yy_accept[yy_current_state] ) |
2199 |
{ |
2200 |
(yy_last_accepting_state) = yy_current_state; |
2201 |
(yy_last_accepting_cpos) = yy_cp; |
2202 |
} |
2203 |
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
2204 |
{ |
2205 |
yy_current_state = (int) yy_def[yy_current_state]; |
2206 |
if ( yy_current_state >= 124 ) |
2207 |
yy_c = yy_meta[yy_c]; |
2208 |
} |
2209 |
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
2210 |
yy_is_jam = (yy_current_state == 123); |
2211 |
|
2212 |
return yy_is_jam ? 0 : yy_current_state; |
2213 |
} |
2214 |
|
2215 |
#ifndef YY_NO_UNPUT |
2216 |
|
2217 |
static void yyunput (int c, char * yy_bp ) |
2218 |
{ |
2219 |
char *yy_cp; |
2220 |
|
2221 |
yy_cp = (yy_c_buf_p); |
2222 |
|
2223 |
/* undo effects of setting up yytext */ |
2224 |
*yy_cp = (yy_hold_char); |
2225 |
|
2226 |
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) |
2227 |
{ /* need to shift things up to make room */ |
2228 |
/* +2 for EOB chars. */ |
2229 |
int number_to_move = (yy_n_chars) + 2; |
2230 |
char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ |
2231 |
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; |
2232 |
char *source = |
2233 |
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; |
2234 |
|
2235 |
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) |
2236 |
*--dest = *--source; |
2237 |
|
2238 |
yy_cp += (int) (dest - source); |
2239 |
yy_bp += (int) (dest - source); |
2240 |
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = |
2241 |
(yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; |
2242 |
|
2243 |
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) |
2244 |
YY_FATAL_ERROR( "flex scanner push-back overflow" ); |
2245 |
} |
2246 |
|
2247 |
*--yy_cp = (char) c; |
2248 |
|
2249 |
if ( c == '\n' ){ |
2250 |
--yylineno; |
2251 |
} |
2252 |
|
2253 |
(yytext_ptr) = yy_bp; |
2254 |
(yy_hold_char) = *yy_cp; |
2255 |
(yy_c_buf_p) = yy_cp; |
2256 |
} |
2257 |
|
2258 |
#endif |
2259 |
|
2260 |
#ifndef YY_NO_INPUT |
2261 |
#ifdef __cplusplus |
2262 |
static int yyinput (void) |
2263 |
#else |
2264 |
static int input (void) |
2265 |
#endif |
2266 |
|
2267 |
{ |
2268 |
int c; |
2269 |
|
2270 |
*(yy_c_buf_p) = (yy_hold_char); |
2271 |
|
2272 |
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) |
2273 |
{ |
2274 |
/* yy_c_buf_p now points to the character we want to return. |
2275 |
* If this occurs *before* the EOB characters, then it's a |
2276 |
* valid NUL; if not, then we've hit the end of the buffer. |
2277 |
*/ |
2278 |
if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) |
2279 |
/* This was really a NUL. */ |
2280 |
*(yy_c_buf_p) = '\0'; |
2281 |
|
2282 |
else |
2283 |
{ /* need more input */ |
2284 |
int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); |
2285 |
++(yy_c_buf_p); |
2286 |
|
2287 |
switch ( yy_get_next_buffer( ) ) |
2288 |
{ |
2289 |
case EOB_ACT_LAST_MATCH: |
2290 |
/* This happens because yy_g_n_b() |
2291 |
* sees that we've accumulated a |
2292 |
* token and flags that we need to |
2293 |
* try matching the token before |
2294 |
* proceeding. But for input(), |
2295 |
* there's no matching to consider. |
2296 |
* So convert the EOB_ACT_LAST_MATCH |
2297 |
* to EOB_ACT_END_OF_FILE. |
2298 |
*/ |
2299 |
|
2300 |
/* Reset buffer status. */ |
2301 |
yyrestart( yyin ); |
2302 |
|
2303 |
/*FALLTHROUGH*/ |
2304 |
|
2305 |
case EOB_ACT_END_OF_FILE: |
2306 |
{ |
2307 |
if ( yywrap( ) ) |
2308 |
return 0; |
2309 |
|
2310 |
if ( ! (yy_did_buffer_switch_on_eof) ) |
2311 |
YY_NEW_FILE; |
2312 |
#ifdef __cplusplus |
2313 |
return yyinput(); |
2314 |
#else |
2315 |
return input(); |
2316 |
#endif |
2317 |
} |
2318 |
|
2319 |
case EOB_ACT_CONTINUE_SCAN: |
2320 |
(yy_c_buf_p) = (yytext_ptr) + offset; |
2321 |
break; |
2322 |
} |
2323 |
} |
2324 |
} |
2325 |
|
2326 |
c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ |
2327 |
*(yy_c_buf_p) = '\0'; /* preserve yytext */ |
2328 |
(yy_hold_char) = *++(yy_c_buf_p); |
2329 |
|
2330 |
if ( c == '\n' ) |
2331 |
|
2332 |
yylineno++; |
2333 |
; |
2334 |
|
2335 |
return c; |
2336 |
} |
2337 |
#endif /* ifndef YY_NO_INPUT */ |
2338 |
|
2339 |
/** Immediately switch to a different input stream. |
2340 |
* @param input_file A readable stream. |
2341 |
* |
2342 |
* @note This function does not reset the start condition to @c INITIAL . |
2343 |
*/ |
2344 |
void yyrestart (FILE * input_file ) |
2345 |
{ |
2346 |
|
2347 |
if ( ! YY_CURRENT_BUFFER ){ |
2348 |
yyensure_buffer_stack (); |
2349 |
YY_CURRENT_BUFFER_LVALUE = |
2350 |
yy_create_buffer( yyin, YY_BUF_SIZE ); |
2351 |
} |
2352 |
|
2353 |
yy_init_buffer( YY_CURRENT_BUFFER, input_file ); |
2354 |
yy_load_buffer_state( ); |
2355 |
} |
2356 |
|
2357 |
/** Switch to a different input buffer. |
2358 |
* @param new_buffer The new input buffer. |
2359 |
* |
2360 |
*/ |
2361 |
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) |
2362 |
{ |
2363 |
|
2364 |
/* TODO. We should be able to replace this entire function body |
2365 |
* with |
2366 |
* yypop_buffer_state(); |
2367 |
* yypush_buffer_state(new_buffer); |
2368 |
*/ |
2369 |
yyensure_buffer_stack (); |
2370 |
if ( YY_CURRENT_BUFFER == new_buffer ) |
2371 |
return; |
2372 |
|
2373 |
if ( YY_CURRENT_BUFFER ) |
2374 |
{ |
2375 |
/* Flush out information for old buffer. */ |
2376 |
*(yy_c_buf_p) = (yy_hold_char); |
2377 |
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); |
2378 |
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); |
2379 |
} |
2380 |
|
2381 |
YY_CURRENT_BUFFER_LVALUE = new_buffer; |
2382 |
yy_load_buffer_state( ); |
2383 |
|
2384 |
/* We don't actually know whether we did this switch during |
2385 |
* EOF (yywrap()) processing, but the only time this flag |
2386 |
* is looked at is after yywrap() is called, so it's safe |
2387 |
* to go ahead and always set it. |
2388 |
*/ |
2389 |
(yy_did_buffer_switch_on_eof) = 1; |
2390 |
} |
2391 |
|
2392 |
static void yy_load_buffer_state (void) |
2393 |
{ |
2394 |
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
2395 |
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; |
2396 |
yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; |
2397 |
(yy_hold_char) = *(yy_c_buf_p); |
2398 |
} |
2399 |
|
2400 |
/** Allocate and initialize an input buffer state. |
2401 |
* @param file A readable stream. |
2402 |
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. |
2403 |
* |
2404 |
* @return the allocated buffer state. |
2405 |
*/ |
2406 |
YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) |
2407 |
{ |
2408 |
YY_BUFFER_STATE b; |
2409 |
|
2410 |
b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); |
2411 |
if ( ! b ) |
2412 |
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
2413 |
|
2414 |
b->yy_buf_size = size; |
2415 |
|
2416 |
/* yy_ch_buf has to be 2 characters longer than the size given because |
2417 |
* we need to put in 2 end-of-buffer characters. |
2418 |
*/ |
2419 |
b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); |
2420 |
if ( ! b->yy_ch_buf ) |
2421 |
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
2422 |
|
2423 |
b->yy_is_our_buffer = 1; |
2424 |
|
2425 |
yy_init_buffer( b, file ); |
2426 |
|
2427 |
return b; |
2428 |
} |
2429 |
|
2430 |
/** Destroy the buffer. |
2431 |
* @param b a buffer created with yy_create_buffer() |
2432 |
* |
2433 |
*/ |
2434 |
void yy_delete_buffer (YY_BUFFER_STATE b ) |
2435 |
{ |
2436 |
|
2437 |
if ( ! b ) |
2438 |
return; |
2439 |
|
2440 |
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ |
2441 |
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; |
2442 |
|
2443 |
if ( b->yy_is_our_buffer ) |
2444 |
yyfree( (void *) b->yy_ch_buf ); |
2445 |
|
2446 |
yyfree( (void *) b ); |
2447 |
} |
2448 |
|
2449 |
/* Initializes or reinitializes a buffer. |
2450 |
* This function is sometimes called more than once on the same buffer, |
2451 |
* such as during a yyrestart() or at EOF. |
2452 |
*/ |
2453 |
static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) |
2454 |
|
2455 |
{ |
2456 |
int oerrno = errno; |
2457 |
|
2458 |
yy_flush_buffer( b ); |
2459 |
|
2460 |
b->yy_input_file = file; |
2461 |
b->yy_fill_buffer = 1; |
2462 |
|
2463 |
/* If b is the current buffer, then yy_init_buffer was _probably_ |
2464 |
* called from yyrestart() or through yy_get_next_buffer. |
2465 |
* In that case, we don't want to reset the lineno or column. |
2466 |
*/ |
2467 |
if (b != YY_CURRENT_BUFFER){ |
2468 |
b->yy_bs_lineno = 1; |
2469 |
b->yy_bs_column = 0; |
2470 |
} |
2471 |
|
2472 |
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; |
2473 |
|
2474 |
errno = oerrno; |
2475 |
} |
2476 |
|
2477 |
/** Discard all buffered characters. On the next scan, YY_INPUT will be called. |
2478 |
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. |
2479 |
* |
2480 |
*/ |
2481 |
void yy_flush_buffer (YY_BUFFER_STATE b ) |
2482 |
{ |
2483 |
if ( ! b ) |
2484 |
return; |
2485 |
|
2486 |
b->yy_n_chars = 0; |
2487 |
|
2488 |
/* We always need two end-of-buffer characters. The first causes |
2489 |
* a transition to the end-of-buffer state. The second causes |
2490 |
* a jam in that state. |
2491 |
*/ |
2492 |
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
2493 |
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
2494 |
|
2495 |
b->yy_buf_pos = &b->yy_ch_buf[0]; |
2496 |
|
2497 |
b->yy_at_bol = 1; |
2498 |
b->yy_buffer_status = YY_BUFFER_NEW; |
2499 |
|
2500 |
if ( b == YY_CURRENT_BUFFER ) |
2501 |
yy_load_buffer_state( ); |
2502 |
} |
2503 |
|
2504 |
/** Pushes the new state onto the stack. The new state becomes |
2505 |
* the current state. This function will allocate the stack |
2506 |
* if necessary. |
2507 |
* @param new_buffer The new state. |
2508 |
* |
2509 |
*/ |
2510 |
void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) |
2511 |
{ |
2512 |
if (new_buffer == NULL) |
2513 |
return; |
2514 |
|
2515 |
yyensure_buffer_stack(); |
2516 |
|
2517 |
/* This block is copied from yy_switch_to_buffer. */ |
2518 |
if ( YY_CURRENT_BUFFER ) |
2519 |
{ |
2520 |
/* Flush out information for old buffer. */ |
2521 |
*(yy_c_buf_p) = (yy_hold_char); |
2522 |
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); |
2523 |
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); |
2524 |
} |
2525 |
|
2526 |
/* Only push if top exists. Otherwise, replace top. */ |
2527 |
if (YY_CURRENT_BUFFER) |
2528 |
(yy_buffer_stack_top)++; |
2529 |
YY_CURRENT_BUFFER_LVALUE = new_buffer; |
2530 |
|
2531 |
/* copied from yy_switch_to_buffer. */ |
2532 |
yy_load_buffer_state( ); |
2533 |
(yy_did_buffer_switch_on_eof) = 1; |
2534 |
} |
2535 |
|
2536 |
/** Removes and deletes the top of the stack, if present. |
2537 |
* The next element becomes the new top. |
2538 |
* |
2539 |
*/ |
2540 |
void yypop_buffer_state (void) |
2541 |
{ |
2542 |
if (!YY_CURRENT_BUFFER) |
2543 |
return; |
2544 |
|
2545 |
yy_delete_buffer(YY_CURRENT_BUFFER ); |
2546 |
YY_CURRENT_BUFFER_LVALUE = NULL; |
2547 |
if ((yy_buffer_stack_top) > 0) |
2548 |
--(yy_buffer_stack_top); |
2549 |
|
2550 |
if (YY_CURRENT_BUFFER) { |
2551 |
yy_load_buffer_state( ); |
2552 |
(yy_did_buffer_switch_on_eof) = 1; |
2553 |
} |
2554 |
} |
2555 |
|
2556 |
/* Allocates the stack if it does not exist. |
2557 |
* Guarantees space for at least one push. |
2558 |
*/ |
2559 |
static void yyensure_buffer_stack (void) |
2560 |
{ |
2561 |
yy_size_t num_to_alloc; |
2562 |
|
2563 |
if (!(yy_buffer_stack)) { |
2564 |
|
2565 |
/* First allocation is just for 2 elements, since we don't know if this |
2566 |
* scanner will even need a stack. We use 2 instead of 1 to avoid an |
2567 |
* immediate realloc on the next call. |
2568 |
*/ |
2569 |
num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ |
2570 |
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc |
2571 |
(num_to_alloc * sizeof(struct yy_buffer_state*) |
2572 |
); |
2573 |
if ( ! (yy_buffer_stack) ) |
2574 |
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); |
2575 |
|
2576 |
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); |
2577 |
|
2578 |
(yy_buffer_stack_max) = num_to_alloc; |
2579 |
(yy_buffer_stack_top) = 0; |
2580 |
return; |
2581 |
} |
2582 |
|
2583 |
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ |
2584 |
|
2585 |
/* Increase the buffer to prepare for a possible push. */ |
2586 |
yy_size_t grow_size = 8 /* arbitrary grow size */; |
2587 |
|
2588 |
num_to_alloc = (yy_buffer_stack_max) + grow_size; |
2589 |
(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc |
2590 |
((yy_buffer_stack), |
2591 |
num_to_alloc * sizeof(struct yy_buffer_state*) |
2592 |
); |
2593 |
if ( ! (yy_buffer_stack) ) |
2594 |
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); |
2595 |
|
2596 |
/* zero only the new slots.*/ |
2597 |
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); |
2598 |
(yy_buffer_stack_max) = num_to_alloc; |
2599 |
} |
2600 |
} |
2601 |
|
2602 |
/** Setup the input buffer state to scan directly from a user-specified character buffer. |
2603 |
* @param base the character buffer |
2604 |
* @param size the size in bytes of the character buffer |
2605 |
* |
2606 |
* @return the newly allocated buffer state object. |
2607 |
*/ |
2608 |
YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) |
2609 |
{ |
2610 |
YY_BUFFER_STATE b; |
2611 |
|
2612 |
if ( size < 2 || |
2613 |
base[size-2] != YY_END_OF_BUFFER_CHAR || |
2614 |
base[size-1] != YY_END_OF_BUFFER_CHAR ) |
2615 |
/* They forgot to leave room for the EOB's. */ |
2616 |
return NULL; |
2617 |
|
2618 |
b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); |
2619 |
if ( ! b ) |
2620 |
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); |
2621 |
|
2622 |
b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ |
2623 |
b->yy_buf_pos = b->yy_ch_buf = base; |
2624 |
b->yy_is_our_buffer = 0; |
2625 |
b->yy_input_file = NULL; |
2626 |
b->yy_n_chars = b->yy_buf_size; |
2627 |
b->yy_is_interactive = 0; |
2628 |
b->yy_at_bol = 1; |
2629 |
b->yy_fill_buffer = 0; |
2630 |
b->yy_buffer_status = YY_BUFFER_NEW; |
2631 |
|
2632 |
yy_switch_to_buffer( b ); |
2633 |
|
2634 |
return b; |
2635 |
} |
2636 |
|
2637 |
/** Setup the input buffer state to scan a string. The next call to yylex() will |
2638 |
* scan from a @e copy of @a str. |
2639 |
* @param yystr a NUL-terminated string to scan |
2640 |
* |
2641 |
* @return the newly allocated buffer state object. |
2642 |
* @note If you want to scan bytes that may contain NUL values, then use |
2643 |
* yy_scan_bytes() instead. |
2644 |
*/ |
2645 |
YY_BUFFER_STATE yy_scan_string (const char * yystr ) |
2646 |
{ |
2647 |
|
2648 |
return yy_scan_bytes( yystr, (int) strlen(yystr) ); |
2649 |
} |
2650 |
|
2651 |
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
2652 |
* scan from a @e copy of @a bytes. |
2653 |
* @param yybytes the byte buffer to scan |
2654 |
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
2655 |
* |
2656 |
* @return the newly allocated buffer state object. |
2657 |
*/ |
2658 |
YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) |
2659 |
{ |
2660 |
YY_BUFFER_STATE b; |
2661 |
char *buf; |
2662 |
yy_size_t n; |
2663 |
int i; |
2664 |
|
2665 |
/* Get memory for full buffer, including space for trailing EOB's. */ |
2666 |
n = (yy_size_t) (_yybytes_len + 2); |
2667 |
buf = (char *) yyalloc( n ); |
2668 |
if ( ! buf ) |
2669 |
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); |
2670 |
|
2671 |
for ( i = 0; i < _yybytes_len; ++i ) |
2672 |
buf[i] = yybytes[i]; |
2673 |
|
2674 |
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; |
2675 |
|
2676 |
b = yy_scan_buffer( buf, n ); |
2677 |
if ( ! b ) |
2678 |
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); |
2679 |
|
2680 |
/* It's okay to grow etc. this buffer, and we should throw it |
2681 |
* away when we're done. |
2682 |
*/ |
2683 |
b->yy_is_our_buffer = 1; |
2684 |
|
2685 |
return b; |
2686 |
} |
2687 |
|
2688 |
#ifndef YY_EXIT_FAILURE |
2689 |
#define YY_EXIT_FAILURE 2 |
2690 |
#endif |
2691 |
|
2692 |
static void yynoreturn yy_fatal_error (const char* msg ) |
2693 |
{ |
2694 |
fprintf( stderr, "%s\n", msg ); |
2695 |
exit( YY_EXIT_FAILURE ); |
2696 |
} |
2697 |
|
2698 |
/* Redefine yyless() so it works in section 3 code. */ |
2699 |
|
2700 |
#undef yyless |
2701 |
#define yyless(n) \ |
2702 |
do \ |
2703 |
{ \ |
2704 |
/* Undo effects of setting up yytext. */ \ |
2705 |
int yyless_macro_arg = (n); \ |
2706 |
YY_LESS_LINENO(yyless_macro_arg);\ |
2707 |
yytext[yyleng] = (yy_hold_char); \ |
2708 |
(yy_c_buf_p) = yytext + yyless_macro_arg; \ |
2709 |
(yy_hold_char) = *(yy_c_buf_p); \ |
2710 |
*(yy_c_buf_p) = '\0'; \ |
2711 |
yyleng = yyless_macro_arg; \ |
2712 |
} \ |
2713 |
while ( 0 ) |
2714 |
|
2715 |
/* Accessor methods (get/set functions) to struct members. */ |
2716 |
|
2717 |
/** Get the current line number. |
2718 |
* |
2719 |
*/ |
2720 |
int yyget_lineno (void) |
2721 |
{ |
2722 |
|
2723 |
return yylineno; |
2724 |
} |
2725 |
|
2726 |
/** Get the input stream. |
2727 |
* |
2728 |
*/ |
2729 |
FILE *yyget_in (void) |
2730 |
{ |
2731 |
return yyin; |
2732 |
} |
2733 |
|
2734 |
/** Get the output stream. |
2735 |
* |
2736 |
*/ |
2737 |
FILE *yyget_out (void) |
2738 |
{ |
2739 |
return yyout; |
2740 |
} |
2741 |
|
2742 |
/** Get the length of the current token. |
2743 |
* |
2744 |
*/ |
2745 |
int yyget_leng (void) |
2746 |
{ |
2747 |
return yyleng; |
2748 |
} |
2749 |
|
2750 |
/** Get the current token. |
2751 |
* |
2752 |
*/ |
2753 |
|
2754 |
char *yyget_text (void) |
2755 |
{ |
2756 |
return yytext; |
2757 |
} |
2758 |
|
2759 |
/** Set the current line number. |
2760 |
* @param _line_number line number |
2761 |
* |
2762 |
*/ |
2763 |
void yyset_lineno (int _line_number ) |
2764 |
{ |
2765 |
|
2766 |
yylineno = _line_number; |
2767 |
} |
2768 |
|
2769 |
/** Set the input stream. This does not discard the current |
2770 |
* input buffer. |
2771 |
* @param _in_str A readable stream. |
2772 |
* |
2773 |
* @see yy_switch_to_buffer |
2774 |
*/ |
2775 |
void yyset_in (FILE * _in_str ) |
2776 |
{ |
2777 |
yyin = _in_str ; |
2778 |
} |
2779 |
|
2780 |
void yyset_out (FILE * _out_str ) |
2781 |
{ |
2782 |
yyout = _out_str ; |
2783 |
} |
2784 |
|
2785 |
int yyget_debug (void) |
2786 |
{ |
2787 |
return yy_flex_debug; |
2788 |
} |
2789 |
|
2790 |
void yyset_debug (int _bdebug ) |
2791 |
{ |
2792 |
yy_flex_debug = _bdebug ; |
2793 |
} |
2794 |
|
2795 |
static int yy_init_globals (void) |
2796 |
{ |
2797 |
/* Initialization is the same as for the non-reentrant scanner. |
2798 |
* This function is called from yylex_destroy(), so don't allocate here. |
2799 |
*/ |
2800 |
|
2801 |
/* We do not touch yylineno unless the option is enabled. */ |
2802 |
yylineno = 1; |
2803 |
|
2804 |
(yy_buffer_stack) = NULL; |
2805 |
(yy_buffer_stack_top) = 0; |
2806 |
(yy_buffer_stack_max) = 0; |
2807 |
(yy_c_buf_p) = NULL; |
2808 |
(yy_init) = 0; |
2809 |
(yy_start) = 0; |
2810 |
|
2811 |
/* Defined in main.c */ |
2812 |
#ifdef YY_STDINIT |
2813 |
yyin = stdin; |
2814 |
yyout = stdout; |
2815 |
#else |
2816 |
yyin = NULL; |
2817 |
yyout = NULL; |
2818 |
#endif |
2819 |
|
2820 |
/* For future reference: Set errno on error, since we are called by |
2821 |
* yylex_init() |
2822 |
*/ |
2823 |
return 0; |
2824 |
} |
2825 |
|
2826 |
/* yylex_destroy is for both reentrant and non-reentrant scanners. */ |
2827 |
int yylex_destroy (void) |
2828 |
{ |
2829 |
|
2830 |
/* Pop the buffer stack, destroying each element. */ |
2831 |
while(YY_CURRENT_BUFFER){ |
2832 |
yy_delete_buffer( YY_CURRENT_BUFFER ); |
2833 |
YY_CURRENT_BUFFER_LVALUE = NULL; |
2834 |
yypop_buffer_state(); |
2835 |
} |
2836 |
|
2837 |
/* Destroy the stack itself. */ |
2838 |
yyfree((yy_buffer_stack) ); |
2839 |
(yy_buffer_stack) = NULL; |
2840 |
|
2841 |
/* Reset the globals. This is important in a non-reentrant scanner so the next time |
2842 |
* yylex() is called, initialization will occur. */ |
2843 |
yy_init_globals( ); |
2844 |
|
2845 |
return 0; |
2846 |
} |
2847 |
|
2848 |
/* |
2849 |
* Internal utility routines. |
2850 |
*/ |
2851 |
|
2852 |
#ifndef yytext_ptr |
2853 |
static void yy_flex_strncpy (char* s1, const char * s2, int n ) |
2854 |
{ |
2855 |
|
2856 |
int i; |
2857 |
for ( i = 0; i < n; ++i ) |
2858 |
s1[i] = s2[i]; |
2859 |
} |
2860 |
#endif |
2861 |
|
2862 |
#ifdef YY_NEED_STRLEN |
2863 |
static int yy_flex_strlen (const char * s ) |
2864 |
{ |
2865 |
int n; |
2866 |
for ( n = 0; s[n]; ++n ) |
2867 |
; |
2868 |
|
2869 |
return n; |
2870 |
} |
2871 |
#endif |
2872 |
|
2873 |
void *yyalloc (yy_size_t size ) |
2874 |
{ |
2875 |
return malloc(size); |
2876 |
} |
2877 |
|
2878 |
void *yyrealloc (void * ptr, yy_size_t size ) |
2879 |
{ |
2880 |
|
2881 |
/* The cast to (char *) in the following accommodates both |
2882 |
* implementations that use char* generic pointers, and those |
2883 |
* that use void* generic pointers. It works with the latter |
2884 |
* because both ANSI C and C++ allow castless assignment from |
2885 |
* any pointer type to void*, and deal with argument conversions |
2886 |
* as though doing an assignment. |
2887 |
*/ |
2888 |
return realloc(ptr, size); |
2889 |
} |
2890 |
|
2891 |
void yyfree (void * ptr ) |
2892 |
{ |
2893 |
free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ |
2894 |
} |
2895 |
|
2896 |
#define YYTABLES_NAME "yytables" |
2897 |
|
2898 |
#line 623 "tcltk/interface/typelex.l" |
2899 |
|
2900 |
/* |
2901 |
* int typ_wrap(void); |
2902 |
* |
2903 |
* This returns 1 if the scanner should stop parsing, or 0 if |
2904 |
* the scanner should continue. Flex requires this function |
2905 |
* unless the flex directive `%option nozzwrap' is given, but |
2906 |
* `%option' directives are a recent addition to flex and for |
2907 |
* maximum portability should not be used. |
2908 |
*/ |
2909 |
int typ_wrap(void) |
2910 |
{ |
2911 |
return 1; |
2912 |
} |
2913 |
|
2914 |
|
2915 |
#ifndef TYPER_TEST |
2916 |
STDHLF(Asc_ExtractType,(Asc_ExtractTypeHL1,Asc_ExtractTypeHL2,HLFSTOP)); |
2917 |
#endif |
2918 |
|
2919 |
/* |
2920 |
* int Asc_ExtractType(cdata, interp, argc, argv) |
2921 |
* ClientData cdata; --Tcl information, not used |
2922 |
* Tcl_Interp *interp; --Tcl interpreter, not used in standalone use |
2923 |
* int argc; --the number of arguments |
2924 |
* char **argv; --the array of arguments |
2925 |
* |
2926 |
* When running as part of ASCEND, returns TCL_OK or TCL_ERROR. |
2927 |
* When running as a stand alone tool (CPP macro TYPER_TEST is defined) |
2928 |
* we return: |
2929 |
* 0 --success |
2930 |
* 1 --problems with arguments |
2931 |
* 2 --problems opening file |
2932 |
* -1 --no errors occurred but the requested type was not found |
2933 |
* |
2934 |
*/ |
2935 |
extern int Asc_ExtractType(ClientData cdata, Tcl_Interp *interp, |
2936 |
int argc, CONST84 char **argv) |
2937 |
{ |
2938 |
int ndx = 1; /* index into the argv array */ |
2939 |
int result; /* result from typ_lex and value to return to caller */ |
2940 |
#ifndef TYPER_TEST |
2941 |
struct TypeDescription *desc=NULL; |
2942 |
struct module_t *mod=NULL; |
2943 |
CONST char *scanstring=NULL; |
2944 |
YY_BUFFER_STATE oldbuf=NULL; |
2945 |
YY_BUFFER_STATE scanbuf=NULL; |
2946 |
#endif /*!typertest*/ |
2947 |
|
2948 |
(void)cdata; /* stop gcc whining about unused parameter */ |
2949 |
#ifdef TYPER_TEST |
2950 |
(void)interp; /* stop gcc whining about unused parameter */ |
2951 |
#endif |
2952 |
|
2953 |
|
2954 |
/* |
2955 |
* Reset our global set |
2956 |
*/ |
2957 |
BEGIN( INITIAL ); |
2958 |
MatchedToken = NONE; |
2959 |
ShowComments = 0; |
2960 |
reqType = ""; |
2961 |
CommentNestLevel = 0; |
2962 |
BracesNestLevel = 0; |
2963 |
|
2964 |
|
2965 |
/* |
2966 |
* Process the arguments |
2967 |
*/ |
2968 |
if (( argc < 2 ) || ( argc > 5 )) { |
2969 |
#ifdef TYPER_TEST |
2970 |
FPRINTF(ASCERR, |
2971 |
"Wrong number of arguments\n" |
2972 |
"Usage: %s [-c] type [source_file] [destination_file]\n", |
2973 |
argv[0]); |
2974 |
return 1; |
2975 |
#else /* ! TYPER_TEST */ |
2976 |
Tcl_AppendResult(interp, "Wrong number of arguments\nUsage: ", |
2977 |
argv[0], "[-c] type [source_file] " |
2978 |
"[-s,destination_file]", |
2979 |
(char*)NULL); |
2980 |
return TCL_ERROR; |
2981 |
#endif /* TYPER_TYPER */ |
2982 |
} |
2983 |
|
2984 |
if(( argc > ndx ) && ( argv[ndx][0] == '-' )) { |
2985 |
switch( argv[ndx][1] ) { |
2986 |
case 'c': |
2987 |
ShowComments = 1; |
2988 |
ndx++; |
2989 |
break; |
2990 |
default: |
2991 |
#ifdef TYPER_TEST |
2992 |
FPRINTF(ASCERR, "Unknown switch %s\n", argv[ndx]); |
2993 |
return 1; |
2994 |
#else /* ! TYPER_TEST */ |
2995 |
Tcl_AppendResult(interp, "Unknown switch ", argv[ndx], (char*)NULL); |
2996 |
return TCL_ERROR; |
2997 |
#endif /* TYPER_TEST */ |
2998 |
} |
2999 |
} |
3000 |
|
3001 |
if( argc > ndx ) { |
3002 |
/* The type of MODEL/ATOM to get */ |
3003 |
reqType = QUIET(argv[ndx++]); |
3004 |
} else { |
3005 |
#ifdef TYPER_TEST |
3006 |
FPRINTF(ASCERR, |
3007 |
"Wrong number of arguments\n" |
3008 |
"Usage: %s [-c] type [source_file] [destination_file]\n", |
3009 |
argv[0]); |
3010 |
return 1; |
3011 |
#else /* ! TYPER_TEST */ |
3012 |
Tcl_AppendResult(interp, "Wrong number of arguments\nUsage: ", |
3013 |
argv[0], "[-c] type [source_file] " |
3014 |
"[-s,destination_file]", |
3015 |
(char*)NULL); |
3016 |
return TCL_ERROR; |
3017 |
#endif /* TYPER_TEST */ |
3018 |
} |
3019 |
|
3020 |
if( argc > ndx ) { |
3021 |
/* The source file; stdin if not specified. */ |
3022 |
#ifndef TYPER_TEST |
3023 |
/* in ascend, find source module if possible for string module name */ |
3024 |
desc = FindType(AddSymbol(reqType)); |
3025 |
if (desc != NULL) { |
3026 |
mod = GetModule(desc); |
3027 |
assert(mod!=NULL); |
3028 |
scanstring = Asc_ModuleString(mod); |
3029 |
if (scanstring == NULL) { |
3030 |
mod = NULL; |
3031 |
} |
3032 |
} |
3033 |
#endif /*!typertest*/ |
3034 |
if(scanstring == NULL && (typ_in = fopen(argv[ndx],"r")) == NULL) { |
3035 |
#ifdef TYPER_TEST |
3036 |
FPRINTF(ASCERR, "Error opening source file \'%s\'\n", argv[ndx]); |
3037 |
return 2; |
3038 |
#else /* ! TYPER_TEST */ |
3039 |
Tcl_AppendResult(interp, "Error opening source file \'", |
3040 |
argv[ndx], "\'", (char*)NULL); |
3041 |
return TCL_ERROR; |
3042 |
#endif /* TYPER_TEST */ |
3043 |
} |
3044 |
ndx++; |
3045 |
} else { |
3046 |
typ_in = stdin; |
3047 |
} |
3048 |
|
3049 |
if( argc > ndx ) { |
3050 |
#ifndef TYPER_TEST |
3051 |
if (argv[ndx][0] == '-' && argv[ndx][1] == 's') { |
3052 |
g_typ__interp = interp; |
3053 |
typ_out = NULL; |
3054 |
} else { |
3055 |
#endif /* !typertest*/ |
3056 |
g_typ__interp = NULL; |
3057 |
/* The destination file; stdout if not specified */ |
3058 |
if((typ_out = fopen(argv[ndx],"a+")) == NULL) { |
3059 |
#ifdef TYPER_TEST |
3060 |
FPRINTF(ASCERR, "Error opening destination file \'%s\'\n", argv[ndx]); |
3061 |
return 2; |
3062 |
#else /* ! TYPER_TEST */ |
3063 |
Tcl_AppendResult(interp, "Error opening destination file \'", |
3064 |
argv[ndx], "\'", (char*)NULL); |
3065 |
return TCL_ERROR; |
3066 |
#endif /* TYPER_TEST */ |
3067 |
} |
3068 |
#ifndef TYPER_TEST |
3069 |
} |
3070 |
#endif /* !typertest*/ |
3071 |
ndx++; |
3072 |
} else { |
3073 |
typ_out = stdout; |
3074 |
} |
3075 |
|
3076 |
|
3077 |
/* |
3078 |
* Call typ_lex() to process the input |
3079 |
*/ |
3080 |
#ifndef TYPER_TEST |
3081 |
if (scanstring != NULL) { |
3082 |
oldbuf = YY_CURRENT_BUFFER; |
3083 |
scanbuf = typ__scan_string(scanstring); |
3084 |
typ__switch_to_buffer(scanbuf); |
3085 |
BEGIN(INITIAL); |
3086 |
/* typ_restart((FILE *)NULL); */ |
3087 |
} |
3088 |
#else |
3089 |
typ_restart(typ_in); |
3090 |
#endif /* !typertest */ |
3091 |
if( (result = typ_lex()) != 0 ) { |
3092 |
#ifdef TYPER_TEST |
3093 |
FPRINTF(ASCERR, "Could not find type \'%s\'\n", reqType); |
3094 |
#else /* ! TYPER_TEST */ |
3095 |
if (g_typ__interp!=NULL) { |
3096 |
Tcl_ResetResult(interp); |
3097 |
} |
3098 |
Tcl_AppendResult(interp, "Could not find type \'", reqType, "\'", |
3099 |
(char*)NULL); |
3100 |
result = TCL_ERROR; |
3101 |
#endif /* TYPER_TEST */ |
3102 |
} else { |
3103 |
/* add a closing semicolon and newline */ |
3104 |
Asc_PutCode( ";\n", typ_out ); |
3105 |
#ifndef TYPER_TEST |
3106 |
result = TCL_OK; |
3107 |
#endif /* ! TYPER_TEST */ |
3108 |
} |
3109 |
|
3110 |
/* |
3111 |
* Close any files/buffers we opened and exit. |
3112 |
*/ |
3113 |
#ifndef TYPER_TEST |
3114 |
if (scanstring != NULL) { |
3115 |
typ__delete_buffer(YY_CURRENT_BUFFER); |
3116 |
typ__switch_to_buffer(oldbuf); |
3117 |
BEGIN(INITIAL); |
3118 |
} |
3119 |
#endif |
3120 |
if ( typ_in != stdin && typ_in != NULL) { |
3121 |
fclose(typ_in); |
3122 |
} |
3123 |
if ( typ_out != stdout && typ_out != NULL) { |
3124 |
fclose(typ_out); |
3125 |
} |
3126 |
|
3127 |
return result; |
3128 |
} |
3129 |
|
3130 |
static void Asc_PutCode(char *s,FILE *fp) |
3131 |
/** into string or screen */ |
3132 |
{ |
3133 |
#ifndef TYPER_TEST |
3134 |
if (g_typ__interp != NULL) { |
3135 |
Tcl_AppendResult(g_typ__interp,s,(char *)NULL); |
3136 |
} else { |
3137 |
#endif /* typertest */ |
3138 |
fputs(s,fp); |
3139 |
#ifndef TYPER_TEST |
3140 |
} |
3141 |
#endif /* typertest */ |
3142 |
} |
3143 |
|
3144 |
#ifdef TYPER_TEST |
3145 |
int main(int argc, char **argv) |
3146 |
{ |
3147 |
return Asc_ExtractType((ClientData)NULL, (Tcl_Interp*)NULL, argc, argv); |
3148 |
} |
3149 |
#endif /* TYPER_TEST */ |
3150 |
|