1 #line 2 "DataDesc/ddt_parse.yy.c"
3 #line 4 "DataDesc/ddt_parse.yy.c"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 31
13 #if YY_FLEX_SUBMINOR_VERSION > 0
17 /* First, we deal with platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
25 /* end standard C headers. */
27 /* flex integer type definitions */
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
36 typedef int8_t flex_int8_t;
37 typedef uint8_t flex_uint8_t;
38 typedef int16_t flex_int16_t;
39 typedef uint16_t flex_uint16_t;
40 typedef int32_t flex_int32_t;
41 typedef uint32_t flex_uint32_t;
43 typedef signed char flex_int8_t;
44 typedef short int flex_int16_t;
45 typedef int flex_int32_t;
46 typedef unsigned char flex_uint8_t;
47 typedef unsigned short int flex_uint16_t;
48 typedef unsigned int flex_uint32_t;
51 /* Limits of integral types. */
53 #define INT8_MIN (-128)
56 #define INT16_MIN (-32767-1)
59 #define INT32_MIN (-2147483647-1)
62 #define INT8_MAX (127)
65 #define INT16_MAX (32767)
68 #define INT32_MAX (2147483647)
71 #define UINT8_MAX (255U)
74 #define UINT16_MAX (65535U)
77 #define UINT32_MAX (4294967295U)
80 #endif /* ! FLEXINT_H */
84 /* The "const" storage-class-modifier is valid. */
87 #else /* ! __cplusplus */
94 #endif /* ! __cplusplus */
102 /* Returned upon end-of-file. */
105 /* Promotes a possibly negative, possibly signed char to an unsigned
106 * integer for use as an array index. If the signed char is negative,
107 * we want to instead treat it as an 8-bit unsigned char, hence the
110 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
112 /* Enter a start condition. This macro really ought to take a parameter,
113 * but we do it the disgusting crufty way forced on us by the ()-less
114 * definition of BEGIN.
116 #define BEGIN (yy_start) = 1 + 2 *
118 /* Translate the current start state into a value that can be later handed
119 * to BEGIN to return to the state. The YYSTATE alias is for lex
122 #define YY_START (((yy_start) - 1) / 2)
123 #define YYSTATE YY_START
125 /* Action number for EOF rule of a given start state. */
126 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
128 /* Special action meaning "start processing a new file". */
129 #define YY_NEW_FILE gras_ddt_parse_restart(gras_ddt_parse_in )
131 #define YY_END_OF_BUFFER_CHAR 0
133 /* Size of default input buffer. */
135 #define YY_BUF_SIZE 16384
138 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
139 #define YY_TYPEDEF_YY_BUFFER_STATE
140 typedef struct yy_buffer_state *YY_BUFFER_STATE;
143 extern int gras_ddt_parse_leng;
145 extern FILE *gras_ddt_parse_in, *gras_ddt_parse_out;
147 #define EOB_ACT_CONTINUE_SCAN 0
148 #define EOB_ACT_END_OF_FILE 1
149 #define EOB_ACT_LAST_MATCH 2
151 #define YY_LESS_LINENO(n)
153 /* Return all but the first "n" matched characters back to the input stream. */
157 /* Undo effects of setting up gras_ddt_parse_text. */ \
158 int yyless_macro_arg = (n); \
159 YY_LESS_LINENO(yyless_macro_arg);\
160 *yy_cp = (yy_hold_char); \
161 YY_RESTORE_YY_MORE_OFFSET \
162 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
163 YY_DO_BEFORE_ACTION; /* set up gras_ddt_parse_text again */ \
167 #define unput(c) yyunput( c, (yytext_ptr) )
169 /* The following is because we cannot portably get our hands on size_t
170 * (without autoconf's help, which isn't available because we want
171 * flex-generated scanners to compile on their own).
174 #ifndef YY_TYPEDEF_YY_SIZE_T
175 #define YY_TYPEDEF_YY_SIZE_T
176 typedef unsigned int yy_size_t;
179 #ifndef YY_STRUCT_YY_BUFFER_STATE
180 #define YY_STRUCT_YY_BUFFER_STATE
181 struct yy_buffer_state
185 char *yy_ch_buf; /* input buffer */
186 char *yy_buf_pos; /* current position in input buffer */
188 /* Size of input buffer in bytes, not including room for EOB
191 yy_size_t yy_buf_size;
193 /* Number of characters read into yy_ch_buf, not including EOB
198 /* Whether we "own" the buffer - i.e., we know we created it,
199 * and can realloc() it to grow it, and should free() it to
202 int yy_is_our_buffer;
204 /* Whether this is an "interactive" input source; if so, and
205 * if we're using stdio for input, then we want to use getc()
206 * instead of fread(), to make sure we stop fetching input after
209 int yy_is_interactive;
211 /* Whether we're considered to be at the beginning of a line.
212 * If so, '^' rules will be active on the next match, otherwise
217 int yy_bs_lineno; /**< The line count. */
218 int yy_bs_column; /**< The column count. */
220 /* Whether to try to fill the input buffer when we reach the
225 int yy_buffer_status;
227 #define YY_BUFFER_NEW 0
228 #define YY_BUFFER_NORMAL 1
229 /* When an EOF's been seen but there's still some text to process
230 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
231 * shouldn't try reading from the input source any more. We might
232 * still have a bunch of tokens to match, though, because of
233 * possible backing-up.
235 * When we actually see the EOF, we change the status to "new"
236 * (via gras_ddt_parse_restart()), so that the user can continue scanning by
237 * just pointing gras_ddt_parse_in at a new input file.
239 #define YY_BUFFER_EOF_PENDING 2
242 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
244 /* Stack of input buffers. */
245 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
246 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
247 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
249 /* We provide macros for accessing buffer states in case in the
250 * future we want to put the buffer states in a more general
253 * Returns the top of the stack, or NULL.
255 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
256 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
259 /* Same as previous macro, but useful when we know that the buffer stack is not
260 * NULL or when we need an lvalue. For internal use only.
262 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
264 /* yy_hold_char holds the character lost when gras_ddt_parse_text is formed. */
265 static char yy_hold_char;
266 static int yy_n_chars; /* number of characters read into yy_ch_buf */
267 int gras_ddt_parse_leng;
269 /* Points to current character in buffer. */
270 static char *yy_c_buf_p = (char *) 0;
271 static int yy_init = 1; /* whether we need to initialize */
272 static int yy_start = 0; /* start state number */
274 /* Flag which is used to allow gras_ddt_parse_wrap()'s to do buffer switches
275 * instead of setting up a fresh gras_ddt_parse_in. A bit of a hack ...
277 static int yy_did_buffer_switch_on_eof;
279 void gras_ddt_parse_restart (FILE *input_file );
280 void gras_ddt_parse__switch_to_buffer (YY_BUFFER_STATE new_buffer );
281 YY_BUFFER_STATE gras_ddt_parse__create_buffer (FILE *file,int size );
282 void gras_ddt_parse__delete_buffer (YY_BUFFER_STATE b );
283 void gras_ddt_parse__flush_buffer (YY_BUFFER_STATE b );
284 void gras_ddt_parse_push_buffer_state (YY_BUFFER_STATE new_buffer );
285 void gras_ddt_parse_pop_buffer_state (void );
287 static void gras_ddt_parse_ensure_buffer_stack (void );
288 static void gras_ddt_parse__load_buffer_state (void );
289 static void gras_ddt_parse__init_buffer (YY_BUFFER_STATE b,FILE *file );
291 #define YY_FLUSH_BUFFER gras_ddt_parse__flush_buffer(YY_CURRENT_BUFFER )
293 YY_BUFFER_STATE gras_ddt_parse__scan_buffer (char *base,yy_size_t size );
294 YY_BUFFER_STATE gras_ddt_parse__scan_string (yyconst char *yy_str );
295 YY_BUFFER_STATE gras_ddt_parse__scan_bytes (yyconst char *bytes,int len );
297 void *gras_ddt_parse_alloc (yy_size_t );
298 void *gras_ddt_parse_realloc (void *,yy_size_t );
299 void gras_ddt_parse_free (void * );
301 #define yy_new_buffer gras_ddt_parse__create_buffer
303 #define yy_set_interactive(is_interactive) \
305 if ( ! YY_CURRENT_BUFFER ){ \
306 gras_ddt_parse_ensure_buffer_stack (); \
307 YY_CURRENT_BUFFER_LVALUE = \
308 gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE ); \
310 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
313 #define yy_set_bol(at_bol) \
315 if ( ! YY_CURRENT_BUFFER ){\
316 gras_ddt_parse_ensure_buffer_stack (); \
317 YY_CURRENT_BUFFER_LVALUE = \
318 gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE ); \
320 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
323 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
325 /* Begin user sect3 */
327 #define gras_ddt_parse_wrap(n) 1
328 #define YY_SKIP_YYWRAP
330 typedef unsigned char YY_CHAR;
332 FILE *gras_ddt_parse_in = (FILE *) 0, *gras_ddt_parse_out = (FILE *) 0;
334 typedef int yy_state_type;
336 extern int gras_ddt_parse_lineno;
338 int gras_ddt_parse_lineno = 1;
340 extern char *gras_ddt_parse_text;
341 #define yytext_ptr gras_ddt_parse_text
343 static yy_state_type yy_get_previous_state (void );
344 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
345 static int yy_get_next_buffer (void );
346 static void yy_fatal_error (yyconst char msg[] );
348 /* Done after the current pattern has been matched and before the
349 * corresponding action - sets up gras_ddt_parse_text.
351 #define YY_DO_BEFORE_ACTION \
352 (yytext_ptr) = yy_bp; \
353 gras_ddt_parse_leng = (size_t) (yy_cp - yy_bp); \
354 (yy_hold_char) = *yy_cp; \
356 (yy_c_buf_p) = yy_cp;
358 #define YY_NUM_RULES 30
359 #define YY_END_OF_BUFFER 31
360 /* This struct is not used in this scanner,
361 but its presence is necessary. */
364 flex_int32_t yy_verify;
367 static yyconst flex_int16_t yy_accept[53] =
369 20, 20, 4, 4, 0, 0, 0, 0, 31, 29,
370 28, 8, 25, 27, 20, 29, 26, 23, 24, 21,
371 22, 4, 6, 5, 30, 30, 19, 10, 9, 30,
372 20, 2, 1, 4, 5, 5, 7, 3, 19, 18,
373 11, 12, 16, 17, 13, 15, 14, 1, 11, 12,
377 static yyconst flex_int32_t yy_ec[256] =
379 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
380 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
381 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
382 1, 1, 1, 3, 1, 1, 1, 1, 1, 1,
383 1, 4, 1, 5, 6, 6, 7, 8, 8, 8,
384 8, 8, 8, 8, 8, 9, 9, 1, 10, 1,
385 1, 1, 1, 1, 6, 6, 6, 6, 6, 6,
386 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
387 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
388 11, 12, 13, 1, 6, 1, 6, 14, 6, 6,
390 6, 15, 6, 6, 6, 6, 6, 6, 6, 16,
391 6, 6, 6, 17, 6, 18, 6, 6, 6, 6,
392 6, 6, 19, 1, 20, 1, 1, 1, 1, 1,
393 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
394 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
395 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
396 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
397 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
398 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
399 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
401 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
402 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
403 1, 1, 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,
409 static yyconst flex_int32_t yy_meta[21] =
411 1, 2, 3, 4, 1, 5, 1, 5, 5, 1,
412 1, 3, 1, 5, 5, 5, 5, 5, 1, 1
415 static yyconst flex_int16_t yy_base[62] =
417 0, 0, 19, 20, 76, 71, 23, 25, 75, 97,
418 97, 97, 97, 97, 0, 25, 97, 97, 97, 97,
419 97, 0, 97, 26, 97, 69, 0, 97, 97, 30,
420 0, 97, 0, 0, 27, 36, 97, 97, 0, 97,
421 33, 41, 97, 97, 97, 97, 97, 0, 43, 45,
422 47, 97, 56, 61, 66, 31, 71, 76, 81, 86,
426 static yyconst flex_int16_t yy_def[62] =
428 52, 1, 53, 53, 54, 54, 55, 55, 52, 52,
429 52, 52, 52, 52, 56, 52, 52, 52, 52, 52,
430 52, 57, 52, 58, 52, 52, 59, 52, 52, 60,
431 56, 52, 61, 57, 58, 58, 52, 52, 59, 52,
432 52, 52, 52, 52, 52, 52, 52, 61, 52, 52,
433 52, 0, 52, 52, 52, 52, 52, 52, 52, 52,
437 static yyconst flex_int16_t yy_nxt[118] =
439 10, 11, 12, 13, 14, 15, 16, 15, 15, 17,
440 18, 10, 19, 15, 15, 15, 15, 15, 20, 21,
441 23, 23, 24, 24, 28, 29, 28, 29, 32, 36,
442 52, 33, 37, 52, 30, 31, 30, 41, 42, 36,
443 49, 50, 37, 43, 44, 45, 46, 47, 50, 50,
444 51, 50, 50, 50, 50, 50, 22, 22, 22, 22,
445 22, 25, 25, 25, 25, 25, 27, 27, 27, 27,
446 27, 34, 38, 34, 52, 34, 35, 26, 35, 35,
447 35, 39, 26, 52, 39, 39, 40, 40, 40, 40,
448 40, 48, 52, 48, 48, 48, 9, 52, 52, 52,
450 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
451 52, 52, 52, 52, 52, 52, 52
454 static yyconst flex_int16_t yy_chk[118] =
456 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
457 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
458 3, 4, 3, 4, 7, 7, 8, 8, 16, 24,
459 35, 16, 24, 35, 7, 56, 8, 30, 30, 36,
460 41, 41, 36, 30, 30, 30, 30, 30, 42, 42,
461 49, 49, 50, 50, 51, 51, 53, 53, 53, 53,
462 53, 54, 54, 54, 54, 54, 55, 55, 55, 55,
463 55, 57, 26, 57, 9, 57, 58, 6, 58, 58,
464 58, 59, 5, 0, 59, 59, 60, 60, 60, 60,
465 60, 61, 0, 61, 61, 61, 52, 52, 52, 52,
467 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
468 52, 52, 52, 52, 52, 52, 52
471 static yy_state_type yy_last_accepting_state;
472 static char *yy_last_accepting_cpos;
474 extern int gras_ddt_parse__flex_debug;
475 int gras_ddt_parse__flex_debug = 0;
477 /* The intent behind this definition is that it'll catch
478 * any uses of REJECT which flex missed.
480 #define REJECT reject_used_but_not_detected
481 #define yymore() yymore_used_but_not_detected
482 #define YY_MORE_ADJ 0
483 #define YY_RESTORE_YY_MORE_OFFSET
484 char *gras_ddt_parse_text;
485 #line 1 "DataDesc/ddt_parse.yy.l"
486 /**** MSG_LICENCE DO NOT REMOVE ****/
487 #line 5 "DataDesc/ddt_parse.yy.l"
488 #include"DataDesc/datadesc_private.h"
489 #include"DataDesc/ddt_parse.yy.h"
491 YY_BUFFER_STATE input_buffer;
494 int gras_ddt_parse_line_pos = 1;
495 int gras_ddt_parse_col_pos = 0;
496 int gras_ddt_parse_char_pos = 0;
497 int gras_ddt_parse_tok_num = 0;
499 #line 500 "DataDesc/ddt_parse.yy.c"
506 #ifndef YY_NO_UNISTD_H
507 /* Special case for "unistd.h", since it is non-ANSI. We include it way
508 * down here because we want the user's section 1 to have been scanned first.
509 * The user has a chance to override it with an option.
514 #ifndef YY_EXTRA_TYPE
515 #define YY_EXTRA_TYPE void *
518 /* Macros after this point can all be overridden by user definitions in
522 #ifndef YY_SKIP_YYWRAP
524 extern "C" int gras_ddt_parse_wrap (void );
526 extern int gras_ddt_parse_wrap (void );
530 static void yyunput (int c,char *buf_ptr );
533 static void yy_flex_strncpy (char *,yyconst char *,int );
536 #ifdef YY_NEED_STRLEN
537 static int yy_flex_strlen (yyconst char * );
543 static int yyinput (void );
545 static int input (void );
550 /* Amount of stuff to slurp up with each read. */
551 #ifndef YY_READ_BUF_SIZE
552 #define YY_READ_BUF_SIZE 8192
555 /* Copy whatever the last rule matched to the standard output. */
557 /* This used to be an fputs(), but since the string might contain NUL's,
558 * we now use fwrite().
560 #define ECHO (void) fwrite( gras_ddt_parse_text, gras_ddt_parse_leng, 1, gras_ddt_parse_out )
563 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
564 * is returned in "result".
567 #define YY_INPUT(buf,result,max_size) \
568 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
572 for ( n = 0; n < max_size && \
573 (c = getc( gras_ddt_parse_in )) != EOF && c != '\n'; ++n ) \
576 buf[n++] = (char) c; \
577 if ( c == EOF && ferror( gras_ddt_parse_in ) ) \
578 YY_FATAL_ERROR( "input in flex scanner failed" ); \
584 while ( (result = fread(buf, 1, max_size, gras_ddt_parse_in))==0 && ferror(gras_ddt_parse_in)) \
586 if( errno != EINTR) \
588 YY_FATAL_ERROR( "input in flex scanner failed" ); \
592 clearerr(gras_ddt_parse_in); \
599 /* No semi-colon after return; correct usage is to write "yyterminate();" -
600 * we don't want an extra ';' after the "return" because that will cause
601 * some compilers to complain about unreachable statements.
604 #define yyterminate() return YY_NULL
607 /* Number of entries by which start-condition stack grows. */
608 #ifndef YY_START_STACK_INCR
609 #define YY_START_STACK_INCR 25
612 /* Report a fatal error. */
613 #ifndef YY_FATAL_ERROR
614 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
617 /* end tables serialization structures and prototypes */
619 /* Default declaration of generated scanner - a define so the user can
620 * easily add parameters.
623 #define YY_DECL_IS_OURS 1
625 extern int gras_ddt_parse_lex (void);
627 #define YY_DECL int gras_ddt_parse_lex (void)
628 #endif /* !YY_DECL */
630 /* Code executed at the beginning of each rule, after gras_ddt_parse_text and gras_ddt_parse_leng
633 #ifndef YY_USER_ACTION
634 #define YY_USER_ACTION
637 /* Code executed at the end of each rule. */
639 #define YY_BREAK break;
642 #define YY_RULE_SETUP \
645 /** The main scanner function which does all the work.
649 register yy_state_type yy_current_state;
650 register char *yy_cp, *yy_bp;
653 #line 22 "DataDesc/ddt_parse.yy.l"
655 int comment_caller=0;
657 char string_buf[GRAS_DDT_PARSE_MAX_STR_CONST];
658 char *string_buf_ptr = NULL;
660 #line 661 "DataDesc/ddt_parse.yy.c"
671 (yy_start) = 1; /* first start state */
673 if ( ! gras_ddt_parse_in )
674 gras_ddt_parse_in = stdin;
676 if ( ! gras_ddt_parse_out )
677 gras_ddt_parse_out = stdout;
679 if ( ! YY_CURRENT_BUFFER ) {
680 gras_ddt_parse_ensure_buffer_stack ();
681 YY_CURRENT_BUFFER_LVALUE =
682 gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE );
685 gras_ddt_parse__load_buffer_state( );
688 while ( 1 ) /* loops until end-of-file is reached */
690 yy_cp = (yy_c_buf_p);
692 /* Support of gras_ddt_parse_text. */
693 *yy_cp = (yy_hold_char);
695 /* yy_bp points to the position in yy_ch_buf of the start of
700 yy_current_state = (yy_start);
704 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
705 if ( yy_accept[yy_current_state] )
707 (yy_last_accepting_state) = yy_current_state;
708 (yy_last_accepting_cpos) = yy_cp;
710 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
712 yy_current_state = (int) yy_def[yy_current_state];
713 if ( yy_current_state >= 53 )
714 yy_c = yy_meta[(unsigned int) yy_c];
716 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
719 while ( yy_base[yy_current_state] != 97 );
722 yy_act = yy_accept[yy_current_state];
724 { /* have to back up */
725 yy_cp = (yy_last_accepting_cpos);
726 yy_current_state = (yy_last_accepting_state);
727 yy_act = yy_accept[yy_current_state];
732 do_action: /* This label is used only to access EOF actions. */
735 { /* beginning of action switch */
736 case 0: /* must back up */
737 /* undo the effects of YY_DO_BEFORE_ACTION */
738 *yy_cp = (yy_hold_char);
739 yy_cp = (yy_last_accepting_cpos);
740 yy_current_state = (yy_last_accepting_state);
745 #line 28 "DataDesc/ddt_parse.yy.l"
750 #line 29 "DataDesc/ddt_parse.yy.l"
752 comment_caller = INITIAL;
758 #line 34 "DataDesc/ddt_parse.yy.l"
760 comment_caller = foo;
766 #line 39 "DataDesc/ddt_parse.yy.l"
767 /* eat anything that's not a '*' */
771 #line 40 "DataDesc/ddt_parse.yy.l"
772 /* eat up '*'s not followed by '/'s */
775 /* rule 6 can match eol */
777 #line 41 "DataDesc/ddt_parse.yy.l"
779 ++gras_ddt_parse_line_pos;
780 gras_ddt_parse_col_pos=0;
781 gras_ddt_parse_char_pos++;
786 #line 46 "DataDesc/ddt_parse.yy.l"
787 BEGIN(comment_caller);
791 #line 48 "DataDesc/ddt_parse.yy.l"
792 string_buf_ptr = string_buf; gras_ddt_parse_char_pos++;gras_ddt_parse_col_pos++; BEGIN(str);
796 #line 50 "DataDesc/ddt_parse.yy.l"
797 { /* saw closing quote - all done */
799 *string_buf_ptr = '\0';
800 gras_ddt_parse_text=string_buf;
801 gras_ddt_parse_char_pos++;
802 gras_ddt_parse_col_pos++;
803 return GRAS_DDT_PARSE_TOKEN_WORD;
804 /* return string constant token type and
810 /* rule 10 can match eol */
812 #line 62 "DataDesc/ddt_parse.yy.l"
814 /* error - unterminated string constant */
815 /* generate error message */
820 #line 67 "DataDesc/ddt_parse.yy.l"
822 /* octal escape sequence */
825 (void) sscanf( gras_ddt_parse_text + 1, "%o", &result );
828 /* error, constant is out-of-bounds */
830 *string_buf_ptr++ = result;
831 gras_ddt_parse_char_pos++;
832 gras_ddt_parse_col_pos++;
837 #line 81 "DataDesc/ddt_parse.yy.l"
839 /* generate error - bad escape sequence; something
840 * like '\48' or '\0777777'
846 #line 87 "DataDesc/ddt_parse.yy.l"
848 *string_buf_ptr++ = '\n';
849 gras_ddt_parse_char_pos++;
850 gras_ddt_parse_col_pos++;
855 #line 92 "DataDesc/ddt_parse.yy.l"
857 *string_buf_ptr++ = '\t';
858 gras_ddt_parse_char_pos++;
859 gras_ddt_parse_col_pos++;
864 #line 97 "DataDesc/ddt_parse.yy.l"
866 *string_buf_ptr++ = '\r';
867 gras_ddt_parse_char_pos++;
868 gras_ddt_parse_col_pos++;
873 #line 102 "DataDesc/ddt_parse.yy.l"
875 *string_buf_ptr++ = '\b';
876 gras_ddt_parse_char_pos++;
877 gras_ddt_parse_col_pos++;
882 #line 107 "DataDesc/ddt_parse.yy.l"
884 *string_buf_ptr++ = '\f';
885 gras_ddt_parse_char_pos++;
886 gras_ddt_parse_col_pos++;
890 /* rule 18 can match eol */
892 #line 113 "DataDesc/ddt_parse.yy.l"
894 *string_buf_ptr++ = gras_ddt_parse_text[1];
895 if(gras_ddt_parse_text[1]=='\n') {
896 ++gras_ddt_parse_line_pos;
897 gras_ddt_parse_col_pos=0;
899 gras_ddt_parse_col_pos++;
901 gras_ddt_parse_char_pos++;
906 #line 124 "DataDesc/ddt_parse.yy.l"
908 char *yptr = gras_ddt_parse_text;
911 *string_buf_ptr++ = *yptr++;
912 gras_ddt_parse_char_pos++;
913 gras_ddt_parse_col_pos++;
918 #line 133 "DataDesc/ddt_parse.yy.l"
920 gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
921 gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
922 return(GRAS_DDT_PARSE_TOKEN_WORD);
927 #line 138 "DataDesc/ddt_parse.yy.l"
929 gras_ddt_parse_char_pos++;
930 gras_ddt_parse_col_pos++;
931 return(GRAS_DDT_PARSE_TOKEN_LP);
936 #line 143 "DataDesc/ddt_parse.yy.l"
938 gras_ddt_parse_char_pos++;
939 gras_ddt_parse_col_pos++;
940 return(GRAS_DDT_PARSE_TOKEN_RP);
945 #line 148 "DataDesc/ddt_parse.yy.l"
947 gras_ddt_parse_char_pos++;
948 gras_ddt_parse_col_pos++;
949 return(GRAS_DDT_PARSE_TOKEN_LB);
954 #line 153 "DataDesc/ddt_parse.yy.l"
956 gras_ddt_parse_char_pos++;
957 gras_ddt_parse_col_pos++;
958 return(GRAS_DDT_PARSE_TOKEN_RB);
963 #line 158 "DataDesc/ddt_parse.yy.l"
965 gras_ddt_parse_char_pos++;
966 gras_ddt_parse_col_pos++;
967 return(GRAS_DDT_PARSE_TOKEN_STAR);
972 #line 163 "DataDesc/ddt_parse.yy.l"
974 gras_ddt_parse_char_pos++;
975 gras_ddt_parse_col_pos++;
976 return(GRAS_DDT_PARSE_TOKEN_SEMI_COLON);
981 #line 168 "DataDesc/ddt_parse.yy.l"
983 gras_ddt_parse_char_pos++;
984 gras_ddt_parse_col_pos++;
985 return(GRAS_DDT_PARSE_TOKEN_COLON);
989 /* rule 28 can match eol */
991 #line 173 "DataDesc/ddt_parse.yy.l"
993 gras_ddt_parse_line_pos++;
994 gras_ddt_parse_char_pos=0;
995 gras_ddt_parse_col_pos++;
1000 #line 178 "DataDesc/ddt_parse.yy.l"
1002 gras_ddt_parse_char_pos++;
1003 gras_ddt_parse_col_pos++;
1008 #line 182 "DataDesc/ddt_parse.yy.l"
1011 #line 1012 "DataDesc/ddt_parse.yy.c"
1012 case YY_STATE_EOF(INITIAL):
1013 case YY_STATE_EOF(comment):
1014 case YY_STATE_EOF(foo):
1015 case YY_STATE_EOF(str):
1018 case YY_END_OF_BUFFER:
1020 /* Amount of text matched not including the EOB char. */
1021 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1023 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1024 *yy_cp = (yy_hold_char);
1025 YY_RESTORE_YY_MORE_OFFSET
1027 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1029 /* We're scanning a new file or input source. It's
1030 * possible that this happened because the user
1031 * just pointed gras_ddt_parse_in at a new source and called
1032 * gras_ddt_parse_lex(). If so, then we have to assure
1033 * consistency between YY_CURRENT_BUFFER and our
1034 * globals. Here is the right place to do so, because
1035 * this is the first action (other than possibly a
1036 * back-up) that will match for the new input source.
1038 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1039 YY_CURRENT_BUFFER_LVALUE->yy_input_file = gras_ddt_parse_in;
1040 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1043 /* Note that here we test for yy_c_buf_p "<=" to the position
1044 * of the first EOB in the buffer, since yy_c_buf_p will
1045 * already have been incremented past the NUL character
1046 * (since all states make transitions on EOB to the
1047 * end-of-buffer state). Contrast this with the test
1050 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1051 { /* This was really a NUL. */
1052 yy_state_type yy_next_state;
1054 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1056 yy_current_state = yy_get_previous_state( );
1058 /* Okay, we're now positioned to make the NUL
1059 * transition. We couldn't have
1060 * yy_get_previous_state() go ahead and do it
1061 * for us because it doesn't know how to deal
1062 * with the possibility of jamming (and we don't
1063 * want to build jamming into it because then it
1064 * will run more slowly).
1067 yy_next_state = yy_try_NUL_trans( yy_current_state );
1069 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1071 if ( yy_next_state )
1073 /* Consume the NUL. */
1074 yy_cp = ++(yy_c_buf_p);
1075 yy_current_state = yy_next_state;
1081 yy_cp = (yy_c_buf_p);
1082 goto yy_find_action;
1086 else switch ( yy_get_next_buffer( ) )
1088 case EOB_ACT_END_OF_FILE:
1090 (yy_did_buffer_switch_on_eof) = 0;
1092 if ( gras_ddt_parse_wrap( ) )
1094 /* Note: because we've taken care in
1095 * yy_get_next_buffer() to have set up
1096 * gras_ddt_parse_text, we can now set up
1097 * yy_c_buf_p so that if some total
1098 * hoser (like flex itself) wants to
1099 * call the scanner after we return the
1100 * YY_NULL, it'll still work - another
1101 * YY_NULL will get returned.
1103 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1105 yy_act = YY_STATE_EOF(YY_START);
1111 if ( ! (yy_did_buffer_switch_on_eof) )
1117 case EOB_ACT_CONTINUE_SCAN:
1119 (yytext_ptr) + yy_amount_of_matched_text;
1121 yy_current_state = yy_get_previous_state( );
1123 yy_cp = (yy_c_buf_p);
1124 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1127 case EOB_ACT_LAST_MATCH:
1129 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1131 yy_current_state = yy_get_previous_state( );
1133 yy_cp = (yy_c_buf_p);
1134 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1135 goto yy_find_action;
1142 "fatal flex scanner internal error--no action found" );
1143 } /* end of action switch */
1144 } /* end of scanning one token */
1145 } /* end of gras_ddt_parse_lex */
1147 /* yy_get_next_buffer - try to read in a new buffer
1149 * Returns a code representing an action:
1150 * EOB_ACT_LAST_MATCH -
1151 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1152 * EOB_ACT_END_OF_FILE - end of file
1154 static int yy_get_next_buffer (void)
1156 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1157 register char *source = (yytext_ptr);
1158 register int number_to_move, i;
1161 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1163 "fatal flex scanner internal error--end of buffer missed" );
1165 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1166 { /* Don't try to fill the buffer, so this is an EOF. */
1167 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1169 /* We matched a single character, the EOB, so
1170 * treat this as a final EOF.
1172 return EOB_ACT_END_OF_FILE;
1177 /* We matched some text prior to the EOB, first
1180 return EOB_ACT_LAST_MATCH;
1184 /* Try to read more data. */
1186 /* First move last chars to start of buffer. */
1187 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1189 for ( i = 0; i < number_to_move; ++i )
1190 *(dest++) = *(source++);
1192 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1193 /* don't do the read, it's not guaranteed to return an EOF,
1196 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1200 size_t num_to_read =
1201 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1203 while ( num_to_read <= 0 )
1204 { /* Not enough room in the buffer - grow it. */
1206 /* just a shorter name for the current buffer */
1207 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1209 int yy_c_buf_p_offset =
1210 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1212 if ( b->yy_is_our_buffer )
1214 int new_size = b->yy_buf_size * 2;
1216 if ( new_size <= 0 )
1217 b->yy_buf_size += b->yy_buf_size / 8;
1219 b->yy_buf_size *= 2;
1221 b->yy_ch_buf = (char *)
1222 /* Include room in for 2 EOB chars. */
1223 gras_ddt_parse_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1226 /* Can't grow it, we don't own it. */
1229 if ( ! b->yy_ch_buf )
1231 "fatal error - scanner input buffer overflow" );
1233 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1235 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1240 if ( num_to_read > YY_READ_BUF_SIZE )
1241 num_to_read = YY_READ_BUF_SIZE;
1243 /* Read in more data. */
1244 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1245 (yy_n_chars), num_to_read );
1247 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1250 if ( (yy_n_chars) == 0 )
1252 if ( number_to_move == YY_MORE_ADJ )
1254 ret_val = EOB_ACT_END_OF_FILE;
1255 gras_ddt_parse_restart(gras_ddt_parse_in );
1260 ret_val = EOB_ACT_LAST_MATCH;
1261 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1262 YY_BUFFER_EOF_PENDING;
1267 ret_val = EOB_ACT_CONTINUE_SCAN;
1269 (yy_n_chars) += number_to_move;
1270 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1271 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1273 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1278 /* yy_get_previous_state - get the state just before the EOB char was reached */
1280 static yy_state_type yy_get_previous_state (void)
1282 register yy_state_type yy_current_state;
1283 register char *yy_cp;
1285 yy_current_state = (yy_start);
1287 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1289 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1290 if ( yy_accept[yy_current_state] )
1292 (yy_last_accepting_state) = yy_current_state;
1293 (yy_last_accepting_cpos) = yy_cp;
1295 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1297 yy_current_state = (int) yy_def[yy_current_state];
1298 if ( yy_current_state >= 53 )
1299 yy_c = yy_meta[(unsigned int) yy_c];
1301 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1304 return yy_current_state;
1307 /* yy_try_NUL_trans - try to make a transition on the NUL character
1310 * next_state = yy_try_NUL_trans( current_state );
1312 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1314 register int yy_is_jam;
1315 register char *yy_cp = (yy_c_buf_p);
1317 register YY_CHAR yy_c = 1;
1318 if ( yy_accept[yy_current_state] )
1320 (yy_last_accepting_state) = yy_current_state;
1321 (yy_last_accepting_cpos) = yy_cp;
1323 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1325 yy_current_state = (int) yy_def[yy_current_state];
1326 if ( yy_current_state >= 53 )
1327 yy_c = yy_meta[(unsigned int) yy_c];
1329 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1330 yy_is_jam = (yy_current_state == 52);
1332 return yy_is_jam ? 0 : yy_current_state;
1335 static void yyunput (int c, register char * yy_bp )
1337 register char *yy_cp;
1339 yy_cp = (yy_c_buf_p);
1341 /* undo effects of setting up gras_ddt_parse_text */
1342 *yy_cp = (yy_hold_char);
1344 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1345 { /* need to shift things up to make room */
1346 /* +2 for EOB chars. */
1347 register int number_to_move = (yy_n_chars) + 2;
1348 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1349 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1350 register char *source =
1351 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1353 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1354 *--dest = *--source;
1356 yy_cp += (int) (dest - source);
1357 yy_bp += (int) (dest - source);
1358 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1359 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1361 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1362 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1365 *--yy_cp = (char) c;
1367 (yytext_ptr) = yy_bp;
1368 (yy_hold_char) = *yy_cp;
1369 (yy_c_buf_p) = yy_cp;
1374 static int yyinput (void)
1376 static int input (void)
1382 *(yy_c_buf_p) = (yy_hold_char);
1384 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1386 /* yy_c_buf_p now points to the character we want to return.
1387 * If this occurs *before* the EOB characters, then it's a
1388 * valid NUL; if not, then we've hit the end of the buffer.
1390 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1391 /* This was really a NUL. */
1392 *(yy_c_buf_p) = '\0';
1395 { /* need more input */
1396 int offset = (yy_c_buf_p) - (yytext_ptr);
1399 switch ( yy_get_next_buffer( ) )
1401 case EOB_ACT_LAST_MATCH:
1402 /* This happens because yy_g_n_b()
1403 * sees that we've accumulated a
1404 * token and flags that we need to
1405 * try matching the token before
1406 * proceeding. But for input(),
1407 * there's no matching to consider.
1408 * So convert the EOB_ACT_LAST_MATCH
1409 * to EOB_ACT_END_OF_FILE.
1412 /* Reset buffer status. */
1413 gras_ddt_parse_restart(gras_ddt_parse_in );
1417 case EOB_ACT_END_OF_FILE:
1419 if ( gras_ddt_parse_wrap( ) )
1422 if ( ! (yy_did_buffer_switch_on_eof) )
1431 case EOB_ACT_CONTINUE_SCAN:
1432 (yy_c_buf_p) = (yytext_ptr) + offset;
1438 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1439 *(yy_c_buf_p) = '\0'; /* preserve gras_ddt_parse_text */
1440 (yy_hold_char) = *++(yy_c_buf_p);
1444 #endif /* ifndef YY_NO_INPUT */
1446 /** Immediately switch to a different input stream.
1447 * @param input_file A readable stream.
1449 * @note This function does not reset the start condition to @c INITIAL .
1451 void gras_ddt_parse_restart (FILE * input_file )
1454 if ( ! YY_CURRENT_BUFFER ){
1455 gras_ddt_parse_ensure_buffer_stack ();
1456 YY_CURRENT_BUFFER_LVALUE =
1457 gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE );
1460 gras_ddt_parse__init_buffer(YY_CURRENT_BUFFER,input_file );
1461 gras_ddt_parse__load_buffer_state( );
1464 /** Switch to a different input buffer.
1465 * @param new_buffer The new input buffer.
1468 void gras_ddt_parse__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1471 /* TODO. We should be able to replace this entire function body
1473 * gras_ddt_parse_pop_buffer_state();
1474 * gras_ddt_parse_push_buffer_state(new_buffer);
1476 gras_ddt_parse_ensure_buffer_stack ();
1477 if ( YY_CURRENT_BUFFER == new_buffer )
1480 if ( YY_CURRENT_BUFFER )
1482 /* Flush out information for old buffer. */
1483 *(yy_c_buf_p) = (yy_hold_char);
1484 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1485 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1488 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1489 gras_ddt_parse__load_buffer_state( );
1491 /* We don't actually know whether we did this switch during
1492 * EOF (gras_ddt_parse_wrap()) processing, but the only time this flag
1493 * is looked at is after gras_ddt_parse_wrap() is called, so it's safe
1494 * to go ahead and always set it.
1496 (yy_did_buffer_switch_on_eof) = 1;
1499 static void gras_ddt_parse__load_buffer_state (void)
1501 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1502 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1503 gras_ddt_parse_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1504 (yy_hold_char) = *(yy_c_buf_p);
1507 /** Allocate and initialize an input buffer state.
1508 * @param file A readable stream.
1509 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1511 * @return the allocated buffer state.
1513 YY_BUFFER_STATE gras_ddt_parse__create_buffer (FILE * file, int size )
1517 b = (YY_BUFFER_STATE) gras_ddt_parse_alloc(sizeof( struct yy_buffer_state ) );
1519 YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__create_buffer()" );
1521 b->yy_buf_size = size;
1523 /* yy_ch_buf has to be 2 characters longer than the size given because
1524 * we need to put in 2 end-of-buffer characters.
1526 b->yy_ch_buf = (char *) gras_ddt_parse_alloc(b->yy_buf_size + 2 );
1527 if ( ! b->yy_ch_buf )
1528 YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__create_buffer()" );
1530 b->yy_is_our_buffer = 1;
1532 gras_ddt_parse__init_buffer(b,file );
1537 /** Destroy the buffer.
1538 * @param b a buffer created with gras_ddt_parse__create_buffer()
1541 void gras_ddt_parse__delete_buffer (YY_BUFFER_STATE b )
1547 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1548 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1550 if ( b->yy_is_our_buffer )
1551 gras_ddt_parse_free((void *) b->yy_ch_buf );
1553 gras_ddt_parse_free((void *) b );
1557 extern int isatty (int );
1558 #endif /* __cplusplus */
1560 /* Initializes or reinitializes a buffer.
1561 * This function is sometimes called more than once on the same buffer,
1562 * such as during a gras_ddt_parse_restart() or at EOF.
1564 static void gras_ddt_parse__init_buffer (YY_BUFFER_STATE b, FILE * file )
1569 gras_ddt_parse__flush_buffer(b );
1571 b->yy_input_file = file;
1572 b->yy_fill_buffer = 1;
1574 /* If b is the current buffer, then gras_ddt_parse__init_buffer was _probably_
1575 * called from gras_ddt_parse_restart() or through yy_get_next_buffer.
1576 * In that case, we don't want to reset the lineno or column.
1578 if (b != YY_CURRENT_BUFFER){
1579 b->yy_bs_lineno = 1;
1580 b->yy_bs_column = 0;
1583 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1588 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1589 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1592 void gras_ddt_parse__flush_buffer (YY_BUFFER_STATE b )
1599 /* We always need two end-of-buffer characters. The first causes
1600 * a transition to the end-of-buffer state. The second causes
1601 * a jam in that state.
1603 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1604 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1606 b->yy_buf_pos = &b->yy_ch_buf[0];
1609 b->yy_buffer_status = YY_BUFFER_NEW;
1611 if ( b == YY_CURRENT_BUFFER )
1612 gras_ddt_parse__load_buffer_state( );
1615 /** Pushes the new state onto the stack. The new state becomes
1616 * the current state. This function will allocate the stack
1618 * @param new_buffer The new state.
1621 void gras_ddt_parse_push_buffer_state (YY_BUFFER_STATE new_buffer )
1623 if (new_buffer == NULL)
1626 gras_ddt_parse_ensure_buffer_stack();
1628 /* This block is copied from gras_ddt_parse__switch_to_buffer. */
1629 if ( YY_CURRENT_BUFFER )
1631 /* Flush out information for old buffer. */
1632 *(yy_c_buf_p) = (yy_hold_char);
1633 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1634 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1637 /* Only push if top exists. Otherwise, replace top. */
1638 if (YY_CURRENT_BUFFER)
1639 (yy_buffer_stack_top)++;
1640 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1642 /* copied from gras_ddt_parse__switch_to_buffer. */
1643 gras_ddt_parse__load_buffer_state( );
1644 (yy_did_buffer_switch_on_eof) = 1;
1647 /** Removes and deletes the top of the stack, if present.
1648 * The next element becomes the new top.
1651 void gras_ddt_parse_pop_buffer_state (void)
1653 if (!YY_CURRENT_BUFFER)
1656 gras_ddt_parse__delete_buffer(YY_CURRENT_BUFFER );
1657 YY_CURRENT_BUFFER_LVALUE = NULL;
1658 if ((yy_buffer_stack_top) > 0)
1659 --(yy_buffer_stack_top);
1661 if (YY_CURRENT_BUFFER) {
1662 gras_ddt_parse__load_buffer_state( );
1663 (yy_did_buffer_switch_on_eof) = 1;
1667 /* Allocates the stack if it does not exist.
1668 * Guarantees space for at least one push.
1670 static void gras_ddt_parse_ensure_buffer_stack (void)
1674 if (!(yy_buffer_stack)) {
1676 /* First allocation is just for 2 elements, since we don't know if this
1677 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1678 * immediate realloc on the next call.
1681 (yy_buffer_stack) = (struct yy_buffer_state**)gras_ddt_parse_alloc
1682 (num_to_alloc * sizeof(struct yy_buffer_state*)
1685 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1687 (yy_buffer_stack_max) = num_to_alloc;
1688 (yy_buffer_stack_top) = 0;
1692 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1694 /* Increase the buffer to prepare for a possible push. */
1695 int grow_size = 8 /* arbitrary grow size */;
1697 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1698 (yy_buffer_stack) = (struct yy_buffer_state**)gras_ddt_parse_realloc
1700 num_to_alloc * sizeof(struct yy_buffer_state*)
1703 /* zero only the new slots.*/
1704 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1705 (yy_buffer_stack_max) = num_to_alloc;
1709 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1710 * @param base the character buffer
1711 * @param size the size in bytes of the character buffer
1713 * @return the newly allocated buffer state object.
1715 YY_BUFFER_STATE gras_ddt_parse__scan_buffer (char * base, yy_size_t size )
1720 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1721 base[size-1] != YY_END_OF_BUFFER_CHAR )
1722 /* They forgot to leave room for the EOB's. */
1725 b = (YY_BUFFER_STATE) gras_ddt_parse_alloc(sizeof( struct yy_buffer_state ) );
1727 YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__scan_buffer()" );
1729 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1730 b->yy_buf_pos = b->yy_ch_buf = base;
1731 b->yy_is_our_buffer = 0;
1732 b->yy_input_file = 0;
1733 b->yy_n_chars = b->yy_buf_size;
1734 b->yy_is_interactive = 0;
1736 b->yy_fill_buffer = 0;
1737 b->yy_buffer_status = YY_BUFFER_NEW;
1739 gras_ddt_parse__switch_to_buffer(b );
1744 /** Setup the input buffer state to scan a string. The next call to gras_ddt_parse_lex() will
1745 * scan from a @e copy of @a str.
1746 * @param str a NUL-terminated string to scan
1748 * @return the newly allocated buffer state object.
1749 * @note If you want to scan bytes that may contain NUL values, then use
1750 * gras_ddt_parse__scan_bytes() instead.
1752 YY_BUFFER_STATE gras_ddt_parse__scan_string (yyconst char * yy_str )
1755 return gras_ddt_parse__scan_bytes(yy_str,strlen(yy_str) );
1758 /** Setup the input buffer state to scan the given bytes. The next call to gras_ddt_parse_lex() will
1759 * scan from a @e copy of @a bytes.
1760 * @param bytes the byte buffer to scan
1761 * @param len the number of bytes in the buffer pointed to by @a bytes.
1763 * @return the newly allocated buffer state object.
1765 YY_BUFFER_STATE gras_ddt_parse__scan_bytes (yyconst char * bytes, int len )
1772 /* Get memory for full buffer, including space for trailing EOB's. */
1774 buf = (char *) gras_ddt_parse_alloc(n );
1776 YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__scan_bytes()" );
1778 for ( i = 0; i < len; ++i )
1781 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1783 b = gras_ddt_parse__scan_buffer(buf,n );
1785 YY_FATAL_ERROR( "bad buffer in gras_ddt_parse__scan_bytes()" );
1787 /* It's okay to grow etc. this buffer, and we should throw it
1788 * away when we're done.
1790 b->yy_is_our_buffer = 1;
1795 #ifndef YY_EXIT_FAILURE
1796 #define YY_EXIT_FAILURE 2
1799 static void yy_fatal_error (yyconst char* msg )
1801 (void) fprintf( stderr, "%s\n", msg );
1802 exit( YY_EXIT_FAILURE );
1805 /* Redefine yyless() so it works in section 3 code. */
1811 /* Undo effects of setting up gras_ddt_parse_text. */ \
1812 int yyless_macro_arg = (n); \
1813 YY_LESS_LINENO(yyless_macro_arg);\
1814 gras_ddt_parse_text[gras_ddt_parse_leng] = (yy_hold_char); \
1815 (yy_c_buf_p) = gras_ddt_parse_text + yyless_macro_arg; \
1816 (yy_hold_char) = *(yy_c_buf_p); \
1817 *(yy_c_buf_p) = '\0'; \
1818 gras_ddt_parse_leng = yyless_macro_arg; \
1822 /* Accessor methods (get/set functions) to struct members. */
1824 /** Get the current line number.
1827 int gras_ddt_parse_get_lineno (void)
1830 return gras_ddt_parse_lineno;
1833 /** Get the input stream.
1836 FILE *gras_ddt_parse_get_in (void)
1838 return gras_ddt_parse_in;
1841 /** Get the output stream.
1844 FILE *gras_ddt_parse_get_out (void)
1846 return gras_ddt_parse_out;
1849 /** Get the length of the current token.
1852 int gras_ddt_parse_get_leng (void)
1854 return gras_ddt_parse_leng;
1857 /** Get the current token.
1861 char *gras_ddt_parse_get_text (void)
1863 return gras_ddt_parse_text;
1866 /** Set the current line number.
1867 * @param line_number
1870 void gras_ddt_parse_set_lineno (int line_number )
1873 gras_ddt_parse_lineno = line_number;
1876 /** Set the input stream. This does not discard the current
1878 * @param in_str A readable stream.
1880 * @see gras_ddt_parse__switch_to_buffer
1882 void gras_ddt_parse_set_in (FILE * in_str )
1884 gras_ddt_parse_in = in_str ;
1887 void gras_ddt_parse_set_out (FILE * out_str )
1889 gras_ddt_parse_out = out_str ;
1892 int gras_ddt_parse_get_debug (void)
1894 return gras_ddt_parse__flex_debug;
1897 void gras_ddt_parse_set_debug (int bdebug )
1899 gras_ddt_parse__flex_debug = bdebug ;
1902 /* gras_ddt_parse_lex_destroy is for both reentrant and non-reentrant scanners. */
1903 int gras_ddt_parse_lex_destroy (void)
1906 /* Pop the buffer stack, destroying each element. */
1907 while(YY_CURRENT_BUFFER){
1908 gras_ddt_parse__delete_buffer(YY_CURRENT_BUFFER );
1909 YY_CURRENT_BUFFER_LVALUE = NULL;
1910 gras_ddt_parse_pop_buffer_state();
1913 /* Destroy the stack itself. */
1914 gras_ddt_parse_free((yy_buffer_stack) );
1915 (yy_buffer_stack) = NULL;
1921 * Internal utility routines.
1925 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1928 for ( i = 0; i < n; ++i )
1933 #ifdef YY_NEED_STRLEN
1934 static int yy_flex_strlen (yyconst char * s )
1937 for ( n = 0; s[n]; ++n )
1944 void *gras_ddt_parse_alloc (yy_size_t size )
1946 return (void *) malloc( size );
1949 void *gras_ddt_parse_realloc (void * ptr, yy_size_t size )
1951 /* The cast to (char *) in the following accommodates both
1952 * implementations that use char* generic pointers, and those
1953 * that use void* generic pointers. It works with the latter
1954 * because both ANSI C and C++ allow castless assignment from
1955 * any pointer type to void*, and deal with argument conversions
1956 * as though doing an assignment.
1958 return (void *) realloc( (char *) ptr, size );
1961 void gras_ddt_parse_free (void * ptr )
1963 free( (char *) ptr ); /* see gras_ddt_parse_realloc() for (char *) cast */
1966 #define YYTABLES_NAME "yytables"
1969 #undef YY_FLUSH_BUFFER
1971 #undef yy_new_buffer
1972 #undef yy_set_interactive
1974 #undef YY_DO_BEFORE_ACTION
1976 #ifdef YY_DECL_IS_OURS
1977 #undef YY_DECL_IS_OURS
1980 #line 182 "DataDesc/ddt_parse.yy.l"
1983 /* {space}+ { return(TOKEN_SPACE);} */
1985 void gras_ddt_parse_dump(void) {
1986 switch(gras_ddt_parse_tok_num) {
1987 case GRAS_DDT_PARSE_TOKEN_LP : {printf("TOKEN_LP ");break;}
1988 case GRAS_DDT_PARSE_TOKEN_RP : {printf("TOKEN_RP ");break;}
1989 case GRAS_DDT_PARSE_TOKEN_WORD : {printf("TOKEN_WORD ");break;}
1990 // case GRAS_DDT_PARSE_TOKEN_SPACE : {printf("TOKEN_SPACE ");break;}
1991 // case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}
1992 case GRAS_DDT_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;}
1993 case GRAS_DDT_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;}
1994 default : {printf("Unknown token %d\n", gras_ddt_parse_tok_num);return;}
1996 printf("-->%s<-- [line %d, pos %d]\n",gras_ddt_parse_text,gras_ddt_parse_line_pos,gras_ddt_parse_char_pos);
2000 int gras_ddt_parse_lex_n_dump(void) {
2001 gras_ddt_parse_tok_num = gras_ddt_parse_lex();
2002 // gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text);
2003 return(gras_ddt_parse_tok_num);
2006 void gras_ddt_parse_pointer_init(const char *file) {
2007 file_to_parse = fopen(file,"r");
2008 input_buffer = gras_ddt_parse__create_buffer(file_to_parse,10 );
2009 gras_ddt_parse__switch_to_buffer(input_buffer);
2011 gras_ddt_parse_line_pos = 1;
2012 gras_ddt_parse_char_pos = 0;
2013 gras_ddt_parse_col_pos = 0;
2014 gras_ddt_parse_tok_num = 0;
2017 void gras_ddt_parse_pointer_close(void) {
2018 gras_ddt_parse__delete_buffer(input_buffer);
2019 fclose(file_to_parse);
2021 gras_ddt_parse_line_pos = 1;
2022 gras_ddt_parse_char_pos = 0;
2023 gras_ddt_parse_tok_num = 0;
2027 void gras_ddt_parse_pointer_string_init(const char *string_to_parse) {
2028 input_buffer = gras_ddt_parse__scan_string (string_to_parse);
2029 gras_ddt_parse__switch_to_buffer(input_buffer);
2031 gras_ddt_parse_line_pos = 1;
2032 gras_ddt_parse_char_pos = 0;
2033 gras_ddt_parse_tok_num = 0;
2036 void gras_ddt_parse_pointer_string_close(void) {
2037 gras_ddt_parse__delete_buffer(input_buffer);
2039 gras_ddt_parse_line_pos = 1;
2040 gras_ddt_parse_char_pos = 0;
2041 gras_ddt_parse_tok_num = 0;