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