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