Debian Codegraph @

debian/external_deps/fetk/maloc/src/vsh/vlex.c

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