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