1 | /* A lexical scanner generated by flex */ |
---|
2 | |
---|
3 | /* Scanner skeleton version: |
---|
4 | * $Header: /afs/dev.mit.edu/source/repository/third/enscript/states/lex.c,v 1.1.1.1 2002-05-29 18:21:17 ghudson Exp $ |
---|
5 | */ |
---|
6 | |
---|
7 | #define FLEX_SCANNER |
---|
8 | #define YY_FLEX_MAJOR_VERSION 2 |
---|
9 | #define YY_FLEX_MINOR_VERSION 5 |
---|
10 | |
---|
11 | #include <stdio.h> |
---|
12 | |
---|
13 | |
---|
14 | /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ |
---|
15 | #ifdef c_plusplus |
---|
16 | #ifndef __cplusplus |
---|
17 | #define __cplusplus |
---|
18 | #endif |
---|
19 | #endif |
---|
20 | |
---|
21 | |
---|
22 | #ifdef __cplusplus |
---|
23 | |
---|
24 | #include <stdlib.h> |
---|
25 | #include <unistd.h> |
---|
26 | |
---|
27 | /* Use prototypes in function declarations. */ |
---|
28 | #define YY_USE_PROTOS |
---|
29 | |
---|
30 | /* The "const" storage-class-modifier is valid. */ |
---|
31 | #define YY_USE_CONST |
---|
32 | |
---|
33 | #else /* ! __cplusplus */ |
---|
34 | |
---|
35 | #if __STDC__ |
---|
36 | |
---|
37 | #define YY_USE_PROTOS |
---|
38 | #define YY_USE_CONST |
---|
39 | |
---|
40 | #endif /* __STDC__ */ |
---|
41 | #endif /* ! __cplusplus */ |
---|
42 | |
---|
43 | #ifdef __TURBOC__ |
---|
44 | #pragma warn -rch |
---|
45 | #pragma warn -use |
---|
46 | #include <io.h> |
---|
47 | #include <stdlib.h> |
---|
48 | #define YY_USE_CONST |
---|
49 | #define YY_USE_PROTOS |
---|
50 | #endif |
---|
51 | |
---|
52 | #ifdef YY_USE_CONST |
---|
53 | #define yyconst const |
---|
54 | #else |
---|
55 | #define yyconst |
---|
56 | #endif |
---|
57 | |
---|
58 | |
---|
59 | #ifdef YY_USE_PROTOS |
---|
60 | #define YY_PROTO(proto) proto |
---|
61 | #else |
---|
62 | #define YY_PROTO(proto) () |
---|
63 | #endif |
---|
64 | |
---|
65 | /* Returned upon end-of-file. */ |
---|
66 | #define YY_NULL 0 |
---|
67 | |
---|
68 | /* Promotes a possibly negative, possibly signed char to an unsigned |
---|
69 | * integer for use as an array index. If the signed char is negative, |
---|
70 | * we want to instead treat it as an 8-bit unsigned char, hence the |
---|
71 | * double cast. |
---|
72 | */ |
---|
73 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) |
---|
74 | |
---|
75 | /* Enter a start condition. This macro really ought to take a parameter, |
---|
76 | * but we do it the disgusting crufty way forced on us by the ()-less |
---|
77 | * definition of BEGIN. |
---|
78 | */ |
---|
79 | #define BEGIN yy_start = 1 + 2 * |
---|
80 | |
---|
81 | /* Translate the current start state into a value that can be later handed |
---|
82 | * to BEGIN to return to the state. The YYSTATE alias is for lex |
---|
83 | * compatibility. |
---|
84 | */ |
---|
85 | #define YY_START ((yy_start - 1) / 2) |
---|
86 | #define YYSTATE YY_START |
---|
87 | |
---|
88 | /* Action number for EOF rule of a given start state. */ |
---|
89 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
---|
90 | |
---|
91 | /* Special action meaning "start processing a new file". */ |
---|
92 | #define YY_NEW_FILE yyrestart( yyin ) |
---|
93 | |
---|
94 | #define YY_END_OF_BUFFER_CHAR 0 |
---|
95 | |
---|
96 | /* Size of default input buffer. */ |
---|
97 | #define YY_BUF_SIZE 16384 |
---|
98 | |
---|
99 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
---|
100 | |
---|
101 | extern int yyleng; |
---|
102 | extern FILE *yyin, *yyout; |
---|
103 | |
---|
104 | #define EOB_ACT_CONTINUE_SCAN 0 |
---|
105 | #define EOB_ACT_END_OF_FILE 1 |
---|
106 | #define EOB_ACT_LAST_MATCH 2 |
---|
107 | |
---|
108 | /* The funky do-while in the following #define is used to turn the definition |
---|
109 | * int a single C statement (which needs a semi-colon terminator). This |
---|
110 | * avoids problems with code like: |
---|
111 | * |
---|
112 | * if ( condition_holds ) |
---|
113 | * yyless( 5 ); |
---|
114 | * else |
---|
115 | * do_something_else(); |
---|
116 | * |
---|
117 | * Prior to using the do-while the compiler would get upset at the |
---|
118 | * "else" because it interpreted the "if" statement as being all |
---|
119 | * done when it reached the ';' after the yyless() call. |
---|
120 | */ |
---|
121 | |
---|
122 | /* Return all but the first 'n' matched characters back to the input stream. */ |
---|
123 | |
---|
124 | #define yyless(n) \ |
---|
125 | do \ |
---|
126 | { \ |
---|
127 | /* Undo effects of setting up yytext. */ \ |
---|
128 | *yy_cp = yy_hold_char; \ |
---|
129 | YY_RESTORE_YY_MORE_OFFSET \ |
---|
130 | yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ |
---|
131 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
---|
132 | } \ |
---|
133 | while ( 0 ) |
---|
134 | |
---|
135 | #define unput(c) yyunput( c, yytext_ptr ) |
---|
136 | |
---|
137 | /* The following is because we cannot portably get our hands on size_t |
---|
138 | * (without autoconf's help, which isn't available because we want |
---|
139 | * flex-generated scanners to compile on their own). |
---|
140 | */ |
---|
141 | typedef unsigned int yy_size_t; |
---|
142 | |
---|
143 | |
---|
144 | struct yy_buffer_state |
---|
145 | { |
---|
146 | FILE *yy_input_file; |
---|
147 | |
---|
148 | char *yy_ch_buf; /* input buffer */ |
---|
149 | char *yy_buf_pos; /* current position in input buffer */ |
---|
150 | |
---|
151 | /* Size of input buffer in bytes, not including room for EOB |
---|
152 | * characters. |
---|
153 | */ |
---|
154 | yy_size_t yy_buf_size; |
---|
155 | |
---|
156 | /* Number of characters read into yy_ch_buf, not including EOB |
---|
157 | * characters. |
---|
158 | */ |
---|
159 | int yy_n_chars; |
---|
160 | |
---|
161 | /* Whether we "own" the buffer - i.e., we know we created it, |
---|
162 | * and can realloc() it to grow it, and should free() it to |
---|
163 | * delete it. |
---|
164 | */ |
---|
165 | int yy_is_our_buffer; |
---|
166 | |
---|
167 | /* Whether this is an "interactive" input source; if so, and |
---|
168 | * if we're using stdio for input, then we want to use getc() |
---|
169 | * instead of fread(), to make sure we stop fetching input after |
---|
170 | * each newline. |
---|
171 | */ |
---|
172 | int yy_is_interactive; |
---|
173 | |
---|
174 | /* Whether we're considered to be at the beginning of a line. |
---|
175 | * If so, '^' rules will be active on the next match, otherwise |
---|
176 | * not. |
---|
177 | */ |
---|
178 | int yy_at_bol; |
---|
179 | |
---|
180 | /* Whether to try to fill the input buffer when we reach the |
---|
181 | * end of it. |
---|
182 | */ |
---|
183 | int yy_fill_buffer; |
---|
184 | |
---|
185 | int yy_buffer_status; |
---|
186 | #define YY_BUFFER_NEW 0 |
---|
187 | #define YY_BUFFER_NORMAL 1 |
---|
188 | /* When an EOF's been seen but there's still some text to process |
---|
189 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we |
---|
190 | * shouldn't try reading from the input source any more. We might |
---|
191 | * still have a bunch of tokens to match, though, because of |
---|
192 | * possible backing-up. |
---|
193 | * |
---|
194 | * When we actually see the EOF, we change the status to "new" |
---|
195 | * (via yyrestart()), so that the user can continue scanning by |
---|
196 | * just pointing yyin at a new input file. |
---|
197 | */ |
---|
198 | #define YY_BUFFER_EOF_PENDING 2 |
---|
199 | }; |
---|
200 | |
---|
201 | static YY_BUFFER_STATE yy_current_buffer = 0; |
---|
202 | |
---|
203 | /* We provide macros for accessing buffer states in case in the |
---|
204 | * future we want to put the buffer states in a more general |
---|
205 | * "scanner state". |
---|
206 | */ |
---|
207 | #define YY_CURRENT_BUFFER yy_current_buffer |
---|
208 | |
---|
209 | |
---|
210 | /* yy_hold_char holds the character lost when yytext is formed. */ |
---|
211 | static char yy_hold_char; |
---|
212 | |
---|
213 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ |
---|
214 | |
---|
215 | |
---|
216 | int yyleng; |
---|
217 | |
---|
218 | /* Points to current character in buffer. */ |
---|
219 | static char *yy_c_buf_p = (char *) 0; |
---|
220 | static int yy_init = 1; /* whether we need to initialize */ |
---|
221 | static int yy_start = 0; /* start state number */ |
---|
222 | |
---|
223 | /* Flag which is used to allow yywrap()'s to do buffer switches |
---|
224 | * instead of setting up a fresh yyin. A bit of a hack ... |
---|
225 | */ |
---|
226 | static int yy_did_buffer_switch_on_eof; |
---|
227 | |
---|
228 | void yyrestart YY_PROTO(( FILE *input_file )); |
---|
229 | |
---|
230 | void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); |
---|
231 | void yy_load_buffer_state YY_PROTO(( void )); |
---|
232 | YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); |
---|
233 | void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); |
---|
234 | void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); |
---|
235 | void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); |
---|
236 | #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) |
---|
237 | |
---|
238 | YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); |
---|
239 | YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); |
---|
240 | YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); |
---|
241 | |
---|
242 | static void *yy_flex_alloc YY_PROTO(( yy_size_t )); |
---|
243 | static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); |
---|
244 | static void yy_flex_free YY_PROTO(( void * )); |
---|
245 | |
---|
246 | #define yy_new_buffer yy_create_buffer |
---|
247 | |
---|
248 | #define yy_set_interactive(is_interactive) \ |
---|
249 | { \ |
---|
250 | if ( ! yy_current_buffer ) \ |
---|
251 | yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ |
---|
252 | yy_current_buffer->yy_is_interactive = is_interactive; \ |
---|
253 | } |
---|
254 | |
---|
255 | #define yy_set_bol(at_bol) \ |
---|
256 | { \ |
---|
257 | if ( ! yy_current_buffer ) \ |
---|
258 | yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ |
---|
259 | yy_current_buffer->yy_at_bol = at_bol; \ |
---|
260 | } |
---|
261 | |
---|
262 | #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) |
---|
263 | |
---|
264 | typedef unsigned char YY_CHAR; |
---|
265 | FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; |
---|
266 | typedef int yy_state_type; |
---|
267 | extern char *yytext; |
---|
268 | #define yytext_ptr yytext |
---|
269 | |
---|
270 | static yy_state_type yy_get_previous_state YY_PROTO(( void )); |
---|
271 | static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); |
---|
272 | static int yy_get_next_buffer YY_PROTO(( void )); |
---|
273 | static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); |
---|
274 | |
---|
275 | /* Done after the current pattern has been matched and before the |
---|
276 | * corresponding action - sets up yytext. |
---|
277 | */ |
---|
278 | #define YY_DO_BEFORE_ACTION \ |
---|
279 | yytext_ptr = yy_bp; \ |
---|
280 | yyleng = (int) (yy_cp - yy_bp); \ |
---|
281 | yy_hold_char = *yy_cp; \ |
---|
282 | *yy_cp = '\0'; \ |
---|
283 | yy_c_buf_p = yy_cp; |
---|
284 | |
---|
285 | #define YY_NUM_RULES 38 |
---|
286 | #define YY_END_OF_BUFFER 39 |
---|
287 | static yyconst short int yy_accept[108] = |
---|
288 | { 0, |
---|
289 | 0, 0, 39, 37, 2, 3, 37, 4, 37, 37, |
---|
290 | 37, 37, 37, 37, 37, 7, 35, 37, 37, 37, |
---|
291 | 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, |
---|
292 | 36, 36, 37, 23, 36, 26, 0, 0, 32, 28, |
---|
293 | 0, 35, 30, 29, 31, 34, 1, 34, 24, 22, |
---|
294 | 25, 36, 36, 36, 36, 36, 36, 13, 36, 36, |
---|
295 | 36, 36, 36, 36, 27, 5, 0, 34, 36, 9, |
---|
296 | 10, 36, 12, 36, 36, 36, 36, 20, 36, 6, |
---|
297 | 36, 33, 11, 36, 36, 36, 36, 36, 36, 8, |
---|
298 | 14, 36, 36, 17, 19, 21, 36, 16, 36, 36, |
---|
299 | |
---|
300 | 36, 36, 36, 15, 36, 18, 0 |
---|
301 | } ; |
---|
302 | |
---|
303 | static yyconst int yy_ec[256] = |
---|
304 | { 0, |
---|
305 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
---|
306 | 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, |
---|
307 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
308 | 1, 2, 4, 5, 1, 6, 1, 7, 8, 1, |
---|
309 | 1, 9, 10, 1, 11, 12, 13, 14, 14, 14, |
---|
310 | 14, 14, 14, 14, 14, 14, 14, 1, 1, 15, |
---|
311 | 16, 17, 1, 1, 18, 19, 18, 20, 21, 18, |
---|
312 | 22, 18, 23, 18, 18, 18, 18, 24, 18, 18, |
---|
313 | 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, |
---|
314 | 1, 25, 1, 1, 18, 1, 26, 27, 28, 29, |
---|
315 | |
---|
316 | 30, 31, 18, 32, 33, 18, 18, 34, 35, 36, |
---|
317 | 37, 18, 18, 38, 39, 40, 41, 42, 43, 18, |
---|
318 | 18, 18, 1, 44, 1, 1, 1, 1, 1, 1, |
---|
319 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
320 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
321 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
322 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
323 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
324 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
325 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
326 | |
---|
327 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
328 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
329 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
330 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
331 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
332 | 1, 1, 1, 1, 1 |
---|
333 | } ; |
---|
334 | |
---|
335 | static yyconst int yy_meta[45] = |
---|
336 | { 0, |
---|
337 | 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, |
---|
338 | 1, 1, 1, 3, 1, 1, 1, 3, 3, 3, |
---|
339 | 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, |
---|
340 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, |
---|
341 | 3, 3, 3, 1 |
---|
342 | } ; |
---|
343 | |
---|
344 | static yyconst short int yy_base[112] = |
---|
345 | { 0, |
---|
346 | 0, 0, 130, 131, 131, 131, 113, 131, 0, 121, |
---|
347 | 102, 110, 35, 41, 111, 115, 34, 107, 106, 105, |
---|
348 | 0, 99, 95, 85, 83, 79, 84, 77, 87, 82, |
---|
349 | 18, 79, 66, 131, 131, 131, 101, 0, 131, 131, |
---|
350 | 94, 42, 131, 131, 131, 93, 131, 92, 131, 131, |
---|
351 | 131, 0, 83, 84, 61, 63, 63, 0, 72, 64, |
---|
352 | 58, 71, 69, 62, 131, 131, 86, 79, 69, 0, |
---|
353 | 75, 60, 0, 63, 58, 46, 22, 0, 52, 131, |
---|
354 | 61, 131, 0, 50, 45, 44, 41, 50, 49, 0, |
---|
355 | 0, 37, 41, 38, 0, 0, 41, 0, 33, 43, |
---|
356 | |
---|
357 | 38, 31, 34, 0, 22, 0, 131, 62, 65, 47, |
---|
358 | 68 |
---|
359 | } ; |
---|
360 | |
---|
361 | static yyconst short int yy_def[112] = |
---|
362 | { 0, |
---|
363 | 107, 1, 107, 107, 107, 107, 107, 107, 108, 107, |
---|
364 | 109, 107, 107, 107, 107, 107, 107, 107, 107, 107, |
---|
365 | 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, |
---|
366 | 110, 110, 107, 107, 107, 107, 107, 111, 107, 107, |
---|
367 | 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, |
---|
368 | 107, 110, 110, 110, 110, 110, 110, 110, 110, 110, |
---|
369 | 110, 110, 110, 110, 107, 107, 107, 107, 110, 110, |
---|
370 | 110, 110, 110, 110, 110, 110, 110, 110, 110, 107, |
---|
371 | 110, 107, 110, 110, 110, 110, 110, 110, 110, 110, |
---|
372 | 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, |
---|
373 | |
---|
374 | 110, 110, 110, 110, 110, 110, 0, 107, 107, 107, |
---|
375 | 107 |
---|
376 | } ; |
---|
377 | |
---|
378 | static yyconst short int yy_nxt[176] = |
---|
379 | { 0, |
---|
380 | 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, |
---|
381 | 14, 15, 16, 17, 18, 19, 20, 21, 22, 21, |
---|
382 | 23, 21, 21, 21, 4, 21, 21, 21, 24, 25, |
---|
383 | 26, 21, 27, 28, 21, 29, 21, 30, 31, 21, |
---|
384 | 21, 21, 32, 33, 40, 48, 41, 42, 42, 52, |
---|
385 | 43, 44, 41, 48, 42, 42, 45, 62, 63, 87, |
---|
386 | 106, 88, 35, 105, 35, 37, 37, 37, 67, 104, |
---|
387 | 67, 103, 102, 101, 100, 99, 98, 97, 96, 95, |
---|
388 | 94, 93, 92, 91, 90, 89, 86, 85, 84, 83, |
---|
389 | 82, 81, 68, 80, 79, 78, 77, 76, 75, 74, |
---|
390 | |
---|
391 | 73, 72, 71, 70, 69, 68, 46, 46, 66, 65, |
---|
392 | 64, 61, 60, 59, 58, 57, 56, 55, 54, 53, |
---|
393 | 51, 50, 49, 47, 46, 39, 38, 36, 34, 107, |
---|
394 | 3, 107, 107, 107, 107, 107, 107, 107, 107, 107, |
---|
395 | 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, |
---|
396 | 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, |
---|
397 | 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, |
---|
398 | 107, 107, 107, 107, 107 |
---|
399 | } ; |
---|
400 | |
---|
401 | static yyconst short int yy_chk[176] = |
---|
402 | { 0, |
---|
403 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
404 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
405 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
406 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
407 | 1, 1, 1, 1, 13, 17, 13, 17, 13, 110, |
---|
408 | 13, 14, 14, 42, 14, 42, 14, 31, 31, 77, |
---|
409 | 105, 77, 108, 103, 108, 109, 109, 109, 111, 102, |
---|
410 | 111, 101, 100, 99, 97, 94, 93, 92, 89, 88, |
---|
411 | 87, 86, 85, 84, 81, 79, 76, 75, 74, 72, |
---|
412 | 71, 69, 68, 67, 64, 63, 62, 61, 60, 59, |
---|
413 | |
---|
414 | 57, 56, 55, 54, 53, 48, 46, 41, 37, 33, |
---|
415 | 32, 30, 29, 28, 27, 26, 25, 24, 23, 22, |
---|
416 | 20, 19, 18, 16, 15, 12, 11, 10, 7, 3, |
---|
417 | 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, |
---|
418 | 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, |
---|
419 | 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, |
---|
420 | 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, |
---|
421 | 107, 107, 107, 107, 107 |
---|
422 | } ; |
---|
423 | |
---|
424 | static yy_state_type yy_last_accepting_state; |
---|
425 | static char *yy_last_accepting_cpos; |
---|
426 | |
---|
427 | /* The intent behind this definition is that it'll catch |
---|
428 | * any uses of REJECT which flex missed. |
---|
429 | */ |
---|
430 | #define REJECT reject_used_but_not_detected |
---|
431 | #define yymore() yymore_used_but_not_detected |
---|
432 | #define YY_MORE_ADJ 0 |
---|
433 | #define YY_RESTORE_YY_MORE_OFFSET |
---|
434 | char *yytext; |
---|
435 | #line 1 "lex.l" |
---|
436 | #define INITIAL 0 |
---|
437 | #line 2 "lex.l" |
---|
438 | /* |
---|
439 | * Lexer for states. |
---|
440 | * Copyright (c) 1997 Markku Rossi. |
---|
441 | * |
---|
442 | * Author: Markku Rossi <mtr@iki.fi> |
---|
443 | */ |
---|
444 | |
---|
445 | /* |
---|
446 | * This file is part of GNU enscript. |
---|
447 | * |
---|
448 | * This program is free software; you can redistribute it and/or modify |
---|
449 | * it under the terms of the GNU General Public License as published by |
---|
450 | * the Free Software Foundation; either version 2, or (at your option) |
---|
451 | * any later version. |
---|
452 | * |
---|
453 | * This program is distributed in the hope that it will be useful, |
---|
454 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
455 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
456 | * GNU General Public License for more details. |
---|
457 | * |
---|
458 | * You should have received a copy of the GNU General Public License |
---|
459 | * along with this program; see the file COPYING. If not, write to |
---|
460 | * the Free Software Foundation, 59 Temple Place - Suite 330, |
---|
461 | * Boston, MA 02111-1307, USA. |
---|
462 | */ |
---|
463 | |
---|
464 | /* |
---|
465 | * $Id: lex.c,v 1.1.1.1 2002-05-29 18:21:17 ghudson Exp $ |
---|
466 | */ |
---|
467 | |
---|
468 | #include "defs.h" |
---|
469 | #include "gram.h" |
---|
470 | |
---|
471 | static void eat_comment (); |
---|
472 | static char *read_string ___P ((unsigned int *len_return)); |
---|
473 | static void read_regexp ___P ((Node *node)); |
---|
474 | #line 475 "lex.yy.c" |
---|
475 | |
---|
476 | /* Macros after this point can all be overridden by user definitions in |
---|
477 | * section 1. |
---|
478 | */ |
---|
479 | |
---|
480 | #ifndef YY_SKIP_YYWRAP |
---|
481 | #ifdef __cplusplus |
---|
482 | extern "C" int yywrap YY_PROTO(( void )); |
---|
483 | #else |
---|
484 | extern int yywrap YY_PROTO(( void )); |
---|
485 | #endif |
---|
486 | #endif |
---|
487 | |
---|
488 | #ifndef YY_NO_UNPUT |
---|
489 | static void yyunput YY_PROTO(( int c, char *buf_ptr )); |
---|
490 | #endif |
---|
491 | |
---|
492 | #ifndef yytext_ptr |
---|
493 | static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); |
---|
494 | #endif |
---|
495 | |
---|
496 | #ifdef YY_NEED_STRLEN |
---|
497 | static int yy_flex_strlen YY_PROTO(( yyconst char * )); |
---|
498 | #endif |
---|
499 | |
---|
500 | #ifndef YY_NO_INPUT |
---|
501 | #ifdef __cplusplus |
---|
502 | static int yyinput YY_PROTO(( void )); |
---|
503 | #else |
---|
504 | static int input YY_PROTO(( void )); |
---|
505 | #endif |
---|
506 | #endif |
---|
507 | |
---|
508 | #if YY_STACK_USED |
---|
509 | static int yy_start_stack_ptr = 0; |
---|
510 | static int yy_start_stack_depth = 0; |
---|
511 | static int *yy_start_stack = 0; |
---|
512 | #ifndef YY_NO_PUSH_STATE |
---|
513 | static void yy_push_state YY_PROTO(( int new_state )); |
---|
514 | #endif |
---|
515 | #ifndef YY_NO_POP_STATE |
---|
516 | static void yy_pop_state YY_PROTO(( void )); |
---|
517 | #endif |
---|
518 | #ifndef YY_NO_TOP_STATE |
---|
519 | static int yy_top_state YY_PROTO(( void )); |
---|
520 | #endif |
---|
521 | |
---|
522 | #else |
---|
523 | #define YY_NO_PUSH_STATE 1 |
---|
524 | #define YY_NO_POP_STATE 1 |
---|
525 | #define YY_NO_TOP_STATE 1 |
---|
526 | #endif |
---|
527 | |
---|
528 | #ifdef YY_MALLOC_DECL |
---|
529 | YY_MALLOC_DECL |
---|
530 | #else |
---|
531 | #if __STDC__ |
---|
532 | #ifndef __cplusplus |
---|
533 | #include <stdlib.h> |
---|
534 | #endif |
---|
535 | #else |
---|
536 | /* Just try to get by without declaring the routines. This will fail |
---|
537 | * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) |
---|
538 | * or sizeof(void*) != sizeof(int). |
---|
539 | */ |
---|
540 | #endif |
---|
541 | #endif |
---|
542 | |
---|
543 | /* Amount of stuff to slurp up with each read. */ |
---|
544 | #ifndef YY_READ_BUF_SIZE |
---|
545 | #define YY_READ_BUF_SIZE 8192 |
---|
546 | #endif |
---|
547 | |
---|
548 | /* Copy whatever the last rule matched to the standard output. */ |
---|
549 | |
---|
550 | #ifndef ECHO |
---|
551 | /* This used to be an fputs(), but since the string might contain NUL's, |
---|
552 | * we now use fwrite(). |
---|
553 | */ |
---|
554 | #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) |
---|
555 | #endif |
---|
556 | |
---|
557 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
---|
558 | * is returned in "result". |
---|
559 | */ |
---|
560 | #ifndef YY_INPUT |
---|
561 | #define YY_INPUT(buf,result,max_size) \ |
---|
562 | if ( yy_current_buffer->yy_is_interactive ) \ |
---|
563 | { \ |
---|
564 | int c = '*', n; \ |
---|
565 | for ( n = 0; n < max_size && \ |
---|
566 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
---|
567 | buf[n] = (char) c; \ |
---|
568 | if ( c == '\n' ) \ |
---|
569 | buf[n++] = (char) c; \ |
---|
570 | if ( c == EOF && ferror( yyin ) ) \ |
---|
571 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
---|
572 | result = n; \ |
---|
573 | } \ |
---|
574 | else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ |
---|
575 | && ferror( yyin ) ) \ |
---|
576 | YY_FATAL_ERROR( "input in flex scanner failed" ); |
---|
577 | #endif |
---|
578 | |
---|
579 | /* No semi-colon after return; correct usage is to write "yyterminate();" - |
---|
580 | * we don't want an extra ';' after the "return" because that will cause |
---|
581 | * some compilers to complain about unreachable statements. |
---|
582 | */ |
---|
583 | #ifndef yyterminate |
---|
584 | #define yyterminate() return YY_NULL |
---|
585 | #endif |
---|
586 | |
---|
587 | /* Number of entries by which start-condition stack grows. */ |
---|
588 | #ifndef YY_START_STACK_INCR |
---|
589 | #define YY_START_STACK_INCR 25 |
---|
590 | #endif |
---|
591 | |
---|
592 | /* Report a fatal error. */ |
---|
593 | #ifndef YY_FATAL_ERROR |
---|
594 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) |
---|
595 | #endif |
---|
596 | |
---|
597 | /* Default declaration of generated scanner - a define so the user can |
---|
598 | * easily add parameters. |
---|
599 | */ |
---|
600 | #ifndef YY_DECL |
---|
601 | #define YY_DECL int yylex YY_PROTO(( void )) |
---|
602 | #endif |
---|
603 | |
---|
604 | /* Code executed at the beginning of each rule, after yytext and yyleng |
---|
605 | * have been set up. |
---|
606 | */ |
---|
607 | #ifndef YY_USER_ACTION |
---|
608 | #define YY_USER_ACTION |
---|
609 | #endif |
---|
610 | |
---|
611 | /* Code executed at the end of each rule. */ |
---|
612 | #ifndef YY_BREAK |
---|
613 | #define YY_BREAK break; |
---|
614 | #endif |
---|
615 | |
---|
616 | #define YY_RULE_SETUP \ |
---|
617 | YY_USER_ACTION |
---|
618 | |
---|
619 | YY_DECL |
---|
620 | { |
---|
621 | register yy_state_type yy_current_state; |
---|
622 | register char *yy_cp, *yy_bp; |
---|
623 | register int yy_act; |
---|
624 | |
---|
625 | #line 44 "lex.l" |
---|
626 | |
---|
627 | |
---|
628 | #line 629 "lex.yy.c" |
---|
629 | |
---|
630 | if ( yy_init ) |
---|
631 | { |
---|
632 | yy_init = 0; |
---|
633 | |
---|
634 | #ifdef YY_USER_INIT |
---|
635 | YY_USER_INIT; |
---|
636 | #endif |
---|
637 | |
---|
638 | if ( ! yy_start ) |
---|
639 | yy_start = 1; /* first start state */ |
---|
640 | |
---|
641 | if ( ! yyin ) |
---|
642 | yyin = stdin; |
---|
643 | |
---|
644 | if ( ! yyout ) |
---|
645 | yyout = stdout; |
---|
646 | |
---|
647 | if ( ! yy_current_buffer ) |
---|
648 | yy_current_buffer = |
---|
649 | yy_create_buffer( yyin, YY_BUF_SIZE ); |
---|
650 | |
---|
651 | yy_load_buffer_state(); |
---|
652 | } |
---|
653 | |
---|
654 | while ( 1 ) /* loops until end-of-file is reached */ |
---|
655 | { |
---|
656 | yy_cp = yy_c_buf_p; |
---|
657 | |
---|
658 | /* Support of yytext. */ |
---|
659 | *yy_cp = yy_hold_char; |
---|
660 | |
---|
661 | /* yy_bp points to the position in yy_ch_buf of the start of |
---|
662 | * the current run. |
---|
663 | */ |
---|
664 | yy_bp = yy_cp; |
---|
665 | |
---|
666 | yy_current_state = yy_start; |
---|
667 | yy_match: |
---|
668 | do |
---|
669 | { |
---|
670 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; |
---|
671 | if ( yy_accept[yy_current_state] ) |
---|
672 | { |
---|
673 | yy_last_accepting_state = yy_current_state; |
---|
674 | yy_last_accepting_cpos = yy_cp; |
---|
675 | } |
---|
676 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
---|
677 | { |
---|
678 | yy_current_state = (int) yy_def[yy_current_state]; |
---|
679 | if ( yy_current_state >= 108 ) |
---|
680 | yy_c = yy_meta[(unsigned int) yy_c]; |
---|
681 | } |
---|
682 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
---|
683 | ++yy_cp; |
---|
684 | } |
---|
685 | while ( yy_base[yy_current_state] != 131 ); |
---|
686 | |
---|
687 | yy_find_action: |
---|
688 | yy_act = yy_accept[yy_current_state]; |
---|
689 | if ( yy_act == 0 ) |
---|
690 | { /* have to back up */ |
---|
691 | yy_cp = yy_last_accepting_cpos; |
---|
692 | yy_current_state = yy_last_accepting_state; |
---|
693 | yy_act = yy_accept[yy_current_state]; |
---|
694 | } |
---|
695 | |
---|
696 | YY_DO_BEFORE_ACTION; |
---|
697 | |
---|
698 | |
---|
699 | do_action: /* This label is used only to access EOF actions. */ |
---|
700 | |
---|
701 | |
---|
702 | switch ( yy_act ) |
---|
703 | { /* beginning of action switch */ |
---|
704 | case 0: /* must back up */ |
---|
705 | /* undo the effects of YY_DO_BEFORE_ACTION */ |
---|
706 | *yy_cp = yy_hold_char; |
---|
707 | yy_cp = yy_last_accepting_cpos; |
---|
708 | yy_current_state = yy_last_accepting_state; |
---|
709 | goto yy_find_action; |
---|
710 | |
---|
711 | case 1: |
---|
712 | YY_RULE_SETUP |
---|
713 | #line 46 "lex.l" |
---|
714 | { eat_comment (); } |
---|
715 | YY_BREAK |
---|
716 | case 2: |
---|
717 | YY_RULE_SETUP |
---|
718 | #line 47 "lex.l" |
---|
719 | { ; } |
---|
720 | YY_BREAK |
---|
721 | case 3: |
---|
722 | YY_RULE_SETUP |
---|
723 | #line 48 "lex.l" |
---|
724 | { linenum++; } |
---|
725 | YY_BREAK |
---|
726 | case 4: |
---|
727 | YY_RULE_SETUP |
---|
728 | #line 50 "lex.l" |
---|
729 | { yylval.node = node_alloc (nSTRING); |
---|
730 | yylval.node->u.str.data |
---|
731 | = read_string (&yylval.node->u.str.len); |
---|
732 | return tSTRING; |
---|
733 | } |
---|
734 | YY_BREAK |
---|
735 | case 5: |
---|
736 | YY_RULE_SETUP |
---|
737 | #line 56 "lex.l" |
---|
738 | { yylval.node = node_alloc (nINTEGER); |
---|
739 | yylval.node->u.integer = yytext[1]; |
---|
740 | return tINTEGER; |
---|
741 | } |
---|
742 | YY_BREAK |
---|
743 | case 6: |
---|
744 | YY_RULE_SETUP |
---|
745 | #line 61 "lex.l" |
---|
746 | { yylval.node = node_alloc (nINTEGER); |
---|
747 | switch (yytext[2]) |
---|
748 | { |
---|
749 | case 'n': |
---|
750 | yylval.node->u.integer = '\n'; |
---|
751 | break; |
---|
752 | |
---|
753 | case 't': |
---|
754 | yylval.node->u.integer = '\t'; |
---|
755 | break; |
---|
756 | |
---|
757 | case 'v': |
---|
758 | yylval.node->u.integer = '\v'; |
---|
759 | break; |
---|
760 | |
---|
761 | case 'b': |
---|
762 | yylval.node->u.integer = '\b'; |
---|
763 | break; |
---|
764 | |
---|
765 | case 'r': |
---|
766 | yylval.node->u.integer = '\r'; |
---|
767 | break; |
---|
768 | |
---|
769 | case 'f': |
---|
770 | yylval.node->u.integer = '\f'; |
---|
771 | break; |
---|
772 | |
---|
773 | case 'a': |
---|
774 | yylval.node->u.integer = '\a'; |
---|
775 | break; |
---|
776 | |
---|
777 | default: |
---|
778 | yylval.node->u.integer = yytext[2]; |
---|
779 | break; |
---|
780 | } |
---|
781 | |
---|
782 | return tINTEGER; |
---|
783 | } |
---|
784 | YY_BREAK |
---|
785 | case 7: |
---|
786 | YY_RULE_SETUP |
---|
787 | #line 100 "lex.l" |
---|
788 | { yylval.node = node_alloc (nREGEXP); |
---|
789 | read_regexp (yylval.node); |
---|
790 | return tREGEXP; |
---|
791 | } |
---|
792 | YY_BREAK |
---|
793 | case 8: |
---|
794 | YY_RULE_SETUP |
---|
795 | #line 105 "lex.l" |
---|
796 | { return tBEGIN; } |
---|
797 | YY_BREAK |
---|
798 | case 9: |
---|
799 | YY_RULE_SETUP |
---|
800 | #line 106 "lex.l" |
---|
801 | { return tEND; } |
---|
802 | YY_BREAK |
---|
803 | case 10: |
---|
804 | YY_RULE_SETUP |
---|
805 | #line 107 "lex.l" |
---|
806 | { return tDIV; } |
---|
807 | YY_BREAK |
---|
808 | case 11: |
---|
809 | YY_RULE_SETUP |
---|
810 | #line 108 "lex.l" |
---|
811 | { return tELSE; } |
---|
812 | YY_BREAK |
---|
813 | case 12: |
---|
814 | YY_RULE_SETUP |
---|
815 | #line 109 "lex.l" |
---|
816 | { return tFOR; } |
---|
817 | YY_BREAK |
---|
818 | case 13: |
---|
819 | YY_RULE_SETUP |
---|
820 | #line 110 "lex.l" |
---|
821 | { return tIF; } |
---|
822 | YY_BREAK |
---|
823 | case 14: |
---|
824 | YY_RULE_SETUP |
---|
825 | #line 111 "lex.l" |
---|
826 | { return tLOCAL; } |
---|
827 | YY_BREAK |
---|
828 | case 15: |
---|
829 | YY_RULE_SETUP |
---|
830 | #line 112 "lex.l" |
---|
831 | { return tNAMERULES; } |
---|
832 | YY_BREAK |
---|
833 | case 16: |
---|
834 | YY_RULE_SETUP |
---|
835 | #line 113 "lex.l" |
---|
836 | { return tRETURN; } |
---|
837 | YY_BREAK |
---|
838 | case 17: |
---|
839 | YY_RULE_SETUP |
---|
840 | #line 114 "lex.l" |
---|
841 | { return tSTART; } |
---|
842 | YY_BREAK |
---|
843 | case 18: |
---|
844 | YY_RULE_SETUP |
---|
845 | #line 115 "lex.l" |
---|
846 | { return tSTARTRULES; } |
---|
847 | YY_BREAK |
---|
848 | case 19: |
---|
849 | YY_RULE_SETUP |
---|
850 | #line 116 "lex.l" |
---|
851 | { return tSTATE; } |
---|
852 | YY_BREAK |
---|
853 | case 20: |
---|
854 | YY_RULE_SETUP |
---|
855 | #line 117 "lex.l" |
---|
856 | { return tSUB; } |
---|
857 | YY_BREAK |
---|
858 | case 21: |
---|
859 | YY_RULE_SETUP |
---|
860 | #line 118 "lex.l" |
---|
861 | { return tWHILE; } |
---|
862 | YY_BREAK |
---|
863 | case 22: |
---|
864 | YY_RULE_SETUP |
---|
865 | #line 120 "lex.l" |
---|
866 | { return tEQ; } |
---|
867 | YY_BREAK |
---|
868 | case 23: |
---|
869 | YY_RULE_SETUP |
---|
870 | #line 121 "lex.l" |
---|
871 | { return tNE; } |
---|
872 | YY_BREAK |
---|
873 | case 24: |
---|
874 | YY_RULE_SETUP |
---|
875 | #line 122 "lex.l" |
---|
876 | { return tLE; } |
---|
877 | YY_BREAK |
---|
878 | case 25: |
---|
879 | YY_RULE_SETUP |
---|
880 | #line 123 "lex.l" |
---|
881 | { return tGE; } |
---|
882 | YY_BREAK |
---|
883 | case 26: |
---|
884 | YY_RULE_SETUP |
---|
885 | #line 124 "lex.l" |
---|
886 | { return tAND; } |
---|
887 | YY_BREAK |
---|
888 | case 27: |
---|
889 | YY_RULE_SETUP |
---|
890 | #line 125 "lex.l" |
---|
891 | { return tOR; } |
---|
892 | YY_BREAK |
---|
893 | case 28: |
---|
894 | YY_RULE_SETUP |
---|
895 | #line 126 "lex.l" |
---|
896 | { return tPLUSPLUS; } |
---|
897 | YY_BREAK |
---|
898 | case 29: |
---|
899 | YY_RULE_SETUP |
---|
900 | #line 127 "lex.l" |
---|
901 | { return tMINUSMINUS; } |
---|
902 | YY_BREAK |
---|
903 | case 30: |
---|
904 | YY_RULE_SETUP |
---|
905 | #line 128 "lex.l" |
---|
906 | { return tADDASSIGN; } |
---|
907 | YY_BREAK |
---|
908 | case 31: |
---|
909 | YY_RULE_SETUP |
---|
910 | #line 129 "lex.l" |
---|
911 | { return tSUBASSIGN; } |
---|
912 | YY_BREAK |
---|
913 | case 32: |
---|
914 | YY_RULE_SETUP |
---|
915 | #line 130 "lex.l" |
---|
916 | { return tMULASSIGN; } |
---|
917 | YY_BREAK |
---|
918 | case 33: |
---|
919 | YY_RULE_SETUP |
---|
920 | #line 131 "lex.l" |
---|
921 | { return tDIVASSIGN; } |
---|
922 | YY_BREAK |
---|
923 | case 34: |
---|
924 | YY_RULE_SETUP |
---|
925 | #line 133 "lex.l" |
---|
926 | { yylval.node = node_alloc (nREAL); |
---|
927 | yylval.node->u.real = atof (yytext); |
---|
928 | return tREAL; |
---|
929 | } |
---|
930 | YY_BREAK |
---|
931 | case 35: |
---|
932 | YY_RULE_SETUP |
---|
933 | #line 137 "lex.l" |
---|
934 | { yylval.node = node_alloc (nINTEGER); |
---|
935 | yylval.node->u.integer = atoi (yytext); |
---|
936 | return tINTEGER; |
---|
937 | } |
---|
938 | YY_BREAK |
---|
939 | case 36: |
---|
940 | YY_RULE_SETUP |
---|
941 | #line 141 "lex.l" |
---|
942 | { yylval.node = node_alloc (nSYMBOL); |
---|
943 | yylval.node->u.sym = xstrdup (yytext); |
---|
944 | return tSYMBOL; |
---|
945 | } |
---|
946 | YY_BREAK |
---|
947 | case 37: |
---|
948 | YY_RULE_SETUP |
---|
949 | #line 146 "lex.l" |
---|
950 | { return yytext[0]; } |
---|
951 | YY_BREAK |
---|
952 | case 38: |
---|
953 | YY_RULE_SETUP |
---|
954 | #line 148 "lex.l" |
---|
955 | ECHO; |
---|
956 | YY_BREAK |
---|
957 | #line 958 "lex.yy.c" |
---|
958 | case YY_STATE_EOF(INITIAL): |
---|
959 | yyterminate(); |
---|
960 | |
---|
961 | case YY_END_OF_BUFFER: |
---|
962 | { |
---|
963 | /* Amount of text matched not including the EOB char. */ |
---|
964 | int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; |
---|
965 | |
---|
966 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
---|
967 | *yy_cp = yy_hold_char; |
---|
968 | YY_RESTORE_YY_MORE_OFFSET |
---|
969 | |
---|
970 | if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) |
---|
971 | { |
---|
972 | /* We're scanning a new file or input source. It's |
---|
973 | * possible that this happened because the user |
---|
974 | * just pointed yyin at a new source and called |
---|
975 | * yylex(). If so, then we have to assure |
---|
976 | * consistency between yy_current_buffer and our |
---|
977 | * globals. Here is the right place to do so, because |
---|
978 | * this is the first action (other than possibly a |
---|
979 | * back-up) that will match for the new input source. |
---|
980 | */ |
---|
981 | yy_n_chars = yy_current_buffer->yy_n_chars; |
---|
982 | yy_current_buffer->yy_input_file = yyin; |
---|
983 | yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; |
---|
984 | } |
---|
985 | |
---|
986 | /* Note that here we test for yy_c_buf_p "<=" to the position |
---|
987 | * of the first EOB in the buffer, since yy_c_buf_p will |
---|
988 | * already have been incremented past the NUL character |
---|
989 | * (since all states make transitions on EOB to the |
---|
990 | * end-of-buffer state). Contrast this with the test |
---|
991 | * in input(). |
---|
992 | */ |
---|
993 | if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) |
---|
994 | { /* This was really a NUL. */ |
---|
995 | yy_state_type yy_next_state; |
---|
996 | |
---|
997 | yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; |
---|
998 | |
---|
999 | yy_current_state = yy_get_previous_state(); |
---|
1000 | |
---|
1001 | /* Okay, we're now positioned to make the NUL |
---|
1002 | * transition. We couldn't have |
---|
1003 | * yy_get_previous_state() go ahead and do it |
---|
1004 | * for us because it doesn't know how to deal |
---|
1005 | * with the possibility of jamming (and we don't |
---|
1006 | * want to build jamming into it because then it |
---|
1007 | * will run more slowly). |
---|
1008 | */ |
---|
1009 | |
---|
1010 | yy_next_state = yy_try_NUL_trans( yy_current_state ); |
---|
1011 | |
---|
1012 | yy_bp = yytext_ptr + YY_MORE_ADJ; |
---|
1013 | |
---|
1014 | if ( yy_next_state ) |
---|
1015 | { |
---|
1016 | /* Consume the NUL. */ |
---|
1017 | yy_cp = ++yy_c_buf_p; |
---|
1018 | yy_current_state = yy_next_state; |
---|
1019 | goto yy_match; |
---|
1020 | } |
---|
1021 | |
---|
1022 | else |
---|
1023 | { |
---|
1024 | yy_cp = yy_c_buf_p; |
---|
1025 | goto yy_find_action; |
---|
1026 | } |
---|
1027 | } |
---|
1028 | |
---|
1029 | else switch ( yy_get_next_buffer() ) |
---|
1030 | { |
---|
1031 | case EOB_ACT_END_OF_FILE: |
---|
1032 | { |
---|
1033 | yy_did_buffer_switch_on_eof = 0; |
---|
1034 | |
---|
1035 | if ( yywrap() ) |
---|
1036 | { |
---|
1037 | /* Note: because we've taken care in |
---|
1038 | * yy_get_next_buffer() to have set up |
---|
1039 | * yytext, we can now set up |
---|
1040 | * yy_c_buf_p so that if some total |
---|
1041 | * hoser (like flex itself) wants to |
---|
1042 | * call the scanner after we return the |
---|
1043 | * YY_NULL, it'll still work - another |
---|
1044 | * YY_NULL will get returned. |
---|
1045 | */ |
---|
1046 | yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; |
---|
1047 | |
---|
1048 | yy_act = YY_STATE_EOF(YY_START); |
---|
1049 | goto do_action; |
---|
1050 | } |
---|
1051 | |
---|
1052 | else |
---|
1053 | { |
---|
1054 | if ( ! yy_did_buffer_switch_on_eof ) |
---|
1055 | YY_NEW_FILE; |
---|
1056 | } |
---|
1057 | break; |
---|
1058 | } |
---|
1059 | |
---|
1060 | case EOB_ACT_CONTINUE_SCAN: |
---|
1061 | yy_c_buf_p = |
---|
1062 | yytext_ptr + yy_amount_of_matched_text; |
---|
1063 | |
---|
1064 | yy_current_state = yy_get_previous_state(); |
---|
1065 | |
---|
1066 | yy_cp = yy_c_buf_p; |
---|
1067 | yy_bp = yytext_ptr + YY_MORE_ADJ; |
---|
1068 | goto yy_match; |
---|
1069 | |
---|
1070 | case EOB_ACT_LAST_MATCH: |
---|
1071 | yy_c_buf_p = |
---|
1072 | &yy_current_buffer->yy_ch_buf[yy_n_chars]; |
---|
1073 | |
---|
1074 | yy_current_state = yy_get_previous_state(); |
---|
1075 | |
---|
1076 | yy_cp = yy_c_buf_p; |
---|
1077 | yy_bp = yytext_ptr + YY_MORE_ADJ; |
---|
1078 | goto yy_find_action; |
---|
1079 | } |
---|
1080 | break; |
---|
1081 | } |
---|
1082 | |
---|
1083 | default: |
---|
1084 | YY_FATAL_ERROR( |
---|
1085 | "fatal flex scanner internal error--no action found" ); |
---|
1086 | } /* end of action switch */ |
---|
1087 | } /* end of scanning one token */ |
---|
1088 | } /* end of yylex */ |
---|
1089 | |
---|
1090 | |
---|
1091 | /* yy_get_next_buffer - try to read in a new buffer |
---|
1092 | * |
---|
1093 | * Returns a code representing an action: |
---|
1094 | * EOB_ACT_LAST_MATCH - |
---|
1095 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
---|
1096 | * EOB_ACT_END_OF_FILE - end of file |
---|
1097 | */ |
---|
1098 | |
---|
1099 | static int yy_get_next_buffer() |
---|
1100 | { |
---|
1101 | register char *dest = yy_current_buffer->yy_ch_buf; |
---|
1102 | register char *source = yytext_ptr; |
---|
1103 | register int number_to_move, i; |
---|
1104 | int ret_val; |
---|
1105 | |
---|
1106 | if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) |
---|
1107 | YY_FATAL_ERROR( |
---|
1108 | "fatal flex scanner internal error--end of buffer missed" ); |
---|
1109 | |
---|
1110 | if ( yy_current_buffer->yy_fill_buffer == 0 ) |
---|
1111 | { /* Don't try to fill the buffer, so this is an EOF. */ |
---|
1112 | if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) |
---|
1113 | { |
---|
1114 | /* We matched a single character, the EOB, so |
---|
1115 | * treat this as a final EOF. |
---|
1116 | */ |
---|
1117 | return EOB_ACT_END_OF_FILE; |
---|
1118 | } |
---|
1119 | |
---|
1120 | else |
---|
1121 | { |
---|
1122 | /* We matched some text prior to the EOB, first |
---|
1123 | * process it. |
---|
1124 | */ |
---|
1125 | return EOB_ACT_LAST_MATCH; |
---|
1126 | } |
---|
1127 | } |
---|
1128 | |
---|
1129 | /* Try to read more data. */ |
---|
1130 | |
---|
1131 | /* First move last chars to start of buffer. */ |
---|
1132 | number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; |
---|
1133 | |
---|
1134 | for ( i = 0; i < number_to_move; ++i ) |
---|
1135 | *(dest++) = *(source++); |
---|
1136 | |
---|
1137 | if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) |
---|
1138 | /* don't do the read, it's not guaranteed to return an EOF, |
---|
1139 | * just force an EOF |
---|
1140 | */ |
---|
1141 | yy_current_buffer->yy_n_chars = yy_n_chars = 0; |
---|
1142 | |
---|
1143 | else |
---|
1144 | { |
---|
1145 | int num_to_read = |
---|
1146 | yy_current_buffer->yy_buf_size - number_to_move - 1; |
---|
1147 | |
---|
1148 | while ( num_to_read <= 0 ) |
---|
1149 | { /* Not enough room in the buffer - grow it. */ |
---|
1150 | #ifdef YY_USES_REJECT |
---|
1151 | YY_FATAL_ERROR( |
---|
1152 | "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); |
---|
1153 | #else |
---|
1154 | |
---|
1155 | /* just a shorter name for the current buffer */ |
---|
1156 | YY_BUFFER_STATE b = yy_current_buffer; |
---|
1157 | |
---|
1158 | int yy_c_buf_p_offset = |
---|
1159 | (int) (yy_c_buf_p - b->yy_ch_buf); |
---|
1160 | |
---|
1161 | if ( b->yy_is_our_buffer ) |
---|
1162 | { |
---|
1163 | int new_size = b->yy_buf_size * 2; |
---|
1164 | |
---|
1165 | if ( new_size <= 0 ) |
---|
1166 | b->yy_buf_size += b->yy_buf_size / 8; |
---|
1167 | else |
---|
1168 | b->yy_buf_size *= 2; |
---|
1169 | |
---|
1170 | b->yy_ch_buf = (char *) |
---|
1171 | /* Include room in for 2 EOB chars. */ |
---|
1172 | yy_flex_realloc( (void *) b->yy_ch_buf, |
---|
1173 | b->yy_buf_size + 2 ); |
---|
1174 | } |
---|
1175 | else |
---|
1176 | /* Can't grow it, we don't own it. */ |
---|
1177 | b->yy_ch_buf = 0; |
---|
1178 | |
---|
1179 | if ( ! b->yy_ch_buf ) |
---|
1180 | YY_FATAL_ERROR( |
---|
1181 | "fatal error - scanner input buffer overflow" ); |
---|
1182 | |
---|
1183 | yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; |
---|
1184 | |
---|
1185 | num_to_read = yy_current_buffer->yy_buf_size - |
---|
1186 | number_to_move - 1; |
---|
1187 | #endif |
---|
1188 | } |
---|
1189 | |
---|
1190 | if ( num_to_read > YY_READ_BUF_SIZE ) |
---|
1191 | num_to_read = YY_READ_BUF_SIZE; |
---|
1192 | |
---|
1193 | /* Read in more data. */ |
---|
1194 | YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), |
---|
1195 | yy_n_chars, num_to_read ); |
---|
1196 | |
---|
1197 | yy_current_buffer->yy_n_chars = yy_n_chars; |
---|
1198 | } |
---|
1199 | |
---|
1200 | if ( yy_n_chars == 0 ) |
---|
1201 | { |
---|
1202 | if ( number_to_move == YY_MORE_ADJ ) |
---|
1203 | { |
---|
1204 | ret_val = EOB_ACT_END_OF_FILE; |
---|
1205 | yyrestart( yyin ); |
---|
1206 | } |
---|
1207 | |
---|
1208 | else |
---|
1209 | { |
---|
1210 | ret_val = EOB_ACT_LAST_MATCH; |
---|
1211 | yy_current_buffer->yy_buffer_status = |
---|
1212 | YY_BUFFER_EOF_PENDING; |
---|
1213 | } |
---|
1214 | } |
---|
1215 | |
---|
1216 | else |
---|
1217 | ret_val = EOB_ACT_CONTINUE_SCAN; |
---|
1218 | |
---|
1219 | yy_n_chars += number_to_move; |
---|
1220 | yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; |
---|
1221 | yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; |
---|
1222 | |
---|
1223 | yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; |
---|
1224 | |
---|
1225 | return ret_val; |
---|
1226 | } |
---|
1227 | |
---|
1228 | |
---|
1229 | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
---|
1230 | |
---|
1231 | static yy_state_type yy_get_previous_state() |
---|
1232 | { |
---|
1233 | register yy_state_type yy_current_state; |
---|
1234 | register char *yy_cp; |
---|
1235 | |
---|
1236 | yy_current_state = yy_start; |
---|
1237 | |
---|
1238 | for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) |
---|
1239 | { |
---|
1240 | register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
---|
1241 | if ( yy_accept[yy_current_state] ) |
---|
1242 | { |
---|
1243 | yy_last_accepting_state = yy_current_state; |
---|
1244 | yy_last_accepting_cpos = yy_cp; |
---|
1245 | } |
---|
1246 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
---|
1247 | { |
---|
1248 | yy_current_state = (int) yy_def[yy_current_state]; |
---|
1249 | if ( yy_current_state >= 108 ) |
---|
1250 | yy_c = yy_meta[(unsigned int) yy_c]; |
---|
1251 | } |
---|
1252 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
---|
1253 | } |
---|
1254 | |
---|
1255 | return yy_current_state; |
---|
1256 | } |
---|
1257 | |
---|
1258 | |
---|
1259 | /* yy_try_NUL_trans - try to make a transition on the NUL character |
---|
1260 | * |
---|
1261 | * synopsis |
---|
1262 | * next_state = yy_try_NUL_trans( current_state ); |
---|
1263 | */ |
---|
1264 | |
---|
1265 | #ifdef YY_USE_PROTOS |
---|
1266 | static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) |
---|
1267 | #else |
---|
1268 | static yy_state_type yy_try_NUL_trans( yy_current_state ) |
---|
1269 | yy_state_type yy_current_state; |
---|
1270 | #endif |
---|
1271 | { |
---|
1272 | register int yy_is_jam; |
---|
1273 | register char *yy_cp = yy_c_buf_p; |
---|
1274 | |
---|
1275 | register YY_CHAR yy_c = 1; |
---|
1276 | if ( yy_accept[yy_current_state] ) |
---|
1277 | { |
---|
1278 | yy_last_accepting_state = yy_current_state; |
---|
1279 | yy_last_accepting_cpos = yy_cp; |
---|
1280 | } |
---|
1281 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
---|
1282 | { |
---|
1283 | yy_current_state = (int) yy_def[yy_current_state]; |
---|
1284 | if ( yy_current_state >= 108 ) |
---|
1285 | yy_c = yy_meta[(unsigned int) yy_c]; |
---|
1286 | } |
---|
1287 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
---|
1288 | yy_is_jam = (yy_current_state == 107); |
---|
1289 | |
---|
1290 | return yy_is_jam ? 0 : yy_current_state; |
---|
1291 | } |
---|
1292 | |
---|
1293 | |
---|
1294 | #ifndef YY_NO_UNPUT |
---|
1295 | #ifdef YY_USE_PROTOS |
---|
1296 | static void yyunput( int c, register char *yy_bp ) |
---|
1297 | #else |
---|
1298 | static void yyunput( c, yy_bp ) |
---|
1299 | int c; |
---|
1300 | register char *yy_bp; |
---|
1301 | #endif |
---|
1302 | { |
---|
1303 | register char *yy_cp = yy_c_buf_p; |
---|
1304 | |
---|
1305 | /* undo effects of setting up yytext */ |
---|
1306 | *yy_cp = yy_hold_char; |
---|
1307 | |
---|
1308 | if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) |
---|
1309 | { /* need to shift things up to make room */ |
---|
1310 | /* +2 for EOB chars. */ |
---|
1311 | register int number_to_move = yy_n_chars + 2; |
---|
1312 | register char *dest = &yy_current_buffer->yy_ch_buf[ |
---|
1313 | yy_current_buffer->yy_buf_size + 2]; |
---|
1314 | register char *source = |
---|
1315 | &yy_current_buffer->yy_ch_buf[number_to_move]; |
---|
1316 | |
---|
1317 | while ( source > yy_current_buffer->yy_ch_buf ) |
---|
1318 | *--dest = *--source; |
---|
1319 | |
---|
1320 | yy_cp += (int) (dest - source); |
---|
1321 | yy_bp += (int) (dest - source); |
---|
1322 | yy_current_buffer->yy_n_chars = |
---|
1323 | yy_n_chars = yy_current_buffer->yy_buf_size; |
---|
1324 | |
---|
1325 | if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) |
---|
1326 | YY_FATAL_ERROR( "flex scanner push-back overflow" ); |
---|
1327 | } |
---|
1328 | |
---|
1329 | *--yy_cp = (char) c; |
---|
1330 | |
---|
1331 | |
---|
1332 | yytext_ptr = yy_bp; |
---|
1333 | yy_hold_char = *yy_cp; |
---|
1334 | yy_c_buf_p = yy_cp; |
---|
1335 | } |
---|
1336 | #endif /* ifndef YY_NO_UNPUT */ |
---|
1337 | |
---|
1338 | |
---|
1339 | #ifdef __cplusplus |
---|
1340 | static int yyinput() |
---|
1341 | #else |
---|
1342 | static int input() |
---|
1343 | #endif |
---|
1344 | { |
---|
1345 | int c; |
---|
1346 | |
---|
1347 | *yy_c_buf_p = yy_hold_char; |
---|
1348 | |
---|
1349 | if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) |
---|
1350 | { |
---|
1351 | /* yy_c_buf_p now points to the character we want to return. |
---|
1352 | * If this occurs *before* the EOB characters, then it's a |
---|
1353 | * valid NUL; if not, then we've hit the end of the buffer. |
---|
1354 | */ |
---|
1355 | if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) |
---|
1356 | /* This was really a NUL. */ |
---|
1357 | *yy_c_buf_p = '\0'; |
---|
1358 | |
---|
1359 | else |
---|
1360 | { /* need more input */ |
---|
1361 | int offset = yy_c_buf_p - yytext_ptr; |
---|
1362 | ++yy_c_buf_p; |
---|
1363 | |
---|
1364 | switch ( yy_get_next_buffer() ) |
---|
1365 | { |
---|
1366 | case EOB_ACT_LAST_MATCH: |
---|
1367 | /* This happens because yy_g_n_b() |
---|
1368 | * sees that we've accumulated a |
---|
1369 | * token and flags that we need to |
---|
1370 | * try matching the token before |
---|
1371 | * proceeding. But for input(), |
---|
1372 | * there's no matching to consider. |
---|
1373 | * So convert the EOB_ACT_LAST_MATCH |
---|
1374 | * to EOB_ACT_END_OF_FILE. |
---|
1375 | */ |
---|
1376 | |
---|
1377 | /* Reset buffer status. */ |
---|
1378 | yyrestart( yyin ); |
---|
1379 | |
---|
1380 | /* fall through */ |
---|
1381 | |
---|
1382 | case EOB_ACT_END_OF_FILE: |
---|
1383 | { |
---|
1384 | if ( yywrap() ) |
---|
1385 | return EOF; |
---|
1386 | |
---|
1387 | if ( ! yy_did_buffer_switch_on_eof ) |
---|
1388 | YY_NEW_FILE; |
---|
1389 | #ifdef __cplusplus |
---|
1390 | return yyinput(); |
---|
1391 | #else |
---|
1392 | return input(); |
---|
1393 | #endif |
---|
1394 | } |
---|
1395 | |
---|
1396 | case EOB_ACT_CONTINUE_SCAN: |
---|
1397 | yy_c_buf_p = yytext_ptr + offset; |
---|
1398 | break; |
---|
1399 | } |
---|
1400 | } |
---|
1401 | } |
---|
1402 | |
---|
1403 | c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ |
---|
1404 | *yy_c_buf_p = '\0'; /* preserve yytext */ |
---|
1405 | yy_hold_char = *++yy_c_buf_p; |
---|
1406 | |
---|
1407 | |
---|
1408 | return c; |
---|
1409 | } |
---|
1410 | |
---|
1411 | |
---|
1412 | #ifdef YY_USE_PROTOS |
---|
1413 | void yyrestart( FILE *input_file ) |
---|
1414 | #else |
---|
1415 | void yyrestart( input_file ) |
---|
1416 | FILE *input_file; |
---|
1417 | #endif |
---|
1418 | { |
---|
1419 | if ( ! yy_current_buffer ) |
---|
1420 | yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); |
---|
1421 | |
---|
1422 | yy_init_buffer( yy_current_buffer, input_file ); |
---|
1423 | yy_load_buffer_state(); |
---|
1424 | } |
---|
1425 | |
---|
1426 | |
---|
1427 | #ifdef YY_USE_PROTOS |
---|
1428 | void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) |
---|
1429 | #else |
---|
1430 | void yy_switch_to_buffer( new_buffer ) |
---|
1431 | YY_BUFFER_STATE new_buffer; |
---|
1432 | #endif |
---|
1433 | { |
---|
1434 | if ( yy_current_buffer == new_buffer ) |
---|
1435 | return; |
---|
1436 | |
---|
1437 | if ( yy_current_buffer ) |
---|
1438 | { |
---|
1439 | /* Flush out information for old buffer. */ |
---|
1440 | *yy_c_buf_p = yy_hold_char; |
---|
1441 | yy_current_buffer->yy_buf_pos = yy_c_buf_p; |
---|
1442 | yy_current_buffer->yy_n_chars = yy_n_chars; |
---|
1443 | } |
---|
1444 | |
---|
1445 | yy_current_buffer = new_buffer; |
---|
1446 | yy_load_buffer_state(); |
---|
1447 | |
---|
1448 | /* We don't actually know whether we did this switch during |
---|
1449 | * EOF (yywrap()) processing, but the only time this flag |
---|
1450 | * is looked at is after yywrap() is called, so it's safe |
---|
1451 | * to go ahead and always set it. |
---|
1452 | */ |
---|
1453 | yy_did_buffer_switch_on_eof = 1; |
---|
1454 | } |
---|
1455 | |
---|
1456 | |
---|
1457 | #ifdef YY_USE_PROTOS |
---|
1458 | void yy_load_buffer_state( void ) |
---|
1459 | #else |
---|
1460 | void yy_load_buffer_state() |
---|
1461 | #endif |
---|
1462 | { |
---|
1463 | yy_n_chars = yy_current_buffer->yy_n_chars; |
---|
1464 | yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; |
---|
1465 | yyin = yy_current_buffer->yy_input_file; |
---|
1466 | yy_hold_char = *yy_c_buf_p; |
---|
1467 | } |
---|
1468 | |
---|
1469 | |
---|
1470 | #ifdef YY_USE_PROTOS |
---|
1471 | YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) |
---|
1472 | #else |
---|
1473 | YY_BUFFER_STATE yy_create_buffer( file, size ) |
---|
1474 | FILE *file; |
---|
1475 | int size; |
---|
1476 | #endif |
---|
1477 | { |
---|
1478 | YY_BUFFER_STATE b; |
---|
1479 | |
---|
1480 | b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); |
---|
1481 | if ( ! b ) |
---|
1482 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
---|
1483 | |
---|
1484 | b->yy_buf_size = size; |
---|
1485 | |
---|
1486 | /* yy_ch_buf has to be 2 characters longer than the size given because |
---|
1487 | * we need to put in 2 end-of-buffer characters. |
---|
1488 | */ |
---|
1489 | b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); |
---|
1490 | if ( ! b->yy_ch_buf ) |
---|
1491 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
---|
1492 | |
---|
1493 | b->yy_is_our_buffer = 1; |
---|
1494 | |
---|
1495 | yy_init_buffer( b, file ); |
---|
1496 | |
---|
1497 | return b; |
---|
1498 | } |
---|
1499 | |
---|
1500 | |
---|
1501 | #ifdef YY_USE_PROTOS |
---|
1502 | void yy_delete_buffer( YY_BUFFER_STATE b ) |
---|
1503 | #else |
---|
1504 | void yy_delete_buffer( b ) |
---|
1505 | YY_BUFFER_STATE b; |
---|
1506 | #endif |
---|
1507 | { |
---|
1508 | if ( ! b ) |
---|
1509 | return; |
---|
1510 | |
---|
1511 | if ( b == yy_current_buffer ) |
---|
1512 | yy_current_buffer = (YY_BUFFER_STATE) 0; |
---|
1513 | |
---|
1514 | if ( b->yy_is_our_buffer ) |
---|
1515 | yy_flex_free( (void *) b->yy_ch_buf ); |
---|
1516 | |
---|
1517 | yy_flex_free( (void *) b ); |
---|
1518 | } |
---|
1519 | |
---|
1520 | |
---|
1521 | #ifndef YY_ALWAYS_INTERACTIVE |
---|
1522 | #ifndef YY_NEVER_INTERACTIVE |
---|
1523 | extern int isatty YY_PROTO(( int )); |
---|
1524 | #endif |
---|
1525 | #endif |
---|
1526 | |
---|
1527 | #ifdef YY_USE_PROTOS |
---|
1528 | void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) |
---|
1529 | #else |
---|
1530 | void yy_init_buffer( b, file ) |
---|
1531 | YY_BUFFER_STATE b; |
---|
1532 | FILE *file; |
---|
1533 | #endif |
---|
1534 | |
---|
1535 | |
---|
1536 | { |
---|
1537 | yy_flush_buffer( b ); |
---|
1538 | |
---|
1539 | b->yy_input_file = file; |
---|
1540 | b->yy_fill_buffer = 1; |
---|
1541 | |
---|
1542 | #if YY_ALWAYS_INTERACTIVE |
---|
1543 | b->yy_is_interactive = 1; |
---|
1544 | #else |
---|
1545 | #if YY_NEVER_INTERACTIVE |
---|
1546 | b->yy_is_interactive = 0; |
---|
1547 | #else |
---|
1548 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; |
---|
1549 | #endif |
---|
1550 | #endif |
---|
1551 | } |
---|
1552 | |
---|
1553 | |
---|
1554 | #ifdef YY_USE_PROTOS |
---|
1555 | void yy_flush_buffer( YY_BUFFER_STATE b ) |
---|
1556 | #else |
---|
1557 | void yy_flush_buffer( b ) |
---|
1558 | YY_BUFFER_STATE b; |
---|
1559 | #endif |
---|
1560 | |
---|
1561 | { |
---|
1562 | if ( ! b ) |
---|
1563 | return; |
---|
1564 | |
---|
1565 | b->yy_n_chars = 0; |
---|
1566 | |
---|
1567 | /* We always need two end-of-buffer characters. The first causes |
---|
1568 | * a transition to the end-of-buffer state. The second causes |
---|
1569 | * a jam in that state. |
---|
1570 | */ |
---|
1571 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
---|
1572 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
---|
1573 | |
---|
1574 | b->yy_buf_pos = &b->yy_ch_buf[0]; |
---|
1575 | |
---|
1576 | b->yy_at_bol = 1; |
---|
1577 | b->yy_buffer_status = YY_BUFFER_NEW; |
---|
1578 | |
---|
1579 | if ( b == yy_current_buffer ) |
---|
1580 | yy_load_buffer_state(); |
---|
1581 | } |
---|
1582 | |
---|
1583 | |
---|
1584 | #ifndef YY_NO_SCAN_BUFFER |
---|
1585 | #ifdef YY_USE_PROTOS |
---|
1586 | YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) |
---|
1587 | #else |
---|
1588 | YY_BUFFER_STATE yy_scan_buffer( base, size ) |
---|
1589 | char *base; |
---|
1590 | yy_size_t size; |
---|
1591 | #endif |
---|
1592 | { |
---|
1593 | YY_BUFFER_STATE b; |
---|
1594 | |
---|
1595 | if ( size < 2 || |
---|
1596 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
---|
1597 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
---|
1598 | /* They forgot to leave room for the EOB's. */ |
---|
1599 | return 0; |
---|
1600 | |
---|
1601 | b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); |
---|
1602 | if ( ! b ) |
---|
1603 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); |
---|
1604 | |
---|
1605 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ |
---|
1606 | b->yy_buf_pos = b->yy_ch_buf = base; |
---|
1607 | b->yy_is_our_buffer = 0; |
---|
1608 | b->yy_input_file = 0; |
---|
1609 | b->yy_n_chars = b->yy_buf_size; |
---|
1610 | b->yy_is_interactive = 0; |
---|
1611 | b->yy_at_bol = 1; |
---|
1612 | b->yy_fill_buffer = 0; |
---|
1613 | b->yy_buffer_status = YY_BUFFER_NEW; |
---|
1614 | |
---|
1615 | yy_switch_to_buffer( b ); |
---|
1616 | |
---|
1617 | return b; |
---|
1618 | } |
---|
1619 | #endif |
---|
1620 | |
---|
1621 | |
---|
1622 | #ifndef YY_NO_SCAN_STRING |
---|
1623 | #ifdef YY_USE_PROTOS |
---|
1624 | YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) |
---|
1625 | #else |
---|
1626 | YY_BUFFER_STATE yy_scan_string( yy_str ) |
---|
1627 | yyconst char *yy_str; |
---|
1628 | #endif |
---|
1629 | { |
---|
1630 | int len; |
---|
1631 | for ( len = 0; yy_str[len]; ++len ) |
---|
1632 | ; |
---|
1633 | |
---|
1634 | return yy_scan_bytes( yy_str, len ); |
---|
1635 | } |
---|
1636 | #endif |
---|
1637 | |
---|
1638 | |
---|
1639 | #ifndef YY_NO_SCAN_BYTES |
---|
1640 | #ifdef YY_USE_PROTOS |
---|
1641 | YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) |
---|
1642 | #else |
---|
1643 | YY_BUFFER_STATE yy_scan_bytes( bytes, len ) |
---|
1644 | yyconst char *bytes; |
---|
1645 | int len; |
---|
1646 | #endif |
---|
1647 | { |
---|
1648 | YY_BUFFER_STATE b; |
---|
1649 | char *buf; |
---|
1650 | yy_size_t n; |
---|
1651 | int i; |
---|
1652 | |
---|
1653 | /* Get memory for full buffer, including space for trailing EOB's. */ |
---|
1654 | n = len + 2; |
---|
1655 | buf = (char *) yy_flex_alloc( n ); |
---|
1656 | if ( ! buf ) |
---|
1657 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); |
---|
1658 | |
---|
1659 | for ( i = 0; i < len; ++i ) |
---|
1660 | buf[i] = bytes[i]; |
---|
1661 | |
---|
1662 | buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; |
---|
1663 | |
---|
1664 | b = yy_scan_buffer( buf, n ); |
---|
1665 | if ( ! b ) |
---|
1666 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); |
---|
1667 | |
---|
1668 | /* It's okay to grow etc. this buffer, and we should throw it |
---|
1669 | * away when we're done. |
---|
1670 | */ |
---|
1671 | b->yy_is_our_buffer = 1; |
---|
1672 | |
---|
1673 | return b; |
---|
1674 | } |
---|
1675 | #endif |
---|
1676 | |
---|
1677 | |
---|
1678 | #ifndef YY_NO_PUSH_STATE |
---|
1679 | #ifdef YY_USE_PROTOS |
---|
1680 | static void yy_push_state( int new_state ) |
---|
1681 | #else |
---|
1682 | static void yy_push_state( new_state ) |
---|
1683 | int new_state; |
---|
1684 | #endif |
---|
1685 | { |
---|
1686 | if ( yy_start_stack_ptr >= yy_start_stack_depth ) |
---|
1687 | { |
---|
1688 | yy_size_t new_size; |
---|
1689 | |
---|
1690 | yy_start_stack_depth += YY_START_STACK_INCR; |
---|
1691 | new_size = yy_start_stack_depth * sizeof( int ); |
---|
1692 | |
---|
1693 | if ( ! yy_start_stack ) |
---|
1694 | yy_start_stack = (int *) yy_flex_alloc( new_size ); |
---|
1695 | |
---|
1696 | else |
---|
1697 | yy_start_stack = (int *) yy_flex_realloc( |
---|
1698 | (void *) yy_start_stack, new_size ); |
---|
1699 | |
---|
1700 | if ( ! yy_start_stack ) |
---|
1701 | YY_FATAL_ERROR( |
---|
1702 | "out of memory expanding start-condition stack" ); |
---|
1703 | } |
---|
1704 | |
---|
1705 | yy_start_stack[yy_start_stack_ptr++] = YY_START; |
---|
1706 | |
---|
1707 | BEGIN(new_state); |
---|
1708 | } |
---|
1709 | #endif |
---|
1710 | |
---|
1711 | |
---|
1712 | #ifndef YY_NO_POP_STATE |
---|
1713 | static void yy_pop_state() |
---|
1714 | { |
---|
1715 | if ( --yy_start_stack_ptr < 0 ) |
---|
1716 | YY_FATAL_ERROR( "start-condition stack underflow" ); |
---|
1717 | |
---|
1718 | BEGIN(yy_start_stack[yy_start_stack_ptr]); |
---|
1719 | } |
---|
1720 | #endif |
---|
1721 | |
---|
1722 | |
---|
1723 | #ifndef YY_NO_TOP_STATE |
---|
1724 | static int yy_top_state() |
---|
1725 | { |
---|
1726 | return yy_start_stack[yy_start_stack_ptr - 1]; |
---|
1727 | } |
---|
1728 | #endif |
---|
1729 | |
---|
1730 | #ifndef YY_EXIT_FAILURE |
---|
1731 | #define YY_EXIT_FAILURE 2 |
---|
1732 | #endif |
---|
1733 | |
---|
1734 | #ifdef YY_USE_PROTOS |
---|
1735 | static void yy_fatal_error( yyconst char msg[] ) |
---|
1736 | #else |
---|
1737 | static void yy_fatal_error( msg ) |
---|
1738 | char msg[]; |
---|
1739 | #endif |
---|
1740 | { |
---|
1741 | (void) fprintf( stderr, "%s\n", msg ); |
---|
1742 | exit( YY_EXIT_FAILURE ); |
---|
1743 | } |
---|
1744 | |
---|
1745 | |
---|
1746 | |
---|
1747 | /* Redefine yyless() so it works in section 3 code. */ |
---|
1748 | |
---|
1749 | #undef yyless |
---|
1750 | #define yyless(n) \ |
---|
1751 | do \ |
---|
1752 | { \ |
---|
1753 | /* Undo effects of setting up yytext. */ \ |
---|
1754 | yytext[yyleng] = yy_hold_char; \ |
---|
1755 | yy_c_buf_p = yytext + n; \ |
---|
1756 | yy_hold_char = *yy_c_buf_p; \ |
---|
1757 | *yy_c_buf_p = '\0'; \ |
---|
1758 | yyleng = n; \ |
---|
1759 | } \ |
---|
1760 | while ( 0 ) |
---|
1761 | |
---|
1762 | |
---|
1763 | /* Internal utility routines. */ |
---|
1764 | |
---|
1765 | #ifndef yytext_ptr |
---|
1766 | #ifdef YY_USE_PROTOS |
---|
1767 | static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) |
---|
1768 | #else |
---|
1769 | static void yy_flex_strncpy( s1, s2, n ) |
---|
1770 | char *s1; |
---|
1771 | yyconst char *s2; |
---|
1772 | int n; |
---|
1773 | #endif |
---|
1774 | { |
---|
1775 | register int i; |
---|
1776 | for ( i = 0; i < n; ++i ) |
---|
1777 | s1[i] = s2[i]; |
---|
1778 | } |
---|
1779 | #endif |
---|
1780 | |
---|
1781 | #ifdef YY_NEED_STRLEN |
---|
1782 | #ifdef YY_USE_PROTOS |
---|
1783 | static int yy_flex_strlen( yyconst char *s ) |
---|
1784 | #else |
---|
1785 | static int yy_flex_strlen( s ) |
---|
1786 | yyconst char *s; |
---|
1787 | #endif |
---|
1788 | { |
---|
1789 | register int n; |
---|
1790 | for ( n = 0; s[n]; ++n ) |
---|
1791 | ; |
---|
1792 | |
---|
1793 | return n; |
---|
1794 | } |
---|
1795 | #endif |
---|
1796 | |
---|
1797 | |
---|
1798 | #ifdef YY_USE_PROTOS |
---|
1799 | static void *yy_flex_alloc( yy_size_t size ) |
---|
1800 | #else |
---|
1801 | static void *yy_flex_alloc( size ) |
---|
1802 | yy_size_t size; |
---|
1803 | #endif |
---|
1804 | { |
---|
1805 | return (void *) malloc( size ); |
---|
1806 | } |
---|
1807 | |
---|
1808 | #ifdef YY_USE_PROTOS |
---|
1809 | static void *yy_flex_realloc( void *ptr, yy_size_t size ) |
---|
1810 | #else |
---|
1811 | static void *yy_flex_realloc( ptr, size ) |
---|
1812 | void *ptr; |
---|
1813 | yy_size_t size; |
---|
1814 | #endif |
---|
1815 | { |
---|
1816 | /* The cast to (char *) in the following accommodates both |
---|
1817 | * implementations that use char* generic pointers, and those |
---|
1818 | * that use void* generic pointers. It works with the latter |
---|
1819 | * because both ANSI C and C++ allow castless assignment from |
---|
1820 | * any pointer type to void*, and deal with argument conversions |
---|
1821 | * as though doing an assignment. |
---|
1822 | */ |
---|
1823 | return (void *) realloc( (char *) ptr, size ); |
---|
1824 | } |
---|
1825 | |
---|
1826 | #ifdef YY_USE_PROTOS |
---|
1827 | static void yy_flex_free( void *ptr ) |
---|
1828 | #else |
---|
1829 | static void yy_flex_free( ptr ) |
---|
1830 | void *ptr; |
---|
1831 | #endif |
---|
1832 | { |
---|
1833 | free( ptr ); |
---|
1834 | } |
---|
1835 | |
---|
1836 | #if YY_MAIN |
---|
1837 | int main() |
---|
1838 | { |
---|
1839 | yylex(); |
---|
1840 | return 0; |
---|
1841 | } |
---|
1842 | #endif |
---|
1843 | #line 148 "lex.l" |
---|
1844 | |
---|
1845 | |
---|
1846 | static void |
---|
1847 | eat_comment () |
---|
1848 | { |
---|
1849 | int c; |
---|
1850 | |
---|
1851 | while ((c = input ()) != EOF) |
---|
1852 | { |
---|
1853 | if (c == '\n') |
---|
1854 | linenum++; |
---|
1855 | else if (c == '*') |
---|
1856 | { |
---|
1857 | c = input (); |
---|
1858 | if (c == '/') |
---|
1859 | /* All done. */ |
---|
1860 | return; |
---|
1861 | |
---|
1862 | if (c == EOF) |
---|
1863 | { |
---|
1864 | yyerror (_("error: EOF in comment")); |
---|
1865 | break; |
---|
1866 | } |
---|
1867 | unput (c); |
---|
1868 | } |
---|
1869 | } |
---|
1870 | yyerror (_("error: EOF in comment")); |
---|
1871 | } |
---|
1872 | |
---|
1873 | |
---|
1874 | int |
---|
1875 | yywrap () |
---|
1876 | { |
---|
1877 | return 1; |
---|
1878 | } |
---|
1879 | |
---|
1880 | static char * |
---|
1881 | read_string (len_return) |
---|
1882 | unsigned int *len_return; |
---|
1883 | { |
---|
1884 | char *buf = NULL; |
---|
1885 | char *buf2; |
---|
1886 | int buflen = 0; |
---|
1887 | int bufpos = 0; |
---|
1888 | int ch; |
---|
1889 | int done = 0; |
---|
1890 | |
---|
1891 | while (!done) |
---|
1892 | { |
---|
1893 | ch = input (); |
---|
1894 | if (ch == '\n') |
---|
1895 | linenum++; |
---|
1896 | |
---|
1897 | switch (ch) |
---|
1898 | { |
---|
1899 | case EOF: |
---|
1900 | unexpected_eof: |
---|
1901 | yyerror (_("error: EOF in string constant")); |
---|
1902 | done = 1; |
---|
1903 | break; |
---|
1904 | |
---|
1905 | case '"': |
---|
1906 | done = 1; |
---|
1907 | break; |
---|
1908 | |
---|
1909 | case '\\': |
---|
1910 | ch = input (); |
---|
1911 | switch (ch) |
---|
1912 | { |
---|
1913 | case 'n': |
---|
1914 | ch = '\n'; |
---|
1915 | break; |
---|
1916 | |
---|
1917 | case 't': |
---|
1918 | ch = '\t'; |
---|
1919 | break; |
---|
1920 | |
---|
1921 | case 'v': |
---|
1922 | ch = '\v'; |
---|
1923 | break; |
---|
1924 | |
---|
1925 | case 'b': |
---|
1926 | ch = '\b'; |
---|
1927 | break; |
---|
1928 | |
---|
1929 | case 'r': |
---|
1930 | ch = '\r'; |
---|
1931 | break; |
---|
1932 | |
---|
1933 | case 'f': |
---|
1934 | ch = '\f'; |
---|
1935 | break; |
---|
1936 | |
---|
1937 | case 'a': |
---|
1938 | ch = '\a'; |
---|
1939 | break; |
---|
1940 | |
---|
1941 | case EOF: |
---|
1942 | goto unexpected_eof; |
---|
1943 | break; |
---|
1944 | |
---|
1945 | default: |
---|
1946 | if (ch == '0') |
---|
1947 | { |
---|
1948 | int i; |
---|
1949 | int val = 0; |
---|
1950 | |
---|
1951 | for (i = 0; i < 3; i++) |
---|
1952 | { |
---|
1953 | ch = input (); |
---|
1954 | if ('0' <= ch && ch <= '7') |
---|
1955 | val = val * 8 + ch - '0'; |
---|
1956 | else |
---|
1957 | { |
---|
1958 | unput (ch); |
---|
1959 | break; |
---|
1960 | } |
---|
1961 | } |
---|
1962 | ch = val; |
---|
1963 | } |
---|
1964 | break; |
---|
1965 | } |
---|
1966 | /* FALLTHROUGH */ |
---|
1967 | |
---|
1968 | default: |
---|
1969 | if (bufpos >= buflen) |
---|
1970 | { |
---|
1971 | buflen += 1024; |
---|
1972 | buf = (char *) xrealloc (buf, buflen); |
---|
1973 | } |
---|
1974 | buf[bufpos++] = ch; |
---|
1975 | break; |
---|
1976 | } |
---|
1977 | } |
---|
1978 | |
---|
1979 | buf2 = (char *) xmalloc (bufpos + 1); |
---|
1980 | memcpy (buf2, buf, bufpos); |
---|
1981 | buf2[bufpos] = '\0'; |
---|
1982 | xfree (buf); |
---|
1983 | |
---|
1984 | *len_return = bufpos; |
---|
1985 | |
---|
1986 | return buf2; |
---|
1987 | } |
---|
1988 | |
---|
1989 | |
---|
1990 | static void |
---|
1991 | read_regexp (node) |
---|
1992 | Node *node; |
---|
1993 | { |
---|
1994 | char *buf = NULL; |
---|
1995 | char *buf2; |
---|
1996 | int buflen = 0; |
---|
1997 | int bufpos = 0; |
---|
1998 | int ch; |
---|
1999 | int done = 0; |
---|
2000 | |
---|
2001 | while (!done) |
---|
2002 | { |
---|
2003 | ch = input (); |
---|
2004 | switch (ch) |
---|
2005 | { |
---|
2006 | case EOF: |
---|
2007 | unexpected_eof: |
---|
2008 | yyerror (_("error: EOF in regular expression")); |
---|
2009 | done = 1; |
---|
2010 | break; |
---|
2011 | |
---|
2012 | case '/': |
---|
2013 | done = 1; |
---|
2014 | break; |
---|
2015 | |
---|
2016 | case '\\': |
---|
2017 | ch = input (); |
---|
2018 | switch (ch) |
---|
2019 | { |
---|
2020 | case '\n': |
---|
2021 | /* Line break. */ |
---|
2022 | linenum++; |
---|
2023 | continue; |
---|
2024 | break; |
---|
2025 | |
---|
2026 | case 'n': |
---|
2027 | ch = '\n'; |
---|
2028 | break; |
---|
2029 | |
---|
2030 | case 'r': |
---|
2031 | ch = '\r'; |
---|
2032 | break; |
---|
2033 | |
---|
2034 | case 'f': |
---|
2035 | ch = '\f'; |
---|
2036 | break; |
---|
2037 | |
---|
2038 | case 't': |
---|
2039 | ch = '\t'; |
---|
2040 | break; |
---|
2041 | |
---|
2042 | case '/': |
---|
2043 | case '\\': |
---|
2044 | /* Quote these. */ |
---|
2045 | break; |
---|
2046 | |
---|
2047 | case EOF: |
---|
2048 | goto unexpected_eof; |
---|
2049 | break; |
---|
2050 | |
---|
2051 | default: |
---|
2052 | if (ch == '0') |
---|
2053 | { |
---|
2054 | int i; |
---|
2055 | int val = 0; |
---|
2056 | |
---|
2057 | for (i = 0; i < 3; i++) |
---|
2058 | { |
---|
2059 | ch = input (); |
---|
2060 | if ('0' <= ch && ch <= '7') |
---|
2061 | val = val * 8 + ch - '0'; |
---|
2062 | else |
---|
2063 | { |
---|
2064 | unput (ch); |
---|
2065 | break; |
---|
2066 | } |
---|
2067 | } |
---|
2068 | ch = val; |
---|
2069 | } |
---|
2070 | else |
---|
2071 | { |
---|
2072 | /* Pass it through. */ |
---|
2073 | unput (ch); |
---|
2074 | ch = '\\'; |
---|
2075 | } |
---|
2076 | break; |
---|
2077 | } |
---|
2078 | /* FALLTHROUGH */ |
---|
2079 | |
---|
2080 | default: |
---|
2081 | if (bufpos >= buflen) |
---|
2082 | { |
---|
2083 | buflen += 1024; |
---|
2084 | buf = (char *) xrealloc (buf, buflen); |
---|
2085 | } |
---|
2086 | buf[bufpos++] = ch; |
---|
2087 | break; |
---|
2088 | } |
---|
2089 | } |
---|
2090 | |
---|
2091 | /* Possible options. */ |
---|
2092 | done = 0; |
---|
2093 | while (!done) |
---|
2094 | { |
---|
2095 | ch = input (); |
---|
2096 | switch (ch) |
---|
2097 | { |
---|
2098 | case 'i': |
---|
2099 | /* Case-insensitive regular expression. */ |
---|
2100 | node->u.re.flags |= fRE_CASE_INSENSITIVE; |
---|
2101 | break; |
---|
2102 | |
---|
2103 | default: |
---|
2104 | /* Unknown option => this belongs to the next token. */ |
---|
2105 | unput (ch); |
---|
2106 | done = 1; |
---|
2107 | break; |
---|
2108 | } |
---|
2109 | } |
---|
2110 | |
---|
2111 | buf2 = (char *) xmalloc (bufpos + 1); |
---|
2112 | memcpy (buf2, buf, bufpos); |
---|
2113 | buf2[bufpos] = '\0'; |
---|
2114 | xfree (buf); |
---|
2115 | |
---|
2116 | node->u.re.data = buf2; |
---|
2117 | node->u.re.len = bufpos; |
---|
2118 | } |
---|
2119 | |
---|
2120 | |
---|
2121 | /* |
---|
2122 | Local variables: |
---|
2123 | mode: c |
---|
2124 | End: |
---|
2125 | */ |
---|