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