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