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