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