Annotation of embedaddon/ipsec-tools/src/racoon/prsa_tok.c, revision 1.1.1.1
1.1 misho 1: #line 2 "prsa_tok.c"
2:
3: #line 4 "prsa_tok.c"
4:
5: #define YY_INT_ALIGNED short int
6:
7: /* A lexical scanner generated by flex */
8:
9: #define yy_create_buffer prsa_create_buffer
10: #define yy_delete_buffer prsa_delete_buffer
11: #define yy_flex_debug prsa_flex_debug
12: #define yy_init_buffer prsa_init_buffer
13: #define yy_flush_buffer prsa_flush_buffer
14: #define yy_load_buffer_state prsa_load_buffer_state
15: #define yy_switch_to_buffer prsa_switch_to_buffer
16: #define yyin prsain
17: #define yyleng prsaleng
18: #define yylex prsalex
19: #define yylineno prsalineno
20: #define yyout prsaout
21: #define yyrestart prsarestart
22: #define yytext prsatext
23: #define yywrap prsawrap
24: #define yyalloc prsaalloc
25: #define yyrealloc prsarealloc
26: #define yyfree prsafree
27:
28: #define FLEX_SCANNER
29: #define YY_FLEX_MAJOR_VERSION 2
30: #define YY_FLEX_MINOR_VERSION 5
31: #define YY_FLEX_SUBMINOR_VERSION 35
32: #if YY_FLEX_SUBMINOR_VERSION > 0
33: #define FLEX_BETA
34: #endif
35:
36: /* First, we deal with platform-specific or compiler-specific issues. */
37:
38: /* begin standard C headers. */
39: #include <stdio.h>
40: #include <string.h>
41: #include <errno.h>
42: #include <stdlib.h>
43:
44: /* end standard C headers. */
45:
46: /* flex integer type definitions */
47:
48: #ifndef FLEXINT_H
49: #define FLEXINT_H
50:
51: /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
52:
53: #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
54:
55: /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
56: * if you want the limit (max/min) macros for int types.
57: */
58: #ifndef __STDC_LIMIT_MACROS
59: #define __STDC_LIMIT_MACROS 1
60: #endif
61:
62: #include <inttypes.h>
63: typedef int8_t flex_int8_t;
64: typedef uint8_t flex_uint8_t;
65: typedef int16_t flex_int16_t;
66: typedef uint16_t flex_uint16_t;
67: typedef int32_t flex_int32_t;
68: typedef uint32_t flex_uint32_t;
69: #else
70: typedef signed char flex_int8_t;
71: typedef short int flex_int16_t;
72: typedef int flex_int32_t;
73: typedef unsigned char flex_uint8_t;
74: typedef unsigned short int flex_uint16_t;
75: typedef unsigned int flex_uint32_t;
76:
77: /* Limits of integral types. */
78: #ifndef INT8_MIN
79: #define INT8_MIN (-128)
80: #endif
81: #ifndef INT16_MIN
82: #define INT16_MIN (-32767-1)
83: #endif
84: #ifndef INT32_MIN
85: #define INT32_MIN (-2147483647-1)
86: #endif
87: #ifndef INT8_MAX
88: #define INT8_MAX (127)
89: #endif
90: #ifndef INT16_MAX
91: #define INT16_MAX (32767)
92: #endif
93: #ifndef INT32_MAX
94: #define INT32_MAX (2147483647)
95: #endif
96: #ifndef UINT8_MAX
97: #define UINT8_MAX (255U)
98: #endif
99: #ifndef UINT16_MAX
100: #define UINT16_MAX (65535U)
101: #endif
102: #ifndef UINT32_MAX
103: #define UINT32_MAX (4294967295U)
104: #endif
105:
106: #endif /* ! C99 */
107:
108: #endif /* ! FLEXINT_H */
109:
110: #ifdef __cplusplus
111:
112: /* The "const" storage-class-modifier is valid. */
113: #define YY_USE_CONST
114:
115: #else /* ! __cplusplus */
116:
117: /* C99 requires __STDC__ to be defined as 1. */
118: #if defined (__STDC__)
119:
120: #define YY_USE_CONST
121:
122: #endif /* defined (__STDC__) */
123: #endif /* ! __cplusplus */
124:
125: #ifdef YY_USE_CONST
126: #define yyconst const
127: #else
128: #define yyconst
129: #endif
130:
131: /* Returned upon end-of-file. */
132: #define YY_NULL 0
133:
134: /* Promotes a possibly negative, possibly signed char to an unsigned
135: * integer for use as an array index. If the signed char is negative,
136: * we want to instead treat it as an 8-bit unsigned char, hence the
137: * double cast.
138: */
139: #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
140:
141: /* Enter a start condition. This macro really ought to take a parameter,
142: * but we do it the disgusting crufty way forced on us by the ()-less
143: * definition of BEGIN.
144: */
145: #define BEGIN (yy_start) = 1 + 2 *
146:
147: /* Translate the current start state into a value that can be later handed
148: * to BEGIN to return to the state. The YYSTATE alias is for lex
149: * compatibility.
150: */
151: #define YY_START (((yy_start) - 1) / 2)
152: #define YYSTATE YY_START
153:
154: /* Action number for EOF rule of a given start state. */
155: #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
156:
157: /* Special action meaning "start processing a new file". */
158: #define YY_NEW_FILE prsarestart(prsain )
159:
160: #define YY_END_OF_BUFFER_CHAR 0
161:
162: /* Size of default input buffer. */
163: #ifndef YY_BUF_SIZE
164: #ifdef __ia64__
165: /* On IA-64, the buffer size is 16k, not 8k.
166: * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
167: * Ditto for the __ia64__ case accordingly.
168: */
169: #define YY_BUF_SIZE 32768
170: #else
171: #define YY_BUF_SIZE 16384
172: #endif /* __ia64__ */
173: #endif
174:
175: /* The state buf must be large enough to hold one state per character in the main buffer.
176: */
177: #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
178:
179: #ifndef YY_TYPEDEF_YY_BUFFER_STATE
180: #define YY_TYPEDEF_YY_BUFFER_STATE
181: typedef struct yy_buffer_state *YY_BUFFER_STATE;
182: #endif
183:
184: extern int prsaleng;
185:
186: extern FILE *prsain, *prsaout;
187:
188: #define EOB_ACT_CONTINUE_SCAN 0
189: #define EOB_ACT_END_OF_FILE 1
190: #define EOB_ACT_LAST_MATCH 2
191:
192: #define YY_LESS_LINENO(n)
193:
194: /* Return all but the first "n" matched characters back to the input stream. */
195: #define yyless(n) \
196: do \
197: { \
198: /* Undo effects of setting up prsatext. */ \
199: int yyless_macro_arg = (n); \
200: YY_LESS_LINENO(yyless_macro_arg);\
201: *yy_cp = (yy_hold_char); \
202: YY_RESTORE_YY_MORE_OFFSET \
203: (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
204: YY_DO_BEFORE_ACTION; /* set up prsatext again */ \
205: } \
206: while ( 0 )
207:
208: #define unput(c) yyunput( c, (yytext_ptr) )
209:
210: #ifndef YY_TYPEDEF_YY_SIZE_T
211: #define YY_TYPEDEF_YY_SIZE_T
212: typedef size_t yy_size_t;
213: #endif
214:
215: #ifndef YY_STRUCT_YY_BUFFER_STATE
216: #define YY_STRUCT_YY_BUFFER_STATE
217: struct yy_buffer_state
218: {
219: FILE *yy_input_file;
220:
221: char *yy_ch_buf; /* input buffer */
222: char *yy_buf_pos; /* current position in input buffer */
223:
224: /* Size of input buffer in bytes, not including room for EOB
225: * characters.
226: */
227: yy_size_t yy_buf_size;
228:
229: /* Number of characters read into yy_ch_buf, not including EOB
230: * characters.
231: */
232: int yy_n_chars;
233:
234: /* Whether we "own" the buffer - i.e., we know we created it,
235: * and can realloc() it to grow it, and should free() it to
236: * delete it.
237: */
238: int yy_is_our_buffer;
239:
240: /* Whether this is an "interactive" input source; if so, and
241: * if we're using stdio for input, then we want to use getc()
242: * instead of fread(), to make sure we stop fetching input after
243: * each newline.
244: */
245: int yy_is_interactive;
246:
247: /* Whether we're considered to be at the beginning of a line.
248: * If so, '^' rules will be active on the next match, otherwise
249: * not.
250: */
251: int yy_at_bol;
252:
253: int yy_bs_lineno; /**< The line count. */
254: int yy_bs_column; /**< The column count. */
255:
256: /* Whether to try to fill the input buffer when we reach the
257: * end of it.
258: */
259: int yy_fill_buffer;
260:
261: int yy_buffer_status;
262:
263: #define YY_BUFFER_NEW 0
264: #define YY_BUFFER_NORMAL 1
265: /* When an EOF's been seen but there's still some text to process
266: * then we mark the buffer as YY_EOF_PENDING, to indicate that we
267: * shouldn't try reading from the input source any more. We might
268: * still have a bunch of tokens to match, though, because of
269: * possible backing-up.
270: *
271: * When we actually see the EOF, we change the status to "new"
272: * (via prsarestart()), so that the user can continue scanning by
273: * just pointing prsain at a new input file.
274: */
275: #define YY_BUFFER_EOF_PENDING 2
276:
277: };
278: #endif /* !YY_STRUCT_YY_BUFFER_STATE */
279:
280: /* Stack of input buffers. */
281: static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
282: static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
283: static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
284:
285: /* We provide macros for accessing buffer states in case in the
286: * future we want to put the buffer states in a more general
287: * "scanner state".
288: *
289: * Returns the top of the stack, or NULL.
290: */
291: #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
292: ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
293: : NULL)
294:
295: /* Same as previous macro, but useful when we know that the buffer stack is not
296: * NULL or when we need an lvalue. For internal use only.
297: */
298: #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
299:
300: /* yy_hold_char holds the character lost when prsatext is formed. */
301: static char yy_hold_char;
302: static int yy_n_chars; /* number of characters read into yy_ch_buf */
303: int prsaleng;
304:
305: /* Points to current character in buffer. */
306: static char *yy_c_buf_p = (char *) 0;
307: static int yy_init = 0; /* whether we need to initialize */
308: static int yy_start = 0; /* start state number */
309:
310: /* Flag which is used to allow prsawrap()'s to do buffer switches
311: * instead of setting up a fresh prsain. A bit of a hack ...
312: */
313: static int yy_did_buffer_switch_on_eof;
314:
315: void prsarestart (FILE *input_file );
316: void prsa_switch_to_buffer (YY_BUFFER_STATE new_buffer );
317: YY_BUFFER_STATE prsa_create_buffer (FILE *file,int size );
318: void prsa_delete_buffer (YY_BUFFER_STATE b );
319: void prsa_flush_buffer (YY_BUFFER_STATE b );
320: void prsapush_buffer_state (YY_BUFFER_STATE new_buffer );
321: void prsapop_buffer_state (void );
322:
323: static void prsaensure_buffer_stack (void );
324: static void prsa_load_buffer_state (void );
325: static void prsa_init_buffer (YY_BUFFER_STATE b,FILE *file );
326:
327: #define YY_FLUSH_BUFFER prsa_flush_buffer(YY_CURRENT_BUFFER )
328:
329: YY_BUFFER_STATE prsa_scan_buffer (char *base,yy_size_t size );
330: YY_BUFFER_STATE prsa_scan_string (yyconst char *yy_str );
331: YY_BUFFER_STATE prsa_scan_bytes (yyconst char *bytes,int len );
332:
333: void *prsaalloc (yy_size_t );
334: void *prsarealloc (void *,yy_size_t );
335: void prsafree (void * );
336:
337: #define yy_new_buffer prsa_create_buffer
338:
339: #define yy_set_interactive(is_interactive) \
340: { \
341: if ( ! YY_CURRENT_BUFFER ){ \
342: prsaensure_buffer_stack (); \
343: YY_CURRENT_BUFFER_LVALUE = \
344: prsa_create_buffer(prsain,YY_BUF_SIZE ); \
345: } \
346: YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
347: }
348:
349: #define yy_set_bol(at_bol) \
350: { \
351: if ( ! YY_CURRENT_BUFFER ){\
352: prsaensure_buffer_stack (); \
353: YY_CURRENT_BUFFER_LVALUE = \
354: prsa_create_buffer(prsain,YY_BUF_SIZE ); \
355: } \
356: YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
357: }
358:
359: #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
360:
361: /* Begin user sect3 */
362:
363: typedef unsigned char YY_CHAR;
364:
365: FILE *prsain = (FILE *) 0, *prsaout = (FILE *) 0;
366:
367: typedef int yy_state_type;
368:
369: extern int prsalineno;
370:
371: int prsalineno = 1;
372:
373: extern char *prsatext;
374: #define yytext_ptr prsatext
375:
376: static yy_state_type yy_get_previous_state (void );
377: static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
378: static int yy_get_next_buffer (void );
379: static void yy_fatal_error (yyconst char msg[] );
380:
381: /* Done after the current pattern has been matched and before the
382: * corresponding action - sets up prsatext.
383: */
384: #define YY_DO_BEFORE_ACTION \
385: (yytext_ptr) = yy_bp; \
386: prsaleng = (size_t) (yy_cp - yy_bp); \
387: (yy_hold_char) = *yy_cp; \
388: *yy_cp = '\0'; \
389: (yy_c_buf_p) = yy_cp;
390:
391: #define YY_NUM_RULES 25
392: #define YY_END_OF_BUFFER 26
393: /* This struct is not used in this scanner,
394: but its presence is necessary. */
395: struct yy_trans_info
396: {
397: flex_int32_t yy_verify;
398: flex_int32_t yy_nxt;
399: };
400: static yyconst flex_int16_t yy_accept[194] =
401: { 0,
402: 22, 22, 26, 25, 22, 23, 24, 17, 18, 18,
403: 18, 18, 3, 25, 25, 25, 25, 25, 25, 25,
404: 1, 2, 22, 24, 0, 18, 21, 0, 0, 0,
405: 18, 18, 18, 21, 21, 21, 21, 21, 0, 0,
406: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
407: 18, 0, 21, 8, 7, 18, 0, 21, 21, 21,
408: 21, 21, 21, 21, 21, 21, 0, 0, 0, 5,
409: 6, 0, 0, 4, 19, 0, 0, 0, 0, 18,
410: 0, 0, 0, 0, 21, 21, 0, 21, 21, 21,
411: 21, 21, 0, 0, 0, 0, 0, 0, 0, 0,
412:
413: 0, 18, 0, 0, 0, 0, 21, 0, 0, 0,
414: 21, 21, 0, 0, 0, 0, 0, 0, 0, 0,
415: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
416: 0, 0, 12, 13, 0, 0, 20, 20, 20, 0,
417: 0, 0, 0, 0, 0, 0, 0, 0, 9, 0,
418: 0, 20, 20, 20, 21, 21, 21, 0, 0, 0,
419: 0, 0, 0, 0, 0, 21, 21, 21, 21, 21,
420: 21, 0, 14, 15, 0, 0, 21, 21, 21, 0,
421: 0, 0, 16, 0, 0, 0, 0, 0, 0, 0,
422: 10, 11, 0
423:
424: } ;
425:
426: static yyconst flex_int32_t yy_ec[256] =
427: { 0,
428: 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
429: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431: 1, 2, 1, 1, 4, 1, 1, 1, 1, 1,
432: 1, 1, 5, 1, 1, 6, 7, 8, 9, 10,
433: 11, 11, 12, 13, 13, 13, 13, 14, 1, 1,
434: 5, 1, 1, 1, 15, 16, 17, 18, 19, 18,
435: 5, 5, 5, 5, 20, 5, 21, 5, 5, 22,
436: 5, 23, 24, 5, 25, 5, 5, 5, 5, 5,
437: 1, 1, 1, 1, 1, 1, 26, 27, 28, 29,
438:
439: 30, 31, 5, 5, 32, 5, 5, 33, 34, 35,
440: 36, 37, 5, 38, 39, 40, 41, 42, 5, 43,
441: 44, 5, 45, 1, 46, 1, 1, 1, 1, 1,
442: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
443: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
444: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
445: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
446: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
447: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
448: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
449:
450: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
451: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
452: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
453: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
454: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
455: 1, 1, 1, 1, 1
456: } ;
457:
458: static yyconst flex_int32_t yy_meta[47] =
459: { 0,
460: 1, 1, 2, 1, 3, 4, 3, 5, 5, 5,
461: 5, 5, 5, 6, 7, 7, 7, 7, 7, 3,
462: 3, 3, 3, 3, 3, 7, 7, 7, 7, 7,
463: 7, 3, 3, 3, 3, 3, 3, 3, 3, 3,
464: 3, 3, 3, 3, 1, 1
465: } ;
466:
467: static yyconst flex_int16_t yy_base[213] =
468: { 0,
469: 0, 0, 674, 675, 671, 675, 0, 675, 41, 22,
470: 77, 65, 113, 122, 636, 628, 634, 54, 645, 633,
471: 675, 675, 665, 0, 88, 130, 154, 163, 0, 0,
472: 0, 653, 94, 171, 100, 142, 195, 204, 635, 627,
473: 634, 642, 645, 628, 632, 643, 613, 650, 212, 649,
474: 220, 246, 0, 0, 0, 648, 183, 254, 280, 0,
475: 640, 646, 288, 232, 266, 314, 620, 614, 608, 675,
476: 675, 49, 615, 675, 675, 300, 641, 322, 640, 631,
477: 630, 637, 329, 636, 123, 164, 335, 343, 369, 0,
478: 628, 634, 608, 603, 604, 606, 609, 602, 627, 377,
479:
480: 626, 355, 383, 625, 391, 624, 615, 622, 398, 621,
481: 205, 247, 594, 595, 583, 53, 583, 594, 404, 615,
482: 412, 614, 613, 419, 612, 425, 577, 433, 574, 550,
483: 533, 482, 675, 675, 448, 452, 438, 444, 450, 456,
484: 434, 464, 420, 413, 471, 399, 366, 344, 675, 357,
485: 307, 477, 483, 675, 488, 494, 500, 506, 330, 514,
486: 323, 291, 72, 252, 250, 519, 525, 675, 530, 536,
487: 542, 244, 675, 675, 190, 119, 548, 554, 675, 79,
488: 82, 82, 675, 80, 84, 64, 58, 31, 24, 8,
489: 675, 675, 675, 566, 569, 574, 577, 580, 584, 586,
490:
491: 587, 590, 592, 594, 598, 600, 602, 604, 606, 608,
492: 610, 612
493: } ;
494:
495: static yyconst flex_int16_t yy_def[213] =
496: { 0,
497: 193, 1, 193, 193, 193, 193, 194, 193, 193, 9,
498: 9, 11, 195, 11, 14, 14, 193, 193, 193, 14,
499: 193, 193, 193, 194, 193, 193, 195, 26, 196, 197,
500: 26, 26, 26, 193, 34, 35, 198, 35, 193, 193,
501: 193, 193, 193, 193, 193, 193, 193, 199, 193, 200,
502: 193, 51, 27, 196, 197, 51, 193, 193, 58, 58,
503: 58, 59, 193, 63, 64, 64, 193, 193, 193, 193,
504: 193, 193, 193, 193, 193, 193, 200, 193, 193, 201,
505: 193, 202, 193, 203, 204, 204, 193, 193, 88, 88,
506: 88, 89, 193, 193, 193, 193, 193, 193, 205, 193,
507:
508: 206, 193, 193, 203, 193, 193, 193, 207, 193, 208,
509: 204, 204, 193, 193, 193, 193, 193, 193, 193, 206,
510: 193, 193, 209, 193, 210, 193, 208, 193, 193, 193,
511: 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
512: 210, 193, 193, 211, 193, 212, 193, 193, 193, 193,
513: 193, 193, 193, 193, 193, 193, 193, 193, 212, 193,
514: 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
515: 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
516: 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
517: 193, 193, 0, 193, 193, 193, 193, 193, 193, 193,
518:
519: 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
520: 193, 193
521: } ;
522:
523: static yyconst flex_int16_t yy_nxt[722] =
524: { 0,
525: 4, 5, 6, 7, 4, 4, 8, 9, 10, 11,
526: 12, 12, 12, 13, 14, 14, 15, 14, 16, 4,
527: 17, 18, 19, 4, 4, 20, 14, 14, 14, 14,
528: 14, 4, 4, 4, 4, 4, 4, 4, 4, 4,
529: 4, 4, 4, 4, 21, 22, 25, 192, 26, 26,
530: 26, 26, 26, 26, 27, 28, 28, 28, 28, 28,
531: 193, 133, 134, 191, 193, 190, 28, 28, 28, 28,
532: 28, 28, 33, 33, 33, 33, 33, 42, 43, 29,
533: 173, 174, 96, 30, 31, 31, 31, 31, 32, 33,
534: 97, 44, 189, 188, 45, 48, 48, 49, 50, 50,
535:
536: 50, 56, 56, 56, 56, 56, 56, 60, 60, 60,
537: 60, 61, 62, 187, 186, 193, 185, 184, 183, 193,
538: 34, 34, 35, 36, 36, 36, 37, 193, 57, 28,
539: 28, 28, 28, 28, 28, 25, 27, 51, 51, 51,
540: 51, 51, 51, 27, 52, 52, 52, 52, 52, 62,
541: 62, 62, 62, 62, 182, 52, 52, 52, 52, 52,
542: 52, 34, 34, 35, 36, 36, 36, 53, 193, 193,
543: 52, 52, 52, 52, 52, 52, 57, 27, 58, 58,
544: 58, 58, 58, 58, 27, 59, 59, 59, 59, 59,
545: 82, 82, 83, 84, 84, 84, 59, 59, 59, 59,
546:
547: 59, 59, 63, 63, 64, 65, 65, 65, 53, 193,
548: 87, 59, 59, 59, 59, 59, 59, 76, 27, 77,
549: 77, 77, 77, 78, 79, 25, 181, 80, 80, 80,
550: 80, 80, 80, 27, 81, 81, 81, 81, 81, 90,
551: 90, 90, 90, 91, 92, 81, 81, 81, 81, 81,
552: 81, 193, 193, 81, 81, 81, 81, 81, 81, 57,
553: 27, 85, 85, 85, 85, 85, 85, 27, 86, 86,
554: 86, 86, 86, 92, 92, 92, 92, 92, 180, 86,
555: 86, 86, 86, 86, 86, 193, 176, 86, 86, 86,
556: 86, 86, 86, 87, 175, 88, 88, 88, 88, 88,
557:
558: 88, 27, 89, 89, 89, 89, 89, 99, 99, 100,
559: 101, 101, 101, 89, 89, 89, 89, 89, 89, 193,
560: 172, 89, 89, 89, 89, 89, 89, 76, 158, 79,
561: 79, 79, 79, 79, 103, 158, 104, 104, 104, 104,
562: 105, 106, 108, 108, 109, 110, 110, 110, 87, 165,
563: 111, 111, 111, 111, 111, 111, 27, 112, 112, 112,
564: 112, 112, 102, 102, 102, 102, 102, 102, 112, 112,
565: 112, 112, 112, 112, 193, 164, 112, 112, 112, 112,
566: 112, 112, 119, 163, 120, 120, 120, 120, 121, 122,
567: 123, 123, 124, 125, 125, 125, 103, 162, 106, 106,
568:
569: 106, 106, 106, 126, 158, 127, 127, 127, 127, 128,
570: 129, 137, 137, 138, 139, 139, 139, 119, 158, 122,
571: 122, 122, 122, 122, 140, 140, 141, 141, 141, 141,
572: 142, 143, 144, 144, 145, 146, 146, 146, 126, 140,
573: 129, 129, 129, 129, 129, 139, 139, 139, 139, 139,
574: 139, 152, 152, 152, 152, 153, 154, 154, 154, 154,
575: 154, 154, 154, 155, 155, 156, 157, 157, 157, 140,
576: 151, 143, 143, 143, 143, 143, 158, 150, 159, 159,
577: 159, 159, 160, 161, 154, 154, 154, 154, 154, 154,
578: 154, 154, 154, 154, 154, 157, 157, 157, 157, 157,
579:
580: 157, 166, 166, 166, 166, 167, 168, 168, 168, 168,
581: 168, 168, 168, 169, 169, 170, 171, 171, 171, 158,
582: 149, 161, 161, 161, 161, 161, 168, 168, 168, 168,
583: 168, 168, 168, 168, 168, 168, 168, 171, 171, 171,
584: 171, 171, 171, 177, 177, 177, 177, 178, 179, 179,
585: 179, 179, 179, 179, 179, 179, 179, 179, 179, 179,
586: 179, 179, 179, 179, 179, 179, 24, 148, 24, 24,
587: 24, 24, 24, 38, 38, 38, 54, 147, 54, 126,
588: 54, 55, 126, 55, 66, 66, 66, 50, 50, 79,
589: 79, 102, 102, 84, 84, 106, 106, 107, 107, 107,
590:
591: 107, 101, 101, 122, 122, 110, 110, 129, 129, 125,
592: 125, 143, 143, 146, 146, 161, 161, 140, 140, 119,
593: 119, 136, 135, 132, 131, 130, 126, 126, 27, 103,
594: 103, 119, 119, 118, 117, 116, 115, 114, 113, 87,
595: 112, 103, 103, 27, 27, 76, 76, 98, 95, 94,
596: 93, 57, 86, 193, 76, 76, 75, 74, 73, 72,
597: 71, 70, 69, 68, 67, 56, 23, 47, 46, 41,
598: 40, 39, 23, 193, 3, 193, 193, 193, 193, 193,
599: 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
600: 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
601:
602: 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
603: 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
604: 193
605: } ;
606:
607: static yyconst flex_int16_t yy_chk[722] =
608: { 0,
609: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
610: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
611: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
612: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
613: 1, 1, 1, 1, 1, 1, 9, 190, 9, 9,
614: 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
615: 10, 116, 116, 189, 10, 188, 9, 9, 9, 9,
616: 9, 9, 12, 12, 12, 12, 12, 18, 18, 9,
617: 163, 163, 72, 9, 11, 11, 11, 11, 11, 11,
618: 72, 18, 187, 186, 18, 25, 25, 25, 25, 25,
619:
620: 25, 33, 33, 33, 33, 33, 33, 35, 35, 35,
621: 35, 35, 35, 185, 184, 11, 182, 181, 180, 11,
622: 13, 13, 13, 13, 13, 13, 13, 14, 85, 14,
623: 14, 14, 14, 14, 14, 26, 85, 26, 26, 26,
624: 26, 26, 26, 26, 26, 26, 26, 26, 26, 36,
625: 36, 36, 36, 36, 176, 26, 26, 26, 26, 26,
626: 26, 27, 27, 27, 27, 27, 27, 27, 28, 86,
627: 28, 28, 28, 28, 28, 28, 34, 86, 34, 34,
628: 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
629: 57, 57, 57, 57, 57, 57, 34, 34, 34, 34,
630:
631: 34, 34, 37, 37, 37, 37, 37, 37, 37, 38,
632: 111, 38, 38, 38, 38, 38, 38, 49, 111, 49,
633: 49, 49, 49, 49, 49, 51, 175, 51, 51, 51,
634: 51, 51, 51, 51, 51, 51, 51, 51, 51, 64,
635: 64, 64, 64, 64, 64, 51, 51, 51, 51, 51,
636: 51, 52, 112, 52, 52, 52, 52, 52, 52, 58,
637: 112, 58, 58, 58, 58, 58, 58, 58, 58, 58,
638: 58, 58, 58, 65, 65, 65, 65, 65, 172, 58,
639: 58, 58, 58, 58, 58, 59, 165, 59, 59, 59,
640: 59, 59, 59, 63, 164, 63, 63, 63, 63, 63,
641:
642: 63, 63, 63, 63, 63, 63, 63, 76, 76, 76,
643: 76, 76, 76, 63, 63, 63, 63, 63, 63, 66,
644: 162, 66, 66, 66, 66, 66, 66, 78, 161, 78,
645: 78, 78, 78, 78, 83, 159, 83, 83, 83, 83,
646: 83, 83, 87, 87, 87, 87, 87, 87, 88, 151,
647: 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
648: 88, 88, 102, 102, 102, 102, 102, 102, 88, 88,
649: 88, 88, 88, 88, 89, 150, 89, 89, 89, 89,
650: 89, 89, 100, 148, 100, 100, 100, 100, 100, 100,
651: 103, 103, 103, 103, 103, 103, 105, 147, 105, 105,
652:
653: 105, 105, 105, 109, 146, 109, 109, 109, 109, 109,
654: 109, 119, 119, 119, 119, 119, 119, 121, 144, 121,
655: 121, 121, 121, 121, 124, 143, 124, 124, 124, 124,
656: 124, 124, 126, 126, 126, 126, 126, 126, 128, 141,
657: 128, 128, 128, 128, 128, 137, 137, 137, 137, 137,
658: 137, 138, 138, 138, 138, 138, 138, 139, 139, 139,
659: 139, 139, 139, 140, 140, 140, 140, 140, 140, 142,
660: 136, 142, 142, 142, 142, 142, 145, 135, 145, 145,
661: 145, 145, 145, 145, 152, 152, 152, 152, 152, 152,
662: 153, 153, 153, 153, 153, 155, 155, 155, 155, 155,
663:
664: 155, 156, 156, 156, 156, 156, 156, 157, 157, 157,
665: 157, 157, 157, 158, 158, 158, 158, 158, 158, 160,
666: 132, 160, 160, 160, 160, 160, 166, 166, 166, 166,
667: 166, 166, 167, 167, 167, 167, 167, 169, 169, 169,
668: 169, 169, 169, 170, 170, 170, 170, 170, 170, 171,
669: 171, 171, 171, 171, 171, 177, 177, 177, 177, 177,
670: 177, 178, 178, 178, 178, 178, 194, 131, 194, 194,
671: 194, 194, 194, 195, 195, 195, 196, 130, 196, 129,
672: 196, 197, 127, 197, 198, 198, 198, 199, 199, 200,
673: 200, 201, 201, 202, 202, 203, 203, 204, 204, 204,
674:
675: 204, 205, 205, 206, 206, 207, 207, 208, 208, 209,
676: 209, 210, 210, 211, 211, 212, 212, 125, 123, 122,
677: 120, 118, 117, 115, 114, 113, 110, 108, 107, 106,
678: 104, 101, 99, 98, 97, 96, 95, 94, 93, 92,
679: 91, 84, 82, 81, 80, 79, 77, 73, 69, 68,
680: 67, 62, 61, 56, 50, 48, 47, 46, 45, 44,
681: 43, 42, 41, 40, 39, 32, 23, 20, 19, 17,
682: 16, 15, 5, 3, 193, 193, 193, 193, 193, 193,
683: 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
684: 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
685:
686: 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
687: 193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
688: 193
689: } ;
690:
691: static yy_state_type yy_last_accepting_state;
692: static char *yy_last_accepting_cpos;
693:
694: extern int prsa_flex_debug;
695: int prsa_flex_debug = 0;
696:
697: /* The intent behind this definition is that it'll catch
698: * any uses of REJECT which flex missed.
699: */
700: #define REJECT reject_used_but_not_detected
701: #define yymore() yymore_used_but_not_detected
702: #define YY_MORE_ADJ 0
703: #define YY_RESTORE_YY_MORE_OFFSET
704: char *prsatext;
705: #line 1 "prsa_tok.l"
706: /* $NetBSD: prsa_tok.l,v 1.4 2006/09/09 16:22:10 manu Exp $ */
707: /* Id: prsa_tok.l,v 1.2 2004/07/12 20:43:51 ludvigm Exp */
708: #line 6 "prsa_tok.l"
709: /*
710: * Copyright (C) 2004 SuSE Linux AG, Nuernberg, Germany.
711: * Contributed by: Michal Ludvig <mludvig@suse.cz>, SUSE Labs
712: * All rights reserved.
713: *
714: * Redistribution and use in source and binary forms, with or without
715: * modification, are permitted provided that the following conditions
716: * are met:
717: * 1. Redistributions of source code must retain the above copyright
718: * notice, this list of conditions and the following disclaimer.
719: * 2. Redistributions in binary form must reproduce the above copyright
720: * notice, this list of conditions and the following disclaimer in the
721: * documentation and/or other materials provided with the distribution.
722: * 3. Neither the name of the project nor the names of its contributors
723: * may be used to endorse or promote products derived from this software
724: * without specific prior written permission.
725: *
726: * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
727: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
728: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
729: * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
730: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
731: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
732: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
733: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
734: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
735: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
736: * SUCH DAMAGE.
737: */
738:
739: /* This file contains a tokeniser for FreeS/WAN-style ipsec.secrets RSA keys. */
740:
741: #include <string.h>
742: #include <openssl/bn.h>
743: #include <openssl/rsa.h>
744: #include "prsa_par.h"
745:
746: extern int prsalex (void);
747: extern int prsa_cur_lineno;
748:
749: #line 750 "prsa_tok.c"
750:
751: #define INITIAL 0
752:
753: #ifndef YY_NO_UNISTD_H
754: /* Special case for "unistd.h", since it is non-ANSI. We include it way
755: * down here because we want the user's section 1 to have been scanned first.
756: * The user has a chance to override it with an option.
757: */
758: #include <unistd.h>
759: #endif
760:
761: #ifndef YY_EXTRA_TYPE
762: #define YY_EXTRA_TYPE void *
763: #endif
764:
765: static int yy_init_globals (void );
766:
767: /* Accessor methods to globals.
768: These are made visible to non-reentrant scanners for convenience. */
769:
770: int prsalex_destroy (void );
771:
772: int prsaget_debug (void );
773:
774: void prsaset_debug (int debug_flag );
775:
776: YY_EXTRA_TYPE prsaget_extra (void );
777:
778: void prsaset_extra (YY_EXTRA_TYPE user_defined );
779:
780: FILE *prsaget_in (void );
781:
782: void prsaset_in (FILE * in_str );
783:
784: FILE *prsaget_out (void );
785:
786: void prsaset_out (FILE * out_str );
787:
788: int prsaget_leng (void );
789:
790: char *prsaget_text (void );
791:
792: int prsaget_lineno (void );
793:
794: void prsaset_lineno (int line_number );
795:
796: /* Macros after this point can all be overridden by user definitions in
797: * section 1.
798: */
799:
800: #ifndef YY_SKIP_YYWRAP
801: #ifdef __cplusplus
802: extern "C" int prsawrap (void );
803: #else
804: extern int prsawrap (void );
805: #endif
806: #endif
807:
808: static void yyunput (int c,char *buf_ptr );
809:
810: #ifndef yytext_ptr
811: static void yy_flex_strncpy (char *,yyconst char *,int );
812: #endif
813:
814: #ifdef YY_NEED_STRLEN
815: static int yy_flex_strlen (yyconst char * );
816: #endif
817:
818: #ifndef YY_NO_INPUT
819:
820: #ifdef __cplusplus
821: static int yyinput (void );
822: #else
823: static int input (void );
824: #endif
825:
826: #endif
827:
828: /* Amount of stuff to slurp up with each read. */
829: #ifndef YY_READ_BUF_SIZE
830: #ifdef __ia64__
831: /* On IA-64, the buffer size is 16k, not 8k */
832: #define YY_READ_BUF_SIZE 16384
833: #else
834: #define YY_READ_BUF_SIZE 8192
835: #endif /* __ia64__ */
836: #endif
837:
838: /* Copy whatever the last rule matched to the standard output. */
839: #ifndef ECHO
840: /* This used to be an fputs(), but since the string might contain NUL's,
841: * we now use fwrite().
842: */
843: #define ECHO do { if (fwrite( prsatext, prsaleng, 1, prsaout )) {} } while (0)
844: #endif
845:
846: /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
847: * is returned in "result".
848: */
849: #ifndef YY_INPUT
850: #define YY_INPUT(buf,result,max_size) \
851: if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
852: { \
853: int c = '*'; \
854: size_t n; \
855: for ( n = 0; n < max_size && \
856: (c = getc( prsain )) != EOF && c != '\n'; ++n ) \
857: buf[n] = (char) c; \
858: if ( c == '\n' ) \
859: buf[n++] = (char) c; \
860: if ( c == EOF && ferror( prsain ) ) \
861: YY_FATAL_ERROR( "input in flex scanner failed" ); \
862: result = n; \
863: } \
864: else \
865: { \
866: errno=0; \
867: while ( (result = fread(buf, 1, max_size, prsain))==0 && ferror(prsain)) \
868: { \
869: if( errno != EINTR) \
870: { \
871: YY_FATAL_ERROR( "input in flex scanner failed" ); \
872: break; \
873: } \
874: errno=0; \
875: clearerr(prsain); \
876: } \
877: }\
878: \
879:
880: #endif
881:
882: /* No semi-colon after return; correct usage is to write "yyterminate();" -
883: * we don't want an extra ';' after the "return" because that will cause
884: * some compilers to complain about unreachable statements.
885: */
886: #ifndef yyterminate
887: #define yyterminate() return YY_NULL
888: #endif
889:
890: /* Number of entries by which start-condition stack grows. */
891: #ifndef YY_START_STACK_INCR
892: #define YY_START_STACK_INCR 25
893: #endif
894:
895: /* Report a fatal error. */
896: #ifndef YY_FATAL_ERROR
897: #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
898: #endif
899:
900: /* end tables serialization structures and prototypes */
901:
902: /* Default declaration of generated scanner - a define so the user can
903: * easily add parameters.
904: */
905: #ifndef YY_DECL
906: #define YY_DECL_IS_OURS 1
907:
908: extern int prsalex (void);
909:
910: #define YY_DECL int prsalex (void)
911: #endif /* !YY_DECL */
912:
913: /* Code executed at the beginning of each rule, after prsatext and prsaleng
914: * have been set up.
915: */
916: #ifndef YY_USER_ACTION
917: #define YY_USER_ACTION
918: #endif
919:
920: /* Code executed at the end of each rule. */
921: #ifndef YY_BREAK
922: #define YY_BREAK break;
923: #endif
924:
925: #define YY_RULE_SETUP \
926: YY_USER_ACTION
927:
928: /** The main scanner function which does all the work.
929: */
930: YY_DECL
931: {
932: register yy_state_type yy_current_state;
933: register char *yy_cp, *yy_bp;
934: register int yy_act;
935:
936: #line 56 "prsa_tok.l"
937:
938: #line 939 "prsa_tok.c"
939:
940: if ( !(yy_init) )
941: {
942: (yy_init) = 1;
943:
944: #ifdef YY_USER_INIT
945: YY_USER_INIT;
946: #endif
947:
948: if ( ! (yy_start) )
949: (yy_start) = 1; /* first start state */
950:
951: if ( ! prsain )
952: prsain = stdin;
953:
954: if ( ! prsaout )
955: prsaout = stdout;
956:
957: if ( ! YY_CURRENT_BUFFER ) {
958: prsaensure_buffer_stack ();
959: YY_CURRENT_BUFFER_LVALUE =
960: prsa_create_buffer(prsain,YY_BUF_SIZE );
961: }
962:
963: prsa_load_buffer_state( );
964: }
965:
966: while ( 1 ) /* loops until end-of-file is reached */
967: {
968: yy_cp = (yy_c_buf_p);
969:
970: /* Support of prsatext. */
971: *yy_cp = (yy_hold_char);
972:
973: /* yy_bp points to the position in yy_ch_buf of the start of
974: * the current run.
975: */
976: yy_bp = yy_cp;
977:
978: yy_current_state = (yy_start);
979: yy_match:
980: do
981: {
982: register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
983: if ( yy_accept[yy_current_state] )
984: {
985: (yy_last_accepting_state) = yy_current_state;
986: (yy_last_accepting_cpos) = yy_cp;
987: }
988: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
989: {
990: yy_current_state = (int) yy_def[yy_current_state];
991: if ( yy_current_state >= 194 )
992: yy_c = yy_meta[(unsigned int) yy_c];
993: }
994: yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
995: ++yy_cp;
996: }
997: while ( yy_base[yy_current_state] != 675 );
998:
999: yy_find_action:
1000: yy_act = yy_accept[yy_current_state];
1001: if ( yy_act == 0 )
1002: { /* have to back up */
1003: yy_cp = (yy_last_accepting_cpos);
1004: yy_current_state = (yy_last_accepting_state);
1005: yy_act = yy_accept[yy_current_state];
1006: }
1007:
1008: YY_DO_BEFORE_ACTION;
1009:
1010: do_action: /* This label is used only to access EOF actions. */
1011:
1012: switch ( yy_act )
1013: { /* beginning of action switch */
1014: case 0: /* must back up */
1015: /* undo the effects of YY_DO_BEFORE_ACTION */
1016: *yy_cp = (yy_hold_char);
1017: yy_cp = (yy_last_accepting_cpos);
1018: yy_current_state = (yy_last_accepting_state);
1019: goto yy_find_action;
1020:
1021: case 1:
1022: YY_RULE_SETUP
1023: #line 57 "prsa_tok.l"
1024: { return OBRACE; }
1025: YY_BREAK
1026: case 2:
1027: YY_RULE_SETUP
1028: #line 58 "prsa_tok.l"
1029: { return EBRACE; }
1030: YY_BREAK
1031: case 3:
1032: YY_RULE_SETUP
1033: #line 59 "prsa_tok.l"
1034: { return COLON; }
1035: YY_BREAK
1036: case 4:
1037: YY_RULE_SETUP
1038: #line 60 "prsa_tok.l"
1039: { return TAG_RSA; }
1040: YY_BREAK
1041: case 5:
1042: YY_RULE_SETUP
1043: #line 61 "prsa_tok.l"
1044: { return TAG_PSK; }
1045: YY_BREAK
1046: case 6:
1047: YY_RULE_SETUP
1048: #line 62 "prsa_tok.l"
1049: { return TAG_PUB; }
1050: YY_BREAK
1051: case 7:
1052: YY_RULE_SETUP
1053: #line 63 "prsa_tok.l"
1054: {
1055: BIGNUM *bn = BN_new();
1056: BN_hex2bn(&bn, prsatext+2);
1057: prsalval.bn = bn;
1058: return HEX;
1059: }
1060: YY_BREAK
1061: case 8:
1062: YY_RULE_SETUP
1063: #line 69 "prsa_tok.l"
1064: {
1065: prsalval.chr = strdup(prsatext);
1066: return BASE64;
1067: }
1068: YY_BREAK
1069: case 9:
1070: YY_RULE_SETUP
1071: #line 73 "prsa_tok.l"
1072: { return MODULUS; }
1073: YY_BREAK
1074: case 10:
1075: YY_RULE_SETUP
1076: #line 74 "prsa_tok.l"
1077: { return PUBLIC_EXPONENT; }
1078: YY_BREAK
1079: case 11:
1080: YY_RULE_SETUP
1081: #line 75 "prsa_tok.l"
1082: { return PRIVATE_EXPONENT; }
1083: YY_BREAK
1084: case 12:
1085: YY_RULE_SETUP
1086: #line 76 "prsa_tok.l"
1087: { return PRIME1; }
1088: YY_BREAK
1089: case 13:
1090: YY_RULE_SETUP
1091: #line 77 "prsa_tok.l"
1092: { return PRIME2; }
1093: YY_BREAK
1094: case 14:
1095: YY_RULE_SETUP
1096: #line 78 "prsa_tok.l"
1097: { return EXPONENT1; }
1098: YY_BREAK
1099: case 15:
1100: YY_RULE_SETUP
1101: #line 79 "prsa_tok.l"
1102: { return EXPONENT2; }
1103: YY_BREAK
1104: case 16:
1105: YY_RULE_SETUP
1106: #line 80 "prsa_tok.l"
1107: { return COEFFICIENT; }
1108: YY_BREAK
1109: case 17:
1110: YY_RULE_SETUP
1111: #line 81 "prsa_tok.l"
1112: { return SLASH; }
1113: YY_BREAK
1114: case 18:
1115: YY_RULE_SETUP
1116: #line 82 "prsa_tok.l"
1117: { prsalval.num = atol(prsatext); return NUMBER; }
1118: YY_BREAK
1119: case 19:
1120: YY_RULE_SETUP
1121: #line 83 "prsa_tok.l"
1122: { return ADDRANY; }
1123: YY_BREAK
1124: case 20:
1125: YY_RULE_SETUP
1126: #line 84 "prsa_tok.l"
1127: { prsalval.chr = strdup(prsatext); return ADDR4; }
1128: YY_BREAK
1129: case 21:
1130: YY_RULE_SETUP
1131: #line 85 "prsa_tok.l"
1132: { prsalval.chr = strdup(prsatext); return ADDR6; }
1133: YY_BREAK
1134: case 22:
1135: YY_RULE_SETUP
1136: #line 86 "prsa_tok.l"
1137: ;
1138: YY_BREAK
1139: case 23:
1140: /* rule 23 can match eol */
1141: YY_RULE_SETUP
1142: #line 87 "prsa_tok.l"
1143: { prsa_cur_lineno++; }
1144: YY_BREAK
1145: case 24:
1146: YY_RULE_SETUP
1147: #line 88 "prsa_tok.l"
1148: ;
1149: YY_BREAK
1150: case 25:
1151: YY_RULE_SETUP
1152: #line 89 "prsa_tok.l"
1153: ECHO;
1154: YY_BREAK
1155: #line 1156 "prsa_tok.c"
1156: case YY_STATE_EOF(INITIAL):
1157: yyterminate();
1158:
1159: case YY_END_OF_BUFFER:
1160: {
1161: /* Amount of text matched not including the EOB char. */
1162: int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1163:
1164: /* Undo the effects of YY_DO_BEFORE_ACTION. */
1165: *yy_cp = (yy_hold_char);
1166: YY_RESTORE_YY_MORE_OFFSET
1167:
1168: if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1169: {
1170: /* We're scanning a new file or input source. It's
1171: * possible that this happened because the user
1172: * just pointed prsain at a new source and called
1173: * prsalex(). If so, then we have to assure
1174: * consistency between YY_CURRENT_BUFFER and our
1175: * globals. Here is the right place to do so, because
1176: * this is the first action (other than possibly a
1177: * back-up) that will match for the new input source.
1178: */
1179: (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1180: YY_CURRENT_BUFFER_LVALUE->yy_input_file = prsain;
1181: YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1182: }
1183:
1184: /* Note that here we test for yy_c_buf_p "<=" to the position
1185: * of the first EOB in the buffer, since yy_c_buf_p will
1186: * already have been incremented past the NUL character
1187: * (since all states make transitions on EOB to the
1188: * end-of-buffer state). Contrast this with the test
1189: * in input().
1190: */
1191: if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1192: { /* This was really a NUL. */
1193: yy_state_type yy_next_state;
1194:
1195: (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1196:
1197: yy_current_state = yy_get_previous_state( );
1198:
1199: /* Okay, we're now positioned to make the NUL
1200: * transition. We couldn't have
1201: * yy_get_previous_state() go ahead and do it
1202: * for us because it doesn't know how to deal
1203: * with the possibility of jamming (and we don't
1204: * want to build jamming into it because then it
1205: * will run more slowly).
1206: */
1207:
1208: yy_next_state = yy_try_NUL_trans( yy_current_state );
1209:
1210: yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1211:
1212: if ( yy_next_state )
1213: {
1214: /* Consume the NUL. */
1215: yy_cp = ++(yy_c_buf_p);
1216: yy_current_state = yy_next_state;
1217: goto yy_match;
1218: }
1219:
1220: else
1221: {
1222: yy_cp = (yy_c_buf_p);
1223: goto yy_find_action;
1224: }
1225: }
1226:
1227: else switch ( yy_get_next_buffer( ) )
1228: {
1229: case EOB_ACT_END_OF_FILE:
1230: {
1231: (yy_did_buffer_switch_on_eof) = 0;
1232:
1233: if ( prsawrap( ) )
1234: {
1235: /* Note: because we've taken care in
1236: * yy_get_next_buffer() to have set up
1237: * prsatext, we can now set up
1238: * yy_c_buf_p so that if some total
1239: * hoser (like flex itself) wants to
1240: * call the scanner after we return the
1241: * YY_NULL, it'll still work - another
1242: * YY_NULL will get returned.
1243: */
1244: (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1245:
1246: yy_act = YY_STATE_EOF(YY_START);
1247: goto do_action;
1248: }
1249:
1250: else
1251: {
1252: if ( ! (yy_did_buffer_switch_on_eof) )
1253: YY_NEW_FILE;
1254: }
1255: break;
1256: }
1257:
1258: case EOB_ACT_CONTINUE_SCAN:
1259: (yy_c_buf_p) =
1260: (yytext_ptr) + yy_amount_of_matched_text;
1261:
1262: yy_current_state = yy_get_previous_state( );
1263:
1264: yy_cp = (yy_c_buf_p);
1265: yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1266: goto yy_match;
1267:
1268: case EOB_ACT_LAST_MATCH:
1269: (yy_c_buf_p) =
1270: &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1271:
1272: yy_current_state = yy_get_previous_state( );
1273:
1274: yy_cp = (yy_c_buf_p);
1275: yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1276: goto yy_find_action;
1277: }
1278: break;
1279: }
1280:
1281: default:
1282: YY_FATAL_ERROR(
1283: "fatal flex scanner internal error--no action found" );
1284: } /* end of action switch */
1285: } /* end of scanning one token */
1286: } /* end of prsalex */
1287:
1288: /* yy_get_next_buffer - try to read in a new buffer
1289: *
1290: * Returns a code representing an action:
1291: * EOB_ACT_LAST_MATCH -
1292: * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1293: * EOB_ACT_END_OF_FILE - end of file
1294: */
1295: static int yy_get_next_buffer (void)
1296: {
1297: register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1298: register char *source = (yytext_ptr);
1299: register int number_to_move, i;
1300: int ret_val;
1301:
1302: if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1303: YY_FATAL_ERROR(
1304: "fatal flex scanner internal error--end of buffer missed" );
1305:
1306: if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1307: { /* Don't try to fill the buffer, so this is an EOF. */
1308: if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1309: {
1310: /* We matched a single character, the EOB, so
1311: * treat this as a final EOF.
1312: */
1313: return EOB_ACT_END_OF_FILE;
1314: }
1315:
1316: else
1317: {
1318: /* We matched some text prior to the EOB, first
1319: * process it.
1320: */
1321: return EOB_ACT_LAST_MATCH;
1322: }
1323: }
1324:
1325: /* Try to read more data. */
1326:
1327: /* First move last chars to start of buffer. */
1328: number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1329:
1330: for ( i = 0; i < number_to_move; ++i )
1331: *(dest++) = *(source++);
1332:
1333: if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1334: /* don't do the read, it's not guaranteed to return an EOF,
1335: * just force an EOF
1336: */
1337: YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1338:
1339: else
1340: {
1341: int num_to_read =
1342: YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1343:
1344: while ( num_to_read <= 0 )
1345: { /* Not enough room in the buffer - grow it. */
1346:
1347: /* just a shorter name for the current buffer */
1348: YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1349:
1350: int yy_c_buf_p_offset =
1351: (int) ((yy_c_buf_p) - b->yy_ch_buf);
1352:
1353: if ( b->yy_is_our_buffer )
1354: {
1355: int new_size = b->yy_buf_size * 2;
1356:
1357: if ( new_size <= 0 )
1358: b->yy_buf_size += b->yy_buf_size / 8;
1359: else
1360: b->yy_buf_size *= 2;
1361:
1362: b->yy_ch_buf = (char *)
1363: /* Include room in for 2 EOB chars. */
1364: prsarealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1365: }
1366: else
1367: /* Can't grow it, we don't own it. */
1368: b->yy_ch_buf = 0;
1369:
1370: if ( ! b->yy_ch_buf )
1371: YY_FATAL_ERROR(
1372: "fatal error - scanner input buffer overflow" );
1373:
1374: (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1375:
1376: num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1377: number_to_move - 1;
1378:
1379: }
1380:
1381: if ( num_to_read > YY_READ_BUF_SIZE )
1382: num_to_read = YY_READ_BUF_SIZE;
1383:
1384: /* Read in more data. */
1385: YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1386: (yy_n_chars), (size_t) num_to_read );
1387:
1388: YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1389: }
1390:
1391: if ( (yy_n_chars) == 0 )
1392: {
1393: if ( number_to_move == YY_MORE_ADJ )
1394: {
1395: ret_val = EOB_ACT_END_OF_FILE;
1396: prsarestart(prsain );
1397: }
1398:
1399: else
1400: {
1401: ret_val = EOB_ACT_LAST_MATCH;
1402: YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1403: YY_BUFFER_EOF_PENDING;
1404: }
1405: }
1406:
1407: else
1408: ret_val = EOB_ACT_CONTINUE_SCAN;
1409:
1410: if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1411: /* Extend the array by 50%, plus the number we really need. */
1412: yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1413: YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) prsarealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1414: if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1415: YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1416: }
1417:
1418: (yy_n_chars) += number_to_move;
1419: YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1420: YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1421:
1422: (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1423:
1424: return ret_val;
1425: }
1426:
1427: /* yy_get_previous_state - get the state just before the EOB char was reached */
1428:
1429: static yy_state_type yy_get_previous_state (void)
1430: {
1431: register yy_state_type yy_current_state;
1432: register char *yy_cp;
1433:
1434: yy_current_state = (yy_start);
1435:
1436: for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1437: {
1438: register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1439: if ( yy_accept[yy_current_state] )
1440: {
1441: (yy_last_accepting_state) = yy_current_state;
1442: (yy_last_accepting_cpos) = yy_cp;
1443: }
1444: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1445: {
1446: yy_current_state = (int) yy_def[yy_current_state];
1447: if ( yy_current_state >= 194 )
1448: yy_c = yy_meta[(unsigned int) yy_c];
1449: }
1450: yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1451: }
1452:
1453: return yy_current_state;
1454: }
1455:
1456: /* yy_try_NUL_trans - try to make a transition on the NUL character
1457: *
1458: * synopsis
1459: * next_state = yy_try_NUL_trans( current_state );
1460: */
1461: static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1462: {
1463: register int yy_is_jam;
1464: register char *yy_cp = (yy_c_buf_p);
1465:
1466: register YY_CHAR yy_c = 1;
1467: if ( yy_accept[yy_current_state] )
1468: {
1469: (yy_last_accepting_state) = yy_current_state;
1470: (yy_last_accepting_cpos) = yy_cp;
1471: }
1472: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1473: {
1474: yy_current_state = (int) yy_def[yy_current_state];
1475: if ( yy_current_state >= 194 )
1476: yy_c = yy_meta[(unsigned int) yy_c];
1477: }
1478: yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1479: yy_is_jam = (yy_current_state == 193);
1480:
1481: return yy_is_jam ? 0 : yy_current_state;
1482: }
1483:
1484: static void yyunput (int c, register char * yy_bp )
1485: {
1486: register char *yy_cp;
1487:
1488: yy_cp = (yy_c_buf_p);
1489:
1490: /* undo effects of setting up prsatext */
1491: *yy_cp = (yy_hold_char);
1492:
1493: if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1494: { /* need to shift things up to make room */
1495: /* +2 for EOB chars. */
1496: register int number_to_move = (yy_n_chars) + 2;
1497: register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1498: YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1499: register char *source =
1500: &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1501:
1502: while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1503: *--dest = *--source;
1504:
1505: yy_cp += (int) (dest - source);
1506: yy_bp += (int) (dest - source);
1507: YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1508: (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1509:
1510: if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1511: YY_FATAL_ERROR( "flex scanner push-back overflow" );
1512: }
1513:
1514: *--yy_cp = (char) c;
1515:
1516: (yytext_ptr) = yy_bp;
1517: (yy_hold_char) = *yy_cp;
1518: (yy_c_buf_p) = yy_cp;
1519: }
1520:
1521: #ifndef YY_NO_INPUT
1522: #ifdef __cplusplus
1523: static int yyinput (void)
1524: #else
1525: static int input (void)
1526: #endif
1527:
1528: {
1529: int c;
1530:
1531: *(yy_c_buf_p) = (yy_hold_char);
1532:
1533: if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1534: {
1535: /* yy_c_buf_p now points to the character we want to return.
1536: * If this occurs *before* the EOB characters, then it's a
1537: * valid NUL; if not, then we've hit the end of the buffer.
1538: */
1539: if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1540: /* This was really a NUL. */
1541: *(yy_c_buf_p) = '\0';
1542:
1543: else
1544: { /* need more input */
1545: int offset = (yy_c_buf_p) - (yytext_ptr);
1546: ++(yy_c_buf_p);
1547:
1548: switch ( yy_get_next_buffer( ) )
1549: {
1550: case EOB_ACT_LAST_MATCH:
1551: /* This happens because yy_g_n_b()
1552: * sees that we've accumulated a
1553: * token and flags that we need to
1554: * try matching the token before
1555: * proceeding. But for input(),
1556: * there's no matching to consider.
1557: * So convert the EOB_ACT_LAST_MATCH
1558: * to EOB_ACT_END_OF_FILE.
1559: */
1560:
1561: /* Reset buffer status. */
1562: prsarestart(prsain );
1563:
1564: /*FALLTHROUGH*/
1565:
1566: case EOB_ACT_END_OF_FILE:
1567: {
1568: if ( prsawrap( ) )
1569: return EOF;
1570:
1571: if ( ! (yy_did_buffer_switch_on_eof) )
1572: YY_NEW_FILE;
1573: #ifdef __cplusplus
1574: return yyinput();
1575: #else
1576: return input();
1577: #endif
1578: }
1579:
1580: case EOB_ACT_CONTINUE_SCAN:
1581: (yy_c_buf_p) = (yytext_ptr) + offset;
1582: break;
1583: }
1584: }
1585: }
1586:
1587: c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1588: *(yy_c_buf_p) = '\0'; /* preserve prsatext */
1589: (yy_hold_char) = *++(yy_c_buf_p);
1590:
1591: return c;
1592: }
1593: #endif /* ifndef YY_NO_INPUT */
1594:
1595: /** Immediately switch to a different input stream.
1596: * @param input_file A readable stream.
1597: *
1598: * @note This function does not reset the start condition to @c INITIAL .
1599: */
1600: void prsarestart (FILE * input_file )
1601: {
1602:
1603: if ( ! YY_CURRENT_BUFFER ){
1604: prsaensure_buffer_stack ();
1605: YY_CURRENT_BUFFER_LVALUE =
1606: prsa_create_buffer(prsain,YY_BUF_SIZE );
1607: }
1608:
1609: prsa_init_buffer(YY_CURRENT_BUFFER,input_file );
1610: prsa_load_buffer_state( );
1611: }
1612:
1613: /** Switch to a different input buffer.
1614: * @param new_buffer The new input buffer.
1615: *
1616: */
1617: void prsa_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1618: {
1619:
1620: /* TODO. We should be able to replace this entire function body
1621: * with
1622: * prsapop_buffer_state();
1623: * prsapush_buffer_state(new_buffer);
1624: */
1625: prsaensure_buffer_stack ();
1626: if ( YY_CURRENT_BUFFER == new_buffer )
1627: return;
1628:
1629: if ( YY_CURRENT_BUFFER )
1630: {
1631: /* Flush out information for old buffer. */
1632: *(yy_c_buf_p) = (yy_hold_char);
1633: YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1634: YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1635: }
1636:
1637: YY_CURRENT_BUFFER_LVALUE = new_buffer;
1638: prsa_load_buffer_state( );
1639:
1640: /* We don't actually know whether we did this switch during
1641: * EOF (prsawrap()) processing, but the only time this flag
1642: * is looked at is after prsawrap() is called, so it's safe
1643: * to go ahead and always set it.
1644: */
1645: (yy_did_buffer_switch_on_eof) = 1;
1646: }
1647:
1648: static void prsa_load_buffer_state (void)
1649: {
1650: (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1651: (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1652: prsain = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1653: (yy_hold_char) = *(yy_c_buf_p);
1654: }
1655:
1656: /** Allocate and initialize an input buffer state.
1657: * @param file A readable stream.
1658: * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1659: *
1660: * @return the allocated buffer state.
1661: */
1662: YY_BUFFER_STATE prsa_create_buffer (FILE * file, int size )
1663: {
1664: YY_BUFFER_STATE b;
1665:
1666: b = (YY_BUFFER_STATE) prsaalloc(sizeof( struct yy_buffer_state ) );
1667: if ( ! b )
1668: YY_FATAL_ERROR( "out of dynamic memory in prsa_create_buffer()" );
1669:
1670: b->yy_buf_size = size;
1671:
1672: /* yy_ch_buf has to be 2 characters longer than the size given because
1673: * we need to put in 2 end-of-buffer characters.
1674: */
1675: b->yy_ch_buf = (char *) prsaalloc(b->yy_buf_size + 2 );
1676: if ( ! b->yy_ch_buf )
1677: YY_FATAL_ERROR( "out of dynamic memory in prsa_create_buffer()" );
1678:
1679: b->yy_is_our_buffer = 1;
1680:
1681: prsa_init_buffer(b,file );
1682:
1683: return b;
1684: }
1685:
1686: /** Destroy the buffer.
1687: * @param b a buffer created with prsa_create_buffer()
1688: *
1689: */
1690: void prsa_delete_buffer (YY_BUFFER_STATE b )
1691: {
1692:
1693: if ( ! b )
1694: return;
1695:
1696: if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1697: YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1698:
1699: if ( b->yy_is_our_buffer )
1700: prsafree((void *) b->yy_ch_buf );
1701:
1702: prsafree((void *) b );
1703: }
1704:
1705: #ifndef __cplusplus
1706: extern int isatty (int );
1707: #endif /* __cplusplus */
1708:
1709: /* Initializes or reinitializes a buffer.
1710: * This function is sometimes called more than once on the same buffer,
1711: * such as during a prsarestart() or at EOF.
1712: */
1713: static void prsa_init_buffer (YY_BUFFER_STATE b, FILE * file )
1714:
1715: {
1716: int oerrno = errno;
1717:
1718: prsa_flush_buffer(b );
1719:
1720: b->yy_input_file = file;
1721: b->yy_fill_buffer = 1;
1722:
1723: /* If b is the current buffer, then prsa_init_buffer was _probably_
1724: * called from prsarestart() or through yy_get_next_buffer.
1725: * In that case, we don't want to reset the lineno or column.
1726: */
1727: if (b != YY_CURRENT_BUFFER){
1728: b->yy_bs_lineno = 1;
1729: b->yy_bs_column = 0;
1730: }
1731:
1732: b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1733:
1734: errno = oerrno;
1735: }
1736:
1737: /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1738: * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1739: *
1740: */
1741: void prsa_flush_buffer (YY_BUFFER_STATE b )
1742: {
1743: if ( ! b )
1744: return;
1745:
1746: b->yy_n_chars = 0;
1747:
1748: /* We always need two end-of-buffer characters. The first causes
1749: * a transition to the end-of-buffer state. The second causes
1750: * a jam in that state.
1751: */
1752: b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1753: b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1754:
1755: b->yy_buf_pos = &b->yy_ch_buf[0];
1756:
1757: b->yy_at_bol = 1;
1758: b->yy_buffer_status = YY_BUFFER_NEW;
1759:
1760: if ( b == YY_CURRENT_BUFFER )
1761: prsa_load_buffer_state( );
1762: }
1763:
1764: /** Pushes the new state onto the stack. The new state becomes
1765: * the current state. This function will allocate the stack
1766: * if necessary.
1767: * @param new_buffer The new state.
1768: *
1769: */
1770: void prsapush_buffer_state (YY_BUFFER_STATE new_buffer )
1771: {
1772: if (new_buffer == NULL)
1773: return;
1774:
1775: prsaensure_buffer_stack();
1776:
1777: /* This block is copied from prsa_switch_to_buffer. */
1778: if ( YY_CURRENT_BUFFER )
1779: {
1780: /* Flush out information for old buffer. */
1781: *(yy_c_buf_p) = (yy_hold_char);
1782: YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1783: YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1784: }
1785:
1786: /* Only push if top exists. Otherwise, replace top. */
1787: if (YY_CURRENT_BUFFER)
1788: (yy_buffer_stack_top)++;
1789: YY_CURRENT_BUFFER_LVALUE = new_buffer;
1790:
1791: /* copied from prsa_switch_to_buffer. */
1792: prsa_load_buffer_state( );
1793: (yy_did_buffer_switch_on_eof) = 1;
1794: }
1795:
1796: /** Removes and deletes the top of the stack, if present.
1797: * The next element becomes the new top.
1798: *
1799: */
1800: void prsapop_buffer_state (void)
1801: {
1802: if (!YY_CURRENT_BUFFER)
1803: return;
1804:
1805: prsa_delete_buffer(YY_CURRENT_BUFFER );
1806: YY_CURRENT_BUFFER_LVALUE = NULL;
1807: if ((yy_buffer_stack_top) > 0)
1808: --(yy_buffer_stack_top);
1809:
1810: if (YY_CURRENT_BUFFER) {
1811: prsa_load_buffer_state( );
1812: (yy_did_buffer_switch_on_eof) = 1;
1813: }
1814: }
1815:
1816: /* Allocates the stack if it does not exist.
1817: * Guarantees space for at least one push.
1818: */
1819: static void prsaensure_buffer_stack (void)
1820: {
1821: int num_to_alloc;
1822:
1823: if (!(yy_buffer_stack)) {
1824:
1825: /* First allocation is just for 2 elements, since we don't know if this
1826: * scanner will even need a stack. We use 2 instead of 1 to avoid an
1827: * immediate realloc on the next call.
1828: */
1829: num_to_alloc = 1;
1830: (yy_buffer_stack) = (struct yy_buffer_state**)prsaalloc
1831: (num_to_alloc * sizeof(struct yy_buffer_state*)
1832: );
1833: if ( ! (yy_buffer_stack) )
1834: YY_FATAL_ERROR( "out of dynamic memory in prsaensure_buffer_stack()" );
1835:
1836: memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1837:
1838: (yy_buffer_stack_max) = num_to_alloc;
1839: (yy_buffer_stack_top) = 0;
1840: return;
1841: }
1842:
1843: if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1844:
1845: /* Increase the buffer to prepare for a possible push. */
1846: int grow_size = 8 /* arbitrary grow size */;
1847:
1848: num_to_alloc = (yy_buffer_stack_max) + grow_size;
1849: (yy_buffer_stack) = (struct yy_buffer_state**)prsarealloc
1850: ((yy_buffer_stack),
1851: num_to_alloc * sizeof(struct yy_buffer_state*)
1852: );
1853: if ( ! (yy_buffer_stack) )
1854: YY_FATAL_ERROR( "out of dynamic memory in prsaensure_buffer_stack()" );
1855:
1856: /* zero only the new slots.*/
1857: memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1858: (yy_buffer_stack_max) = num_to_alloc;
1859: }
1860: }
1861:
1862: /** Setup the input buffer state to scan directly from a user-specified character buffer.
1863: * @param base the character buffer
1864: * @param size the size in bytes of the character buffer
1865: *
1866: * @return the newly allocated buffer state object.
1867: */
1868: YY_BUFFER_STATE prsa_scan_buffer (char * base, yy_size_t size )
1869: {
1870: YY_BUFFER_STATE b;
1871:
1872: if ( size < 2 ||
1873: base[size-2] != YY_END_OF_BUFFER_CHAR ||
1874: base[size-1] != YY_END_OF_BUFFER_CHAR )
1875: /* They forgot to leave room for the EOB's. */
1876: return 0;
1877:
1878: b = (YY_BUFFER_STATE) prsaalloc(sizeof( struct yy_buffer_state ) );
1879: if ( ! b )
1880: YY_FATAL_ERROR( "out of dynamic memory in prsa_scan_buffer()" );
1881:
1882: b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1883: b->yy_buf_pos = b->yy_ch_buf = base;
1884: b->yy_is_our_buffer = 0;
1885: b->yy_input_file = 0;
1886: b->yy_n_chars = b->yy_buf_size;
1887: b->yy_is_interactive = 0;
1888: b->yy_at_bol = 1;
1889: b->yy_fill_buffer = 0;
1890: b->yy_buffer_status = YY_BUFFER_NEW;
1891:
1892: prsa_switch_to_buffer(b );
1893:
1894: return b;
1895: }
1896:
1897: /** Setup the input buffer state to scan a string. The next call to prsalex() will
1898: * scan from a @e copy of @a str.
1899: * @param yystr a NUL-terminated string to scan
1900: *
1901: * @return the newly allocated buffer state object.
1902: * @note If you want to scan bytes that may contain NUL values, then use
1903: * prsa_scan_bytes() instead.
1904: */
1905: YY_BUFFER_STATE prsa_scan_string (yyconst char * yystr )
1906: {
1907:
1908: return prsa_scan_bytes(yystr,strlen(yystr) );
1909: }
1910:
1911: /** Setup the input buffer state to scan the given bytes. The next call to prsalex() will
1912: * scan from a @e copy of @a bytes.
1913: * @param yybytes the byte buffer to scan
1914: * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1915: *
1916: * @return the newly allocated buffer state object.
1917: */
1918: YY_BUFFER_STATE prsa_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1919: {
1920: YY_BUFFER_STATE b;
1921: char *buf;
1922: yy_size_t n;
1923: int i;
1924:
1925: /* Get memory for full buffer, including space for trailing EOB's. */
1926: n = _yybytes_len + 2;
1927: buf = (char *) prsaalloc(n );
1928: if ( ! buf )
1929: YY_FATAL_ERROR( "out of dynamic memory in prsa_scan_bytes()" );
1930:
1931: for ( i = 0; i < _yybytes_len; ++i )
1932: buf[i] = yybytes[i];
1933:
1934: buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1935:
1936: b = prsa_scan_buffer(buf,n );
1937: if ( ! b )
1938: YY_FATAL_ERROR( "bad buffer in prsa_scan_bytes()" );
1939:
1940: /* It's okay to grow etc. this buffer, and we should throw it
1941: * away when we're done.
1942: */
1943: b->yy_is_our_buffer = 1;
1944:
1945: return b;
1946: }
1947:
1948: #ifndef YY_EXIT_FAILURE
1949: #define YY_EXIT_FAILURE 2
1950: #endif
1951:
1952: static void yy_fatal_error (yyconst char* msg )
1953: {
1954: (void) fprintf( stderr, "%s\n", msg );
1955: exit( YY_EXIT_FAILURE );
1956: }
1957:
1958: /* Redefine yyless() so it works in section 3 code. */
1959:
1960: #undef yyless
1961: #define yyless(n) \
1962: do \
1963: { \
1964: /* Undo effects of setting up prsatext. */ \
1965: int yyless_macro_arg = (n); \
1966: YY_LESS_LINENO(yyless_macro_arg);\
1967: prsatext[prsaleng] = (yy_hold_char); \
1968: (yy_c_buf_p) = prsatext + yyless_macro_arg; \
1969: (yy_hold_char) = *(yy_c_buf_p); \
1970: *(yy_c_buf_p) = '\0'; \
1971: prsaleng = yyless_macro_arg; \
1972: } \
1973: while ( 0 )
1974:
1975: /* Accessor methods (get/set functions) to struct members. */
1976:
1977: /** Get the current line number.
1978: *
1979: */
1980: int prsaget_lineno (void)
1981: {
1982:
1983: return prsalineno;
1984: }
1985:
1986: /** Get the input stream.
1987: *
1988: */
1989: FILE *prsaget_in (void)
1990: {
1991: return prsain;
1992: }
1993:
1994: /** Get the output stream.
1995: *
1996: */
1997: FILE *prsaget_out (void)
1998: {
1999: return prsaout;
2000: }
2001:
2002: /** Get the length of the current token.
2003: *
2004: */
2005: int prsaget_leng (void)
2006: {
2007: return prsaleng;
2008: }
2009:
2010: /** Get the current token.
2011: *
2012: */
2013:
2014: char *prsaget_text (void)
2015: {
2016: return prsatext;
2017: }
2018:
2019: /** Set the current line number.
2020: * @param line_number
2021: *
2022: */
2023: void prsaset_lineno (int line_number )
2024: {
2025:
2026: prsalineno = line_number;
2027: }
2028:
2029: /** Set the input stream. This does not discard the current
2030: * input buffer.
2031: * @param in_str A readable stream.
2032: *
2033: * @see prsa_switch_to_buffer
2034: */
2035: void prsaset_in (FILE * in_str )
2036: {
2037: prsain = in_str ;
2038: }
2039:
2040: void prsaset_out (FILE * out_str )
2041: {
2042: prsaout = out_str ;
2043: }
2044:
2045: int prsaget_debug (void)
2046: {
2047: return prsa_flex_debug;
2048: }
2049:
2050: void prsaset_debug (int bdebug )
2051: {
2052: prsa_flex_debug = bdebug ;
2053: }
2054:
2055: static int yy_init_globals (void)
2056: {
2057: /* Initialization is the same as for the non-reentrant scanner.
2058: * This function is called from prsalex_destroy(), so don't allocate here.
2059: */
2060:
2061: (yy_buffer_stack) = 0;
2062: (yy_buffer_stack_top) = 0;
2063: (yy_buffer_stack_max) = 0;
2064: (yy_c_buf_p) = (char *) 0;
2065: (yy_init) = 0;
2066: (yy_start) = 0;
2067:
2068: /* Defined in main.c */
2069: #ifdef YY_STDINIT
2070: prsain = stdin;
2071: prsaout = stdout;
2072: #else
2073: prsain = (FILE *) 0;
2074: prsaout = (FILE *) 0;
2075: #endif
2076:
2077: /* For future reference: Set errno on error, since we are called by
2078: * prsalex_init()
2079: */
2080: return 0;
2081: }
2082:
2083: /* prsalex_destroy is for both reentrant and non-reentrant scanners. */
2084: int prsalex_destroy (void)
2085: {
2086:
2087: /* Pop the buffer stack, destroying each element. */
2088: while(YY_CURRENT_BUFFER){
2089: prsa_delete_buffer(YY_CURRENT_BUFFER );
2090: YY_CURRENT_BUFFER_LVALUE = NULL;
2091: prsapop_buffer_state();
2092: }
2093:
2094: /* Destroy the stack itself. */
2095: prsafree((yy_buffer_stack) );
2096: (yy_buffer_stack) = NULL;
2097:
2098: /* Reset the globals. This is important in a non-reentrant scanner so the next time
2099: * prsalex() is called, initialization will occur. */
2100: yy_init_globals( );
2101:
2102: return 0;
2103: }
2104:
2105: /*
2106: * Internal utility routines.
2107: */
2108:
2109: #ifndef yytext_ptr
2110: static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2111: {
2112: register int i;
2113: for ( i = 0; i < n; ++i )
2114: s1[i] = s2[i];
2115: }
2116: #endif
2117:
2118: #ifdef YY_NEED_STRLEN
2119: static int yy_flex_strlen (yyconst char * s )
2120: {
2121: register int n;
2122: for ( n = 0; s[n]; ++n )
2123: ;
2124:
2125: return n;
2126: }
2127: #endif
2128:
2129: void *prsaalloc (yy_size_t size )
2130: {
2131: return (void *) malloc( size );
2132: }
2133:
2134: void *prsarealloc (void * ptr, yy_size_t size )
2135: {
2136: /* The cast to (char *) in the following accommodates both
2137: * implementations that use char* generic pointers, and those
2138: * that use void* generic pointers. It works with the latter
2139: * because both ANSI C and C++ allow castless assignment from
2140: * any pointer type to void*, and deal with argument conversions
2141: * as though doing an assignment.
2142: */
2143: return (void *) realloc( (char *) ptr, size );
2144: }
2145:
2146: void prsafree (void * ptr )
2147: {
2148: free( (char *) ptr ); /* see prsarealloc() for (char *) cast */
2149: }
2150:
2151: #define YYTABLES_NAME "yytables"
2152:
2153: #line 89 "prsa_tok.l"
2154:
2155:
2156:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>