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