1 /* A lexical scanner generated by flex */
2
3 /* scanner skeleton version:
4 *
5 * $Header: flex/RCS/flex.skel,v 2.13 90/05/26 17:24:13 vern Exp $
6 *
7 * @(#)lex.skel 5.5 (Berkeley) 5/6/91
8 */
9
10 #define FLEX_SCANNER
11
12 #include <stdio.h>
13 #include <stdlib.h>
14
15 #ifdef __STDC__
16
17 #define YY_USE_PROTOS
18 #endif
19
20
21 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
22 #ifdef c_plusplus
23 #ifndef __cplusplus
24 #define __cplusplus
25 #endif
26 #endif
27
28
29 #ifdef __cplusplus
30
31 #include <osfcn.h>
32
33 /* use prototypes in function declarations */
34 #define YY_USE_PROTOS
35
36 #endif
37
38
39 #ifdef YY_USE_PROTOS
40 #define YY_PROTO(proto) proto
41 #else
42 #define YY_PROTO(proto) ()
43 #endif
44
45
46 /* amount of stuff to slurp up with each read */
47 #ifndef YY_READ_BUF_SIZE
48 #define YY_READ_BUF_SIZE 8192
49 #endif
50
51 /* returned upon end-of-file */
52 #define YY_END_TOK 0
53
54 /* copy whatever the last rule matched to the standard output */
55
56 /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
57 /* this used to be an fputs(), but since the string might contain NUL's,
58 * we now use fwrite()
59 */
60 #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
61
62 /* gets input and stuffs it into "buf". number of characters read, or YY_NULL,
63 * is returned in "result".
64 */
65 #define YY_INPUT(buf,result,max_size) \
66 if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
67 YY_FATAL_ERROR( "read() in flex scanner failed" );
68 #define YY_NULL 0
69
70 /* no semi-colon after return; correct usage is to write "yyterminate();" -
71 * we don't want an extra ';' after the "return" because that will cause
72 * some compilers to complain about unreachable statements.
73 */
74 #define yyterminate() return ( YY_NULL )
75
76 /* report a fatal error */
77
78 /* The funky do-while is used to turn this macro definition into
79 * a single C statement (which needs a semi-colon terminator).
80 * This avoids problems with code like:
81 *
82 * if ( something_happens )
83 * YY_FATAL_ERROR( "oops, the something happened" );
84 * else
85 * everything_okay();
86 *
87 * Prior to using the do-while the compiler would get upset at the
88 * "else" because it interpreted the "if" statement as being all
89 * done when it reached the ';' after the YY_FATAL_ERROR() call.
90 */
91
92 #define YY_FATAL_ERROR(msg) \
93 do \
94 { \
95 (void) fputs( msg, stderr ); \
96 (void) putc( '\n', stderr ); \
97 exit( 1 ); \
98 } \
99 while ( 0 )
100
101 /* default yywrap function - always treat EOF as an EOF */
102 #define yywrap() 1
103
104 /* enter a start condition. This macro really ought to take a parameter,
105 * but we do it the disgusting crufty way forced on us by the ()-less
106 * definition of BEGIN
107 */
108 #define BEGIN yy_start = 1 + 2 *
109
110 /* action number for EOF rule of a given start state */
111 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
112
113 /* special action meaning "start processing a new file" */
114 #define YY_NEW_FILE \
115 do \
116 { \
117 yy_init_buffer( yy_current_buffer, yyin ); \
118 yy_load_buffer_state(); \
119 } \
120 while ( 0 )
121
122 /* default declaration of generated scanner - a define so the user can
123 * easily add parameters
124 */
125 #define YY_DECL int yylex YY_PROTO(( void ))
126
127 /* code executed at the end of each rule */
128 #define YY_BREAK break;
129
130 #define YY_END_OF_BUFFER_CHAR 0
131
132 #ifndef YY_BUF_SIZE
133 #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
134 #endif
135
136 typedef struct yy_buffer_state *YY_BUFFER_STATE;
137
138 #define YY_CHAR char
139 # line 1 "tcplex.l"
140 #define INITIAL 0
141 # line 2 "tcplex.l"
142 /*
143 * Copyright (c) 1988-1990 The Regents of the University of California.
144 * All rights reserved.
145 *
146 * Redistribution and use in source and binary forms, with or without
147 * modification, are permitted provided that: (1) source code distributions
148 * retain the above copyright notice and this paragraph in its entirety, (2)
149 * distributions including binary code include the above copyright notice and
150 * this paragraph in its entirety in the documentation or other materials
151 * provided with the distribution, and (3) all advertising materials mentioning
152 * features or use of this software display the following acknowledgement:
153 * ``This product includes software developed by the University of California,
154 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
155 * the University nor the names of its contributors may be used to endorse
156 * or promote products derived from this software without specific prior
157 * written permission.
158 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
159 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
160 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
161 */
162
163 #ifndef lint
164 static char rcsid[] =
165 "@(#) $Header: tcplex.l,v 1.21 91/06/06 22:35:55 mccanne Exp $ (LBL)";
166 #endif
167
168 /*
169 * Compiling with gcc under SunOS will cause problems unless we have this
170 * cruft here. The flex skeleton includes stddef.h which defines these types
171 * (under gcc). They will conflict with Sun's definitions in sys/types.h.
172 */
173 #define size_t xxxsize_t
174 #define ptrdiff_t xxxptrdiff_t
175 #include <sys/types.h>
176 #undef size_t
177 #undef ptrdiff_t
178
179 #include "nametoaddr.h"
180
181 /*
182 * We need bpf since enum bpf_code is in YYSTYPE.
183 */
184 #include <sys/time.h>
185 #include <net/bpf.h>
186
187 #include "tokdefs.h"
188
189 #ifdef FLEX_SCANNER
190 #undef YY_INPUT
191 #define YY_INPUT(buf, result, max)\
192 {\
193 char *src = in_buffer;\
194 int i;\
195 \
196 if (*src == 0)\
197 result = YY_NULL;\
198 else {\
199 for (i = 0; *src && i < max; ++i)\
200 buf[i] = *src++;\
201 in_buffer += i;\
202 result = i;\
203 }\
204 }
205 #else
206 #undef getc
207 #define getc(fp) (*in_buffer == 0 ? EOF : *in_buffer++)
208 #endif
209
210 extern YYSTYPE yylval;
211 static char *in_buffer;
212
213 # line 80 "tcplex.l"
214
215 /* done after the current pattern has been matched and before the
216 * corresponding action - sets up yytext
217 */
218 #define YY_DO_BEFORE_ACTION \
219 yytext = yy_bp; \
220 yyleng = yy_cp - yy_bp; \
221 yy_hold_char = *yy_cp; \
222 *yy_cp = '\0'; \
223 yy_c_buf_p = yy_cp;
224
225 #define EOB_ACT_CONTINUE_SCAN 0
226 #define EOB_ACT_END_OF_FILE 1
227 #define EOB_ACT_LAST_MATCH 2
228
229 /* return all but the first 'n' matched characters back to the input stream */
230 #define yyless(n) \
231 do \
232 { \
233 /* undo effects of setting up yytext */ \
234 *yy_cp = yy_hold_char; \
235 yy_c_buf_p = yy_cp = yy_bp + n; \
236 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
237 } \
238 while ( 0 )
239
240 #define unput(c) yyunput( c, yytext )
241
242
243 struct yy_buffer_state
244 {
245 FILE *yy_input_file;
246
247 YY_CHAR *yy_ch_buf; /* input buffer */
248 YY_CHAR *yy_buf_pos; /* current position in input buffer */
249
250 /* size of input buffer in bytes, not including room for EOB characters*/
251 int yy_buf_size;
252
253 /* number of characters read into yy_ch_buf, not including EOB characters */
254 int yy_n_chars;
255
256 int yy_eof_status; /* whether we've seen an EOF on this buffer */
257 #define EOF_NOT_SEEN 0
258 /* "pending" happens when the EOF has been seen but there's still
259 * some text process
260 */
261 #define EOF_PENDING 1
262 #define EOF_DONE 2
263 };
264
265 static YY_BUFFER_STATE yy_current_buffer;
266
267 /* we provide macros for accessing buffer states in case in the
268 * future we want to put the buffer states in a more general
269 * "scanner state"
270 */
271 #define YY_CURRENT_BUFFER yy_current_buffer
272
273
274 /* yy_hold_char holds the character lost when yytext is formed */
275 static YY_CHAR yy_hold_char;
276
277 static int yy_n_chars; /* number of characters read into yy_ch_buf */
278
279
280
281 #ifndef YY_USER_ACTION
282 #define YY_USER_ACTION
283 #endif
284
285 #ifndef YY_USER_INIT
286 #define YY_USER_INIT
287 #endif
288
289 extern YY_CHAR *yytext;
290 extern int yyleng;
291 extern FILE *yyin, *yyout;
292
293 YY_CHAR *yytext;
294 int yyleng;
295
296 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
297
298 #define YY_END_OF_BUFFER 39
299 typedef int yy_state_type;
300 static const short int yy_accept[148] =
301 { 0,
302 0, 0, 39, 36, 23, 23, 24, 24, 24, 37,
303 30, 30, 24, 24, 34, 34, 36, 34, 34, 34,
304 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
305 34, 34, 36, 27, 0, 30, 0, 0, 0, 28,
306 26, 25, 29, 34, 34, 35, 35, 34, 34, 34,
307 34, 34, 34, 34, 34, 34, 34, 6, 34, 34,
308 34, 20, 34, 34, 34, 34, 34, 34, 31, 31,
309 30, 0, 0, 30, 19, 4, 34, 34, 1, 34,
310 34, 34, 34, 34, 22, 34, 11, 21, 34, 34,
311 34, 2, 7, 8, 0, 0, 0, 33, 0, 34,
312
313 17, 34, 34, 34, 10, 9, 15, 12, 34, 5,
314 31, 31, 31, 0, 33, 0, 34, 3, 34, 34,
315 13, 0, 0, 0, 33, 34, 34, 34, 31, 31,
316 31, 0, 34, 14, 16, 0, 0, 33, 34, 31,
317 0, 18, 0, 33, 32, 32, 0
318 } ;
319
320 static const YY_CHAR yy_ec[128] =
321 { 0,
322 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
323 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
324 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
325 1, 2, 4, 1, 1, 1, 1, 5, 1, 6,
326 6, 7, 7, 1, 8, 9, 7, 10, 11, 11,
327 11, 11, 11, 11, 11, 11, 11, 12, 1, 13,
328 14, 15, 1, 1, 16, 16, 16, 16, 16, 16,
329 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
330 17, 17, 17, 17, 17, 17, 17, 18, 17, 17,
331 5, 19, 5, 1, 20, 1, 21, 22, 23, 24,
332
333 25, 16, 26, 27, 28, 17, 17, 29, 30, 31,
334 32, 33, 17, 34, 35, 36, 37, 17, 38, 39,
335 40, 17, 1, 5, 1, 1, 1
336 } ;
337
338 static const YY_CHAR yy_meta[41] =
339 { 0,
340 1, 2, 2, 2, 1, 2, 1, 3, 3, 4,
341 4, 5, 1, 1, 1, 4, 3, 3, 1, 3,
342 4, 4, 4, 4, 4, 3, 3, 3, 3, 3,
343 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
344 } ;
345
346 static const short int yy_base[166] =
347 { 0,
348 0, 0, 340, 40, 341, 341, 325, 341, 41, 341,
349 52, 26, 32, 35, 82, 326, 71, 98, 48, 20,
350 35, 46, 69, 101, 31, 103, 77, 84, 74, 105,
351 113, 73, 126, 341, 89, 131, 325, 324, 0, 341,
352 341, 341, 341, 323, 322, 143, 0, 125, 114, 119,
353 118, 134, 75, 136, 140, 141, 144, 321, 146, 147,
354 148, 320, 145, 154, 151, 152, 149, 155, 180, 183,
355 186, 319, 318, 320, 316, 315, 157, 175, 314, 187,
356 189, 159, 190, 191, 313, 192, 312, 311, 193, 194,
357 195, 310, 309, 308, 198, 0, 307, 306, 305, 198,
358
359 304, 199, 201, 204, 303, 302, 301, 300, 203, 299,
360 227, 232, 301, 270, 263, 262, 208, 261, 211, 209,
361 260, 207, 0, 259, 258, 232, 72, 213, 238, 240,
362 259, 255, 234, 253, 252, 0, 251, 250, 240, 0,
363 249, 248, 247, 246, 245, 243, 341, 275, 280, 282,
364 250, 284, 286, 169, 288, 290, 292, 164, 294, 296,
365 53, 298, 300, 302, 304
366 } ;
367
368 static const short int yy_def[166] =
369 { 0,
370 147, 1, 147, 147, 147, 147, 147, 147, 147, 147,
371 147, 11, 147, 147, 148, 148, 149, 148, 18, 18,
372 18, 148, 148, 148, 148, 148, 148, 148, 148, 148,
373 148, 148, 147, 147, 147, 147, 150, 147, 151, 147,
374 147, 147, 147, 148, 148, 149, 149, 148, 148, 148,
375 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
376 148, 148, 148, 148, 148, 148, 148, 148, 147, 147,
377 147, 152, 153, 151, 148, 148, 148, 148, 148, 148,
378 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
379 148, 148, 148, 148, 147, 154, 147, 155, 156, 148,
380
381 148, 148, 148, 148, 148, 148, 148, 148, 148, 148,
382 147, 147, 154, 157, 153, 147, 148, 148, 148, 148,
383 148, 147, 158, 147, 159, 148, 148, 148, 147, 147,
384 158, 160, 148, 148, 148, 161, 147, 162, 148, 161,
385 163, 148, 147, 164, 165, 147, 0, 147, 147, 147,
386 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
387 147, 147, 147, 147, 147
388 } ;
389
390 static const short int yy_nxt[382] =
391 { 0,
392 4, 5, 6, 7, 8, 8, 9, 8, 10, 11,
393 12, 9, 13, 8, 14, 15, 16, 16, 17, 10,
394 18, 19, 15, 20, 21, 22, 23, 24, 25, 16,
395 26, 27, 28, 29, 30, 31, 32, 16, 16, 16,
396 33, 33, 147, 147, 40, 41, 33, 33, 42, 43,
397 44, 33, 33, 44, 52, 59, 140, 147, 33, 33,
398 35, 36, 36, 37, 147, 44, 54, 38, 44, 39,
399 53, 46, 38, 38, 38, 38, 38, 46, 44, 55,
400 147, 50, 46, 147, 147, 147, 147, 51, 147, 46,
401 39, 45, 45, 37, 65, 147, 68, 45, 69, 70,
402
403 56, 80, 45, 45, 45, 45, 45, 45, 45, 37,
404 62, 134, 147, 45, 147, 63, 147, 64, 45, 45,
405 45, 45, 45, 57, 147, 147, 33, 60, 48, 147,
406 147, 49, 33, 58, 61, 67, 147, 33, 66, 35,
407 71, 71, 37, 46, 33, 147, 76, 147, 75, 46,
408 77, 147, 147, 78, 46, 147, 147, 147, 147, 147,
409 147, 46, 147, 147, 82, 147, 147, 131, 147, 79,
410 147, 81, 113, 84, 92, 83, 85, 100, 89, 104,
411 86, 93, 87, 88, 91, 90, 147, 94, 95, 70,
412 70, 95, 70, 70, 35, 71, 71, 96, 147, 101,
413
414 147, 147, 147, 147, 147, 147, 147, 111, 112, 147,
415 147, 102, 147, 103, 147, 147, 129, 130, 96, 147,
416 147, 117, 147, 106, 147, 105, 107, 110, 108, 109,
417 126, 127, 118, 128, 121, 122, 112, 112, 119, 120,
418 122, 112, 112, 147, 123, 147, 135, 130, 130, 130,
419 130, 147, 133, 74, 115, 136, 115, 115, 144, 147,
420 144, 115, 138, 147, 147, 123, 138, 122, 139, 115,
421 125, 147, 147, 115, 115, 142, 136, 44, 44, 44,
422 47, 125, 47, 47, 47, 72, 72, 97, 97, 99,
423 99, 114, 114, 116, 116, 124, 124, 132, 132, 137,
424
425 137, 141, 141, 143, 143, 145, 145, 146, 146, 95,
426 147, 147, 147, 147, 147, 147, 115, 115, 98, 147,
427 147, 147, 147, 147, 147, 147, 147, 147, 35, 73,
428 98, 147, 147, 37, 147, 37, 73, 147, 34, 147,
429 3, 147, 147, 147, 147, 147, 147, 147, 147, 147,
430 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
431 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
432 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
433 147
434 } ;
435
436 static const short int yy_chk[382] =
437 { 0,
438 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
439 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
440 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
441 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
442 4, 9, 25, 12, 13, 13, 4, 9, 14, 14,
443 20, 4, 9, 20, 20, 25, 161, 22, 4, 9,
444 11, 11, 11, 11, 12, 21, 22, 11, 21, 11,
445 21, 17, 11, 11, 11, 11, 11, 17, 19, 22,
446 23, 19, 17, 127, 32, 29, 53, 19, 27, 17,
447 11, 15, 15, 15, 29, 28, 32, 15, 35, 35,
448
449 23, 53, 15, 15, 15, 15, 15, 18, 18, 18,
450 27, 127, 24, 18, 26, 28, 30, 28, 18, 18,
451 18, 18, 18, 24, 31, 49, 33, 26, 18, 51,
452 50, 18, 33, 24, 26, 31, 48, 33, 30, 36,
453 36, 36, 36, 46, 33, 52, 49, 54, 48, 46,
454 50, 55, 56, 51, 46, 57, 63, 59, 60, 61,
455 67, 46, 65, 66, 55, 64, 68, 158, 77, 52,
456 82, 54, 154, 57, 66, 56, 59, 77, 63, 82,
457 59, 67, 60, 61, 65, 64, 78, 68, 69, 69,
458 69, 70, 70, 70, 71, 71, 71, 69, 80, 78,
459
460 81, 83, 84, 86, 89, 90, 91, 95, 95, 100,
461 102, 80, 103, 81, 109, 104, 122, 122, 69, 117,
462 120, 100, 119, 84, 128, 83, 86, 91, 89, 90,
463 117, 119, 102, 120, 109, 111, 111, 111, 103, 104,
464 112, 112, 112, 126, 111, 133, 128, 129, 129, 130,
465 130, 139, 126, 151, 146, 129, 145, 144, 143, 142,
466 141, 138, 137, 135, 134, 111, 132, 131, 133, 125,
467 124, 121, 118, 116, 115, 139, 129, 148, 148, 148,
468 149, 114, 149, 149, 149, 150, 150, 152, 152, 153,
469 153, 155, 155, 156, 156, 157, 157, 159, 159, 160,
470
471 160, 162, 162, 163, 163, 164, 164, 165, 165, 113,
472 110, 108, 107, 106, 105, 101, 99, 98, 97, 94,
473 93, 92, 88, 87, 85, 79, 76, 75, 74, 73,
474 72, 62, 58, 45, 44, 38, 37, 16, 7, 3,
475 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
476 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
477 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
478 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
479 147
480 } ;
481
482 static yy_state_type yy_last_accepting_state;
483 static YY_CHAR *yy_last_accepting_cpos;
484
485 /* the intent behind this definition is that it'll catch
486 * any uses of REJECT which flex missed
487 */
488 #define REJECT reject_used_but_not_detected
489 #define yymore() yymore_used_but_not_detected
490 #define YY_MORE_ADJ 0
491
492 /* these variables are all declared out here so that section 3 code can
493 * manipulate them
494 */
495 /* points to current character in buffer */
496 static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
497 static int yy_init = 1; /* whether we need to initialize */
498 static int yy_start = 0; /* start state number */
499
500 /* flag which is used to allow yywrap()'s to do buffer switches
501 * instead of setting up a fresh yyin. A bit of a hack ...
502 */
503 static int yy_did_buffer_switch_on_eof;
504
505 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
506 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
507 static int yy_get_next_buffer YY_PROTO(( void ));
508 static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
509 void yyrestart YY_PROTO(( FILE *input_file ));
510 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
511 void yy_load_buffer_state YY_PROTO(( void ));
512 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
513 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
514 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
515
516 #define yy_new_buffer yy_create_buffer
517
518 #ifdef __cplusplus
519 static int yyinput YY_PROTO(( void ));
520 #else
521 static int input YY_PROTO(( void ));
522 #endif
523
524 YY_DECL
525 {
526 register yy_state_type yy_current_state;
527 register YY_CHAR *yy_cp, *yy_bp;
528 register int yy_act;
529
530
531
532 if ( yy_init )
533 {
534 YY_USER_INIT;
535
536 if ( ! yy_start )
537 yy_start = 1; /* first start state */
538
539 if ( ! yyin )
540 yyin = stdin;
541
542 if ( ! yyout )
543 yyout = stdout;
544
545 if ( yy_current_buffer )
546 yy_init_buffer( yy_current_buffer, yyin );
547 else
548 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
549
550 yy_load_buffer_state();
551
552 yy_init = 0;
553 }
554
555 while ( 1 ) /* loops until end-of-file is reached */
556 {
557 yy_cp = yy_c_buf_p;
558
559 /* support of yytext */
560 *yy_cp = yy_hold_char;
561
562 /* yy_bp points to the position in yy_ch_buf of the start of the
563 * current run.
564 */
565 yy_bp = yy_cp;
566
567 yy_current_state = yy_start;
568 yy_match:
569 do
570 {
571 register YY_CHAR yy_c = yy_ec[*yy_cp];
572 if ( yy_accept[yy_current_state] )
573 {
574 yy_last_accepting_state = yy_current_state;
575 yy_last_accepting_cpos = yy_cp;
576 }
577 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
578 {
579 yy_current_state = yy_def[yy_current_state];
580 if ( yy_current_state >= 148 )
581 yy_c = yy_meta[yy_c];
582 }
583 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
584 ++yy_cp;
585 }
586 while ( yy_current_state != 147 );
587 yy_cp = yy_last_accepting_cpos;
588 yy_current_state = yy_last_accepting_state;
589
590 yy_find_action:
591 yy_act = yy_accept[yy_current_state];
592
593 YY_DO_BEFORE_ACTION;
594 YY_USER_ACTION;
595
596 do_action: /* this label is used only to access EOF actions */
597
598
599 switch ( yy_act )
600 {
601 case 0: /* must backtrack */
602 /* undo the effects of YY_DO_BEFORE_ACTION */
603 *yy_cp = yy_hold_char;
604 yy_cp = yy_last_accepting_cpos;
605 yy_current_state = yy_last_accepting_state;
606 goto yy_find_action;
607
608 case 1:
609 # line 81 "tcplex.l"
610 return DST;
611 YY_BREAK
612 case 2:
613 # line 82 "tcplex.l"
614 return SRC;
615 YY_BREAK
616 case 3:
617 # line 84 "tcplex.l"
618 return ETHER;
619 YY_BREAK
620 case 4:
621 # line 85 "tcplex.l"
622 return ARP;
623 YY_BREAK
624 case 5:
625 # line 86 "tcplex.l"
626 return RARP;
627 YY_BREAK
628 case 6:
629 # line 87 "tcplex.l"
630 return IP;
631 YY_BREAK
632 case 7:
633 # line 88 "tcplex.l"
634 return TCP;
635 YY_BREAK
636 case 8:
637 # line 89 "tcplex.l"
638 return UDP;
639 YY_BREAK
640 case 9:
641 # line 90 "tcplex.l"
642 return ICMP;
643 YY_BREAK
644 case 10:
645 # line 92 "tcplex.l"
646 return HOST;
647 YY_BREAK
648 case 11:
649 # line 93 "tcplex.l"
650 return NET;
651 YY_BREAK
652 case 12:
653 # line 94 "tcplex.l"
654 return PORT;
655 YY_BREAK
656 case 13:
657 # line 95 "tcplex.l"
658 return PROTO;
659 YY_BREAK
660 case 14:
661 # line 97 "tcplex.l"
662 return GATEWAY;
663 YY_BREAK
664 case 15:
665 # line 99 "tcplex.l"
666 return LESS;
667 YY_BREAK
668 case 16:
669 # line 100 "tcplex.l"
670 return GREATER;
671 YY_BREAK
672 case 17:
673 # line 101 "tcplex.l"
674 return BYTE;
675 YY_BREAK
676 case 18:
677 # line 102 "tcplex.l"
678 return BROADCAST;
679 YY_BREAK
680 case 19:
681 # line 104 "tcplex.l"
682 return AND;
683 YY_BREAK
684 case 20:
685 # line 105 "tcplex.l"
686 return OR;
687 YY_BREAK
688 case 21:
689 # line 106 "tcplex.l"
690 return '!';
691 YY_BREAK
692 case 22:
693 # line 108 "tcplex.l"
694 return LEN;
695 YY_BREAK
696 case 23:
697 # line 110 "tcplex.l"
698 ;
699 YY_BREAK
700 case 24:
701 # line 111 "tcplex.l"
702 return yytext[0];
703 YY_BREAK
704 case 25:
705 # line 112 "tcplex.l"
706 return GEQ;
707 YY_BREAK
708 case 26:
709 # line 113 "tcplex.l"
710 return LEQ;
711 YY_BREAK
712 case 27:
713 # line 114 "tcplex.l"
714 return NEQ;
715 YY_BREAK
716 case 28:
717 # line 115 "tcplex.l"
718 return LSH;
719 YY_BREAK
720 case 29:
721 # line 116 "tcplex.l"
722 return RSH;
723 YY_BREAK
724 case 30:
725 # line 117 "tcplex.l"
726 { yylval.i = stoi(yytext); return NUM; }
727 YY_BREAK
728 case 31:
729 # line 118 "tcplex.l"
730 {
731 yylval.h = atoin(yytext); return HID;
732 }
733 YY_BREAK
734 case 32:
735 # line 121 "tcplex.l"
736 { yylval.e = ETHER_aton(yytext); return EID; }
737 YY_BREAK
738 case 33:
739 # line 122 "tcplex.l"
740 { error("bogus ethernet address %s", yytext); }
741 YY_BREAK
742 case 34:
743 # line 123 "tcplex.l"
744 { yylval.s = yytext; return ID; }
745 YY_BREAK
746 case 35:
747 # line 124 "tcplex.l"
748 { yylval.s = yytext + 1; return ID; }
749 YY_BREAK
750 case 36:
751 # line 125 "tcplex.l"
752 { error("illegal token: %s\n", yytext); }
753 YY_BREAK
754 case 37:
755 # line 126 "tcplex.l"
756 { error("illegal char '%c'", *yytext); }
757 YY_BREAK
758 case 38:
759 # line 127 "tcplex.l"
760 ECHO;
761 YY_BREAK
762 case YY_STATE_EOF(INITIAL):
763 yyterminate();
764
765 case YY_END_OF_BUFFER:
766 {
767 /* amount of text matched not including the EOB char */
768 int yy_amount_of_matched_text = yy_cp - yytext - 1;
769
770 /* undo the effects of YY_DO_BEFORE_ACTION */
771 *yy_cp = yy_hold_char;
772
773 /* note that here we test for yy_c_buf_p "<=" to the position
774 * of the first EOB in the buffer, since yy_c_buf_p will
775 * already have been incremented past the NUL character
776 * (since all states make transitions on EOB to the end-
777 * of-buffer state). Contrast this with the test in yyinput().
778 */
779 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
780 /* this was really a NUL */
781 {
782 yy_state_type yy_next_state;
783
784 yy_c_buf_p = yytext + yy_amount_of_matched_text;
785
786 yy_current_state = yy_get_previous_state();
787
788 /* okay, we're now positioned to make the
789 * NUL transition. We couldn't have
790 * yy_get_previous_state() go ahead and do it
791 * for us because it doesn't know how to deal
792 * with the possibility of jamming (and we
793 * don't want to build jamming into it because
794 * then it will run more slowly)
795 */
796
797 yy_next_state = yy_try_NUL_trans( yy_current_state );
798
799 yy_bp = yytext + YY_MORE_ADJ;
800
801 if ( yy_next_state )
802 {
803 /* consume the NUL */
804 yy_cp = ++yy_c_buf_p;
805 yy_current_state = yy_next_state;
806 goto yy_match;
807 }
808
809 else
810 {
811 yy_cp = yy_last_accepting_cpos;
812 yy_current_state = yy_last_accepting_state;
813 goto yy_find_action;
814 }
815 }
816
817 else switch ( yy_get_next_buffer() )
818 {
819 case EOB_ACT_END_OF_FILE:
820 {
821 yy_did_buffer_switch_on_eof = 0;
822
823 if ( yywrap() )
824 {
825 /* note: because we've taken care in
826 * yy_get_next_buffer() to have set up yytext,
827 * we can now set up yy_c_buf_p so that if some
828 * total hoser (like flex itself) wants
829 * to call the scanner after we return the
830 * YY_NULL, it'll still work - another YY_NULL
831 * will get returned.
832 */
833 yy_c_buf_p = yytext + YY_MORE_ADJ;
834
835 yy_act = YY_STATE_EOF((yy_start - 1) / 2);
836 goto do_action;
837 }
838
839 else
840 {
841 if ( ! yy_did_buffer_switch_on_eof )
842 YY_NEW_FILE;
843 }
844 }
845 break;
846
847 case EOB_ACT_CONTINUE_SCAN:
848 yy_c_buf_p = yytext + yy_amount_of_matched_text;
849
850 yy_current_state = yy_get_previous_state();
851
852 yy_cp = yy_c_buf_p;
853 yy_bp = yytext + YY_MORE_ADJ;
854 goto yy_match;
855
856 case EOB_ACT_LAST_MATCH:
857 yy_c_buf_p =
858 &yy_current_buffer->yy_ch_buf[yy_n_chars];
859
860 yy_current_state = yy_get_previous_state();
861
862 yy_cp = yy_c_buf_p;
863 yy_bp = yytext + YY_MORE_ADJ;
864 goto yy_find_action;
865 }
866 break;
867 }
868
869 default:
870 #ifdef FLEX_DEBUG
871 printf( "action # %d\n", yy_act );
872 #endif
873 YY_FATAL_ERROR(
874 "fatal flex scanner internal error--no action found" );
875 }
876 }
877 }
878
879
880 /* yy_get_next_buffer - try to read in a new buffer
881 *
882 * synopsis
883 * int yy_get_next_buffer();
884 *
885 * returns a code representing an action
886 * EOB_ACT_LAST_MATCH -
887 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
888 * EOB_ACT_END_OF_FILE - end of file
889 */
890
yy_get_next_buffer()891 static int yy_get_next_buffer()
892
893 {
894 register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
895 register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
896 register int number_to_move, i;
897 int ret_val;
898
899 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
900 YY_FATAL_ERROR(
901 "fatal flex scanner internal error--end of buffer missed" );
902
903 /* try to read more data */
904
905 /* first move last chars to start of buffer */
906 number_to_move = yy_c_buf_p - yytext;
907
908 for ( i = 0; i < number_to_move; ++i )
909 *(dest++) = *(source++);
910
911 if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
912 /* don't do the read, it's not guaranteed to return an EOF,
913 * just force an EOF
914 */
915 yy_n_chars = 0;
916
917 else
918 {
919 int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
920
921 if ( num_to_read > YY_READ_BUF_SIZE )
922 num_to_read = YY_READ_BUF_SIZE;
923
924 else if ( num_to_read <= 0 )
925 YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
926
927 /* read in more data */
928 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
929 yy_n_chars, num_to_read );
930 }
931
932 if ( yy_n_chars == 0 )
933 {
934 if ( number_to_move == 1 )
935 {
936 ret_val = EOB_ACT_END_OF_FILE;
937 yy_current_buffer->yy_eof_status = EOF_DONE;
938 }
939
940 else
941 {
942 ret_val = EOB_ACT_LAST_MATCH;
943 yy_current_buffer->yy_eof_status = EOF_PENDING;
944 }
945 }
946
947 else
948 ret_val = EOB_ACT_CONTINUE_SCAN;
949
950 yy_n_chars += number_to_move;
951 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
952 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
953
954 /* yytext begins at the second character in yy_ch_buf; the first
955 * character is the one which preceded it before reading in the latest
956 * buffer; it needs to be kept around in case it's a newline, so
957 * yy_get_previous_state() will have with '^' rules active
958 */
959
960 yytext = &yy_current_buffer->yy_ch_buf[1];
961
962 return ( ret_val );
963 }
964
965
966 /* yy_get_previous_state - get the state just before the EOB char was reached
967 *
968 * synopsis
969 * yy_state_type yy_get_previous_state();
970 */
971
yy_get_previous_state()972 static yy_state_type yy_get_previous_state()
973
974 {
975 register yy_state_type yy_current_state;
976 register YY_CHAR *yy_cp;
977
978 yy_current_state = yy_start;
979
980 for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
981 {
982 register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1);
983 if ( yy_accept[yy_current_state] )
984 {
985 yy_last_accepting_state = yy_current_state;
986 yy_last_accepting_cpos = yy_cp;
987 }
988 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
989 {
990 yy_current_state = yy_def[yy_current_state];
991 if ( yy_current_state >= 148 )
992 yy_c = yy_meta[yy_c];
993 }
994 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
995 }
996
997 return ( yy_current_state );
998 }
999
1000
1001 /* yy_try_NUL_trans - try to make a transition on the NUL character
1002 *
1003 * synopsis
1004 * next_state = yy_try_NUL_trans( current_state );
1005 */
1006
1007 #ifdef YY_USE_PROTOS
yy_try_NUL_trans(register yy_state_type yy_current_state)1008 static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
1009 #else
1010 static yy_state_type yy_try_NUL_trans( yy_current_state )
1011 register yy_state_type yy_current_state;
1012 #endif
1013
1014 {
1015 register int yy_is_jam;
1016 register YY_CHAR *yy_cp = yy_c_buf_p;
1017
1018 register YY_CHAR yy_c = 1;
1019 if ( yy_accept[yy_current_state] )
1020 {
1021 yy_last_accepting_state = yy_current_state;
1022 yy_last_accepting_cpos = yy_cp;
1023 }
1024 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1025 {
1026 yy_current_state = yy_def[yy_current_state];
1027 if ( yy_current_state >= 148 )
1028 yy_c = yy_meta[yy_c];
1029 }
1030 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1031 yy_is_jam = (yy_current_state == 147);
1032
1033 return ( yy_is_jam ? 0 : yy_current_state );
1034 }
1035
1036
1037 #ifdef YY_USE_PROTOS
yyunput(YY_CHAR c,register YY_CHAR * yy_bp)1038 static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
1039 #else
1040 static void yyunput( c, yy_bp )
1041 YY_CHAR c;
1042 register YY_CHAR *yy_bp;
1043 #endif
1044
1045 {
1046 register YY_CHAR *yy_cp = yy_c_buf_p;
1047
1048 /* undo effects of setting up yytext */
1049 *yy_cp = yy_hold_char;
1050
1051 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1052 { /* need to shift things up to make room */
1053 register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
1054 register YY_CHAR *dest =
1055 &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
1056 register YY_CHAR *source =
1057 &yy_current_buffer->yy_ch_buf[number_to_move];
1058
1059 while ( source > yy_current_buffer->yy_ch_buf )
1060 *--dest = *--source;
1061
1062 yy_cp += dest - source;
1063 yy_bp += dest - source;
1064 yy_n_chars = yy_current_buffer->yy_buf_size;
1065
1066 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1067 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1068 }
1069
1070 if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
1071 yy_cp[-2] = '\n';
1072
1073 *--yy_cp = c;
1074
1075 /* note: the formal parameter *must* be called "yy_bp" for this
1076 * macro to now work correctly
1077 */
1078 YY_DO_BEFORE_ACTION; /* set up yytext again */
1079 }
1080
1081
1082 #ifdef __cplusplus
yyinput()1083 static int yyinput()
1084 #else
1085 static int input()
1086 #endif
1087
1088 {
1089 int c;
1090 YY_CHAR *yy_cp = yy_c_buf_p;
1091
1092 *yy_cp = yy_hold_char;
1093
1094 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1095 {
1096 /* yy_c_buf_p now points to the character we want to return.
1097 * If this occurs *before* the EOB characters, then it's a
1098 * valid NUL; if not, then we've hit the end of the buffer.
1099 */
1100 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1101 /* this was really a NUL */
1102 *yy_c_buf_p = '\0';
1103
1104 else
1105 { /* need more input */
1106 yytext = yy_c_buf_p;
1107 ++yy_c_buf_p;
1108
1109 switch ( yy_get_next_buffer() )
1110 {
1111 case EOB_ACT_END_OF_FILE:
1112 {
1113 if ( yywrap() )
1114 {
1115 yy_c_buf_p = yytext + YY_MORE_ADJ;
1116 return ( EOF );
1117 }
1118
1119 YY_NEW_FILE;
1120
1121 #ifdef __cplusplus
1122 return ( yyinput() );
1123 #else
1124 return ( input() );
1125 #endif
1126 }
1127 break;
1128
1129 case EOB_ACT_CONTINUE_SCAN:
1130 yy_c_buf_p = yytext + YY_MORE_ADJ;
1131 break;
1132
1133 case EOB_ACT_LAST_MATCH:
1134 #ifdef __cplusplus
1135 YY_FATAL_ERROR( "unexpected last match in yyinput()" );
1136 #else
1137 YY_FATAL_ERROR( "unexpected last match in input()" );
1138 #endif
1139 }
1140 }
1141 }
1142
1143 c = *yy_c_buf_p;
1144 yy_hold_char = *++yy_c_buf_p;
1145
1146 return ( c );
1147 }
1148
1149
1150 #ifdef YY_USE_PROTOS
yyrestart(FILE * input_file)1151 void yyrestart( FILE *input_file )
1152 #else
1153 void yyrestart( input_file )
1154 FILE *input_file;
1155 #endif
1156
1157 {
1158 yy_init_buffer( yy_current_buffer, input_file );
1159 yy_load_buffer_state();
1160 }
1161
1162
1163 #ifdef YY_USE_PROTOS
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)1164 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1165 #else
1166 void yy_switch_to_buffer( new_buffer )
1167 YY_BUFFER_STATE new_buffer;
1168 #endif
1169
1170 {
1171 if ( yy_current_buffer == new_buffer )
1172 return;
1173
1174 if ( yy_current_buffer )
1175 {
1176 /* flush out information for old buffer */
1177 *yy_c_buf_p = yy_hold_char;
1178 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1179 yy_current_buffer->yy_n_chars = yy_n_chars;
1180 }
1181
1182 yy_current_buffer = new_buffer;
1183 yy_load_buffer_state();
1184
1185 /* we don't actually know whether we did this switch during
1186 * EOF (yywrap()) processing, but the only time this flag
1187 * is looked at is after yywrap() is called, so it's safe
1188 * to go ahead and always set it.
1189 */
1190 yy_did_buffer_switch_on_eof = 1;
1191 }
1192
1193
1194 #ifdef YY_USE_PROTOS
yy_load_buffer_state(void)1195 void yy_load_buffer_state( void )
1196 #else
1197 void yy_load_buffer_state()
1198 #endif
1199
1200 {
1201 yy_n_chars = yy_current_buffer->yy_n_chars;
1202 yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1203 yyin = yy_current_buffer->yy_input_file;
1204 yy_hold_char = *yy_c_buf_p;
1205 }
1206
1207
1208 #ifdef YY_USE_PROTOS
yy_create_buffer(FILE * file,int size)1209 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1210 #else
1211 YY_BUFFER_STATE yy_create_buffer( file, size )
1212 FILE *file;
1213 int size;
1214 #endif
1215
1216 {
1217 YY_BUFFER_STATE b;
1218
1219 b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
1220
1221 if ( ! b )
1222 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1223
1224 b->yy_buf_size = size;
1225
1226 /* yy_ch_buf has to be 2 characters longer than the size given because
1227 * we need to put in 2 end-of-buffer characters.
1228 */
1229 b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
1230
1231 if ( ! b->yy_ch_buf )
1232 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1233
1234 yy_init_buffer( b, file );
1235
1236 return ( b );
1237 }
1238
1239
1240 #ifdef YY_USE_PROTOS
yy_delete_buffer(YY_BUFFER_STATE b)1241 void yy_delete_buffer( YY_BUFFER_STATE b )
1242 #else
1243 void yy_delete_buffer( b )
1244 YY_BUFFER_STATE b;
1245 #endif
1246
1247 {
1248 if ( b == yy_current_buffer )
1249 yy_current_buffer = (YY_BUFFER_STATE) 0;
1250
1251 free( (char *) b->yy_ch_buf );
1252 free( (char *) b );
1253 }
1254
1255
1256 #ifdef YY_USE_PROTOS
yy_init_buffer(YY_BUFFER_STATE b,FILE * file)1257 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1258 #else
1259 void yy_init_buffer( b, file )
1260 YY_BUFFER_STATE b;
1261 FILE *file;
1262 #endif
1263
1264 {
1265 b->yy_input_file = file;
1266
1267 /* we put in the '\n' and start reading from [1] so that an
1268 * initial match-at-newline will be true.
1269 */
1270
1271 b->yy_ch_buf[0] = '\n';
1272 b->yy_n_chars = 1;
1273
1274 /* we always need two end-of-buffer characters. The first causes
1275 * a transition to the end-of-buffer state. The second causes
1276 * a jam in that state.
1277 */
1278 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1279 b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
1280
1281 b->yy_buf_pos = &b->yy_ch_buf[1];
1282
1283 b->yy_eof_status = EOF_NOT_SEEN;
1284 }
1285 # line 127 "tcplex.l"
1286
1287 void
lex_init(buf)1288 lex_init(buf)
1289 char *buf;
1290 {
1291 in_buffer = buf;
1292 }
1293 #ifndef FLEX_SCANNER
1294 int
yywrap()1295 yywrap()
1296 /* so we don't need -ll */
1297 {
1298 return 1;
1299 }
1300 #endif
1301