1 |
aw0a |
1 |
#define yy_create_buffer typ__create_buffer |
2 |
|
|
#define yy_delete_buffer typ__delete_buffer |
3 |
|
|
#define yy_scan_buffer typ__scan_buffer |
4 |
|
|
#define yy_scan_string typ__scan_string |
5 |
|
|
#define yy_scan_bytes typ__scan_bytes |
6 |
|
|
#define yy_flex_debug typ__flex_debug |
7 |
|
|
#define yy_init_buffer typ__init_buffer |
8 |
|
|
#define yy_flush_buffer typ__flush_buffer |
9 |
|
|
#define yy_load_buffer_state typ__load_buffer_state |
10 |
|
|
#define yy_switch_to_buffer typ__switch_to_buffer |
11 |
|
|
#define yyin typ_in |
12 |
|
|
#define yyleng typ_leng |
13 |
|
|
#define yylex typ_lex |
14 |
|
|
#define yyout typ_out |
15 |
|
|
#define yyrestart typ_restart |
16 |
|
|
#define yytext typ_text |
17 |
|
|
#define yywrap typ_wrap |
18 |
|
|
|
19 |
|
|
/* A lexical scanner generated by flex */ |
20 |
|
|
|
21 |
|
|
/* Scanner skeleton version: |
22 |
|
|
* $Header: /afs/cs.cmu.edu/project/ascend/Repository/ascend4/interface/typelex.c.no.flex,v 1.11 1998/02/27 14:39:53 mthomas Exp $ |
23 |
|
|
*/ |
24 |
|
|
|
25 |
|
|
#define FLEX_SCANNER |
26 |
|
|
#define YY_FLEX_MAJOR_VERSION 2 |
27 |
|
|
#define YY_FLEX_MINOR_VERSION 5 |
28 |
|
|
|
29 |
|
|
#include <stdio.h> |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ |
33 |
|
|
#ifdef c_plusplus |
34 |
|
|
#ifndef __cplusplus |
35 |
|
|
#define __cplusplus |
36 |
|
|
#endif |
37 |
|
|
#endif |
38 |
|
|
|
39 |
|
|
|
40 |
|
|
#ifdef __cplusplus |
41 |
|
|
|
42 |
|
|
#include <stdlib.h> |
43 |
|
|
#include <unistd.h> |
44 |
|
|
|
45 |
|
|
/* Use prototypes in function declarations. */ |
46 |
|
|
#define YY_USE_PROTOS |
47 |
|
|
|
48 |
|
|
/* The "const" storage-class-modifier is valid. */ |
49 |
|
|
#define YY_USE_CONST |
50 |
|
|
|
51 |
|
|
#else /* ! __cplusplus */ |
52 |
|
|
|
53 |
|
|
#if __STDC__ |
54 |
|
|
|
55 |
|
|
#define YY_USE_PROTOS |
56 |
|
|
#define YY_USE_CONST |
57 |
|
|
|
58 |
|
|
#endif /* __STDC__ */ |
59 |
|
|
#endif /* ! __cplusplus */ |
60 |
|
|
|
61 |
|
|
#ifdef __TURBOC__ |
62 |
|
|
#pragma warn -rch |
63 |
|
|
#pragma warn -use |
64 |
|
|
#include <io.h> |
65 |
|
|
#include <stdlib.h> |
66 |
|
|
#define YY_USE_CONST |
67 |
|
|
#define YY_USE_PROTOS |
68 |
|
|
#endif |
69 |
|
|
|
70 |
|
|
#ifndef YY_USE_CONST |
71 |
|
|
#ifndef const |
72 |
|
|
#define const |
73 |
|
|
#endif |
74 |
|
|
#endif |
75 |
|
|
|
76 |
|
|
|
77 |
|
|
#ifdef YY_USE_PROTOS |
78 |
|
|
#define YY_PROTO(proto) proto |
79 |
|
|
#else |
80 |
|
|
#define YY_PROTO(proto) () |
81 |
|
|
#endif |
82 |
|
|
|
83 |
|
|
/* Returned upon end-of-file. */ |
84 |
|
|
#define YY_NULL 0 |
85 |
|
|
|
86 |
|
|
/* Promotes a possibly negative, possibly signed char to an unsigned |
87 |
|
|
* integer for use as an array index. If the signed char is negative, |
88 |
|
|
* we want to instead treat it as an 8-bit unsigned char, hence the |
89 |
|
|
* double cast. |
90 |
|
|
*/ |
91 |
|
|
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) |
92 |
|
|
|
93 |
|
|
/* Enter a start condition. This macro really ought to take a parameter, |
94 |
|
|
* but we do it the disgusting crufty way forced on us by the ()-less |
95 |
|
|
* definition of BEGIN. |
96 |
|
|
*/ |
97 |
|
|
#define BEGIN yy_start = 1 + 2 * |
98 |
|
|
|
99 |
|
|
/* Translate the current start state into a value that can be later handed |
100 |
|
|
* to BEGIN to return to the state. The YYSTATE alias is for lex |
101 |
|
|
* compatibility. |
102 |
|
|
*/ |
103 |
|
|
#define YY_START ((yy_start - 1) / 2) |
104 |
|
|
#define YYSTATE YY_START |
105 |
|
|
|
106 |
|
|
/* Action number for EOF rule of a given start state. */ |
107 |
|
|
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
108 |
|
|
|
109 |
|
|
/* Special action meaning "start processing a new file". */ |
110 |
|
|
#define YY_NEW_FILE yyrestart( yyin ) |
111 |
|
|
|
112 |
|
|
#define YY_END_OF_BUFFER_CHAR 0 |
113 |
|
|
|
114 |
|
|
/* Size of default input buffer. */ |
115 |
|
|
#define YY_BUF_SIZE 16384 |
116 |
|
|
|
117 |
|
|
typedef struct yy_buffer_state *YY_BUFFER_STATE; |
118 |
|
|
|
119 |
|
|
extern int yyleng; |
120 |
|
|
extern FILE *yyin, *yyout; |
121 |
|
|
|
122 |
|
|
#define EOB_ACT_CONTINUE_SCAN 0 |
123 |
|
|
#define EOB_ACT_END_OF_FILE 1 |
124 |
|
|
#define EOB_ACT_LAST_MATCH 2 |
125 |
|
|
|
126 |
|
|
/* The funky do-while in the following #define is used to turn the definition |
127 |
|
|
* int a single C statement (which needs a semi-colon terminator). This |
128 |
|
|
* avoids problems with code like: |
129 |
|
|
* |
130 |
|
|
* if ( condition_holds ) |
131 |
|
|
* yyless( 5 ); |
132 |
|
|
* else |
133 |
|
|
* do_something_else(); |
134 |
|
|
* |
135 |
|
|
* Prior to using the do-while the compiler would get upset at the |
136 |
|
|
* "else" because it interpreted the "if" statement as being all |
137 |
|
|
* done when it reached the ';' after the yyless() call. |
138 |
|
|
*/ |
139 |
|
|
|
140 |
|
|
/* Return all but the first 'n' matched characters back to the input stream. */ |
141 |
|
|
|
142 |
|
|
#define yyless(n) \ |
143 |
|
|
do \ |
144 |
|
|
{ \ |
145 |
|
|
/* Undo effects of setting up yytext. */ \ |
146 |
|
|
*yy_cp = yy_hold_char; \ |
147 |
|
|
yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ |
148 |
|
|
YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
149 |
|
|
} \ |
150 |
|
|
while ( 0 ) |
151 |
|
|
|
152 |
|
|
#define unput(c) yyunput( c, yytext_ptr ) |
153 |
|
|
|
154 |
|
|
/* The following is because we cannot portably get our hands on size_t |
155 |
|
|
* (without autoconf's help, which isn't available because we want |
156 |
|
|
* flex-generated scanners to compile on their own). |
157 |
|
|
*/ |
158 |
|
|
typedef unsigned int yy_size_t; |
159 |
|
|
|
160 |
|
|
|
161 |
|
|
struct yy_buffer_state |
162 |
|
|
{ |
163 |
|
|
FILE *yy_input_file; |
164 |
|
|
|
165 |
|
|
char *yy_ch_buf; /* input buffer */ |
166 |
|
|
char *yy_buf_pos; /* current position in input buffer */ |
167 |
|
|
|
168 |
|
|
/* Size of input buffer in bytes, not including room for EOB |
169 |
|
|
* characters. |
170 |
|
|
*/ |
171 |
|
|
yy_size_t yy_buf_size; |
172 |
|
|
|
173 |
|
|
/* Number of characters read into yy_ch_buf, not including EOB |
174 |
|
|
* characters. |
175 |
|
|
*/ |
176 |
|
|
int yy_n_chars; |
177 |
|
|
|
178 |
|
|
/* Whether we "own" the buffer - i.e., we know we created it, |
179 |
|
|
* and can realloc() it to grow it, and should free() it to |
180 |
|
|
* delete it. |
181 |
|
|
*/ |
182 |
|
|
int yy_is_our_buffer; |
183 |
|
|
|
184 |
|
|
/* Whether this is an "interactive" input source; if so, and |
185 |
|
|
* if we're using stdio for input, then we want to use getc() |
186 |
|
|
* instead of fread(), to make sure we stop fetching input after |
187 |
|
|
* each newline. |
188 |
|
|
*/ |
189 |
|
|
int yy_is_interactive; |
190 |
|
|
|
191 |
|
|
/* Whether we're considered to be at the beginning of a line. |
192 |
|
|
* If so, '^' rules will be active on the next match, otherwise |
193 |
|
|
* not. |
194 |
|
|
*/ |
195 |
|
|
int yy_at_bol; |
196 |
|
|
|
197 |
|
|
/* Whether to try to fill the input buffer when we reach the |
198 |
|
|
* end of it. |
199 |
|
|
*/ |
200 |
|
|
int yy_fill_buffer; |
201 |
|
|
|
202 |
|
|
int yy_buffer_status; |
203 |
|
|
#define YY_BUFFER_NEW 0 |
204 |
|
|
#define YY_BUFFER_NORMAL 1 |
205 |
|
|
/* When an EOF's been seen but there's still some text to process |
206 |
|
|
* then we mark the buffer as YY_EOF_PENDING, to indicate that we |
207 |
|
|
* shouldn't try reading from the input source any more. We might |
208 |
|
|
* still have a bunch of tokens to match, though, because of |
209 |
|
|
* possible backing-up. |
210 |
|
|
* |
211 |
|
|
* When we actually see the EOF, we change the status to "new" |
212 |
|
|
* (via yyrestart()), so that the user can continue scanning by |
213 |
|
|
* just pointing yyin at a new input file. |
214 |
|
|
*/ |
215 |
|
|
#define YY_BUFFER_EOF_PENDING 2 |
216 |
|
|
}; |
217 |
|
|
|
218 |
|
|
static YY_BUFFER_STATE yy_current_buffer = 0; |
219 |
|
|
|
220 |
|
|
/* We provide macros for accessing buffer states in case in the |
221 |
|
|
* future we want to put the buffer states in a more general |
222 |
|
|
* "scanner state". |
223 |
|
|
*/ |
224 |
|
|
#define YY_CURRENT_BUFFER yy_current_buffer |
225 |
|
|
|
226 |
|
|
|
227 |
|
|
/* yy_hold_char holds the character lost when yytext is formed. */ |
228 |
|
|
static char yy_hold_char; |
229 |
|
|
|
230 |
|
|
static int yy_n_chars; /* number of characters read into yy_ch_buf */ |
231 |
|
|
|
232 |
|
|
|
233 |
|
|
int yyleng; |
234 |
|
|
|
235 |
|
|
/* Points to current character in buffer. */ |
236 |
|
|
static char *yy_c_buf_p = (char *) 0; |
237 |
|
|
static int yy_init = 1; /* whether we need to initialize */ |
238 |
|
|
static int yy_start = 0; /* start state number */ |
239 |
|
|
|
240 |
|
|
/* Flag which is used to allow yywrap()'s to do buffer switches |
241 |
|
|
* instead of setting up a fresh yyin. A bit of a hack ... |
242 |
|
|
*/ |
243 |
|
|
static int yy_did_buffer_switch_on_eof; |
244 |
|
|
|
245 |
|
|
void yyrestart YY_PROTO(( FILE *input_file )); |
246 |
|
|
|
247 |
|
|
void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); |
248 |
|
|
void yy_load_buffer_state YY_PROTO(( void )); |
249 |
|
|
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); |
250 |
|
|
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); |
251 |
|
|
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); |
252 |
|
|
void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); |
253 |
|
|
#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) |
254 |
|
|
|
255 |
|
|
YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); |
256 |
|
|
YY_BUFFER_STATE yy_scan_string YY_PROTO(( const char *str )); |
257 |
|
|
YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( const char *bytes, int len )); |
258 |
|
|
|
259 |
|
|
static void *yy_flex_alloc YY_PROTO(( yy_size_t )); |
260 |
|
|
static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); |
261 |
|
|
static void yy_flex_free YY_PROTO(( void * )); |
262 |
|
|
|
263 |
|
|
#define yy_new_buffer yy_create_buffer |
264 |
|
|
|
265 |
|
|
#define yy_set_interactive(is_interactive) \ |
266 |
|
|
{ \ |
267 |
|
|
if ( ! yy_current_buffer ) \ |
268 |
|
|
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ |
269 |
|
|
yy_current_buffer->yy_is_interactive = is_interactive; \ |
270 |
|
|
} |
271 |
|
|
|
272 |
|
|
#define yy_set_bol(at_bol) \ |
273 |
|
|
{ \ |
274 |
|
|
if ( ! yy_current_buffer ) \ |
275 |
|
|
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ |
276 |
|
|
yy_current_buffer->yy_at_bol = at_bol; \ |
277 |
|
|
} |
278 |
|
|
|
279 |
|
|
#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) |
280 |
|
|
|
281 |
|
|
typedef unsigned char YY_CHAR; |
282 |
|
|
#ifdef VMS |
283 |
|
|
#ifndef __VMS_POSIX |
284 |
|
|
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; |
285 |
|
|
#else |
286 |
|
|
FILE *yyin = stdin, *yyout = stdout; |
287 |
|
|
#endif |
288 |
|
|
#else |
289 |
|
|
FILE *yyin = stdin, *yyout = stdout; |
290 |
|
|
#endif |
291 |
|
|
typedef int yy_state_type; |
292 |
|
|
extern char *yytext; |
293 |
|
|
#define yytext_ptr yytext |
294 |
|
|
|
295 |
|
|
#ifndef YY_SKIP_YYWRAP |
296 |
|
|
#ifdef __cplusplus |
297 |
|
|
extern "C" int yywrap YY_PROTO(( void )); |
298 |
|
|
#else |
299 |
|
|
extern int yywrap YY_PROTO(( void )); |
300 |
|
|
#endif |
301 |
|
|
#endif |
302 |
|
|
|
303 |
|
|
#ifndef YY_NO_UNPUT |
304 |
|
|
static void yyunput YY_PROTO(( int c, char *buf_ptr )); |
305 |
|
|
#endif |
306 |
|
|
|
307 |
|
|
#ifndef yytext_ptr |
308 |
|
|
static void yy_flex_strncpy YY_PROTO(( char *, const char *, int )); |
309 |
|
|
#endif |
310 |
|
|
|
311 |
|
|
#ifndef YY_NO_INPUT |
312 |
|
|
#ifdef __cplusplus |
313 |
|
|
static int yyinput YY_PROTO(( void )); |
314 |
|
|
#else |
315 |
|
|
static int input YY_PROTO(( void )); |
316 |
|
|
#endif |
317 |
|
|
#endif |
318 |
|
|
|
319 |
|
|
static yy_state_type yy_get_previous_state YY_PROTO(( void )); |
320 |
|
|
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); |
321 |
|
|
static int yy_get_next_buffer YY_PROTO(( void )); |
322 |
|
|
static void yy_fatal_error YY_PROTO(( const char msg[] )); |
323 |
|
|
|
324 |
|
|
/* Done after the current pattern has been matched and before the |
325 |
|
|
* corresponding action - sets up yytext. |
326 |
|
|
*/ |
327 |
|
|
#define YY_DO_BEFORE_ACTION \ |
328 |
|
|
yytext_ptr = yy_bp; \ |
329 |
|
|
yytext_ptr -= yy_more_len; \ |
330 |
|
|
yyleng = (int) (yy_cp - yytext_ptr); \ |
331 |
|
|
yy_hold_char = *yy_cp; \ |
332 |
|
|
*yy_cp = '\0'; \ |
333 |
|
|
yy_c_buf_p = yy_cp; |
334 |
|
|
|
335 |
|
|
#define YY_NUM_RULES 34 |
336 |
|
|
#define YY_END_OF_BUFFER 35 |
337 |
|
|
static const short int yy_accept[124] = |
338 |
|
|
{ 0, |
339 |
|
|
0, 0, 6, 6, 16, 16, 0, 0, 0, 0, |
340 |
|
|
0, 0, 35, 31, 32, 33, 33, 33, 33, 33, |
341 |
|
|
33, 31, 9, 6, 7, 8, 16, 34, 14, 15, |
342 |
|
|
20, 21, 22, 22, 20, 10, 24, 25, 23, 11, |
343 |
|
|
18, 34, 17, 31, 32, 32, 1, 33, 33, 33, |
344 |
|
|
33, 33, 33, 33, 33, 31, 31, 31, 6, 0, |
345 |
|
|
7, 7, 4, 8, 5, 8, 16, 0, 15, 12, |
346 |
|
|
13, 14, 20, 21, 21, 2, 22, 22, 22, 22, |
347 |
|
|
20, 20, 20, 24, 25, 25, 3, 17, 33, 33, |
348 |
|
|
33, 33, 33, 4, 22, 33, 33, 33, 33, 33, |
349 |
|
|
|
350 |
|
|
19, 28, 33, 33, 33, 33, 33, 33, 27, 33, |
351 |
|
|
33, 33, 33, 33, 33, 33, 30, 33, 33, 33, |
352 |
|
|
26, 29, 0 |
353 |
|
|
} ; |
354 |
|
|
|
355 |
|
|
static const int yy_ec[256] = |
356 |
|
|
{ 0, |
357 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
358 |
|
|
2, 2, 2, 1, 1, 1, 1, 1, 1, 1, |
359 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
360 |
|
|
1, 2, 1, 1, 1, 1, 1, 1, 1, 4, |
361 |
|
|
5, 6, 1, 1, 1, 1, 1, 7, 7, 7, |
362 |
|
|
7, 7, 7, 7, 7, 7, 7, 1, 8, 1, |
363 |
|
|
1, 1, 1, 1, 9, 10, 11, 12, 13, 14, |
364 |
|
|
10, 10, 15, 10, 10, 16, 17, 18, 19, 10, |
365 |
|
|
10, 20, 21, 22, 23, 24, 10, 10, 10, 10, |
366 |
|
|
1, 25, 1, 1, 26, 1, 27, 27, 27, 27, |
367 |
|
|
|
368 |
|
|
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, |
369 |
|
|
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, |
370 |
|
|
27, 27, 28, 1, 29, 1, 1, 1, 1, 1, |
371 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
372 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
373 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
374 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
375 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
376 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
377 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
378 |
|
|
|
379 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
380 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
381 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
382 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
383 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
384 |
|
|
1, 1, 1, 1, 1 |
385 |
|
|
} ; |
386 |
|
|
|
387 |
|
|
static const int yy_meta[30] = |
388 |
|
|
{ 0, |
389 |
|
|
1, 2, 1, 3, 1, 4, 5, 6, 7, 7, |
390 |
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
391 |
|
|
7, 7, 7, 7, 8, 9, 5, 10, 8 |
392 |
|
|
} ; |
393 |
|
|
|
394 |
|
|
static const short int yy_base[143] = |
395 |
|
|
{ 0, |
396 |
|
|
0, 0, 26, 27, 9, 11, 40, 0, 66, 67, |
397 |
|
|
95, 0, 343, 0, 72, 71, 75, 123, 78, 124, |
398 |
|
|
126, 144, 467, 333, 78, 82, 56, 327, 0, 467, |
399 |
|
|
0, 86, 125, 146, 173, 467, 0, 131, 467, 467, |
400 |
|
|
467, 467, 0, 0, 132, 322, 467, 289, 287, 151, |
401 |
|
|
153, 175, 154, 155, 180, 286, 285, 0, 280, 124, |
402 |
|
|
135, 154, 0, 160, 467, 179, 161, 277, 467, 467, |
403 |
|
|
467, 0, 0, 183, 264, 467, 261, 256, 189, 199, |
404 |
|
|
254, 229, 0, 0, 188, 199, 467, 0, 202, 204, |
405 |
|
|
206, 207, 214, 0, 215, 216, 224, 225, 226, 227, |
406 |
|
|
|
407 |
|
|
211, 194, 228, 237, 239, 242, 246, 247, 138, 249, |
408 |
|
|
251, 259, 263, 258, 273, 274, 87, 275, 276, 277, |
409 |
|
|
70, 33, 467, 293, 303, 313, 323, 332, 340, 349, |
410 |
|
|
359, 369, 379, 388, 398, 407, 416, 424, 433, 442, |
411 |
|
|
447, 456 |
412 |
|
|
} ; |
413 |
|
|
|
414 |
|
|
static const short int yy_def[143] = |
415 |
|
|
{ 0, |
416 |
|
|
123, 1, 124, 124, 125, 125, 123, 7, 126, 126, |
417 |
|
|
123, 11, 123, 127, 128, 129, 129, 129, 129, 129, |
418 |
|
|
129, 129, 123, 130, 131, 132, 133, 134, 135, 123, |
419 |
|
|
136, 137, 138, 138, 138, 123, 139, 140, 123, 123, |
420 |
|
|
123, 123, 141, 127, 128, 45, 123, 123, 123, 129, |
421 |
|
|
129, 129, 129, 129, 129, 127, 127, 22, 130, 123, |
422 |
|
|
131, 131, 142, 132, 123, 132, 133, 134, 123, 123, |
423 |
|
|
123, 135, 136, 137, 74, 123, 123, 123, 138, 138, |
424 |
|
|
136, 136, 35, 139, 140, 140, 123, 141, 129, 129, |
425 |
|
|
129, 129, 129, 142, 138, 129, 129, 129, 129, 129, |
426 |
|
|
|
427 |
|
|
123, 123, 129, 129, 129, 129, 129, 129, 123, 129, |
428 |
|
|
129, 129, 129, 129, 129, 129, 123, 129, 129, 129, |
429 |
|
|
123, 123, 0, 123, 123, 123, 123, 123, 123, 123, |
430 |
|
|
123, 123, 123, 123, 123, 123, 123, 123, 123, 123, |
431 |
|
|
123, 123 |
432 |
|
|
} ; |
433 |
|
|
|
434 |
|
|
static const short int yy_nxt[497] = |
435 |
|
|
{ 0, |
436 |
|
|
14, 14, 14, 15, 14, 14, 14, 14, 16, 17, |
437 |
|
|
18, 19, 17, 17, 17, 17, 20, 17, 17, 17, |
438 |
|
|
17, 17, 21, 17, 14, 22, 14, 23, 14, 25, |
439 |
|
|
25, 26, 26, 28, 122, 28, 29, 30, 29, 30, |
440 |
|
|
31, 31, 31, 32, 31, 31, 31, 31, 33, 33, |
441 |
|
|
33, 33, 34, 33, 33, 33, 33, 33, 33, 33, |
442 |
|
|
33, 33, 33, 33, 31, 35, 31, 36, 31, 38, |
443 |
|
|
38, 121, 48, 39, 39, 46, 48, 47, 49, 48, |
444 |
|
|
68, 62, 49, 63, 69, 49, 65, 66, 117, 75, |
445 |
|
|
53, 76, 51, 40, 40, 41, 41, 42, 41, 41, |
446 |
|
|
|
447 |
|
|
41, 41, 41, 43, 43, 43, 43, 43, 43, 43, |
448 |
|
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 41, |
449 |
|
|
41, 43, 41, 41, 48, 48, 77, 48, 65, 60, |
450 |
|
|
49, 49, 78, 49, 86, 123, 87, 123, 123, 109, |
451 |
|
|
123, 52, 54, 55, 44, 56, 44, 77, 44, 44, |
452 |
|
|
44, 57, 48, 78, 48, 48, 48, 62, 49, 123, |
453 |
|
|
49, 49, 49, 80, 123, 123, 92, 91, 44, 58, |
454 |
|
|
44, 89, 44, 73, 81, 73, 48, 73, 73, 73, |
455 |
|
|
82, 48, 49, 65, 66, 68, 123, 49, 123, 69, |
456 |
|
|
77, 123, 90, 123, 93, 102, 78, 73, 83, 73, |
457 |
|
|
|
458 |
|
|
77, 73, 86, 48, 123, 48, 78, 48, 48, 49, |
459 |
|
|
95, 49, 101, 49, 49, 48, 101, 102, 96, 99, |
460 |
|
|
98, 49, 78, 49, 97, 48, 48, 48, 48, 48, |
461 |
|
|
81, 49, 49, 49, 49, 49, 107, 100, 48, 106, |
462 |
|
|
109, 105, 104, 48, 49, 103, 49, 48, 48, 49, |
463 |
|
|
48, 108, 48, 49, 49, 81, 49, 77, 49, 117, |
464 |
|
|
48, 110, 77, 111, 48, 49, 49, 75, 112, 113, |
465 |
|
|
49, 116, 114, 115, 48, 48, 48, 121, 122, 71, |
466 |
|
|
49, 49, 49, 49, 49, 60, 56, 56, 48, 119, |
467 |
|
|
48, 118, 120, 24, 24, 24, 24, 24, 24, 24, |
468 |
|
|
|
469 |
|
|
24, 24, 24, 27, 27, 27, 27, 27, 27, 27, |
470 |
|
|
27, 27, 27, 37, 37, 37, 37, 37, 37, 37, |
471 |
|
|
37, 37, 37, 44, 44, 46, 44, 44, 44, 71, |
472 |
|
|
44, 44, 45, 45, 45, 45, 45, 45, 60, 45, |
473 |
|
|
45, 50, 123, 123, 123, 50, 50, 123, 50, 59, |
474 |
|
|
59, 123, 59, 59, 59, 59, 59, 59, 59, 61, |
475 |
|
|
61, 61, 61, 61, 61, 61, 61, 61, 61, 64, |
476 |
|
|
64, 123, 64, 64, 64, 64, 64, 64, 64, 67, |
477 |
|
|
67, 67, 67, 67, 67, 67, 67, 67, 70, 70, |
478 |
|
|
70, 70, 70, 70, 70, 70, 70, 70, 72, 72, |
479 |
|
|
|
480 |
|
|
72, 72, 72, 72, 72, 123, 72, 73, 73, 123, |
481 |
|
|
73, 73, 73, 123, 73, 73, 74, 74, 74, 74, |
482 |
|
|
74, 74, 123, 74, 74, 79, 123, 123, 123, 79, |
483 |
|
|
79, 123, 79, 84, 84, 123, 84, 84, 123, 84, |
484 |
|
|
84, 84, 85, 85, 85, 85, 85, 123, 85, 85, |
485 |
|
|
85, 88, 123, 88, 123, 88, 94, 94, 123, 123, |
486 |
|
|
94, 94, 94, 94, 94, 94, 13, 123, 123, 123, |
487 |
|
|
123, 123, 123, 123, 123, 123, 123, 123, 123, 123, |
488 |
|
|
123, 123, 123, 123, 123, 123, 123, 123, 123, 123, |
489 |
|
|
123, 123, 123, 123, 123, 123 |
490 |
|
|
|
491 |
|
|
} ; |
492 |
|
|
|
493 |
|
|
static const short int yy_chk[497] = |
494 |
|
|
{ 0, |
495 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
496 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
497 |
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 3, |
498 |
|
|
4, 3, 4, 5, 122, 6, 5, 5, 6, 6, |
499 |
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
500 |
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
501 |
|
|
7, 7, 7, 7, 7, 7, 7, 7, 7, 9, |
502 |
|
|
10, 121, 16, 9, 10, 15, 17, 15, 16, 19, |
503 |
|
|
27, 25, 17, 25, 27, 19, 26, 26, 117, 32, |
504 |
|
|
19, 32, 16, 9, 10, 11, 11, 11, 11, 11, |
505 |
|
|
|
506 |
|
|
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, |
507 |
|
|
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, |
508 |
|
|
11, 11, 11, 11, 18, 20, 33, 21, 60, 60, |
509 |
|
|
18, 20, 33, 21, 38, 45, 38, 45, 61, 109, |
510 |
|
|
61, 18, 20, 21, 22, 22, 22, 34, 22, 22, |
511 |
|
|
22, 22, 50, 34, 51, 53, 54, 62, 50, 62, |
512 |
|
|
51, 53, 54, 34, 64, 64, 54, 53, 22, 22, |
513 |
|
|
22, 51, 22, 35, 35, 35, 52, 35, 35, 35, |
514 |
|
|
35, 55, 52, 66, 66, 67, 74, 55, 74, 67, |
515 |
|
|
79, 85, 52, 85, 55, 102, 79, 35, 35, 35, |
516 |
|
|
|
517 |
|
|
80, 35, 86, 89, 86, 90, 80, 91, 92, 89, |
518 |
|
|
80, 90, 101, 91, 92, 93, 95, 96, 89, 92, |
519 |
|
|
91, 93, 95, 96, 90, 97, 98, 99, 100, 103, |
520 |
|
|
82, 97, 98, 99, 100, 103, 103, 93, 104, 100, |
521 |
|
|
105, 99, 98, 106, 104, 97, 105, 107, 108, 106, |
522 |
|
|
110, 104, 111, 107, 108, 81, 110, 78, 111, 114, |
523 |
|
|
112, 106, 77, 107, 113, 114, 112, 75, 108, 110, |
524 |
|
|
113, 113, 111, 112, 115, 116, 118, 119, 120, 68, |
525 |
|
|
115, 116, 118, 119, 120, 59, 57, 56, 49, 116, |
526 |
|
|
48, 115, 118, 124, 124, 124, 124, 124, 124, 124, |
527 |
|
|
|
528 |
|
|
124, 124, 124, 125, 125, 125, 125, 125, 125, 125, |
529 |
|
|
125, 125, 125, 126, 126, 126, 126, 126, 126, 126, |
530 |
|
|
126, 126, 126, 127, 127, 46, 127, 127, 127, 28, |
531 |
|
|
127, 127, 128, 128, 128, 128, 128, 128, 24, 128, |
532 |
|
|
128, 129, 13, 0, 0, 129, 129, 0, 129, 130, |
533 |
|
|
130, 0, 130, 130, 130, 130, 130, 130, 130, 131, |
534 |
|
|
131, 131, 131, 131, 131, 131, 131, 131, 131, 132, |
535 |
|
|
132, 0, 132, 132, 132, 132, 132, 132, 132, 133, |
536 |
|
|
133, 133, 133, 133, 133, 133, 133, 133, 134, 134, |
537 |
|
|
134, 134, 134, 134, 134, 134, 134, 134, 135, 135, |
538 |
|
|
|
539 |
|
|
135, 135, 135, 135, 135, 0, 135, 136, 136, 0, |
540 |
|
|
136, 136, 136, 0, 136, 136, 137, 137, 137, 137, |
541 |
|
|
137, 137, 0, 137, 137, 138, 0, 0, 0, 138, |
542 |
|
|
138, 0, 138, 139, 139, 0, 139, 139, 0, 139, |
543 |
|
|
139, 139, 140, 140, 140, 140, 140, 0, 140, 140, |
544 |
|
|
140, 141, 0, 141, 0, 141, 142, 142, 0, 0, |
545 |
|
|
142, 142, 142, 142, 142, 142, 123, 123, 123, 123, |
546 |
|
|
123, 123, 123, 123, 123, 123, 123, 123, 123, 123, |
547 |
|
|
123, 123, 123, 123, 123, 123, 123, 123, 123, 123, |
548 |
|
|
123, 123, 123, 123, 123, 123 |
549 |
|
|
|
550 |
|
|
} ; |
551 |
|
|
|
552 |
|
|
static yy_state_type yy_last_accepting_state; |
553 |
|
|
static char *yy_last_accepting_cpos; |
554 |
|
|
|
555 |
|
|
/* The intent behind this definition is that it'll catch |
556 |
|
|
* any uses of REJECT which flex missed. |
557 |
|
|
*/ |
558 |
|
|
#define REJECT reject_used_but_not_detected |
559 |
|
|
static int yy_more_flag = 0; |
560 |
|
|
static int yy_more_len = 0; |
561 |
|
|
#define yymore() (yy_more_flag = 1) |
562 |
|
|
#define YY_MORE_ADJ yy_more_len |
563 |
|
|
char *yytext; |
564 |
|
|
#define INITIAL 0 |
565 |
|
|
/* |
566 |
|
|
* TypeExtractor.l |
567 |
|
|
* by Kirk Abbott and Ben Allan |
568 |
|
|
* Created: 1/94 |
569 |
|
|
* Version: $Revision: 1.11 $ |
570 |
|
|
* Version control file: $RCSfile: typelex.c.no.flex,v $ |
571 |
|
|
* Date last modified: $Date: 1998/02/27 14:39:53 $ |
572 |
|
|
* Last modified by: $Author: mthomas $ |
573 |
|
|
* |
574 |
|
|
* This file is part of the ASCEND Tcl/Tk interface |
575 |
|
|
* |
576 |
|
|
* Copyright 1997, Carnegie Mellon University |
577 |
|
|
* |
578 |
|
|
* The ASCEND Tcl/Tk interface is free software; you can redistribute |
579 |
|
|
* it and/or modify it under the terms of the GNU General Public License as |
580 |
|
|
* published by the Free Software Foundation; either version 2 of the |
581 |
|
|
* License, or (at your option) any later version. |
582 |
|
|
* |
583 |
|
|
* The ASCEND Tcl/Tk interface is distributed in hope that it will be |
584 |
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
585 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
586 |
|
|
* General Public License for more details. |
587 |
|
|
* |
588 |
|
|
* You should have received a copy of the GNU General Public License |
589 |
|
|
* along with the program; if not, write to the Free Software Foundation, |
590 |
|
|
* Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named |
591 |
|
|
* COPYING. COPYING is found in ../compiler. |
592 |
|
|
*/ |
593 |
|
|
|
594 |
|
|
/* |
595 |
|
|
* ASCEND Type Retriever 1.2 |
596 |
|
|
* |
597 |
|
|
* Purpose: |
598 |
|
|
* To extract a type definition from an input file. |
599 |
|
|
* Usage: |
600 |
|
|
* See the header file for use from within ASCEND. |
601 |
|
|
* For stand-alone use: |
602 |
|
|
* typer [flags] ascend_type_name input_file output_file |
603 |
|
|
* flags: -c show comments |
604 |
|
|
* If no -c given, strip out comments. |
605 |
|
|
* Features: |
606 |
|
|
* --Does not descend into REQUIREd files. Only examines input_file |
607 |
|
|
* for definitions of ascend_type_name. |
608 |
|
|
* --This version DOES handle the UNIVERSAL quantifier. |
609 |
|
|
* |
610 |
|
|
*/ |
611 |
|
|
|
612 |
|
|
#include "tcl.h" |
613 |
|
|
#include "utilities/ascConfig.h" |
614 |
|
|
#include "general/list.h" |
615 |
|
|
#ifndef TYPER_TEST |
616 |
|
|
/* for handling string modules and results in interp */ |
617 |
|
|
#include "compiler/compiler.h" |
618 |
|
|
#include "compiler/symtab.h" |
619 |
|
|
#include "compiler/fractions.h" |
620 |
|
|
#include "compiler/dimen.h" |
621 |
|
|
#include "compiler/child.h" |
622 |
|
|
#include "compiler/type_desc.h" |
623 |
|
|
#include "compiler/library.h" |
624 |
|
|
#include "compiler/module.h" |
625 |
|
|
#include "interface/HelpProc.h" /* help is not necessary for test */ |
626 |
|
|
#endif /*!typertest*/ |
627 |
|
|
#include "interface/typelex.h" |
628 |
|
|
|
629 |
|
|
|
630 |
|
|
#ifndef lint |
631 |
|
|
static const char TyperID[] = "$Id: typelex.c.no.flex,v 1.11 1998/02/27 14:39:53 mthomas Exp $"; |
632 |
|
|
#endif |
633 |
|
|
|
634 |
|
|
#define YY_BREAK |
635 |
|
|
/* |
636 |
|
|
* Defining yybreak as above (empty) means that all of our matches must end |
637 |
|
|
* in break or return because the normal flex supplied yybreak will |
638 |
|
|
* be preempted by our empty one. |
639 |
|
|
* In cases where matches contain a conditional return, make sure a |
640 |
|
|
* break follows in the failure case. |
641 |
|
|
*/ |
642 |
|
|
|
643 |
|
|
static int CommentNestLevel = 0; |
644 |
|
|
/* |
645 |
|
|
* Nesting level of (* comments *) |
646 |
|
|
*/ |
647 |
|
|
|
648 |
|
|
static int BracesNestLevel = 0; |
649 |
|
|
/* |
650 |
|
|
* Nesting level of {braced} expressions |
651 |
|
|
*/ |
652 |
|
|
|
653 |
|
|
enum keyword_tokens { |
654 |
|
|
NONE, /* Nothing to match, we're in the initial state */ |
655 |
|
|
MODEL, /* We've just read a MODEL or ATOM keyword */ |
656 |
|
|
MODEL_END, /* We've just read an END keyword inside a MODEL, |
657 |
|
|
* an ATOM, or a DEFINITION. */ |
658 |
|
|
CONSTANT /* We've just read a CONSTANT keyword */ |
659 |
|
|
}; |
660 |
|
|
static enum keyword_tokens MatchedToken = NONE; |
661 |
|
|
/* |
662 |
|
|
* The recognized token we've most recently read. This usually implies |
663 |
|
|
* that we're either in that state or we need to check the next keyword |
664 |
|
|
* to see if we should enter (or leave, in the case of MODEL_END) that |
665 |
|
|
* state. MODEL, ATOM, and DEFINITION state are equivalent. |
666 |
|
|
*/ |
667 |
|
|
|
668 |
|
|
static int ShowComments = 0; |
669 |
|
|
/* |
670 |
|
|
* Should we print comments? (1 = yes, 0 = no) |
671 |
|
|
* This is set to 1 with `-c' on the command line |
672 |
|
|
*/ |
673 |
|
|
|
674 |
|
|
static unsigned long StartId = 0; |
675 |
|
|
/* |
676 |
|
|
* The location in the `yytext' array where the MODEL, ATOM, or CONSTANT |
677 |
|
|
* identifierbegins. We save this value and call yymore() when we find |
678 |
|
|
* a MODEL, ATOM, or CONSTANT keyword; StartId tells us where the |
679 |
|
|
* Identifier will go. |
680 |
|
|
*/ |
681 |
|
|
|
682 |
|
|
static char *reqType = ""; |
683 |
|
|
/* |
684 |
|
|
* The type we are looking for. This is one of the arguments passed |
685 |
|
|
* to Asc_ExtractType() in the argv vector. |
686 |
|
|
*/ |
687 |
|
|
|
688 |
|
|
static Tcl_Interp *g_yy_interp; |
689 |
|
|
/* during parse, set to caller's interp if string result is wanted |
690 |
|
|
* instead of file. |
691 |
|
|
*/ |
692 |
|
|
|
693 |
|
|
#ifdef TYPER_TEST |
694 |
|
|
/* |
695 |
|
|
* Specify ASCERR, ASCWAR when building stand alone. |
696 |
|
|
*/ |
697 |
|
|
FILE *ASCERR = stderr; |
698 |
|
|
FILE *ASCWAR = stderr; |
699 |
|
|
#endif /* TYPER_TEST */ |
700 |
|
|
|
701 |
|
|
#define Comment 1 |
702 |
|
|
|
703 |
|
|
#define BracedText 2 |
704 |
|
|
|
705 |
|
|
#define Model 3 |
706 |
|
|
|
707 |
|
|
#define Constant 4 |
708 |
|
|
|
709 |
|
|
#define CheckID 5 |
710 |
|
|
|
711 |
|
|
|
712 |
|
|
/* Macros after this point can all be overridden by user definitions in |
713 |
|
|
* section 1. |
714 |
|
|
*/ |
715 |
|
|
|
716 |
|
|
#if YY_STACK_USED |
717 |
|
|
static int yy_start_stack_ptr = 0; |
718 |
|
|
static int yy_start_stack_depth = 0; |
719 |
|
|
static int *yy_start_stack = 0; |
720 |
|
|
#ifndef YY_NO_PUSH_STATE |
721 |
|
|
static void yy_push_state YY_PROTO(( int new_state )); |
722 |
|
|
#endif |
723 |
|
|
#ifndef YY_NO_POP_STATE |
724 |
|
|
static void yy_pop_state YY_PROTO(( void )); |
725 |
|
|
#endif |
726 |
|
|
#ifndef YY_NO_TOP_STATE |
727 |
|
|
static int yy_top_state YY_PROTO(( void )); |
728 |
|
|
#endif |
729 |
|
|
|
730 |
|
|
#else |
731 |
|
|
#define YY_NO_PUSH_STATE 1 |
732 |
|
|
#define YY_NO_POP_STATE 1 |
733 |
|
|
#define YY_NO_TOP_STATE 1 |
734 |
|
|
#endif |
735 |
|
|
|
736 |
|
|
#ifdef YY_MALLOC_DECL |
737 |
|
|
YY_MALLOC_DECL |
738 |
|
|
#else |
739 |
|
|
#if __STDC__ |
740 |
|
|
#ifndef __cplusplus |
741 |
|
|
#include <stdlib.h> |
742 |
|
|
#endif |
743 |
|
|
#else |
744 |
|
|
/* Just try to get by without declaring the routines. This will fail |
745 |
|
|
* miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) |
746 |
|
|
* or sizeof(void*) != sizeof(int). |
747 |
|
|
*/ |
748 |
|
|
#endif |
749 |
|
|
#endif |
750 |
|
|
|
751 |
|
|
/* Amount of stuff to slurp up with each read. */ |
752 |
|
|
#ifndef YY_READ_BUF_SIZE |
753 |
|
|
#define YY_READ_BUF_SIZE 8192 |
754 |
|
|
#endif |
755 |
|
|
|
756 |
|
|
/* Copy whatever the last rule matched to the standard output. */ |
757 |
|
|
|
758 |
|
|
#ifndef ECHO |
759 |
|
|
/* This used to be an fputs(), but since the string might contain NUL's, |
760 |
|
|
* we now use fwrite(). |
761 |
|
|
*/ |
762 |
|
|
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) |
763 |
|
|
#endif |
764 |
|
|
|
765 |
|
|
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
766 |
|
|
* is returned in "result". |
767 |
|
|
*/ |
768 |
|
|
#ifndef YY_INPUT |
769 |
|
|
#define YY_INPUT(buf,result,max_size) \ |
770 |
|
|
if ( yy_current_buffer->yy_is_interactive ) \ |
771 |
|
|
{ \ |
772 |
|
|
int c = '*', n; \ |
773 |
|
|
for ( n = 0; n < max_size && \ |
774 |
|
|
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
775 |
|
|
buf[n] = (char) c; \ |
776 |
|
|
if ( c == '\n' ) \ |
777 |
|
|
buf[n++] = (char) c; \ |
778 |
|
|
if ( c == EOF && ferror( yyin ) ) \ |
779 |
|
|
YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
780 |
|
|
result = n; \ |
781 |
|
|
} \ |
782 |
|
|
else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ |
783 |
|
|
&& ferror( yyin ) ) \ |
784 |
|
|
YY_FATAL_ERROR( "input in flex scanner failed" ); |
785 |
|
|
#endif |
786 |
|
|
|
787 |
|
|
/* No semi-colon after return; correct usage is to write "yyterminate();" - |
788 |
|
|
* we don't want an extra ';' after the "return" because that will cause |
789 |
|
|
* some compilers to complain about unreachable statements. |
790 |
|
|
*/ |
791 |
|
|
#ifndef yyterminate |
792 |
|
|
#define yyterminate() return YY_NULL |
793 |
|
|
#endif |
794 |
|
|
|
795 |
|
|
/* Number of entries by which start-condition stack grows. */ |
796 |
|
|
#ifndef YY_START_STACK_INCR |
797 |
|
|
#define YY_START_STACK_INCR 25 |
798 |
|
|
#endif |
799 |
|
|
|
800 |
|
|
/* Report a fatal error. */ |
801 |
|
|
#ifndef YY_FATAL_ERROR |
802 |
|
|
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) |
803 |
|
|
#endif |
804 |
|
|
|
805 |
|
|
/* Default declaration of generated scanner - a define so the user can |
806 |
|
|
* easily add parameters. |
807 |
|
|
*/ |
808 |
|
|
#ifndef YY_DECL |
809 |
|
|
#define YY_DECL int yylex YY_PROTO(( void )) |
810 |
|
|
#endif |
811 |
|
|
|
812 |
|
|
/* Code executed at the beginning of each rule, after yytext and yyleng |
813 |
|
|
* have been set up. |
814 |
|
|
*/ |
815 |
|
|
#ifndef YY_USER_ACTION |
816 |
|
|
#define YY_USER_ACTION |
817 |
|
|
#endif |
818 |
|
|
|
819 |
|
|
/* Code executed at the end of each rule. */ |
820 |
|
|
#ifndef YY_BREAK |
821 |
|
|
#define YY_BREAK break; |
822 |
|
|
#endif |
823 |
|
|
|
824 |
|
|
#define YY_RULE_SETUP \ |
825 |
|
|
YY_USER_ACTION |
826 |
|
|
|
827 |
|
|
YY_DECL |
828 |
|
|
{ |
829 |
|
|
register yy_state_type yy_current_state; |
830 |
|
|
register char *yy_cp, *yy_bp; |
831 |
|
|
register int yy_act; |
832 |
|
|
|
833 |
|
|
|
834 |
|
|
|
835 |
|
|
/* |
836 |
|
|
* Code to handle (* Comments *) |
837 |
|
|
* |
838 |
|
|
* "(*" puts us into the Comment state. Comments nest, so in the |
839 |
|
|
* Comment state we need to look for "(*" that increases the nesting |
840 |
|
|
* level and "*)" that will lower it. |
841 |
|
|
* Do NOT try to match \(\*+ since that causes "(****)" to parse |
842 |
|
|
* incorrectly. |
843 |
|
|
*/ |
844 |
|
|
|
845 |
|
|
|
846 |
|
|
if ( yy_init ) |
847 |
|
|
{ |
848 |
|
|
yy_init = 0; |
849 |
|
|
|
850 |
|
|
#ifdef YY_USER_INIT |
851 |
|
|
YY_USER_INIT; |
852 |
|
|
#endif |
853 |
|
|
|
854 |
|
|
if ( ! yy_start ) |
855 |
|
|
yy_start = 1; /* first start state */ |
856 |
|
|
|
857 |
|
|
if ( ! yyin ) |
858 |
|
|
yyin = stdin; |
859 |
|
|
|
860 |
|
|
if ( ! yyout ) |
861 |
|
|
yyout = stdout; |
862 |
|
|
|
863 |
|
|
if ( ! yy_current_buffer ) |
864 |
|
|
yy_current_buffer = |
865 |
|
|
yy_create_buffer( yyin, YY_BUF_SIZE ); |
866 |
|
|
|
867 |
|
|
yy_load_buffer_state(); |
868 |
|
|
} |
869 |
|
|
|
870 |
|
|
while ( 1 ) /* loops until end-of-file is reached */ |
871 |
|
|
{ |
872 |
|
|
yy_more_len = 0; |
873 |
|
|
if ( yy_more_flag ) |
874 |
|
|
{ |
875 |
|
|
yy_more_len = yyleng; |
876 |
|
|
yy_more_flag = 0; |
877 |
|
|
} |
878 |
|
|
yy_cp = yy_c_buf_p; |
879 |
|
|
|
880 |
|
|
/* Support of yytext. */ |
881 |
|
|
*yy_cp = yy_hold_char; |
882 |
|
|
|
883 |
|
|
/* yy_bp points to the position in yy_ch_buf of the start of |
884 |
|
|
* the current run. |
885 |
|
|
*/ |
886 |
|
|
yy_bp = yy_cp; |
887 |
|
|
|
888 |
|
|
yy_current_state = yy_start; |
889 |
|
|
yy_match: |
890 |
|
|
do |
891 |
|
|
{ |
892 |
|
|
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; |
893 |
|
|
if ( yy_accept[yy_current_state] ) |
894 |
|
|
{ |
895 |
|
|
yy_last_accepting_state = yy_current_state; |
896 |
|
|
yy_last_accepting_cpos = yy_cp; |
897 |
|
|
} |
898 |
|
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
899 |
|
|
{ |
900 |
|
|
yy_current_state = (int) yy_def[yy_current_state]; |
901 |
|
|
if ( yy_current_state >= 124 ) |
902 |
|
|
yy_c = yy_meta[(unsigned int) yy_c]; |
903 |
|
|
} |
904 |
|
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
905 |
|
|
++yy_cp; |
906 |
|
|
} |
907 |
|
|
while ( yy_base[yy_current_state] != 467 ); |
908 |
|
|
|
909 |
|
|
yy_find_action: |
910 |
|
|
yy_act = yy_accept[yy_current_state]; |
911 |
|
|
if ( yy_act == 0 ) |
912 |
|
|
{ /* have to back up */ |
913 |
|
|
yy_cp = yy_last_accepting_cpos; |
914 |
|
|
yy_current_state = yy_last_accepting_state; |
915 |
|
|
yy_act = yy_accept[yy_current_state]; |
916 |
|
|
} |
917 |
|
|
|
918 |
|
|
YY_DO_BEFORE_ACTION; |
919 |
|
|
|
920 |
|
|
|
921 |
|
|
do_action: /* This label is used only to access EOF actions. */ |
922 |
|
|
|
923 |
|
|
|
924 |
|
|
switch ( yy_act ) |
925 |
|
|
{ /* beginning of action switch */ |
926 |
|
|
case 0: /* must back up */ |
927 |
|
|
/* undo the effects of YY_DO_BEFORE_ACTION */ |
928 |
|
|
*yy_cp = yy_hold_char; |
929 |
|
|
yy_cp = yy_last_accepting_cpos; |
930 |
|
|
yy_current_state = yy_last_accepting_state; |
931 |
|
|
goto yy_find_action; |
932 |
|
|
|
933 |
|
|
case 1: |
934 |
|
|
case 2: |
935 |
|
|
case 3: |
936 |
|
|
YY_RULE_SETUP |
937 |
|
|
{ |
938 |
|
|
/* Match "(" followed by "*" puts us into |
939 |
|
|
* the COMMENT state. Don't use \*+ since |
940 |
|
|
* that will parse "(***)" incorrectly. |
941 |
|
|
* Initialize the nesting level. |
942 |
|
|
* Print if ShowComments is TRUE and |
943 |
|
|
* MatchedToken is not NONE |
944 |
|
|
*/ |
945 |
|
|
BEGIN(Comment); |
946 |
|
|
CommentNestLevel = 1; |
947 |
|
|
if( ShowComments && MatchedToken!=NONE ) { |
948 |
|
|
Asc_PutCode( yytext, yyout ); |
949 |
|
|
} |
950 |
|
|
break; |
951 |
|
|
} |
952 |
|
|
YY_BREAK |
953 |
|
|
case 4: |
954 |
|
|
YY_RULE_SETUP |
955 |
|
|
{ |
956 |
|
|
/* Match "(" followed "*" followed by |
957 |
|
|
* anything that's not "(" nor "*". |
958 |
|
|
* `anything' includes newlines. |
959 |
|
|
* Increase the commment nesting level. |
960 |
|
|
* Print if ShowComments is TRUE and |
961 |
|
|
* MatchedToken is not NONE. |
962 |
|
|
*/ |
963 |
|
|
CommentNestLevel++; |
964 |
|
|
if( ShowComments && MatchedToken!=NONE ) { |
965 |
|
|
Asc_PutCode( yytext, yyout ); |
966 |
|
|
} |
967 |
|
|
break; |
968 |
|
|
} |
969 |
|
|
YY_BREAK |
970 |
|
|
case 5: |
971 |
|
|
YY_RULE_SETUP |
972 |
|
|
{ |
973 |
|
|
/* Match anything not "*" or "(" followed |
974 |
|
|
* by one or more "*"s followed by ")". |
975 |
|
|
* `anything' includes newlines. |
976 |
|
|
* This decreases the comment nesting level |
977 |
|
|
* and kicks us out if we're back to zero. |
978 |
|
|
* Print if ShowComments is TRUE and |
979 |
|
|
* MatchedToken is not NONE. |
980 |
|
|
*/ |
981 |
|
|
CommentNestLevel--; |
982 |
|
|
if( CommentNestLevel > 0 ) { |
983 |
|
|
/* more comments */ |
984 |
|
|
break; |
985 |
|
|
} |
986 |
|
|
if( MatchedToken == NONE ) { |
987 |
|
|
BEGIN(INITIAL); |
988 |
|
|
break; |
989 |
|
|
} |
990 |
|
|
if( ShowComments ) { |
991 |
|
|
Asc_PutCode( yytext, yyout ); |
992 |
|
|
} |
993 |
|
|
switch( MatchedToken ) { |
994 |
|
|
case MODEL: |
995 |
|
|
BEGIN(Model); |
996 |
|
|
break; |
997 |
|
|
case CONSTANT: |
998 |
|
|
BEGIN(Constant); |
999 |
|
|
break; |
1000 |
|
|
default: |
1001 |
|
|
BEGIN(INITIAL); |
1002 |
|
|
break; |
1003 |
|
|
} |
1004 |
|
|
break; |
1005 |
|
|
} |
1006 |
|
|
YY_BREAK |
1007 |
|
|
case 6: |
1008 |
|
|
case 7: |
1009 |
|
|
case 8: |
1010 |
|
|
YY_RULE_SETUP |
1011 |
|
|
{ |
1012 |
|
|
/* |
1013 |
|
|
* These three rules eat: |
1014 |
|
|
* -- anything that's not a "*" or a "(" |
1015 |
|
|
* -- "("s not followed by "*" |
1016 |
|
|
* -- "*"s not followed by ")" |
1017 |
|
|
* `anything' includes newlines. |
1018 |
|
|
* Print if ShowComments is TRUE and |
1019 |
|
|
* MatchedToken is not NONE |
1020 |
|
|
*/ |
1021 |
|
|
if( ShowComments && MatchedToken!=NONE ) { |
1022 |
|
|
Asc_PutCode( yytext, yyout ); |
1023 |
|
|
} |
1024 |
|
|
break; |
1025 |
|
|
} |
1026 |
|
|
YY_BREAK |
1027 |
|
|
/* |
1028 |
|
|
* Code to handle { Text in Braces } |
1029 |
|
|
* |
1030 |
|
|
* "{" puts us into the BracedText state. Braces nest, so |
1031 |
|
|
* in the BracedText state we need to look for "{" that increases |
1032 |
|
|
* the nesting level and "}" that will lower it. |
1033 |
|
|
*/ |
1034 |
|
|
case 9: |
1035 |
|
|
case 10: |
1036 |
|
|
case 11: |
1037 |
|
|
YY_RULE_SETUP |
1038 |
|
|
{ |
1039 |
|
|
/* A "{" puts us into the BracedText state. |
1040 |
|
|
* Initialize the nesting level. |
1041 |
|
|
* Print if MatchedToken is not NONE. |
1042 |
|
|
* |
1043 |
|
|
*/ |
1044 |
|
|
BEGIN(BracedText); |
1045 |
|
|
BracesNestLevel = 1; |
1046 |
|
|
if( MatchedToken != NONE ) { |
1047 |
|
|
Asc_PutCode( yytext, yyout ); |
1048 |
|
|
} |
1049 |
|
|
break; |
1050 |
|
|
} |
1051 |
|
|
YY_BREAK |
1052 |
|
|
case 12: |
1053 |
|
|
YY_RULE_SETUP |
1054 |
|
|
{ |
1055 |
|
|
/* A backslash \ in the BracedText state |
1056 |
|
|
* protects any character---even a |
1057 |
|
|
* newline---and does not affect the |
1058 |
|
|
* Nesting Level. |
1059 |
|
|
* Print if MatchedToken is not NONE. |
1060 |
|
|
*/ |
1061 |
|
|
if( MatchedToken != NONE ) { |
1062 |
|
|
Asc_PutCode( yytext, yyout ); |
1063 |
|
|
} |
1064 |
|
|
break; |
1065 |
|
|
} |
1066 |
|
|
YY_BREAK |
1067 |
|
|
case 13: |
1068 |
|
|
YY_RULE_SETUP |
1069 |
|
|
{ |
1070 |
|
|
/* A backslash \ in the BracedText state |
1071 |
|
|
* protects any character---even a |
1072 |
|
|
* newline---and does not affect the |
1073 |
|
|
* Nesting Level. |
1074 |
|
|
* Print if MatchedToken is not NONE. |
1075 |
|
|
*/ |
1076 |
|
|
if( MatchedToken != NONE ) { |
1077 |
|
|
Asc_PutCode( yytext, yyout ); |
1078 |
|
|
} |
1079 |
|
|
break; |
1080 |
|
|
} |
1081 |
|
|
YY_BREAK |
1082 |
|
|
case 14: |
1083 |
|
|
YY_RULE_SETUP |
1084 |
|
|
{ |
1085 |
|
|
/* A "{" in the braces state gets added to |
1086 |
|
|
* the text and increase the nesting level. |
1087 |
|
|
* Match any non-brace character---including |
1088 |
|
|
* newlines---that follows the open brace. |
1089 |
|
|
* Print if MatchedToken is not NONE. |
1090 |
|
|
*/ |
1091 |
|
|
BracesNestLevel++; |
1092 |
|
|
if( MatchedToken != NONE ) { |
1093 |
|
|
Asc_PutCode( yytext, yyout ); |
1094 |
|
|
} |
1095 |
|
|
break; |
1096 |
|
|
} |
1097 |
|
|
YY_BREAK |
1098 |
|
|
case 15: |
1099 |
|
|
YY_RULE_SETUP |
1100 |
|
|
{ |
1101 |
|
|
/* A "}" will reduce the nesting level. |
1102 |
|
|
* If the nesting level is zero, go back to |
1103 |
|
|
* the previous state. Match any |
1104 |
|
|
* non-brace character---including |
1105 |
|
|
* newlines---that precedes the close brace. |
1106 |
|
|
* Print if MatchedToken is not NONE. |
1107 |
|
|
*/ |
1108 |
|
|
BracesNestLevel--; |
1109 |
|
|
if (BracesNestLevel > 0) { |
1110 |
|
|
/* more braced text */ |
1111 |
|
|
break; |
1112 |
|
|
} |
1113 |
|
|
if( MatchedToken == NONE ) { |
1114 |
|
|
BEGIN(INITIAL); |
1115 |
|
|
break; |
1116 |
|
|
} |
1117 |
|
|
Asc_PutCode( yytext, yyout ); |
1118 |
|
|
switch( MatchedToken ) { |
1119 |
|
|
case MODEL: |
1120 |
|
|
BEGIN(Model); |
1121 |
|
|
break; |
1122 |
|
|
case CONSTANT: |
1123 |
|
|
BEGIN(Constant); |
1124 |
|
|
break; |
1125 |
|
|
default: |
1126 |
|
|
BEGIN(INITIAL); |
1127 |
|
|
break; |
1128 |
|
|
} |
1129 |
|
|
break; |
1130 |
|
|
} |
1131 |
|
|
YY_BREAK |
1132 |
|
|
case 16: |
1133 |
|
|
YY_RULE_SETUP |
1134 |
|
|
{ |
1135 |
|
|
/* Match anything that is not "{" nor "}" |
1136 |
|
|
* nor "\\"(backslash). |
1137 |
|
|
* `anything' includes newlines. |
1138 |
|
|
* Print if MatchedToken is not NONE. |
1139 |
|
|
*/ |
1140 |
|
|
if( MatchedToken != NONE ) { |
1141 |
|
|
Asc_PutCode( yytext, yyout ); |
1142 |
|
|
} |
1143 |
|
|
break; |
1144 |
|
|
} |
1145 |
|
|
YY_BREAK |
1146 |
|
|
/* |
1147 |
|
|
* Code to check an identifier. |
1148 |
|
|
* |
1149 |
|
|
* When we are looking for a MODEL, ATOM, CONSTANT, or DEFIITION |
1150 |
|
|
* and we find the text [UNIVERSAL]{MODEL|ATOM|CONSTANT|DEFINITION}, |
1151 |
|
|
* we enter this state. |
1152 |
|
|
* |
1153 |
|
|
* When we are insided MODEL, ATOM, or DEFINITION and we find |
1154 |
|
|
* the text END, we enter this state. |
1155 |
|
|
* |
1156 |
|
|
* This state checks to see if the text following the MODEL, |
1157 |
|
|
* ATOM, CONSTANT, DEFINITION, or END keyword matches |
1158 |
|
|
* `reqType'---the type requested by the user. If so, we are |
1159 |
|
|
* at the beginning or end of a type, and should change states |
1160 |
|
|
* accordingly. If not, we should stay in our current state. |
1161 |
|
|
*/ |
1162 |
|
|
case 17: |
1163 |
|
|
YY_RULE_SETUP |
1164 |
|
|
{ |
1165 |
|
|
/* |
1166 |
|
|
* Found an identifier. |
1167 |
|
|
* Identify the correct state. |
1168 |
|
|
*/ |
1169 |
|
|
if( MatchedToken == MODEL_END ) { |
1170 |
|
|
/* |
1171 |
|
|
* We're in the Model state, print the |
1172 |
|
|
* text and see if matches reqType, if |
1173 |
|
|
* so, we're at the end of the MODEL |
1174 |
|
|
* (or ATOM or DEFINITION) |
1175 |
|
|
* and should exit yylex()---return to |
1176 |
|
|
* our caller, else stay in the Model |
1177 |
|
|
* state. |
1178 |
|
|
*/ |
1179 |
|
|
Asc_PutCode( yytext, yyout ); |
1180 |
|
|
if(strcmp((yytext+StartId),reqType) == 0) { |
1181 |
|
|
return 0; |
1182 |
|
|
} else { |
1183 |
|
|
MatchedToken = MODEL; |
1184 |
|
|
BEGIN(Model); |
1185 |
|
|
} |
1186 |
|
|
break; |
1187 |
|
|
} |
1188 |
|
|
if(strcmp((yytext+StartId),reqType)==0){ |
1189 |
|
|
/* |
1190 |
|
|
* We're in the INITIAL state, and we |
1191 |
|
|
* found the beginning of the |
1192 |
|
|
* requested MODEL, ATOM, CONSTANT, |
1193 |
|
|
* or DEFINITION. |
1194 |
|
|
* Print the text and set OutputState to |
1195 |
|
|
* say we are printing. Start the |
1196 |
|
|
* appropriate State by checking |
1197 |
|
|
* MatchedToken. |
1198 |
|
|
*/ |
1199 |
|
|
Asc_PutCode( yytext, yyout ); |
1200 |
|
|
switch( MatchedToken ) { |
1201 |
|
|
case MODEL: |
1202 |
|
|
BEGIN(Model); |
1203 |
|
|
break; |
1204 |
|
|
case CONSTANT: |
1205 |
|
|
BEGIN(Constant); |
1206 |
|
|
break; |
1207 |
|
|
default: |
1208 |
|
|
/* something is wrong */ |
1209 |
|
|
BEGIN(INITIAL); |
1210 |
|
|
break; |
1211 |
|
|
} |
1212 |
|
|
break; |
1213 |
|
|
} |
1214 |
|
|
/* |
1215 |
|
|
* We're in the INITIAL state; we found |
1216 |
|
|
* an MODEL, ATOM, CONSTANT, or |
1217 |
|
|
* DEFINITION, but it wasn't the right |
1218 |
|
|
* one. Stay in the INITIAL state. |
1219 |
|
|
*/ |
1220 |
|
|
MatchedToken = NONE; |
1221 |
|
|
BEGIN(INITIAL); |
1222 |
|
|
break; |
1223 |
|
|
} |
1224 |
|
|
YY_BREAK |
1225 |
|
|
case 18: |
1226 |
|
|
YY_RULE_SETUP |
1227 |
|
|
{ |
1228 |
|
|
/* |
1229 |
|
|
* Some text other than an identifier |
1230 |
|
|
* was found. Print the text if |
1231 |
|
|
* MatchedToken is not NONE, |
1232 |
|
|
* and return to the correct state. |
1233 |
|
|
*/ |
1234 |
|
|
if( MatchedToken == NONE ) { |
1235 |
|
|
BEGIN(INITIAL); |
1236 |
|
|
break; |
1237 |
|
|
} |
1238 |
|
|
Asc_PutCode( yytext, yyout ); |
1239 |
|
|
switch( MatchedToken ) { |
1240 |
|
|
case MODEL: |
1241 |
|
|
BEGIN(Model); |
1242 |
|
|
break; |
1243 |
|
|
case CONSTANT: |
1244 |
|
|
BEGIN(Constant); |
1245 |
|
|
break; |
1246 |
|
|
default: |
1247 |
|
|
/* something is wrong */ |
1248 |
|
|
BEGIN(INITIAL); |
1249 |
|
|
break; |
1250 |
|
|
} |
1251 |
|
|
break; |
1252 |
|
|
} |
1253 |
|
|
YY_BREAK |
1254 |
|
|
/* |
1255 |
|
|
* Code to handle the model/atom/definition we want. |
1256 |
|
|
* |
1257 |
|
|
* Once we've found the start of the matching MODEL, ATOM, or |
1258 |
|
|
* DEFINITION, print the text until we find the END token. |
1259 |
|
|
* When we find END, save the current length of yytext and use |
1260 |
|
|
* yymore() to append the identifier, then check the identifier |
1261 |
|
|
* (in the CheckID state) to see if it is what we want. If so, |
1262 |
|
|
* this is the end of this MODEL, ATOM, or DEFINITION. |
1263 |
|
|
*/ |
1264 |
|
|
case 19: |
1265 |
|
|
YY_RULE_SETUP |
1266 |
|
|
{ |
1267 |
|
|
/* |
1268 |
|
|
* Found the END keyword. Save the |
1269 |
|
|
* current location in the yytext array, |
1270 |
|
|
* then enter the CheckID state to see if |
1271 |
|
|
* the identifier matches what we want. |
1272 |
|
|
*/ |
1273 |
|
|
StartId = yyleng; |
1274 |
|
|
MatchedToken = MODEL_END; |
1275 |
|
|
BEGIN(CheckID); |
1276 |
|
|
yymore(); |
1277 |
|
|
break; |
1278 |
|
|
} |
1279 |
|
|
YY_BREAK |
1280 |
|
|
case 20: |
1281 |
|
|
case 21: |
1282 |
|
|
case 22: |
1283 |
|
|
YY_RULE_SETUP |
1284 |
|
|
{ |
1285 |
|
|
/* |
1286 |
|
|
* These rules match |
1287 |
|
|
* -- any character except that which |
1288 |
|
|
* would cause us to change states |
1289 |
|
|
* -- "("s not followed by "*"s |
1290 |
|
|
* -- uppercase keywords and following |
1291 |
|
|
* semicolon or whitespace. |
1292 |
|
|
* Print the text. |
1293 |
|
|
*/ |
1294 |
|
|
Asc_PutCode( yytext, yyout ); |
1295 |
|
|
break; |
1296 |
|
|
} |
1297 |
|
|
YY_BREAK |
1298 |
|
|
/* |
1299 |
|
|
* Code to handle the constant definition we want. |
1300 |
|
|
* |
1301 |
|
|
* Once we've found the start of the matching CONSTANT, print |
1302 |
|
|
* the text until we find a semicolon ";". |
1303 |
|
|
*/ |
1304 |
|
|
case 23: |
1305 |
|
|
YY_RULE_SETUP |
1306 |
|
|
{ |
1307 |
|
|
/* |
1308 |
|
|
* Found the ";" which ends the CONSTANT. |
1309 |
|
|
* Do NOT print it since that will be |
1310 |
|
|
* added below. Return 0. |
1311 |
|
|
*/ |
1312 |
|
|
return 0; |
1313 |
|
|
} |
1314 |
|
|
YY_BREAK |
1315 |
|
|
case 24: |
1316 |
|
|
case 25: |
1317 |
|
|
YY_RULE_SETUP |
1318 |
|
|
{ |
1319 |
|
|
/* |
1320 |
|
|
* These rules match |
1321 |
|
|
* -- any character except that which |
1322 |
|
|
* would cause us to change states |
1323 |
|
|
* -- "("s not followed by "*"s |
1324 |
|
|
* Print the text. |
1325 |
|
|
*/ |
1326 |
|
|
Asc_PutCode( yytext, yyout ); |
1327 |
|
|
break; |
1328 |
|
|
} |
1329 |
|
|
YY_BREAK |
1330 |
|
|
/* |
1331 |
|
|
* Code to look for [UNIVERSAL ]{MODEL|ATOM|CONSTANT|DEFINITION}. |
1332 |
|
|
* |
1333 |
|
|
* If we find UNIVERSAL, use yymore() to append the next |
1334 |
|
|
* keyword---probably MODEL, ATOM, or CONSTANT. |
1335 |
|
|
* If we find MODEL, ATOM, CONSTANT, or DEFINITION save the |
1336 |
|
|
* current length and use yymore() to append the identifier, |
1337 |
|
|
* then check the identifier (in the CheckID state) to see if |
1338 |
|
|
* it is what we're looking for. |
1339 |
|
|
*/ |
1340 |
|
|
case 26: |
1341 |
|
|
YY_RULE_SETUP |
1342 |
|
|
{ |
1343 |
|
|
/* |
1344 |
|
|
* Found the UNIVERSAL keyword. Append |
1345 |
|
|
* the following ATOM/MODEL/CONSTANT |
1346 |
|
|
* keyword. |
1347 |
|
|
*/ |
1348 |
|
|
yymore(); |
1349 |
|
|
break; |
1350 |
|
|
} |
1351 |
|
|
YY_BREAK |
1352 |
|
|
case 27: |
1353 |
|
|
case 28: |
1354 |
|
|
case 29: |
1355 |
|
|
YY_RULE_SETUP |
1356 |
|
|
{ |
1357 |
|
|
/* |
1358 |
|
|
* Found an MODEL, ATOM, or DEFINITION |
1359 |
|
|
* keyword--perhaps with a UNIVERSAL |
1360 |
|
|
* modifier. Save the current location |
1361 |
|
|
* in the yytext array, then enter the |
1362 |
|
|
* CheckID state to see if the identifier |
1363 |
|
|
* matches what we want. |
1364 |
|
|
*/ |
1365 |
|
|
StartId = yyleng; |
1366 |
|
|
MatchedToken = MODEL; |
1367 |
|
|
BEGIN(CheckID); |
1368 |
|
|
yymore(); |
1369 |
|
|
break; |
1370 |
|
|
} |
1371 |
|
|
YY_BREAK |
1372 |
|
|
case 30: |
1373 |
|
|
YY_RULE_SETUP |
1374 |
|
|
{ |
1375 |
|
|
/* |
1376 |
|
|
* Found a CONSTANT keyword--perhaps |
1377 |
|
|
* with a UNIVERSAL modifier. Save the |
1378 |
|
|
* current location in the yytext array, |
1379 |
|
|
* then enter the CheckID state to see if |
1380 |
|
|
* the identifier matches what we want. |
1381 |
|
|
*/ |
1382 |
|
|
StartId = yyleng; |
1383 |
|
|
MatchedToken = CONSTANT; |
1384 |
|
|
BEGIN(CheckID); |
1385 |
|
|
yymore(); |
1386 |
|
|
break; |
1387 |
|
|
} |
1388 |
|
|
YY_BREAK |
1389 |
|
|
/* |
1390 |
|
|
* Rules to match other text. |
1391 |
|
|
*/ |
1392 |
|
|
case 31: |
1393 |
|
|
case 32: |
1394 |
|
|
case 33: |
1395 |
|
|
YY_RULE_SETUP |
1396 |
|
|
{ |
1397 |
|
|
/* |
1398 |
|
|
* These rules match |
1399 |
|
|
* -- any character except that which |
1400 |
|
|
* would cause us to change states |
1401 |
|
|
* -- "("s not followed by "*"s |
1402 |
|
|
* -- uppercase keywords and following |
1403 |
|
|
* semicolon or whitespace. |
1404 |
|
|
* Do nothing. |
1405 |
|
|
*/ |
1406 |
|
|
break; |
1407 |
|
|
} |
1408 |
|
|
YY_BREAK |
1409 |
|
|
case YY_STATE_EOF(INITIAL): |
1410 |
|
|
{ |
1411 |
|
|
/* |
1412 |
|
|
* Reached End of file without a match |
1413 |
|
|
*/ |
1414 |
|
|
return 1; |
1415 |
|
|
} |
1416 |
|
|
YY_BREAK |
1417 |
|
|
case 34: |
1418 |
|
|
YY_RULE_SETUP |
1419 |
|
|
ECHO; |
1420 |
|
|
YY_BREAK |
1421 |
|
|
case YY_STATE_EOF(Comment): |
1422 |
|
|
case YY_STATE_EOF(BracedText): |
1423 |
|
|
case YY_STATE_EOF(Model): |
1424 |
|
|
case YY_STATE_EOF(Constant): |
1425 |
|
|
case YY_STATE_EOF(CheckID): |
1426 |
|
|
yyterminate(); |
1427 |
|
|
|
1428 |
|
|
case YY_END_OF_BUFFER: |
1429 |
|
|
{ |
1430 |
|
|
/* Amount of text matched not including the EOB char. */ |
1431 |
|
|
int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; |
1432 |
|
|
|
1433 |
|
|
/* Undo the effects of YY_DO_BEFORE_ACTION. */ |
1434 |
|
|
*yy_cp = yy_hold_char; |
1435 |
|
|
|
1436 |
|
|
if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) |
1437 |
|
|
{ |
1438 |
|
|
/* We're scanning a new file or input source. It's |
1439 |
|
|
* possible that this happened because the user |
1440 |
|
|
* just pointed yyin at a new source and called |
1441 |
|
|
* yylex(). If so, then we have to assure |
1442 |
|
|
* consistency between yy_current_buffer and our |
1443 |
|
|
* globals. Here is the right place to do so, because |
1444 |
|
|
* this is the first action (other than possibly a |
1445 |
|
|
* back-up) that will match for the new input source. |
1446 |
|
|
*/ |
1447 |
|
|
yy_n_chars = yy_current_buffer->yy_n_chars; |
1448 |
|
|
yy_current_buffer->yy_input_file = yyin; |
1449 |
|
|
yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; |
1450 |
|
|
} |
1451 |
|
|
|
1452 |
|
|
/* Note that here we test for yy_c_buf_p "<=" to the position |
1453 |
|
|
* of the first EOB in the buffer, since yy_c_buf_p will |
1454 |
|
|
* already have been incremented past the NUL character |
1455 |
|
|
* (since all states make transitions on EOB to the |
1456 |
|
|
* end-of-buffer state). Contrast this with the test |
1457 |
|
|
* in input(). |
1458 |
|
|
*/ |
1459 |
|
|
if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) |
1460 |
|
|
{ /* This was really a NUL. */ |
1461 |
|
|
yy_state_type yy_next_state; |
1462 |
|
|
|
1463 |
|
|
yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; |
1464 |
|
|
|
1465 |
|
|
yy_current_state = yy_get_previous_state(); |
1466 |
|
|
|
1467 |
|
|
/* Okay, we're now positioned to make the NUL |
1468 |
|
|
* transition. We couldn't have |
1469 |
|
|
* yy_get_previous_state() go ahead and do it |
1470 |
|
|
* for us because it doesn't know how to deal |
1471 |
|
|
* with the possibility of jamming (and we don't |
1472 |
|
|
* want to build jamming into it because then it |
1473 |
|
|
* will run more slowly). |
1474 |
|
|
*/ |
1475 |
|
|
|
1476 |
|
|
yy_next_state = yy_try_NUL_trans( yy_current_state ); |
1477 |
|
|
|
1478 |
|
|
yy_bp = yytext_ptr + YY_MORE_ADJ; |
1479 |
|
|
|
1480 |
|
|
if ( yy_next_state ) |
1481 |
|
|
{ |
1482 |
|
|
/* Consume the NUL. */ |
1483 |
|
|
yy_cp = ++yy_c_buf_p; |
1484 |
|
|
yy_current_state = yy_next_state; |
1485 |
|
|
goto yy_match; |
1486 |
|
|
} |
1487 |
|
|
|
1488 |
|
|
else |
1489 |
|
|
{ |
1490 |
|
|
yy_cp = yy_c_buf_p; |
1491 |
|
|
goto yy_find_action; |
1492 |
|
|
} |
1493 |
|
|
} |
1494 |
|
|
|
1495 |
|
|
else switch ( yy_get_next_buffer() ) |
1496 |
|
|
{ |
1497 |
|
|
case EOB_ACT_END_OF_FILE: |
1498 |
|
|
{ |
1499 |
|
|
yy_did_buffer_switch_on_eof = 0; |
1500 |
|
|
|
1501 |
|
|
if ( yywrap() ) |
1502 |
|
|
{ |
1503 |
|
|
/* Note: because we've taken care in |
1504 |
|
|
* yy_get_next_buffer() to have set up |
1505 |
|
|
* yytext, we can now set up |
1506 |
|
|
* yy_c_buf_p so that if some total |
1507 |
|
|
* hoser (like flex itself) wants to |
1508 |
|
|
* call the scanner after we return the |
1509 |
|
|
* YY_NULL, it'll still work - another |
1510 |
|
|
* YY_NULL will get returned. |
1511 |
|
|
*/ |
1512 |
|
|
yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; |
1513 |
|
|
|
1514 |
|
|
yy_act = YY_STATE_EOF(YY_START); |
1515 |
|
|
goto do_action; |
1516 |
|
|
} |
1517 |
|
|
|
1518 |
|
|
else |
1519 |
|
|
{ |
1520 |
|
|
if ( ! yy_did_buffer_switch_on_eof ) |
1521 |
|
|
YY_NEW_FILE; |
1522 |
|
|
} |
1523 |
|
|
break; |
1524 |
|
|
} |
1525 |
|
|
|
1526 |
|
|
case EOB_ACT_CONTINUE_SCAN: |
1527 |
|
|
yy_c_buf_p = |
1528 |
|
|
yytext_ptr + yy_amount_of_matched_text; |
1529 |
|
|
|
1530 |
|
|
yy_current_state = yy_get_previous_state(); |
1531 |
|
|
|
1532 |
|
|
yy_cp = yy_c_buf_p; |
1533 |
|
|
yy_bp = yytext_ptr + YY_MORE_ADJ; |
1534 |
|
|
goto yy_match; |
1535 |
|
|
|
1536 |
|
|
case EOB_ACT_LAST_MATCH: |
1537 |
|
|
yy_c_buf_p = |
1538 |
|
|
&yy_current_buffer->yy_ch_buf[yy_n_chars]; |
1539 |
|
|
|
1540 |
|
|
yy_current_state = yy_get_previous_state(); |
1541 |
|
|
|
1542 |
|
|
yy_cp = yy_c_buf_p; |
1543 |
|
|
yy_bp = yytext_ptr + YY_MORE_ADJ; |
1544 |
|
|
goto yy_find_action; |
1545 |
|
|
} |
1546 |
|
|
break; |
1547 |
|
|
} |
1548 |
|
|
|
1549 |
|
|
default: |
1550 |
|
|
YY_FATAL_ERROR( |
1551 |
|
|
"fatal flex scanner internal error--no action found" ); |
1552 |
|
|
} /* end of action switch */ |
1553 |
|
|
} /* end of scanning one token */ |
1554 |
|
|
} /* end of yylex */ |
1555 |
|
|
|
1556 |
|
|
|
1557 |
|
|
/* yy_get_next_buffer - try to read in a new buffer |
1558 |
|
|
* |
1559 |
|
|
* Returns a code representing an action: |
1560 |
|
|
* EOB_ACT_LAST_MATCH - |
1561 |
|
|
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
1562 |
|
|
* EOB_ACT_END_OF_FILE - end of file |
1563 |
|
|
*/ |
1564 |
|
|
|
1565 |
|
|
static int yy_get_next_buffer() |
1566 |
|
|
{ |
1567 |
|
|
register char *dest = yy_current_buffer->yy_ch_buf; |
1568 |
|
|
register char *source = yytext_ptr; |
1569 |
|
|
register int number_to_move, i; |
1570 |
|
|
int ret_val; |
1571 |
|
|
|
1572 |
|
|
if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) |
1573 |
|
|
YY_FATAL_ERROR( |
1574 |
|
|
"fatal flex scanner internal error--end of buffer missed" ); |
1575 |
|
|
|
1576 |
|
|
if ( yy_current_buffer->yy_fill_buffer == 0 ) |
1577 |
|
|
{ /* Don't try to fill the buffer, so this is an EOF. */ |
1578 |
|
|
if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) |
1579 |
|
|
{ |
1580 |
|
|
/* We matched a singled characater, the EOB, so |
1581 |
|
|
* treat this as a final EOF. |
1582 |
|
|
*/ |
1583 |
|
|
return EOB_ACT_END_OF_FILE; |
1584 |
|
|
} |
1585 |
|
|
|
1586 |
|
|
else |
1587 |
|
|
{ |
1588 |
|
|
/* We matched some text prior to the EOB, first |
1589 |
|
|
* process it. |
1590 |
|
|
*/ |
1591 |
|
|
return EOB_ACT_LAST_MATCH; |
1592 |
|
|
} |
1593 |
|
|
} |
1594 |
|
|
|
1595 |
|
|
/* Try to read more data. */ |
1596 |
|
|
|
1597 |
|
|
/* First move last chars to start of buffer. */ |
1598 |
|
|
number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; |
1599 |
|
|
|
1600 |
|
|
for ( i = 0; i < number_to_move; ++i ) |
1601 |
|
|
*(dest++) = *(source++); |
1602 |
|
|
|
1603 |
|
|
if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) |
1604 |
|
|
/* don't do the read, it's not guaranteed to return an EOF, |
1605 |
|
|
* just force an EOF |
1606 |
|
|
*/ |
1607 |
|
|
yy_n_chars = 0; |
1608 |
|
|
|
1609 |
|
|
else |
1610 |
|
|
{ |
1611 |
|
|
int num_to_read = |
1612 |
|
|
yy_current_buffer->yy_buf_size - number_to_move - 1; |
1613 |
|
|
|
1614 |
|
|
while ( num_to_read <= 0 ) |
1615 |
|
|
{ /* Not enough room in the buffer - grow it. */ |
1616 |
|
|
#ifdef YY_USES_REJECT |
1617 |
|
|
YY_FATAL_ERROR( |
1618 |
|
|
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); |
1619 |
|
|
#else |
1620 |
|
|
|
1621 |
|
|
/* just a shorter name for the current buffer */ |
1622 |
|
|
YY_BUFFER_STATE b = yy_current_buffer; |
1623 |
|
|
|
1624 |
|
|
int yy_c_buf_p_offset = |
1625 |
|
|
(int) (yy_c_buf_p - b->yy_ch_buf); |
1626 |
|
|
|
1627 |
|
|
if ( b->yy_is_our_buffer ) |
1628 |
|
|
{ |
1629 |
|
|
int new_size = b->yy_buf_size * 2; |
1630 |
|
|
|
1631 |
|
|
if ( new_size <= 0 ) |
1632 |
|
|
b->yy_buf_size += b->yy_buf_size / 8; |
1633 |
|
|
else |
1634 |
|
|
b->yy_buf_size *= 2; |
1635 |
|
|
|
1636 |
|
|
b->yy_ch_buf = (char *) |
1637 |
|
|
/* Include room in for 2 EOB chars. */ |
1638 |
|
|
yy_flex_realloc( (void *) b->yy_ch_buf, |
1639 |
|
|
b->yy_buf_size + 2 ); |
1640 |
|
|
} |
1641 |
|
|
else |
1642 |
|
|
/* Can't grow it, we don't own it. */ |
1643 |
|
|
b->yy_ch_buf = 0; |
1644 |
|
|
|
1645 |
|
|
if ( ! b->yy_ch_buf ) |
1646 |
|
|
YY_FATAL_ERROR( |
1647 |
|
|
"fatal error - scanner input buffer overflow" ); |
1648 |
|
|
|
1649 |
|
|
yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; |
1650 |
|
|
|
1651 |
|
|
num_to_read = yy_current_buffer->yy_buf_size - |
1652 |
|
|
number_to_move - 1; |
1653 |
|
|
#endif |
1654 |
|
|
} |
1655 |
|
|
|
1656 |
|
|
if ( num_to_read > YY_READ_BUF_SIZE ) |
1657 |
|
|
num_to_read = YY_READ_BUF_SIZE; |
1658 |
|
|
|
1659 |
|
|
/* Read in more data. */ |
1660 |
|
|
YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), |
1661 |
|
|
yy_n_chars, num_to_read ); |
1662 |
|
|
} |
1663 |
|
|
|
1664 |
|
|
if ( yy_n_chars == 0 ) |
1665 |
|
|
{ |
1666 |
|
|
if ( number_to_move == YY_MORE_ADJ ) |
1667 |
|
|
{ |
1668 |
|
|
ret_val = EOB_ACT_END_OF_FILE; |
1669 |
|
|
yyrestart( yyin ); |
1670 |
|
|
} |
1671 |
|
|
|
1672 |
|
|
else |
1673 |
|
|
{ |
1674 |
|
|
ret_val = EOB_ACT_LAST_MATCH; |
1675 |
|
|
yy_current_buffer->yy_buffer_status = |
1676 |
|
|
YY_BUFFER_EOF_PENDING; |
1677 |
|
|
} |
1678 |
|
|
} |
1679 |
|
|
|
1680 |
|
|
else |
1681 |
|
|
ret_val = EOB_ACT_CONTINUE_SCAN; |
1682 |
|
|
|
1683 |
|
|
yy_n_chars += number_to_move; |
1684 |
|
|
yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; |
1685 |
|
|
yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; |
1686 |
|
|
|
1687 |
|
|
yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; |
1688 |
|
|
|
1689 |
|
|
return ret_val; |
1690 |
|
|
} |
1691 |
|
|
|
1692 |
|
|
|
1693 |
|
|
/* yy_get_previous_state - get the state just before the EOB char was reached */ |
1694 |
|
|
|
1695 |
|
|
static yy_state_type yy_get_previous_state() |
1696 |
|
|
{ |
1697 |
|
|
register yy_state_type yy_current_state; |
1698 |
|
|
register char *yy_cp; |
1699 |
|
|
|
1700 |
|
|
yy_current_state = yy_start; |
1701 |
|
|
|
1702 |
|
|
for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) |
1703 |
|
|
{ |
1704 |
|
|
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
1705 |
|
|
if ( yy_accept[yy_current_state] ) |
1706 |
|
|
{ |
1707 |
|
|
yy_last_accepting_state = yy_current_state; |
1708 |
|
|
yy_last_accepting_cpos = yy_cp; |
1709 |
|
|
} |
1710 |
|
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1711 |
|
|
{ |
1712 |
|
|
yy_current_state = (int) yy_def[yy_current_state]; |
1713 |
|
|
if ( yy_current_state >= 124 ) |
1714 |
|
|
yy_c = yy_meta[(unsigned int) yy_c]; |
1715 |
|
|
} |
1716 |
|
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
1717 |
|
|
} |
1718 |
|
|
|
1719 |
|
|
return yy_current_state; |
1720 |
|
|
} |
1721 |
|
|
|
1722 |
|
|
|
1723 |
|
|
/* yy_try_NUL_trans - try to make a transition on the NUL character |
1724 |
|
|
* |
1725 |
|
|
* synopsis |
1726 |
|
|
* next_state = yy_try_NUL_trans( current_state ); |
1727 |
|
|
*/ |
1728 |
|
|
|
1729 |
|
|
#ifdef YY_USE_PROTOS |
1730 |
|
|
static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) |
1731 |
|
|
#else |
1732 |
|
|
static yy_state_type yy_try_NUL_trans( yy_current_state ) |
1733 |
|
|
yy_state_type yy_current_state; |
1734 |
|
|
#endif |
1735 |
|
|
{ |
1736 |
|
|
register int yy_is_jam; |
1737 |
|
|
register char *yy_cp = yy_c_buf_p; |
1738 |
|
|
|
1739 |
|
|
register YY_CHAR yy_c = 1; |
1740 |
|
|
if ( yy_accept[yy_current_state] ) |
1741 |
|
|
{ |
1742 |
|
|
yy_last_accepting_state = yy_current_state; |
1743 |
|
|
yy_last_accepting_cpos = yy_cp; |
1744 |
|
|
} |
1745 |
|
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1746 |
|
|
{ |
1747 |
|
|
yy_current_state = (int) yy_def[yy_current_state]; |
1748 |
|
|
if ( yy_current_state >= 124 ) |
1749 |
|
|
yy_c = yy_meta[(unsigned int) yy_c]; |
1750 |
|
|
} |
1751 |
|
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
1752 |
|
|
yy_is_jam = (yy_current_state == 123); |
1753 |
|
|
|
1754 |
|
|
return yy_is_jam ? 0 : yy_current_state; |
1755 |
|
|
} |
1756 |
|
|
|
1757 |
|
|
|
1758 |
|
|
#ifdef YY_USE_PROTOS |
1759 |
|
|
static void yyunput( int c, register char *yy_bp ) |
1760 |
|
|
#else |
1761 |
|
|
static void yyunput( c, yy_bp ) |
1762 |
|
|
int c; |
1763 |
|
|
register char *yy_bp; |
1764 |
|
|
#endif |
1765 |
|
|
{ |
1766 |
|
|
register char *yy_cp = yy_c_buf_p; |
1767 |
|
|
|
1768 |
|
|
/* undo effects of setting up yytext */ |
1769 |
|
|
*yy_cp = yy_hold_char; |
1770 |
|
|
|
1771 |
|
|
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) |
1772 |
|
|
{ /* need to shift things up to make room */ |
1773 |
|
|
/* +2 for EOB chars. */ |
1774 |
|
|
register int number_to_move = yy_n_chars + 2; |
1775 |
|
|
register char *dest = &yy_current_buffer->yy_ch_buf[ |
1776 |
|
|
yy_current_buffer->yy_buf_size + 2]; |
1777 |
|
|
register char *source = |
1778 |
|
|
&yy_current_buffer->yy_ch_buf[number_to_move]; |
1779 |
|
|
|
1780 |
|
|
while ( source > yy_current_buffer->yy_ch_buf ) |
1781 |
|
|
*--dest = *--source; |
1782 |
|
|
|
1783 |
|
|
yy_cp += (int) (dest - source); |
1784 |
|
|
yy_bp += (int) (dest - source); |
1785 |
|
|
yy_n_chars = yy_current_buffer->yy_buf_size; |
1786 |
|
|
|
1787 |
|
|
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) |
1788 |
|
|
YY_FATAL_ERROR( "flex scanner push-back overflow" ); |
1789 |
|
|
} |
1790 |
|
|
|
1791 |
|
|
*--yy_cp = (char) c; |
1792 |
|
|
|
1793 |
|
|
|
1794 |
|
|
yytext_ptr = yy_bp; |
1795 |
|
|
yy_hold_char = *yy_cp; |
1796 |
|
|
yy_c_buf_p = yy_cp; |
1797 |
|
|
} |
1798 |
|
|
|
1799 |
|
|
|
1800 |
|
|
#ifdef __cplusplus |
1801 |
|
|
static int yyinput() |
1802 |
|
|
#else |
1803 |
|
|
static int input() |
1804 |
|
|
#endif |
1805 |
|
|
{ |
1806 |
|
|
int c; |
1807 |
|
|
|
1808 |
|
|
*yy_c_buf_p = yy_hold_char; |
1809 |
|
|
|
1810 |
|
|
if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) |
1811 |
|
|
{ |
1812 |
|
|
/* yy_c_buf_p now points to the character we want to return. |
1813 |
|
|
* If this occurs *before* the EOB characters, then it's a |
1814 |
|
|
* valid NUL; if not, then we've hit the end of the buffer. |
1815 |
|
|
*/ |
1816 |
|
|
if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) |
1817 |
|
|
/* This was really a NUL. */ |
1818 |
|
|
*yy_c_buf_p = '\0'; |
1819 |
|
|
|
1820 |
|
|
else |
1821 |
|
|
{ /* need more input */ |
1822 |
|
|
yytext_ptr = yy_c_buf_p; |
1823 |
|
|
++yy_c_buf_p; |
1824 |
|
|
|
1825 |
|
|
switch ( yy_get_next_buffer() ) |
1826 |
|
|
{ |
1827 |
|
|
case EOB_ACT_END_OF_FILE: |
1828 |
|
|
{ |
1829 |
|
|
if ( yywrap() ) |
1830 |
|
|
{ |
1831 |
|
|
yy_c_buf_p = |
1832 |
|
|
yytext_ptr + YY_MORE_ADJ; |
1833 |
|
|
return EOF; |
1834 |
|
|
} |
1835 |
|
|
|
1836 |
|
|
if ( ! yy_did_buffer_switch_on_eof ) |
1837 |
|
|
YY_NEW_FILE; |
1838 |
|
|
#ifdef __cplusplus |
1839 |
|
|
return yyinput(); |
1840 |
|
|
#else |
1841 |
|
|
return input(); |
1842 |
|
|
#endif |
1843 |
|
|
} |
1844 |
|
|
|
1845 |
|
|
case EOB_ACT_CONTINUE_SCAN: |
1846 |
|
|
yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; |
1847 |
|
|
break; |
1848 |
|
|
|
1849 |
|
|
case EOB_ACT_LAST_MATCH: |
1850 |
|
|
#ifdef __cplusplus |
1851 |
|
|
YY_FATAL_ERROR( |
1852 |
|
|
"unexpected last match in yyinput()" ); |
1853 |
|
|
#else |
1854 |
|
|
YY_FATAL_ERROR( |
1855 |
|
|
"unexpected last match in input()" ); |
1856 |
|
|
#endif |
1857 |
|
|
} |
1858 |
|
|
} |
1859 |
|
|
} |
1860 |
|
|
|
1861 |
|
|
c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ |
1862 |
|
|
*yy_c_buf_p = '\0'; /* preserve yytext */ |
1863 |
|
|
yy_hold_char = *++yy_c_buf_p; |
1864 |
|
|
|
1865 |
|
|
|
1866 |
|
|
return c; |
1867 |
|
|
} |
1868 |
|
|
|
1869 |
|
|
|
1870 |
|
|
#ifdef YY_USE_PROTOS |
1871 |
|
|
void yyrestart( FILE *input_file ) |
1872 |
|
|
#else |
1873 |
|
|
void yyrestart( input_file ) |
1874 |
|
|
FILE *input_file; |
1875 |
|
|
#endif |
1876 |
|
|
{ |
1877 |
|
|
if ( ! yy_current_buffer ) |
1878 |
|
|
yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); |
1879 |
|
|
|
1880 |
|
|
yy_init_buffer( yy_current_buffer, input_file ); |
1881 |
|
|
yy_load_buffer_state(); |
1882 |
|
|
} |
1883 |
|
|
|
1884 |
|
|
|
1885 |
|
|
#ifdef YY_USE_PROTOS |
1886 |
|
|
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) |
1887 |
|
|
#else |
1888 |
|
|
void yy_switch_to_buffer( new_buffer ) |
1889 |
|
|
YY_BUFFER_STATE new_buffer; |
1890 |
|
|
#endif |
1891 |
|
|
{ |
1892 |
|
|
if ( yy_current_buffer == new_buffer ) |
1893 |
|
|
return; |
1894 |
|
|
|
1895 |
|
|
if ( yy_current_buffer ) |
1896 |
|
|
{ |
1897 |
|
|
/* Flush out information for old buffer. */ |
1898 |
|
|
*yy_c_buf_p = yy_hold_char; |
1899 |
|
|
yy_current_buffer->yy_buf_pos = yy_c_buf_p; |
1900 |
|
|
yy_current_buffer->yy_n_chars = yy_n_chars; |
1901 |
|
|
} |
1902 |
|
|
|
1903 |
|
|
yy_current_buffer = new_buffer; |
1904 |
|
|
yy_load_buffer_state(); |
1905 |
|
|
|
1906 |
|
|
/* We don't actually know whether we did this switch during |
1907 |
|
|
* EOF (yywrap()) processing, but the only time this flag |
1908 |
|
|
* is looked at is after yywrap() is called, so it's safe |
1909 |
|
|
* to go ahead and always set it. |
1910 |
|
|
*/ |
1911 |
|
|
yy_did_buffer_switch_on_eof = 1; |
1912 |
|
|
} |
1913 |
|
|
|
1914 |
|
|
|
1915 |
|
|
#ifdef YY_USE_PROTOS |
1916 |
|
|
void yy_load_buffer_state( void ) |
1917 |
|
|
#else |
1918 |
|
|
void yy_load_buffer_state() |
1919 |
|
|
#endif |
1920 |
|
|
{ |
1921 |
|
|
yy_n_chars = yy_current_buffer->yy_n_chars; |
1922 |
|
|
yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; |
1923 |
|
|
yyin = yy_current_buffer->yy_input_file; |
1924 |
|
|
yy_hold_char = *yy_c_buf_p; |
1925 |
|
|
} |
1926 |
|
|
|
1927 |
|
|
|
1928 |
|
|
#ifdef YY_USE_PROTOS |
1929 |
|
|
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) |
1930 |
|
|
#else |
1931 |
|
|
YY_BUFFER_STATE yy_create_buffer( file, size ) |
1932 |
|
|
FILE *file; |
1933 |
|
|
int size; |
1934 |
|
|
#endif |
1935 |
|
|
{ |
1936 |
|
|
YY_BUFFER_STATE b; |
1937 |
|
|
|
1938 |
|
|
b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); |
1939 |
|
|
if ( ! b ) |
1940 |
|
|
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
1941 |
|
|
|
1942 |
|
|
b->yy_buf_size = size; |
1943 |
|
|
|
1944 |
|
|
/* yy_ch_buf has to be 2 characters longer than the size given because |
1945 |
|
|
* we need to put in 2 end-of-buffer characters. |
1946 |
|
|
*/ |
1947 |
|
|
b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); |
1948 |
|
|
if ( ! b->yy_ch_buf ) |
1949 |
|
|
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
1950 |
|
|
|
1951 |
|
|
b->yy_is_our_buffer = 1; |
1952 |
|
|
|
1953 |
|
|
yy_init_buffer( b, file ); |
1954 |
|
|
|
1955 |
|
|
return b; |
1956 |
|
|
} |
1957 |
|
|
|
1958 |
|
|
|
1959 |
|
|
#ifdef YY_USE_PROTOS |
1960 |
|
|
void yy_delete_buffer( YY_BUFFER_STATE b ) |
1961 |
|
|
#else |
1962 |
|
|
void yy_delete_buffer( b ) |
1963 |
|
|
YY_BUFFER_STATE b; |
1964 |
|
|
#endif |
1965 |
|
|
{ |
1966 |
|
|
if ( b == yy_current_buffer ) |
1967 |
|
|
yy_current_buffer = (YY_BUFFER_STATE) 0; |
1968 |
|
|
|
1969 |
|
|
if ( b->yy_is_our_buffer ) |
1970 |
|
|
yy_flex_free( (void *) b->yy_ch_buf ); |
1971 |
|
|
|
1972 |
|
|
yy_flex_free( (void *) b ); |
1973 |
|
|
} |
1974 |
|
|
|
1975 |
|
|
|
1976 |
|
|
#ifndef YY_ALWAYS_INTERACTIVE |
1977 |
|
|
#ifndef YY_NEVER_INTERACTIVE |
1978 |
|
|
extern int isatty YY_PROTO(( int )); |
1979 |
|
|
#endif |
1980 |
|
|
#endif |
1981 |
|
|
|
1982 |
|
|
#ifdef YY_USE_PROTOS |
1983 |
|
|
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) |
1984 |
|
|
#else |
1985 |
|
|
void yy_init_buffer( b, file ) |
1986 |
|
|
YY_BUFFER_STATE b; |
1987 |
|
|
FILE *file; |
1988 |
|
|
#endif |
1989 |
|
|
|
1990 |
|
|
|
1991 |
|
|
{ |
1992 |
|
|
yy_flush_buffer( b ); |
1993 |
|
|
|
1994 |
|
|
b->yy_input_file = file; |
1995 |
|
|
b->yy_fill_buffer = 1; |
1996 |
|
|
|
1997 |
|
|
#if YY_ALWAYS_INTERACTIVE |
1998 |
|
|
b->yy_is_interactive = 1; |
1999 |
|
|
#else |
2000 |
|
|
#if YY_NEVER_INTERACTIVE |
2001 |
|
|
b->yy_is_interactive = 0; |
2002 |
|
|
#else |
2003 |
|
|
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; |
2004 |
|
|
#endif |
2005 |
|
|
#endif |
2006 |
|
|
} |
2007 |
|
|
|
2008 |
|
|
|
2009 |
|
|
#ifdef YY_USE_PROTOS |
2010 |
|
|
void yy_flush_buffer( YY_BUFFER_STATE b ) |
2011 |
|
|
#else |
2012 |
|
|
void yy_flush_buffer( b ) |
2013 |
|
|
YY_BUFFER_STATE b; |
2014 |
|
|
#endif |
2015 |
|
|
|
2016 |
|
|
{ |
2017 |
|
|
b->yy_n_chars = 0; |
2018 |
|
|
|
2019 |
|
|
/* We always need two end-of-buffer characters. The first causes |
2020 |
|
|
* a transition to the end-of-buffer state. The second causes |
2021 |
|
|
* a jam in that state. |
2022 |
|
|
*/ |
2023 |
|
|
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
2024 |
|
|
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
2025 |
|
|
|
2026 |
|
|
b->yy_buf_pos = &b->yy_ch_buf[0]; |
2027 |
|
|
|
2028 |
|
|
b->yy_at_bol = 1; |
2029 |
|
|
b->yy_buffer_status = YY_BUFFER_NEW; |
2030 |
|
|
|
2031 |
|
|
if ( b == yy_current_buffer ) |
2032 |
|
|
yy_load_buffer_state(); |
2033 |
|
|
} |
2034 |
|
|
|
2035 |
|
|
|
2036 |
|
|
#ifndef YY_NO_SCAN_BUFFER |
2037 |
|
|
#ifdef YY_USE_PROTOS |
2038 |
|
|
YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) |
2039 |
|
|
#else |
2040 |
|
|
YY_BUFFER_STATE yy_scan_buffer( base, size ) |
2041 |
|
|
char *base; |
2042 |
|
|
yy_size_t size; |
2043 |
|
|
#endif |
2044 |
|
|
{ |
2045 |
|
|
YY_BUFFER_STATE b; |
2046 |
|
|
|
2047 |
|
|
if ( size < 2 || |
2048 |
|
|
base[size-2] != YY_END_OF_BUFFER_CHAR || |
2049 |
|
|
base[size-1] != YY_END_OF_BUFFER_CHAR ) |
2050 |
|
|
/* They forgot to leave room for the EOB's. */ |
2051 |
|
|
return 0; |
2052 |
|
|
|
2053 |
|
|
b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); |
2054 |
|
|
if ( ! b ) |
2055 |
|
|
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); |
2056 |
|
|
|
2057 |
|
|
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ |
2058 |
|
|
b->yy_buf_pos = b->yy_ch_buf = base; |
2059 |
|
|
b->yy_is_our_buffer = 0; |
2060 |
|
|
b->yy_input_file = 0; |
2061 |
|
|
b->yy_n_chars = b->yy_buf_size; |
2062 |
|
|
b->yy_is_interactive = 0; |
2063 |
|
|
b->yy_at_bol = 1; |
2064 |
|
|
b->yy_fill_buffer = 0; |
2065 |
|
|
b->yy_buffer_status = YY_BUFFER_NEW; |
2066 |
|
|
|
2067 |
|
|
yy_switch_to_buffer( b ); |
2068 |
|
|
|
2069 |
|
|
return b; |
2070 |
|
|
} |
2071 |
|
|
#endif |
2072 |
|
|
|
2073 |
|
|
|
2074 |
|
|
#ifndef YY_NO_SCAN_STRING |
2075 |
|
|
#ifdef YY_USE_PROTOS |
2076 |
|
|
YY_BUFFER_STATE yy_scan_string( const char *str ) |
2077 |
|
|
#else |
2078 |
|
|
YY_BUFFER_STATE yy_scan_string( str ) |
2079 |
|
|
const char *str; |
2080 |
|
|
#endif |
2081 |
|
|
{ |
2082 |
|
|
int len; |
2083 |
|
|
for ( len = 0; str[len]; ++len ) |
2084 |
|
|
; |
2085 |
|
|
|
2086 |
|
|
return yy_scan_bytes( str, len ); |
2087 |
|
|
} |
2088 |
|
|
#endif |
2089 |
|
|
|
2090 |
|
|
|
2091 |
|
|
#ifndef YY_NO_SCAN_BYTES |
2092 |
|
|
#ifdef YY_USE_PROTOS |
2093 |
|
|
YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len ) |
2094 |
|
|
#else |
2095 |
|
|
YY_BUFFER_STATE yy_scan_bytes( bytes, len ) |
2096 |
|
|
const char *bytes; |
2097 |
|
|
int len; |
2098 |
|
|
#endif |
2099 |
|
|
{ |
2100 |
|
|
YY_BUFFER_STATE b; |
2101 |
|
|
char *buf; |
2102 |
|
|
yy_size_t n; |
2103 |
|
|
int i; |
2104 |
|
|
|
2105 |
|
|
/* Get memory for full buffer, including space for trailing EOB's. */ |
2106 |
|
|
n = len + 2; |
2107 |
|
|
buf = (char *) yy_flex_alloc( n ); |
2108 |
|
|
if ( ! buf ) |
2109 |
|
|
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); |
2110 |
|
|
|
2111 |
|
|
for ( i = 0; i < len; ++i ) |
2112 |
|
|
buf[i] = bytes[i]; |
2113 |
|
|
|
2114 |
|
|
buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; |
2115 |
|
|
|
2116 |
|
|
b = yy_scan_buffer( buf, n ); |
2117 |
|
|
if ( ! b ) |
2118 |
|
|
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); |
2119 |
|
|
|
2120 |
|
|
/* It's okay to grow etc. this buffer, and we should throw it |
2121 |
|
|
* away when we're done. |
2122 |
|
|
*/ |
2123 |
|
|
b->yy_is_our_buffer = 1; |
2124 |
|
|
|
2125 |
|
|
return b; |
2126 |
|
|
} |
2127 |
|
|
#endif |
2128 |
|
|
|
2129 |
|
|
|
2130 |
|
|
#ifndef YY_NO_PUSH_STATE |
2131 |
|
|
#ifdef YY_USE_PROTOS |
2132 |
|
|
static void yy_push_state( int new_state ) |
2133 |
|
|
#else |
2134 |
|
|
static void yy_push_state( new_state ) |
2135 |
|
|
int new_state; |
2136 |
|
|
#endif |
2137 |
|
|
{ |
2138 |
|
|
if ( yy_start_stack_ptr >= yy_start_stack_depth ) |
2139 |
|
|
{ |
2140 |
|
|
yy_size_t new_size; |
2141 |
|
|
|
2142 |
|
|
yy_start_stack_depth += YY_START_STACK_INCR; |
2143 |
|
|
new_size = yy_start_stack_depth * sizeof( int ); |
2144 |
|
|
|
2145 |
|
|
if ( ! yy_start_stack ) |
2146 |
|
|
yy_start_stack = (int *) yy_flex_alloc( new_size ); |
2147 |
|
|
|
2148 |
|
|
else |
2149 |
|
|
yy_start_stack = (int *) yy_flex_realloc( |
2150 |
|
|
(void *) yy_start_stack, new_size ); |
2151 |
|
|
|
2152 |
|
|
if ( ! yy_start_stack ) |
2153 |
|
|
YY_FATAL_ERROR( |
2154 |
|
|
"out of memory expanding start-condition stack" ); |
2155 |
|
|
} |
2156 |
|
|
|
2157 |
|
|
yy_start_stack[yy_start_stack_ptr++] = YY_START; |
2158 |
|
|
|
2159 |
|
|
BEGIN(new_state); |
2160 |
|
|
} |
2161 |
|
|
#endif |
2162 |
|
|
|
2163 |
|
|
|
2164 |
|
|
#ifndef YY_NO_POP_STATE |
2165 |
|
|
static void yy_pop_state() |
2166 |
|
|
{ |
2167 |
|
|
if ( --yy_start_stack_ptr < 0 ) |
2168 |
|
|
YY_FATAL_ERROR( "start-condition stack underflow" ); |
2169 |
|
|
|
2170 |
|
|
BEGIN(yy_start_stack[yy_start_stack_ptr]); |
2171 |
|
|
} |
2172 |
|
|
#endif |
2173 |
|
|
|
2174 |
|
|
|
2175 |
|
|
#ifndef YY_NO_TOP_STATE |
2176 |
|
|
static int yy_top_state() |
2177 |
|
|
{ |
2178 |
|
|
return yy_start_stack[yy_start_stack_ptr - 1]; |
2179 |
|
|
} |
2180 |
|
|
#endif |
2181 |
|
|
|
2182 |
|
|
#ifndef YY_EXIT_FAILURE |
2183 |
|
|
#define YY_EXIT_FAILURE 2 |
2184 |
|
|
#endif |
2185 |
|
|
|
2186 |
|
|
#ifdef YY_USE_PROTOS |
2187 |
|
|
static void yy_fatal_error( const char msg[] ) |
2188 |
|
|
#else |
2189 |
|
|
static void yy_fatal_error( msg ) |
2190 |
|
|
char msg[]; |
2191 |
|
|
#endif |
2192 |
|
|
{ |
2193 |
|
|
(void) fprintf( stderr, "%s\n", msg ); |
2194 |
|
|
exit( YY_EXIT_FAILURE ); |
2195 |
|
|
} |
2196 |
|
|
|
2197 |
|
|
|
2198 |
|
|
|
2199 |
|
|
/* Redefine yyless() so it works in section 3 code. */ |
2200 |
|
|
|
2201 |
|
|
#undef yyless |
2202 |
|
|
#define yyless(n) \ |
2203 |
|
|
do \ |
2204 |
|
|
{ \ |
2205 |
|
|
/* Undo effects of setting up yytext. */ \ |
2206 |
|
|
yytext[yyleng] = yy_hold_char; \ |
2207 |
|
|
yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ |
2208 |
|
|
yy_hold_char = *yy_c_buf_p; \ |
2209 |
|
|
*yy_c_buf_p = '\0'; \ |
2210 |
|
|
yyleng = n; \ |
2211 |
|
|
} \ |
2212 |
|
|
while ( 0 ) |
2213 |
|
|
|
2214 |
|
|
|
2215 |
|
|
/* Internal utility routines. */ |
2216 |
|
|
|
2217 |
|
|
#ifndef yytext_ptr |
2218 |
|
|
#ifdef YY_USE_PROTOS |
2219 |
|
|
static void yy_flex_strncpy( char *s1, const char *s2, int n ) |
2220 |
|
|
#else |
2221 |
|
|
static void yy_flex_strncpy( s1, s2, n ) |
2222 |
|
|
char *s1; |
2223 |
|
|
const char *s2; |
2224 |
|
|
int n; |
2225 |
|
|
#endif |
2226 |
|
|
{ |
2227 |
|
|
register int i; |
2228 |
|
|
for ( i = 0; i < n; ++i ) |
2229 |
|
|
s1[i] = s2[i]; |
2230 |
|
|
} |
2231 |
|
|
#endif |
2232 |
|
|
|
2233 |
|
|
|
2234 |
|
|
#ifdef YY_USE_PROTOS |
2235 |
|
|
static void *yy_flex_alloc( yy_size_t size ) |
2236 |
|
|
#else |
2237 |
|
|
static void *yy_flex_alloc( size ) |
2238 |
|
|
yy_size_t size; |
2239 |
|
|
#endif |
2240 |
|
|
{ |
2241 |
|
|
return (void *) malloc( size ); |
2242 |
|
|
} |
2243 |
|
|
|
2244 |
|
|
#ifdef YY_USE_PROTOS |
2245 |
|
|
static void *yy_flex_realloc( void *ptr, yy_size_t size ) |
2246 |
|
|
#else |
2247 |
|
|
static void *yy_flex_realloc( ptr, size ) |
2248 |
|
|
void *ptr; |
2249 |
|
|
yy_size_t size; |
2250 |
|
|
#endif |
2251 |
|
|
{ |
2252 |
|
|
return (void *) realloc( ptr, size ); |
2253 |
|
|
} |
2254 |
|
|
|
2255 |
|
|
#ifdef YY_USE_PROTOS |
2256 |
|
|
static void yy_flex_free( void *ptr ) |
2257 |
|
|
#else |
2258 |
|
|
static void yy_flex_free( ptr ) |
2259 |
|
|
void *ptr; |
2260 |
|
|
#endif |
2261 |
|
|
{ |
2262 |
|
|
free( ptr ); |
2263 |
|
|
} |
2264 |
|
|
|
2265 |
|
|
#if YY_MAIN |
2266 |
|
|
int main() |
2267 |
|
|
{ |
2268 |
|
|
yylex(); |
2269 |
|
|
return 0; |
2270 |
|
|
} |
2271 |
|
|
#endif |
2272 |
|
|
|
2273 |
|
|
/* |
2274 |
|
|
* int yywrap(void); |
2275 |
|
|
* |
2276 |
|
|
* This returns 1 if the scanner should stop parsing, or 0 if |
2277 |
|
|
* the scanner should continue. Flex requires this function |
2278 |
|
|
* unless the flex directive `%option noyywrap' is given, but |
2279 |
|
|
* `%option' directives are a recent addition to flex and for |
2280 |
|
|
* maximum portability should not be used. |
2281 |
|
|
*/ |
2282 |
|
|
int yywrap(void) |
2283 |
|
|
{ |
2284 |
|
|
return 1; |
2285 |
|
|
} |
2286 |
|
|
|
2287 |
|
|
|
2288 |
|
|
#ifndef TYPER_TEST |
2289 |
|
|
STDHLF(Asc_ExtractType,(Asc_ExtractTypeHL1,Asc_ExtractTypeHL2,HLFSTOP)); |
2290 |
|
|
#endif |
2291 |
|
|
|
2292 |
|
|
/* |
2293 |
|
|
* int Asc_ExtractType(cdata, interp, argc, argv) |
2294 |
|
|
* ClientData cdata; --Tcl information, not used |
2295 |
|
|
* Tcl_Interp *interp; --Tcl interpreter, not used in standalone use |
2296 |
|
|
* int argc; --the number of arguments |
2297 |
|
|
* char **argv; --the array of arguments |
2298 |
|
|
* |
2299 |
|
|
* When running as part of ASCEND, returns TCL_OK or TCL_ERROR. |
2300 |
|
|
* When running as a stand alone tool (CPP macro TYPER_TEST is defined) |
2301 |
|
|
* we return: |
2302 |
|
|
* 0 --success |
2303 |
|
|
* 1 --problems with arguments |
2304 |
|
|
* 2 --problems opening file |
2305 |
|
|
* -1 --no errors occurred but the requested type was not found |
2306 |
|
|
* |
2307 |
|
|
*/ |
2308 |
|
|
extern int Asc_ExtractType(ClientData cdata, Tcl_Interp *interp, |
2309 |
|
|
int argc, char **argv) |
2310 |
|
|
{ |
2311 |
|
|
int ndx = 1; /* index into the argv array */ |
2312 |
|
|
int result; /* result from yylex and value to return to caller */ |
2313 |
|
|
#ifndef TYPER_TEST |
2314 |
|
|
struct TypeDescription *desc=NULL; |
2315 |
|
|
struct module_t *mod=NULL; |
2316 |
|
|
CONST char *scanstring=NULL; |
2317 |
|
|
YY_BUFFER_STATE oldbuf=NULL; |
2318 |
|
|
YY_BUFFER_STATE scanbuf=NULL; |
2319 |
|
|
#endif /*!typertest*/ |
2320 |
|
|
|
2321 |
|
|
(void)cdata; /* stop gcc whining about unused parameter */ |
2322 |
|
|
#ifdef TYPER_TEST |
2323 |
|
|
(void)interp; /* stop gcc whining about unused parameter */ |
2324 |
|
|
#endif |
2325 |
|
|
|
2326 |
|
|
|
2327 |
|
|
/* |
2328 |
|
|
* Reset our global set |
2329 |
|
|
*/ |
2330 |
|
|
BEGIN( INITIAL ); |
2331 |
|
|
MatchedToken = NONE; |
2332 |
|
|
ShowComments = 0; |
2333 |
|
|
reqType = ""; |
2334 |
|
|
CommentNestLevel = 0; |
2335 |
|
|
BracesNestLevel = 0; |
2336 |
|
|
|
2337 |
|
|
|
2338 |
|
|
/* |
2339 |
|
|
* Process the arguments |
2340 |
|
|
*/ |
2341 |
|
|
if (( argc < 2 ) || ( argc > 5 )) { |
2342 |
|
|
#ifdef TYPER_TEST |
2343 |
|
|
FPRINTF(ASCERR, |
2344 |
|
|
"Wrong number of arguments\n" |
2345 |
|
|
"Usage: %s [-c] type [source_file] [destination_file]\n", |
2346 |
|
|
argv[0]); |
2347 |
|
|
return 1; |
2348 |
|
|
#else /* ! TYPER_TEST */ |
2349 |
|
|
Tcl_AppendResult(interp, "Wrong number of arguments\nUsage: ", |
2350 |
|
|
argv[0], "[-c] type [source_file] " |
2351 |
|
|
"[-s,destination_file]", |
2352 |
|
|
(char*)NULL); |
2353 |
|
|
return TCL_ERROR; |
2354 |
|
|
#endif /* TYPER_TYPER */ |
2355 |
|
|
} |
2356 |
|
|
|
2357 |
|
|
if(( argc > ndx ) && ( argv[ndx][0] == '-' )) { |
2358 |
|
|
switch( argv[ndx][1] ) { |
2359 |
|
|
case 'c': |
2360 |
|
|
ShowComments = 1; |
2361 |
|
|
ndx++; |
2362 |
|
|
break; |
2363 |
|
|
default: |
2364 |
|
|
#ifdef TYPER_TEST |
2365 |
|
|
FPRINTF(ASCERR, "Unknown switch %s\n", argv[ndx]); |
2366 |
|
|
return 1; |
2367 |
|
|
#else /* ! TYPER_TEST */ |
2368 |
|
|
Tcl_AppendResult(interp, "Unknown switch ", argv[ndx], (char*)NULL); |
2369 |
|
|
return TCL_ERROR; |
2370 |
|
|
#endif /* TYPER_TEST */ |
2371 |
|
|
} |
2372 |
|
|
} |
2373 |
|
|
|
2374 |
|
|
if( argc > ndx ) { |
2375 |
|
|
/* The type of MODEL/ATOM to get */ |
2376 |
|
|
reqType = argv[ndx++]; |
2377 |
|
|
} else { |
2378 |
|
|
#ifdef TYPER_TEST |
2379 |
|
|
FPRINTF(ASCERR, |
2380 |
|
|
"Wrong number of arguments\n" |
2381 |
|
|
"Usage: %s [-c] type [source_file] [destination_file]\n", |
2382 |
|
|
argv[0]); |
2383 |
|
|
return 1; |
2384 |
|
|
#else /* ! TYPER_TEST */ |
2385 |
|
|
Tcl_AppendResult(interp, "Wrong number of arguments\nUsage: ", |
2386 |
|
|
argv[0], "[-c] type [source_file] " |
2387 |
|
|
"[-s,destination_file]", |
2388 |
|
|
(char*)NULL); |
2389 |
|
|
return TCL_ERROR; |
2390 |
|
|
#endif /* TYPER_TEST */ |
2391 |
|
|
} |
2392 |
|
|
|
2393 |
|
|
if( argc > ndx ) { |
2394 |
|
|
/* The source file; stdin if not specified. */ |
2395 |
|
|
#ifndef TYPER_TEST |
2396 |
|
|
/* in ascend, find source module if possible for string module name */ |
2397 |
|
|
desc = FindType(AddSymbol(reqType)); |
2398 |
|
|
if (desc != NULL) { |
2399 |
|
|
mod = GetModule(desc); |
2400 |
|
|
assert(mod!=NULL); |
2401 |
|
|
scanstring = Asc_ModuleString(mod); |
2402 |
|
|
if (scanstring == NULL) { |
2403 |
|
|
mod = NULL; |
2404 |
|
|
} |
2405 |
|
|
} |
2406 |
|
|
#endif /*!typertest*/ |
2407 |
|
|
if(scanstring == NULL && (yyin = fopen(argv[ndx],"r")) == NULL) { |
2408 |
|
|
#ifdef TYPER_TEST |
2409 |
|
|
FPRINTF(ASCERR, "Error opening source file \'%s\'\n", argv[ndx]); |
2410 |
|
|
return 2; |
2411 |
|
|
#else /* ! TYPER_TEST */ |
2412 |
|
|
Tcl_AppendResult(interp, "Error opening source file \'", |
2413 |
|
|
argv[ndx], "\'", (char*)NULL); |
2414 |
|
|
return TCL_ERROR; |
2415 |
|
|
#endif /* TYPER_TEST */ |
2416 |
|
|
} |
2417 |
|
|
ndx++; |
2418 |
|
|
} else { |
2419 |
|
|
yyin = stdin; |
2420 |
|
|
} |
2421 |
|
|
|
2422 |
|
|
if( argc > ndx ) { |
2423 |
|
|
#ifndef TYPER_TEST |
2424 |
|
|
if (argv[ndx][0] == '-' && argv[ndx][1] == 's') { |
2425 |
|
|
g_yy_interp = interp; |
2426 |
|
|
yyout = NULL; |
2427 |
|
|
} else { |
2428 |
|
|
#endif /* !typertest*/ |
2429 |
|
|
g_yy_interp = NULL; |
2430 |
|
|
/* The destination file; stdout if not specified */ |
2431 |
|
|
if((yyout = fopen(argv[ndx],"a+")) == NULL) { |
2432 |
|
|
#ifdef TYPER_TEST |
2433 |
|
|
FPRINTF(ASCERR, "Error opening destination file \'%s\'\n", argv[ndx]); |
2434 |
|
|
return 2; |
2435 |
|
|
#else /* ! TYPER_TEST */ |
2436 |
|
|
Tcl_AppendResult(interp, "Error opening destination file \'", |
2437 |
|
|
argv[ndx], "\'", (char*)NULL); |
2438 |
|
|
return TCL_ERROR; |
2439 |
|
|
#endif /* TYPER_TEST */ |
2440 |
|
|
} |
2441 |
|
|
#ifndef TYPER_TEST |
2442 |
|
|
} |
2443 |
|
|
#endif /* !typertest*/ |
2444 |
|
|
ndx++; |
2445 |
|
|
} else { |
2446 |
|
|
yyout = stdout; |
2447 |
|
|
} |
2448 |
|
|
|
2449 |
|
|
|
2450 |
|
|
/* |
2451 |
|
|
* Call yylex() to process the input |
2452 |
|
|
*/ |
2453 |
|
|
#ifndef TYPER_TEST |
2454 |
|
|
if (scanstring != NULL) { |
2455 |
|
|
oldbuf = YY_CURRENT_BUFFER; |
2456 |
|
|
scanbuf = yy_scan_string(scanstring); |
2457 |
|
|
yy_switch_to_buffer(scanbuf); |
2458 |
|
|
BEGIN(INITIAL); |
2459 |
|
|
/* yyrestart((FILE *)NULL); */ |
2460 |
|
|
} |
2461 |
|
|
#else |
2462 |
|
|
yyrestart(yyin); |
2463 |
|
|
#endif /* !typertest */ |
2464 |
|
|
if( (result = yylex()) != 0 ) { |
2465 |
|
|
#ifdef TYPER_TEST |
2466 |
|
|
FPRINTF(ASCERR, "Could not find type \'%s\'\n", reqType); |
2467 |
|
|
#else /* ! TYPER_TEST */ |
2468 |
|
|
if (g_yy_interp!=NULL) { |
2469 |
|
|
Tcl_ResetResult(interp); |
2470 |
|
|
} |
2471 |
|
|
Tcl_AppendResult(interp, "Could not find type \'", reqType, "\'", |
2472 |
|
|
(char*)NULL); |
2473 |
|
|
result = TCL_ERROR; |
2474 |
|
|
#endif /* TYPER_TEST */ |
2475 |
|
|
} else { |
2476 |
|
|
/* add a closing semicolon and newline */ |
2477 |
|
|
Asc_PutCode( ";\n", yyout ); |
2478 |
|
|
#ifndef TYPER_TEST |
2479 |
|
|
result = TCL_OK; |
2480 |
|
|
#endif /* ! TYPER_TEST */ |
2481 |
|
|
} |
2482 |
|
|
|
2483 |
|
|
/* |
2484 |
|
|
* Close any files/buffers we opened and exit. |
2485 |
|
|
*/ |
2486 |
|
|
#ifndef TYPER_TEST |
2487 |
|
|
if (scanstring != NULL) { |
2488 |
|
|
yy_delete_buffer(YY_CURRENT_BUFFER); |
2489 |
|
|
yy_switch_to_buffer(oldbuf); |
2490 |
|
|
BEGIN(INITIAL); |
2491 |
|
|
} |
2492 |
|
|
#endif |
2493 |
|
|
if ( yyin != stdin && yyin != NULL) { |
2494 |
|
|
fclose(yyin); |
2495 |
|
|
} |
2496 |
|
|
if ( yyout != stdout && yyout != NULL) { |
2497 |
|
|
fclose(yyout); |
2498 |
|
|
} |
2499 |
|
|
|
2500 |
|
|
return result; |
2501 |
|
|
} |
2502 |
|
|
|
2503 |
|
|
void Asc_PutCode(char *s,FILE *fp) |
2504 |
|
|
{ |
2505 |
|
|
#ifndef TYPER_TEST |
2506 |
|
|
if (g_yy_interp != NULL) { |
2507 |
|
|
Tcl_AppendResult(g_yy_interp,s,(char *)NULL); |
2508 |
|
|
} else { |
2509 |
|
|
#endif /* typertest */ |
2510 |
|
|
fputs(s,fp); |
2511 |
|
|
#ifndef TYPER_TEST |
2512 |
|
|
} |
2513 |
|
|
#endif /* typertest */ |
2514 |
|
|
} |
2515 |
|
|
|
2516 |
|
|
#ifdef TYPER_TEST |
2517 |
|
|
int main(int argc, char **argv) |
2518 |
|
|
{ |
2519 |
|
|
return Asc_ExtractType((ClientData)NULL, (Tcl_Interp*)NULL, argc, argv); |
2520 |
|
|
} |
2521 |
|
|
#endif /* TYPER_TEST */ |