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