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"
487 /* DataDesc/ddt_parse -- automatic parsing of data structures */
488 /* Authors: Arnaud Legrand, Martin Quinson */
489 /* Copyright (C) 2003, 2004 Martin Quinson. */
490 /* This program is free software; you can redistribute it and/or modify it
491 under the terms of the license (GNU LGPL) which comes with this package. */
492 #line 13 "DataDesc/ddt_parse.yy.l"
493 #include"DataDesc/datadesc_private.h"
494 #include"DataDesc/ddt_parse.yy.h"
496 YY_BUFFER_STATE input_buffer;
499 int gras_ddt_parse_line_pos = 1;
500 int gras_ddt_parse_col_pos = 0;
501 int gras_ddt_parse_char_pos = 0;
502 int gras_ddt_parse_tok_num = 0;
503 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(lexer,parse);
504 #define SHOW_WHERE DEBUG4("%d:%d (char #%d): seen %s", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,gras_ddt_parse_char_pos,gras_ddt_parse_text)
506 #line 507 "DataDesc/ddt_parse.yy.c"
513 #ifndef YY_NO_UNISTD_H
514 /* Special case for "unistd.h", since it is non-ANSI. We include it way
515 * down here because we want the user's section 1 to have been scanned first.
516 * The user has a chance to override it with an option.
521 #ifndef YY_EXTRA_TYPE
522 #define YY_EXTRA_TYPE void *
525 /* Macros after this point can all be overridden by user definitions in
529 #ifndef YY_SKIP_YYWRAP
531 extern "C" int gras_ddt_parse_wrap (void );
533 extern int gras_ddt_parse_wrap (void );
537 static void yyunput (int c,char *buf_ptr );
540 static void yy_flex_strncpy (char *,yyconst char *,int );
543 #ifdef YY_NEED_STRLEN
544 static int yy_flex_strlen (yyconst char * );
550 static int yyinput (void );
552 static int input (void );
557 /* Amount of stuff to slurp up with each read. */
558 #ifndef YY_READ_BUF_SIZE
559 #define YY_READ_BUF_SIZE 8192
562 /* Copy whatever the last rule matched to the standard output. */
564 /* This used to be an fputs(), but since the string might contain NUL's,
565 * we now use fwrite().
567 #define ECHO (void) fwrite( gras_ddt_parse_text, gras_ddt_parse_leng, 1, gras_ddt_parse_out )
570 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
571 * is returned in "result".
574 #define YY_INPUT(buf,result,max_size) \
575 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
579 for ( n = 0; n < max_size && \
580 (c = getc( gras_ddt_parse_in )) != EOF && c != '\n'; ++n ) \
583 buf[n++] = (char) c; \
584 if ( c == EOF && ferror( gras_ddt_parse_in ) ) \
585 YY_FATAL_ERROR( "input in flex scanner failed" ); \
591 while ( (result = fread(buf, 1, max_size, gras_ddt_parse_in))==0 && ferror(gras_ddt_parse_in)) \
593 if( errno != EINTR) \
595 YY_FATAL_ERROR( "input in flex scanner failed" ); \
599 clearerr(gras_ddt_parse_in); \
606 /* No semi-colon after return; correct usage is to write "yyterminate();" -
607 * we don't want an extra ';' after the "return" because that will cause
608 * some compilers to complain about unreachable statements.
611 #define yyterminate() return YY_NULL
614 /* Number of entries by which start-condition stack grows. */
615 #ifndef YY_START_STACK_INCR
616 #define YY_START_STACK_INCR 25
619 /* Report a fatal error. */
620 #ifndef YY_FATAL_ERROR
621 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
624 /* end tables serialization structures and prototypes */
626 /* Default declaration of generated scanner - a define so the user can
627 * easily add parameters.
630 #define YY_DECL_IS_OURS 1
632 extern int gras_ddt_parse_lex (void);
634 #define YY_DECL int gras_ddt_parse_lex (void)
635 #endif /* !YY_DECL */
637 /* Code executed at the beginning of each rule, after gras_ddt_parse_text and gras_ddt_parse_leng
640 #ifndef YY_USER_ACTION
641 #define YY_USER_ACTION
644 /* Code executed at the end of each rule. */
646 #define YY_BREAK break;
649 #define YY_RULE_SETUP \
652 /** The main scanner function which does all the work.
656 register yy_state_type yy_current_state;
657 register char *yy_cp, *yy_bp;
660 #line 32 "DataDesc/ddt_parse.yy.l"
662 int comment_caller=0;
664 char string_buf[GRAS_DDT_PARSE_MAX_STR_CONST];
665 char *string_buf_ptr = NULL;
667 #line 668 "DataDesc/ddt_parse.yy.c"
678 (yy_start) = 1; /* first start state */
680 if ( ! gras_ddt_parse_in )
681 gras_ddt_parse_in = stdin;
683 if ( ! gras_ddt_parse_out )
684 gras_ddt_parse_out = stdout;
686 if ( ! YY_CURRENT_BUFFER ) {
687 gras_ddt_parse_ensure_buffer_stack ();
688 YY_CURRENT_BUFFER_LVALUE =
689 gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE );
692 gras_ddt_parse__load_buffer_state( );
695 while ( 1 ) /* loops until end-of-file is reached */
697 yy_cp = (yy_c_buf_p);
699 /* Support of gras_ddt_parse_text. */
700 *yy_cp = (yy_hold_char);
702 /* yy_bp points to the position in yy_ch_buf of the start of
707 yy_current_state = (yy_start);
711 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
712 if ( yy_accept[yy_current_state] )
714 (yy_last_accepting_state) = yy_current_state;
715 (yy_last_accepting_cpos) = yy_cp;
717 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
719 yy_current_state = (int) yy_def[yy_current_state];
720 if ( yy_current_state >= 53 )
721 yy_c = yy_meta[(unsigned int) yy_c];
723 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
726 while ( yy_base[yy_current_state] != 97 );
729 yy_act = yy_accept[yy_current_state];
731 { /* have to back up */
732 yy_cp = (yy_last_accepting_cpos);
733 yy_current_state = (yy_last_accepting_state);
734 yy_act = yy_accept[yy_current_state];
739 do_action: /* This label is used only to access EOF actions. */
742 { /* beginning of action switch */
743 case 0: /* must back up */
744 /* undo the effects of YY_DO_BEFORE_ACTION */
745 *yy_cp = (yy_hold_char);
746 yy_cp = (yy_last_accepting_cpos);
747 yy_current_state = (yy_last_accepting_state);
752 #line 38 "DataDesc/ddt_parse.yy.l"
757 #line 39 "DataDesc/ddt_parse.yy.l"
759 comment_caller = INITIAL;
765 #line 44 "DataDesc/ddt_parse.yy.l"
767 comment_caller = foo;
773 #line 49 "DataDesc/ddt_parse.yy.l"
774 /* eat anything that's not a '*' */
778 #line 50 "DataDesc/ddt_parse.yy.l"
779 /* eat up '*'s not followed by '/'s */
782 /* rule 6 can match eol */
784 #line 51 "DataDesc/ddt_parse.yy.l"
786 ++gras_ddt_parse_line_pos;
787 gras_ddt_parse_col_pos=0;
788 gras_ddt_parse_char_pos++;
793 #line 56 "DataDesc/ddt_parse.yy.l"
794 BEGIN(comment_caller);
798 #line 58 "DataDesc/ddt_parse.yy.l"
799 string_buf_ptr = string_buf; gras_ddt_parse_char_pos++;gras_ddt_parse_col_pos++; BEGIN(str);
803 #line 60 "DataDesc/ddt_parse.yy.l"
804 { /* saw closing quote - all done */
806 *string_buf_ptr = '\0';
807 gras_ddt_parse_text=string_buf;
808 gras_ddt_parse_char_pos++;
809 gras_ddt_parse_col_pos++;
810 return GRAS_DDT_PARSE_TOKEN_WORD;
811 /* return string constant token type and
817 /* rule 10 can match eol */
819 #line 72 "DataDesc/ddt_parse.yy.l"
821 /* error - unterminated string constant */
822 /* generate error message */
827 #line 77 "DataDesc/ddt_parse.yy.l"
829 /* octal escape sequence */
832 (void) sscanf( gras_ddt_parse_text + 1, "%o", &result );
835 /* error, constant is out-of-bounds */
837 *string_buf_ptr++ = result;
838 gras_ddt_parse_char_pos++;
839 gras_ddt_parse_col_pos++;
844 #line 91 "DataDesc/ddt_parse.yy.l"
846 /* generate error - bad escape sequence; something
847 * like '\48' or '\0777777'
853 #line 97 "DataDesc/ddt_parse.yy.l"
855 *string_buf_ptr++ = '\n';
856 gras_ddt_parse_char_pos++;
857 gras_ddt_parse_col_pos++;
862 #line 102 "DataDesc/ddt_parse.yy.l"
864 *string_buf_ptr++ = '\t';
865 gras_ddt_parse_char_pos++;
866 gras_ddt_parse_col_pos++;
871 #line 107 "DataDesc/ddt_parse.yy.l"
873 *string_buf_ptr++ = '\r';
874 gras_ddt_parse_char_pos++;
875 gras_ddt_parse_col_pos++;
880 #line 112 "DataDesc/ddt_parse.yy.l"
882 *string_buf_ptr++ = '\b';
883 gras_ddt_parse_char_pos++;
884 gras_ddt_parse_col_pos++;
889 #line 117 "DataDesc/ddt_parse.yy.l"
891 *string_buf_ptr++ = '\f';
892 gras_ddt_parse_char_pos++;
893 gras_ddt_parse_col_pos++;
897 /* rule 18 can match eol */
899 #line 123 "DataDesc/ddt_parse.yy.l"
901 *string_buf_ptr++ = gras_ddt_parse_text[1];
902 if(gras_ddt_parse_text[1]=='\n') {
903 ++gras_ddt_parse_line_pos;
904 gras_ddt_parse_col_pos=0;
906 gras_ddt_parse_col_pos++;
908 gras_ddt_parse_char_pos++;
913 #line 134 "DataDesc/ddt_parse.yy.l"
915 char *yptr = gras_ddt_parse_text;
918 *string_buf_ptr++ = *yptr++;
919 gras_ddt_parse_char_pos++;
920 gras_ddt_parse_col_pos++;
925 #line 143 "DataDesc/ddt_parse.yy.l"
927 gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
928 gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
929 return(GRAS_DDT_PARSE_TOKEN_WORD);
934 #line 148 "DataDesc/ddt_parse.yy.l"
936 gras_ddt_parse_char_pos++;
937 gras_ddt_parse_col_pos++;
939 return(GRAS_DDT_PARSE_TOKEN_LP);
944 #line 154 "DataDesc/ddt_parse.yy.l"
946 gras_ddt_parse_char_pos++;
947 gras_ddt_parse_col_pos++;
949 return(GRAS_DDT_PARSE_TOKEN_RP);
954 #line 160 "DataDesc/ddt_parse.yy.l"
956 gras_ddt_parse_char_pos++;
957 gras_ddt_parse_col_pos++;
959 return(GRAS_DDT_PARSE_TOKEN_LB);
964 #line 166 "DataDesc/ddt_parse.yy.l"
966 gras_ddt_parse_char_pos++;
967 gras_ddt_parse_col_pos++;
969 return(GRAS_DDT_PARSE_TOKEN_RB);
974 #line 172 "DataDesc/ddt_parse.yy.l"
976 gras_ddt_parse_char_pos++;
977 gras_ddt_parse_col_pos++;
979 return(GRAS_DDT_PARSE_TOKEN_STAR);
984 #line 178 "DataDesc/ddt_parse.yy.l"
986 gras_ddt_parse_char_pos++;
987 gras_ddt_parse_col_pos++;
989 return(GRAS_DDT_PARSE_TOKEN_SEMI_COLON);
994 #line 184 "DataDesc/ddt_parse.yy.l"
996 gras_ddt_parse_char_pos++;
997 gras_ddt_parse_col_pos++;
999 return(GRAS_DDT_PARSE_TOKEN_COLON);
1003 /* rule 28 can match eol */
1005 #line 190 "DataDesc/ddt_parse.yy.l"
1007 gras_ddt_parse_line_pos++;
1008 gras_ddt_parse_char_pos++;
1009 gras_ddt_parse_col_pos=0;
1015 #line 196 "DataDesc/ddt_parse.yy.l"
1017 gras_ddt_parse_char_pos++;
1018 gras_ddt_parse_col_pos++;
1024 #line 201 "DataDesc/ddt_parse.yy.l"
1027 #line 1028 "DataDesc/ddt_parse.yy.c"
1028 case YY_STATE_EOF(INITIAL):
1029 case YY_STATE_EOF(comment):
1030 case YY_STATE_EOF(foo):
1031 case YY_STATE_EOF(str):
1034 case YY_END_OF_BUFFER:
1036 /* Amount of text matched not including the EOB char. */
1037 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1039 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1040 *yy_cp = (yy_hold_char);
1041 YY_RESTORE_YY_MORE_OFFSET
1043 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1045 /* We're scanning a new file or input source. It's
1046 * possible that this happened because the user
1047 * just pointed gras_ddt_parse_in at a new source and called
1048 * gras_ddt_parse_lex(). If so, then we have to assure
1049 * consistency between YY_CURRENT_BUFFER and our
1050 * globals. Here is the right place to do so, because
1051 * this is the first action (other than possibly a
1052 * back-up) that will match for the new input source.
1054 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1055 YY_CURRENT_BUFFER_LVALUE->yy_input_file = gras_ddt_parse_in;
1056 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1059 /* Note that here we test for yy_c_buf_p "<=" to the position
1060 * of the first EOB in the buffer, since yy_c_buf_p will
1061 * already have been incremented past the NUL character
1062 * (since all states make transitions on EOB to the
1063 * end-of-buffer state). Contrast this with the test
1066 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1067 { /* This was really a NUL. */
1068 yy_state_type yy_next_state;
1070 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1072 yy_current_state = yy_get_previous_state( );
1074 /* Okay, we're now positioned to make the NUL
1075 * transition. We couldn't have
1076 * yy_get_previous_state() go ahead and do it
1077 * for us because it doesn't know how to deal
1078 * with the possibility of jamming (and we don't
1079 * want to build jamming into it because then it
1080 * will run more slowly).
1083 yy_next_state = yy_try_NUL_trans( yy_current_state );
1085 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1087 if ( yy_next_state )
1089 /* Consume the NUL. */
1090 yy_cp = ++(yy_c_buf_p);
1091 yy_current_state = yy_next_state;
1097 yy_cp = (yy_c_buf_p);
1098 goto yy_find_action;
1102 else switch ( yy_get_next_buffer( ) )
1104 case EOB_ACT_END_OF_FILE:
1106 (yy_did_buffer_switch_on_eof) = 0;
1108 if ( gras_ddt_parse_wrap( ) )
1110 /* Note: because we've taken care in
1111 * yy_get_next_buffer() to have set up
1112 * gras_ddt_parse_text, we can now set up
1113 * yy_c_buf_p so that if some total
1114 * hoser (like flex itself) wants to
1115 * call the scanner after we return the
1116 * YY_NULL, it'll still work - another
1117 * YY_NULL will get returned.
1119 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1121 yy_act = YY_STATE_EOF(YY_START);
1127 if ( ! (yy_did_buffer_switch_on_eof) )
1133 case EOB_ACT_CONTINUE_SCAN:
1135 (yytext_ptr) + yy_amount_of_matched_text;
1137 yy_current_state = yy_get_previous_state( );
1139 yy_cp = (yy_c_buf_p);
1140 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1143 case EOB_ACT_LAST_MATCH:
1145 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1147 yy_current_state = yy_get_previous_state( );
1149 yy_cp = (yy_c_buf_p);
1150 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1151 goto yy_find_action;
1158 "fatal flex scanner internal error--no action found" );
1159 } /* end of action switch */
1160 } /* end of scanning one token */
1161 } /* end of gras_ddt_parse_lex */
1163 /* yy_get_next_buffer - try to read in a new buffer
1165 * Returns a code representing an action:
1166 * EOB_ACT_LAST_MATCH -
1167 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1168 * EOB_ACT_END_OF_FILE - end of file
1170 static int yy_get_next_buffer (void)
1172 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1173 register char *source = (yytext_ptr);
1174 register int number_to_move, i;
1177 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1179 "fatal flex scanner internal error--end of buffer missed" );
1181 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1182 { /* Don't try to fill the buffer, so this is an EOF. */
1183 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1185 /* We matched a single character, the EOB, so
1186 * treat this as a final EOF.
1188 return EOB_ACT_END_OF_FILE;
1193 /* We matched some text prior to the EOB, first
1196 return EOB_ACT_LAST_MATCH;
1200 /* Try to read more data. */
1202 /* First move last chars to start of buffer. */
1203 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1205 for ( i = 0; i < number_to_move; ++i )
1206 *(dest++) = *(source++);
1208 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1209 /* don't do the read, it's not guaranteed to return an EOF,
1212 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1216 size_t num_to_read =
1217 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1219 while ( num_to_read <= 0 )
1220 { /* Not enough room in the buffer - grow it. */
1222 /* just a shorter name for the current buffer */
1223 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1225 int yy_c_buf_p_offset =
1226 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1228 if ( b->yy_is_our_buffer )
1230 int new_size = b->yy_buf_size * 2;
1232 if ( new_size <= 0 )
1233 b->yy_buf_size += b->yy_buf_size / 8;
1235 b->yy_buf_size *= 2;
1237 b->yy_ch_buf = (char *)
1238 /* Include room in for 2 EOB chars. */
1239 gras_ddt_parse_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1242 /* Can't grow it, we don't own it. */
1245 if ( ! b->yy_ch_buf )
1247 "fatal error - scanner input buffer overflow" );
1249 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1251 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1256 if ( num_to_read > YY_READ_BUF_SIZE )
1257 num_to_read = YY_READ_BUF_SIZE;
1259 /* Read in more data. */
1260 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1261 (yy_n_chars), num_to_read );
1263 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1266 if ( (yy_n_chars) == 0 )
1268 if ( number_to_move == YY_MORE_ADJ )
1270 ret_val = EOB_ACT_END_OF_FILE;
1271 gras_ddt_parse_restart(gras_ddt_parse_in );
1276 ret_val = EOB_ACT_LAST_MATCH;
1277 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1278 YY_BUFFER_EOF_PENDING;
1283 ret_val = EOB_ACT_CONTINUE_SCAN;
1285 (yy_n_chars) += number_to_move;
1286 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1287 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1289 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1294 /* yy_get_previous_state - get the state just before the EOB char was reached */
1296 static yy_state_type yy_get_previous_state (void)
1298 register yy_state_type yy_current_state;
1299 register char *yy_cp;
1301 yy_current_state = (yy_start);
1303 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1305 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1306 if ( yy_accept[yy_current_state] )
1308 (yy_last_accepting_state) = yy_current_state;
1309 (yy_last_accepting_cpos) = yy_cp;
1311 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1313 yy_current_state = (int) yy_def[yy_current_state];
1314 if ( yy_current_state >= 53 )
1315 yy_c = yy_meta[(unsigned int) yy_c];
1317 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1320 return yy_current_state;
1323 /* yy_try_NUL_trans - try to make a transition on the NUL character
1326 * next_state = yy_try_NUL_trans( current_state );
1328 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1330 register int yy_is_jam;
1331 register char *yy_cp = (yy_c_buf_p);
1333 register YY_CHAR yy_c = 1;
1334 if ( yy_accept[yy_current_state] )
1336 (yy_last_accepting_state) = yy_current_state;
1337 (yy_last_accepting_cpos) = yy_cp;
1339 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1341 yy_current_state = (int) yy_def[yy_current_state];
1342 if ( yy_current_state >= 53 )
1343 yy_c = yy_meta[(unsigned int) yy_c];
1345 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1346 yy_is_jam = (yy_current_state == 52);
1348 return yy_is_jam ? 0 : yy_current_state;
1351 static void yyunput (int c, register char * yy_bp )
1353 register char *yy_cp;
1355 yy_cp = (yy_c_buf_p);
1357 /* undo effects of setting up gras_ddt_parse_text */
1358 *yy_cp = (yy_hold_char);
1360 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1361 { /* need to shift things up to make room */
1362 /* +2 for EOB chars. */
1363 register int number_to_move = (yy_n_chars) + 2;
1364 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1365 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1366 register char *source =
1367 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1369 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1370 *--dest = *--source;
1372 yy_cp += (int) (dest - source);
1373 yy_bp += (int) (dest - source);
1374 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1375 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1377 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1378 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1381 *--yy_cp = (char) c;
1383 (yytext_ptr) = yy_bp;
1384 (yy_hold_char) = *yy_cp;
1385 (yy_c_buf_p) = yy_cp;
1390 static int yyinput (void)
1392 static int input (void)
1398 *(yy_c_buf_p) = (yy_hold_char);
1400 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1402 /* yy_c_buf_p now points to the character we want to return.
1403 * If this occurs *before* the EOB characters, then it's a
1404 * valid NUL; if not, then we've hit the end of the buffer.
1406 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1407 /* This was really a NUL. */
1408 *(yy_c_buf_p) = '\0';
1411 { /* need more input */
1412 int offset = (yy_c_buf_p) - (yytext_ptr);
1415 switch ( yy_get_next_buffer( ) )
1417 case EOB_ACT_LAST_MATCH:
1418 /* This happens because yy_g_n_b()
1419 * sees that we've accumulated a
1420 * token and flags that we need to
1421 * try matching the token before
1422 * proceeding. But for input(),
1423 * there's no matching to consider.
1424 * So convert the EOB_ACT_LAST_MATCH
1425 * to EOB_ACT_END_OF_FILE.
1428 /* Reset buffer status. */
1429 gras_ddt_parse_restart(gras_ddt_parse_in );
1433 case EOB_ACT_END_OF_FILE:
1435 if ( gras_ddt_parse_wrap( ) )
1438 if ( ! (yy_did_buffer_switch_on_eof) )
1447 case EOB_ACT_CONTINUE_SCAN:
1448 (yy_c_buf_p) = (yytext_ptr) + offset;
1454 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1455 *(yy_c_buf_p) = '\0'; /* preserve gras_ddt_parse_text */
1456 (yy_hold_char) = *++(yy_c_buf_p);
1460 #endif /* ifndef YY_NO_INPUT */
1462 /** Immediately switch to a different input stream.
1463 * @param input_file A readable stream.
1465 * @note This function does not reset the start condition to @c INITIAL .
1467 void gras_ddt_parse_restart (FILE * input_file )
1470 if ( ! YY_CURRENT_BUFFER ){
1471 gras_ddt_parse_ensure_buffer_stack ();
1472 YY_CURRENT_BUFFER_LVALUE =
1473 gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE );
1476 gras_ddt_parse__init_buffer(YY_CURRENT_BUFFER,input_file );
1477 gras_ddt_parse__load_buffer_state( );
1480 /** Switch to a different input buffer.
1481 * @param new_buffer The new input buffer.
1484 void gras_ddt_parse__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1487 /* TODO. We should be able to replace this entire function body
1489 * gras_ddt_parse_pop_buffer_state();
1490 * gras_ddt_parse_push_buffer_state(new_buffer);
1492 gras_ddt_parse_ensure_buffer_stack ();
1493 if ( YY_CURRENT_BUFFER == new_buffer )
1496 if ( YY_CURRENT_BUFFER )
1498 /* Flush out information for old buffer. */
1499 *(yy_c_buf_p) = (yy_hold_char);
1500 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1501 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1504 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1505 gras_ddt_parse__load_buffer_state( );
1507 /* We don't actually know whether we did this switch during
1508 * EOF (gras_ddt_parse_wrap()) processing, but the only time this flag
1509 * is looked at is after gras_ddt_parse_wrap() is called, so it's safe
1510 * to go ahead and always set it.
1512 (yy_did_buffer_switch_on_eof) = 1;
1515 static void gras_ddt_parse__load_buffer_state (void)
1517 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1518 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1519 gras_ddt_parse_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1520 (yy_hold_char) = *(yy_c_buf_p);
1523 /** Allocate and initialize an input buffer state.
1524 * @param file A readable stream.
1525 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1527 * @return the allocated buffer state.
1529 YY_BUFFER_STATE gras_ddt_parse__create_buffer (FILE * file, int size )
1533 b = (YY_BUFFER_STATE) gras_ddt_parse_alloc(sizeof( struct yy_buffer_state ) );
1535 YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__create_buffer()" );
1537 b->yy_buf_size = size;
1539 /* yy_ch_buf has to be 2 characters longer than the size given because
1540 * we need to put in 2 end-of-buffer characters.
1542 b->yy_ch_buf = (char *) gras_ddt_parse_alloc(b->yy_buf_size + 2 );
1543 if ( ! b->yy_ch_buf )
1544 YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__create_buffer()" );
1546 b->yy_is_our_buffer = 1;
1548 gras_ddt_parse__init_buffer(b,file );
1553 /** Destroy the buffer.
1554 * @param b a buffer created with gras_ddt_parse__create_buffer()
1557 void gras_ddt_parse__delete_buffer (YY_BUFFER_STATE b )
1563 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1564 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1566 if ( b->yy_is_our_buffer )
1567 gras_ddt_parse_free((void *) b->yy_ch_buf );
1569 gras_ddt_parse_free((void *) b );
1573 extern int isatty (int );
1574 #endif /* __cplusplus */
1576 /* Initializes or reinitializes a buffer.
1577 * This function is sometimes called more than once on the same buffer,
1578 * such as during a gras_ddt_parse_restart() or at EOF.
1580 static void gras_ddt_parse__init_buffer (YY_BUFFER_STATE b, FILE * file )
1585 gras_ddt_parse__flush_buffer(b );
1587 b->yy_input_file = file;
1588 b->yy_fill_buffer = 1;
1590 /* If b is the current buffer, then gras_ddt_parse__init_buffer was _probably_
1591 * called from gras_ddt_parse_restart() or through yy_get_next_buffer.
1592 * In that case, we don't want to reset the lineno or column.
1594 if (b != YY_CURRENT_BUFFER){
1595 b->yy_bs_lineno = 1;
1596 b->yy_bs_column = 0;
1599 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1604 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1605 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1608 void gras_ddt_parse__flush_buffer (YY_BUFFER_STATE b )
1615 /* We always need two end-of-buffer characters. The first causes
1616 * a transition to the end-of-buffer state. The second causes
1617 * a jam in that state.
1619 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1620 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1622 b->yy_buf_pos = &b->yy_ch_buf[0];
1625 b->yy_buffer_status = YY_BUFFER_NEW;
1627 if ( b == YY_CURRENT_BUFFER )
1628 gras_ddt_parse__load_buffer_state( );
1631 /** Pushes the new state onto the stack. The new state becomes
1632 * the current state. This function will allocate the stack
1634 * @param new_buffer The new state.
1637 void gras_ddt_parse_push_buffer_state (YY_BUFFER_STATE new_buffer )
1639 if (new_buffer == NULL)
1642 gras_ddt_parse_ensure_buffer_stack();
1644 /* This block is copied from gras_ddt_parse__switch_to_buffer. */
1645 if ( YY_CURRENT_BUFFER )
1647 /* Flush out information for old buffer. */
1648 *(yy_c_buf_p) = (yy_hold_char);
1649 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1650 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1653 /* Only push if top exists. Otherwise, replace top. */
1654 if (YY_CURRENT_BUFFER)
1655 (yy_buffer_stack_top)++;
1656 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1658 /* copied from gras_ddt_parse__switch_to_buffer. */
1659 gras_ddt_parse__load_buffer_state( );
1660 (yy_did_buffer_switch_on_eof) = 1;
1663 /** Removes and deletes the top of the stack, if present.
1664 * The next element becomes the new top.
1667 void gras_ddt_parse_pop_buffer_state (void)
1669 if (!YY_CURRENT_BUFFER)
1672 gras_ddt_parse__delete_buffer(YY_CURRENT_BUFFER );
1673 YY_CURRENT_BUFFER_LVALUE = NULL;
1674 if ((yy_buffer_stack_top) > 0)
1675 --(yy_buffer_stack_top);
1677 if (YY_CURRENT_BUFFER) {
1678 gras_ddt_parse__load_buffer_state( );
1679 (yy_did_buffer_switch_on_eof) = 1;
1683 /* Allocates the stack if it does not exist.
1684 * Guarantees space for at least one push.
1686 static void gras_ddt_parse_ensure_buffer_stack (void)
1690 if (!(yy_buffer_stack)) {
1692 /* First allocation is just for 2 elements, since we don't know if this
1693 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1694 * immediate realloc on the next call.
1697 (yy_buffer_stack) = (struct yy_buffer_state**)gras_ddt_parse_alloc
1698 (num_to_alloc * sizeof(struct yy_buffer_state*)
1701 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1703 (yy_buffer_stack_max) = num_to_alloc;
1704 (yy_buffer_stack_top) = 0;
1708 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1710 /* Increase the buffer to prepare for a possible push. */
1711 int grow_size = 8 /* arbitrary grow size */;
1713 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1714 (yy_buffer_stack) = (struct yy_buffer_state**)gras_ddt_parse_realloc
1716 num_to_alloc * sizeof(struct yy_buffer_state*)
1719 /* zero only the new slots.*/
1720 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1721 (yy_buffer_stack_max) = num_to_alloc;
1725 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1726 * @param base the character buffer
1727 * @param size the size in bytes of the character buffer
1729 * @return the newly allocated buffer state object.
1731 YY_BUFFER_STATE gras_ddt_parse__scan_buffer (char * base, yy_size_t size )
1736 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1737 base[size-1] != YY_END_OF_BUFFER_CHAR )
1738 /* They forgot to leave room for the EOB's. */
1741 b = (YY_BUFFER_STATE) gras_ddt_parse_alloc(sizeof( struct yy_buffer_state ) );
1743 YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__scan_buffer()" );
1745 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1746 b->yy_buf_pos = b->yy_ch_buf = base;
1747 b->yy_is_our_buffer = 0;
1748 b->yy_input_file = 0;
1749 b->yy_n_chars = b->yy_buf_size;
1750 b->yy_is_interactive = 0;
1752 b->yy_fill_buffer = 0;
1753 b->yy_buffer_status = YY_BUFFER_NEW;
1755 gras_ddt_parse__switch_to_buffer(b );
1760 /** Setup the input buffer state to scan a string. The next call to gras_ddt_parse_lex() will
1761 * scan from a @e copy of @a str.
1762 * @param str a NUL-terminated string to scan
1764 * @return the newly allocated buffer state object.
1765 * @note If you want to scan bytes that may contain NUL values, then use
1766 * gras_ddt_parse__scan_bytes() instead.
1768 YY_BUFFER_STATE gras_ddt_parse__scan_string (yyconst char * yy_str )
1771 return gras_ddt_parse__scan_bytes(yy_str,strlen(yy_str) );
1774 /** Setup the input buffer state to scan the given bytes. The next call to gras_ddt_parse_lex() will
1775 * scan from a @e copy of @a bytes.
1776 * @param bytes the byte buffer to scan
1777 * @param len the number of bytes in the buffer pointed to by @a bytes.
1779 * @return the newly allocated buffer state object.
1781 YY_BUFFER_STATE gras_ddt_parse__scan_bytes (yyconst char * bytes, int len )
1788 /* Get memory for full buffer, including space for trailing EOB's. */
1790 buf = (char *) gras_ddt_parse_alloc(n );
1792 YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__scan_bytes()" );
1794 for ( i = 0; i < len; ++i )
1797 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1799 b = gras_ddt_parse__scan_buffer(buf,n );
1801 YY_FATAL_ERROR( "bad buffer in gras_ddt_parse__scan_bytes()" );
1803 /* It's okay to grow etc. this buffer, and we should throw it
1804 * away when we're done.
1806 b->yy_is_our_buffer = 1;
1811 #ifndef YY_EXIT_FAILURE
1812 #define YY_EXIT_FAILURE 2
1815 static void yy_fatal_error (yyconst char* msg )
1817 (void) fprintf( stderr, "%s\n", msg );
1818 exit( YY_EXIT_FAILURE );
1821 /* Redefine yyless() so it works in section 3 code. */
1827 /* Undo effects of setting up gras_ddt_parse_text. */ \
1828 int yyless_macro_arg = (n); \
1829 YY_LESS_LINENO(yyless_macro_arg);\
1830 gras_ddt_parse_text[gras_ddt_parse_leng] = (yy_hold_char); \
1831 (yy_c_buf_p) = gras_ddt_parse_text + yyless_macro_arg; \
1832 (yy_hold_char) = *(yy_c_buf_p); \
1833 *(yy_c_buf_p) = '\0'; \
1834 gras_ddt_parse_leng = yyless_macro_arg; \
1838 /* Accessor methods (get/set functions) to struct members. */
1840 /** Get the current line number.
1843 int gras_ddt_parse_get_lineno (void)
1846 return gras_ddt_parse_lineno;
1849 /** Get the input stream.
1852 FILE *gras_ddt_parse_get_in (void)
1854 return gras_ddt_parse_in;
1857 /** Get the output stream.
1860 FILE *gras_ddt_parse_get_out (void)
1862 return gras_ddt_parse_out;
1865 /** Get the length of the current token.
1868 int gras_ddt_parse_get_leng (void)
1870 return gras_ddt_parse_leng;
1873 /** Get the current token.
1877 char *gras_ddt_parse_get_text (void)
1879 return gras_ddt_parse_text;
1882 /** Set the current line number.
1883 * @param line_number
1886 void gras_ddt_parse_set_lineno (int line_number )
1889 gras_ddt_parse_lineno = line_number;
1892 /** Set the input stream. This does not discard the current
1894 * @param in_str A readable stream.
1896 * @see gras_ddt_parse__switch_to_buffer
1898 void gras_ddt_parse_set_in (FILE * in_str )
1900 gras_ddt_parse_in = in_str ;
1903 void gras_ddt_parse_set_out (FILE * out_str )
1905 gras_ddt_parse_out = out_str ;
1908 int gras_ddt_parse_get_debug (void)
1910 return gras_ddt_parse__flex_debug;
1913 void gras_ddt_parse_set_debug (int bdebug )
1915 gras_ddt_parse__flex_debug = bdebug ;
1918 /* gras_ddt_parse_lex_destroy is for both reentrant and non-reentrant scanners. */
1919 int gras_ddt_parse_lex_destroy (void)
1922 /* Pop the buffer stack, destroying each element. */
1923 while(YY_CURRENT_BUFFER){
1924 gras_ddt_parse__delete_buffer(YY_CURRENT_BUFFER );
1925 YY_CURRENT_BUFFER_LVALUE = NULL;
1926 gras_ddt_parse_pop_buffer_state();
1929 /* Destroy the stack itself. */
1930 gras_ddt_parse_free((yy_buffer_stack) );
1931 (yy_buffer_stack) = NULL;
1937 * Internal utility routines.
1941 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1944 for ( i = 0; i < n; ++i )
1949 #ifdef YY_NEED_STRLEN
1950 static int yy_flex_strlen (yyconst char * s )
1953 for ( n = 0; s[n]; ++n )
1960 void *gras_ddt_parse_alloc (yy_size_t size )
1962 return (void *) malloc( size );
1965 void *gras_ddt_parse_realloc (void * ptr, yy_size_t size )
1967 /* The cast to (char *) in the following accommodates both
1968 * implementations that use char* generic pointers, and those
1969 * that use void* generic pointers. It works with the latter
1970 * because both ANSI C and C++ allow castless assignment from
1971 * any pointer type to void*, and deal with argument conversions
1972 * as though doing an assignment.
1974 return (void *) realloc( (char *) ptr, size );
1977 void gras_ddt_parse_free (void * ptr )
1979 free( (char *) ptr ); /* see gras_ddt_parse_realloc() for (char *) cast */
1982 #define YYTABLES_NAME "yytables"
1985 #undef YY_FLUSH_BUFFER
1987 #undef yy_new_buffer
1988 #undef yy_set_interactive
1990 #undef YY_DO_BEFORE_ACTION
1992 #ifdef YY_DECL_IS_OURS
1993 #undef YY_DECL_IS_OURS
1996 #line 201 "DataDesc/ddt_parse.yy.l"
1999 /* {space}+ { return(TOKEN_SPACE);} */
2001 void gras_ddt_parse_dump(void) {
2002 switch(gras_ddt_parse_tok_num) {
2003 case GRAS_DDT_PARSE_TOKEN_LP : {printf("TOKEN_LP ");break;}
2004 case GRAS_DDT_PARSE_TOKEN_RP : {printf("TOKEN_RP ");break;}
2005 case GRAS_DDT_PARSE_TOKEN_WORD : {printf("TOKEN_WORD ");break;}
2006 // case GRAS_DDT_PARSE_TOKEN_SPACE : {printf("TOKEN_SPACE ");break;}
2007 // case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}
2008 case GRAS_DDT_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;}
2009 case GRAS_DDT_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;}
2010 default : {printf("Unknown token %d\n", gras_ddt_parse_tok_num);return;}
2012 printf("-->%s<-- [line %d, pos %d]\n",gras_ddt_parse_text,gras_ddt_parse_line_pos,gras_ddt_parse_char_pos);
2016 int gras_ddt_parse_lex_n_dump(void) {
2017 gras_ddt_parse_tok_num = gras_ddt_parse_lex();
2018 // gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text);
2019 return(gras_ddt_parse_tok_num);
2022 void gras_ddt_parse_pointer_init(const char *file) {
2023 file_to_parse = fopen(file,"r");
2024 input_buffer = gras_ddt_parse__create_buffer(file_to_parse,10 );
2025 gras_ddt_parse__switch_to_buffer(input_buffer);
2027 gras_ddt_parse_line_pos = 1;
2028 gras_ddt_parse_char_pos = 0;
2029 gras_ddt_parse_col_pos = 0;
2030 gras_ddt_parse_tok_num = 0;
2033 void gras_ddt_parse_pointer_close(void) {
2034 gras_ddt_parse__delete_buffer(input_buffer);
2035 fclose(file_to_parse);
2037 gras_ddt_parse_line_pos = 1;
2038 gras_ddt_parse_char_pos = 0;
2039 gras_ddt_parse_tok_num = 0;
2043 void gras_ddt_parse_pointer_string_init(const char *string_to_parse) {
2044 input_buffer = gras_ddt_parse__scan_string (string_to_parse);
2045 gras_ddt_parse__switch_to_buffer(input_buffer);
2047 gras_ddt_parse_line_pos = 1;
2048 gras_ddt_parse_char_pos = 0;
2049 gras_ddt_parse_tok_num = 0;
2052 void gras_ddt_parse_pointer_string_close(void) {
2053 gras_ddt_parse__delete_buffer(input_buffer);
2055 gras_ddt_parse_line_pos = 1;
2056 gras_ddt_parse_char_pos = 0;
2057 gras_ddt_parse_tok_num = 0;