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