1 #line 2 "gras/DataDesc/ddt_parse.yy.c"
3 #line 4 "gras/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 26
359 #define YY_END_OF_BUFFER 27
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[61] =
369 14, 14, 7, 7, 10, 10, 0, 0, 27, 25,
370 24, 19, 20, 21, 23, 14, 25, 22, 17, 18,
371 15, 16, 7, 7, 6, 7, 7, 10, 12, 11,
372 26, 26, 14, 0, 1, 7, 7, 7, 5, 7,
373 10, 11, 11, 13, 0, 0, 2, 1, 4, 0,
374 3, 0, 2, 0, 3, 0, 0, 8, 9, 0
377 static yyconst flex_int32_t yy_ec[256] =
379 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
380 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
381 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
382 1, 2, 1, 1, 1, 1, 1, 1, 1, 4,
383 5, 6, 1, 7, 8, 8, 9, 10, 10, 10,
384 10, 10, 10, 10, 10, 10, 10, 1, 11, 1,
385 1, 1, 1, 1, 8, 8, 8, 8, 8, 8,
386 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
387 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
388 12, 1, 13, 14, 8, 1, 8, 8, 8, 8,
390 8, 8, 15, 8, 8, 8, 8, 8, 8, 8,
391 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
392 8, 8, 16, 1, 17, 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[18] =
411 1, 1, 2, 1, 1, 3, 1, 4, 1, 4,
415 static yyconst flex_int16_t yy_base[69] =
417 0, 0, 16, 30, 17, 18, 78, 77, 85, 88,
418 88, 88, 88, 88, 88, 0, 19, 88, 88, 88,
419 88, 88, 0, 24, 88, 75, 77, 0, 88, 21,
420 88, 76, 0, 22, 0, 0, 27, 75, 0, 71,
421 0, 29, 34, 88, 29, 65, 76, 0, 0, 63,
422 74, 60, 72, 56, 65, 51, 50, 88, 88, 88,
423 45, 49, 53, 55, 57, 61, 65, 69
426 static yyconst flex_int16_t yy_def[69] =
428 60, 1, 61, 61, 62, 62, 63, 63, 60, 60,
429 60, 60, 60, 60, 60, 64, 60, 60, 60, 60,
430 60, 60, 65, 65, 60, 65, 65, 66, 60, 67,
431 60, 60, 64, 60, 68, 65, 65, 65, 65, 65,
432 66, 67, 67, 60, 60, 60, 60, 68, 65, 60,
433 60, 60, 60, 60, 60, 60, 60, 60, 60, 0,
434 60, 60, 60, 60, 60, 60, 60, 60
437 static yyconst flex_int16_t yy_nxt[106] =
439 10, 10, 11, 12, 13, 14, 15, 16, 17, 16,
440 18, 19, 20, 10, 16, 21, 22, 24, 25, 29,
441 29, 26, 30, 30, 34, 37, 43, 35, 37, 44,
442 27, 24, 25, 46, 60, 26, 47, 60, 38, 43,
443 50, 38, 44, 51, 27, 23, 23, 23, 23, 28,
444 28, 28, 28, 31, 31, 31, 31, 36, 33, 36,
445 36, 41, 59, 58, 41, 42, 55, 42, 42, 48,
446 57, 48, 48, 53, 56, 55, 54, 53, 52, 49,
447 40, 45, 40, 39, 60, 32, 32, 9, 60, 60,
448 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
453 static yyconst flex_int16_t yy_chk[106] =
455 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
456 1, 1, 1, 1, 1, 1, 1, 3, 3, 5,
457 6, 3, 5, 6, 17, 24, 30, 17, 37, 30,
458 3, 4, 4, 34, 42, 4, 34, 42, 24, 43,
459 45, 37, 43, 45, 4, 61, 61, 61, 61, 62,
460 62, 62, 62, 63, 63, 63, 63, 65, 64, 65,
461 65, 66, 57, 56, 66, 67, 55, 67, 67, 68,
462 54, 68, 68, 53, 52, 51, 50, 47, 46, 40,
463 38, 32, 27, 26, 9, 8, 7, 60, 60, 60,
464 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
469 static yy_state_type yy_last_accepting_state;
470 static char *yy_last_accepting_cpos;
472 extern int gras_ddt_parse__flex_debug;
473 int gras_ddt_parse__flex_debug = 0;
475 /* The intent behind this definition is that it'll catch
476 * any uses of REJECT which flex missed.
478 #define REJECT reject_used_but_not_detected
479 #define yymore() yymore_used_but_not_detected
480 #define YY_MORE_ADJ 0
481 #define YY_RESTORE_YY_MORE_OFFSET
482 char *gras_ddt_parse_text;
483 #line 1 "gras/DataDesc/ddt_parse.yy.l"
485 /* DataDesc/ddt_parse -- automatic parsing of data structures */
486 /* Copyright (c) 2004 Arnaud Legrand, Martin Quinson. All rights reserved. */
487 /* This program is free software; you can redistribute it and/or modify it
488 * under the terms of the license (GNU LGPL) which comes with this package. */
489 #line 12 "gras/DataDesc/ddt_parse.yy.l"
490 #include "gras/DataDesc/datadesc_private.h"
491 #include "gras/DataDesc/ddt_parse.yy.h"
493 YY_BUFFER_STATE gras_ddt_input_buffer;
494 FILE *gras_ddt_file_to_parse;
496 int gras_ddt_parse_line_pos = 1;
497 int gras_ddt_parse_col_pos = 0;
498 int gras_ddt_parse_char_pos = 0;
499 int gras_ddt_parse_tok_num = 0;
500 const char *definition;
501 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lexer,ddt_parse,"The crude internals of the lexer used for type parsing");
502 #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)
504 #line 505 "gras/DataDesc/ddt_parse.yy.c"
511 #ifndef YY_NO_UNISTD_H
512 /* Special case for "unistd.h", since it is non-ANSI. We include it way
513 * down here because we want the user's section 1 to have been scanned first.
514 * The user has a chance to override it with an option.
519 #ifndef YY_EXTRA_TYPE
520 #define YY_EXTRA_TYPE void *
523 /* Macros after this point can all be overridden by user definitions in
527 #ifndef YY_SKIP_YYWRAP
529 extern "C" int gras_ddt_parse_wrap (void );
531 extern int gras_ddt_parse_wrap (void );
535 static void yyunput (int c,char *buf_ptr );
538 static void yy_flex_strncpy (char *,yyconst char *,int );
541 #ifdef YY_NEED_STRLEN
542 static int yy_flex_strlen (yyconst char * );
548 static int yyinput (void );
550 static int input (void );
555 /* Amount of stuff to slurp up with each read. */
556 #ifndef YY_READ_BUF_SIZE
557 #define YY_READ_BUF_SIZE 8192
560 /* Copy whatever the last rule matched to the standard output. */
562 /* This used to be an fputs(), but since the string might contain NUL's,
563 * we now use fwrite().
565 #define ECHO (void) fwrite( gras_ddt_parse_text, gras_ddt_parse_leng, 1, gras_ddt_parse_out )
568 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
569 * is returned in "result".
572 #define YY_INPUT(buf,result,max_size) \
573 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
577 for ( n = 0; n < max_size && \
578 (c = getc( gras_ddt_parse_in )) != EOF && c != '\n'; ++n ) \
581 buf[n++] = (char) c; \
582 if ( c == EOF && ferror( gras_ddt_parse_in ) ) \
583 YY_FATAL_ERROR( "input in flex scanner failed" ); \
589 while ( (result = fread(buf, 1, max_size, gras_ddt_parse_in))==0 && ferror(gras_ddt_parse_in)) \
591 if( errno != EINTR) \
593 YY_FATAL_ERROR( "input in flex scanner failed" ); \
597 clearerr(gras_ddt_parse_in); \
604 /* No semi-colon after return; correct usage is to write "yyterminate();" -
605 * we don't want an extra ';' after the "return" because that will cause
606 * some compilers to complain about unreachable statements.
609 #define yyterminate() return YY_NULL
612 /* Number of entries by which start-condition stack grows. */
613 #ifndef YY_START_STACK_INCR
614 #define YY_START_STACK_INCR 25
617 /* Report a fatal error. */
618 #ifndef YY_FATAL_ERROR
619 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
622 /* end tables serialization structures and prototypes */
624 /* Default declaration of generated scanner - a define so the user can
625 * easily add parameters.
628 #define YY_DECL_IS_OURS 1
630 extern int gras_ddt_parse_lex (void);
632 #define YY_DECL int gras_ddt_parse_lex (void)
633 #endif /* !YY_DECL */
635 /* Code executed at the beginning of each rule, after gras_ddt_parse_text and gras_ddt_parse_leng
638 #ifndef YY_USER_ACTION
639 #define YY_USER_ACTION
642 /* Code executed at the end of each rule. */
644 #define YY_BREAK break;
647 #define YY_RULE_SETUP \
650 /** The main scanner function which does all the work.
654 register yy_state_type yy_current_state;
655 register char *yy_cp, *yy_bp;
658 #line 32 "gras/DataDesc/ddt_parse.yy.l"
660 int comment_caller=0;
661 int annotate_caller=0;
663 #line 664 "gras/DataDesc/ddt_parse.yy.c"
674 (yy_start) = 1; /* first start state */
676 if ( ! gras_ddt_parse_in )
677 gras_ddt_parse_in = stdin;
679 if ( ! gras_ddt_parse_out )
680 gras_ddt_parse_out = stdout;
682 if ( ! YY_CURRENT_BUFFER ) {
683 gras_ddt_parse_ensure_buffer_stack ();
684 YY_CURRENT_BUFFER_LVALUE =
685 gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE );
688 gras_ddt_parse__load_buffer_state( );
691 while ( 1 ) /* loops until end-of-file is reached */
693 yy_cp = (yy_c_buf_p);
695 /* Support of gras_ddt_parse_text. */
696 *yy_cp = (yy_hold_char);
698 /* yy_bp points to the position in yy_ch_buf of the start of
703 yy_current_state = (yy_start);
707 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
708 if ( yy_accept[yy_current_state] )
710 (yy_last_accepting_state) = yy_current_state;
711 (yy_last_accepting_cpos) = yy_cp;
713 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
715 yy_current_state = (int) yy_def[yy_current_state];
716 if ( yy_current_state >= 61 )
717 yy_c = yy_meta[(unsigned int) yy_c];
719 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
722 while ( yy_base[yy_current_state] != 88 );
725 yy_act = yy_accept[yy_current_state];
727 { /* have to back up */
728 yy_cp = (yy_last_accepting_cpos);
729 yy_current_state = (yy_last_accepting_state);
730 yy_act = yy_accept[yy_current_state];
735 do_action: /* This label is used only to access EOF actions. */
738 { /* beginning of action switch */
739 case 0: /* must back up */
740 /* undo the effects of YY_DO_BEFORE_ACTION */
741 *yy_cp = (yy_hold_char);
742 yy_cp = (yy_last_accepting_cpos);
743 yy_current_state = (yy_last_accepting_state);
748 #line 36 "gras/DataDesc/ddt_parse.yy.l"
753 #line 38 "gras/DataDesc/ddt_parse.yy.l"
754 { /****************** ANNOTATION ************************/
755 DEBUG0("Begin annotation");
756 annotate_caller = INITIAL;
757 gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
758 gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
764 #line 45 "gras/DataDesc/ddt_parse.yy.l"
765 { /* trim annotation */
766 DEBUG0("Begin annotation");
767 annotate_caller = foo;
768 gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
769 gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
775 #line 53 "gras/DataDesc/ddt_parse.yy.l"
777 DEBUG0("End annotation");
778 gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
779 gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
780 BEGIN(annotate_caller);
785 #line 60 "gras/DataDesc/ddt_parse.yy.l"
787 PARSE_ERROR0("``/*g'' construct closed by a regular ``*/''");
791 /* rule 6 can match eol */
793 #line 63 "gras/DataDesc/ddt_parse.yy.l"
795 PARSE_ERROR0("Type annotation cannot spread over several lines");
800 #line 67 "gras/DataDesc/ddt_parse.yy.l"
802 gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
803 gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
804 return GRAS_DDT_PARSE_TOKEN_ANNOTATE;
809 #line 73 "gras/DataDesc/ddt_parse.yy.l"
810 { /****************** COMMENTS ************************/
811 /* constructs like : */
813 /* are not comments but size annotations */
814 comment_caller = INITIAL;
820 #line 81 "gras/DataDesc/ddt_parse.yy.l"
822 comment_caller = foo;
828 #line 86 "gras/DataDesc/ddt_parse.yy.l"
829 { /* eat anything that's not a '*' */
834 #line 88 "gras/DataDesc/ddt_parse.yy.l"
835 { /* eat up '*'s not followed by '/'s */
839 /* rule 12 can match eol */
841 #line 90 "gras/DataDesc/ddt_parse.yy.l"
843 ++gras_ddt_parse_line_pos;
844 gras_ddt_parse_col_pos=0;
845 gras_ddt_parse_char_pos++;
850 #line 95 "gras/DataDesc/ddt_parse.yy.l"
852 gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text);
853 gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text);
854 BEGIN(comment_caller);
859 #line 101 "gras/DataDesc/ddt_parse.yy.l"
860 { /****************** STATEMENTS ************************/
861 gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text);
862 gras_ddt_parse_col_pos += strlen(gras_ddt_parse_text);
864 return(GRAS_DDT_PARSE_TOKEN_WORD);
869 #line 107 "gras/DataDesc/ddt_parse.yy.l"
871 gras_ddt_parse_char_pos++;
872 gras_ddt_parse_col_pos++;
874 return(GRAS_DDT_PARSE_TOKEN_LA);
879 #line 113 "gras/DataDesc/ddt_parse.yy.l"
881 gras_ddt_parse_char_pos++;
882 gras_ddt_parse_col_pos++;
884 return(GRAS_DDT_PARSE_TOKEN_RA);
889 #line 119 "gras/DataDesc/ddt_parse.yy.l"
891 gras_ddt_parse_char_pos++;
892 gras_ddt_parse_col_pos++;
894 return(GRAS_DDT_PARSE_TOKEN_LB);
899 #line 125 "gras/DataDesc/ddt_parse.yy.l"
901 gras_ddt_parse_char_pos++;
902 gras_ddt_parse_col_pos++;
904 return(GRAS_DDT_PARSE_TOKEN_RB);
909 #line 131 "gras/DataDesc/ddt_parse.yy.l"
911 gras_ddt_parse_char_pos++;
912 gras_ddt_parse_col_pos++;
914 return(GRAS_DDT_PARSE_TOKEN_LP);
919 #line 137 "gras/DataDesc/ddt_parse.yy.l"
921 gras_ddt_parse_char_pos++;
922 gras_ddt_parse_col_pos++;
924 return(GRAS_DDT_PARSE_TOKEN_RP);
929 #line 143 "gras/DataDesc/ddt_parse.yy.l"
931 gras_ddt_parse_char_pos++;
932 gras_ddt_parse_col_pos++;
934 return(GRAS_DDT_PARSE_TOKEN_STAR);
939 #line 149 "gras/DataDesc/ddt_parse.yy.l"
941 gras_ddt_parse_char_pos++;
942 gras_ddt_parse_col_pos++;
944 return(GRAS_DDT_PARSE_TOKEN_SEMI_COLON);
949 #line 155 "gras/DataDesc/ddt_parse.yy.l"
951 gras_ddt_parse_char_pos++;
952 gras_ddt_parse_col_pos++;
954 return(GRAS_DDT_PARSE_TOKEN_COLON);
958 /* rule 24 can match eol */
960 #line 161 "gras/DataDesc/ddt_parse.yy.l"
962 gras_ddt_parse_line_pos++;
963 gras_ddt_parse_char_pos++;
964 gras_ddt_parse_col_pos=0;
970 #line 167 "gras/DataDesc/ddt_parse.yy.l"
972 gras_ddt_parse_char_pos++;
973 gras_ddt_parse_col_pos++;
979 #line 172 "gras/DataDesc/ddt_parse.yy.l"
982 #line 983 "gras/DataDesc/ddt_parse.yy.c"
983 case YY_STATE_EOF(INITIAL):
984 case YY_STATE_EOF(annotate):
985 case YY_STATE_EOF(comment):
986 case YY_STATE_EOF(foo):
989 case YY_END_OF_BUFFER:
991 /* Amount of text matched not including the EOB char. */
992 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
994 /* Undo the effects of YY_DO_BEFORE_ACTION. */
995 *yy_cp = (yy_hold_char);
996 YY_RESTORE_YY_MORE_OFFSET
998 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1000 /* We're scanning a new file or input source. It's
1001 * possible that this happened because the user
1002 * just pointed gras_ddt_parse_in at a new source and called
1003 * gras_ddt_parse_lex(). If so, then we have to assure
1004 * consistency between YY_CURRENT_BUFFER and our
1005 * globals. Here is the right place to do so, because
1006 * this is the first action (other than possibly a
1007 * back-up) that will match for the new input source.
1009 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1010 YY_CURRENT_BUFFER_LVALUE->yy_input_file = gras_ddt_parse_in;
1011 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1014 /* Note that here we test for yy_c_buf_p "<=" to the position
1015 * of the first EOB in the buffer, since yy_c_buf_p will
1016 * already have been incremented past the NUL character
1017 * (since all states make transitions on EOB to the
1018 * end-of-buffer state). Contrast this with the test
1021 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1022 { /* This was really a NUL. */
1023 yy_state_type yy_next_state;
1025 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1027 yy_current_state = yy_get_previous_state( );
1029 /* Okay, we're now positioned to make the NUL
1030 * transition. We couldn't have
1031 * yy_get_previous_state() go ahead and do it
1032 * for us because it doesn't know how to deal
1033 * with the possibility of jamming (and we don't
1034 * want to build jamming into it because then it
1035 * will run more slowly).
1038 yy_next_state = yy_try_NUL_trans( yy_current_state );
1040 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1042 if ( yy_next_state )
1044 /* Consume the NUL. */
1045 yy_cp = ++(yy_c_buf_p);
1046 yy_current_state = yy_next_state;
1052 yy_cp = (yy_c_buf_p);
1053 goto yy_find_action;
1057 else switch ( yy_get_next_buffer( ) )
1059 case EOB_ACT_END_OF_FILE:
1061 (yy_did_buffer_switch_on_eof) = 0;
1063 if ( gras_ddt_parse_wrap( ) )
1065 /* Note: because we've taken care in
1066 * yy_get_next_buffer() to have set up
1067 * gras_ddt_parse_text, we can now set up
1068 * yy_c_buf_p so that if some total
1069 * hoser (like flex itself) wants to
1070 * call the scanner after we return the
1071 * YY_NULL, it'll still work - another
1072 * YY_NULL will get returned.
1074 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1076 yy_act = YY_STATE_EOF(YY_START);
1082 if ( ! (yy_did_buffer_switch_on_eof) )
1088 case EOB_ACT_CONTINUE_SCAN:
1090 (yytext_ptr) + yy_amount_of_matched_text;
1092 yy_current_state = yy_get_previous_state( );
1094 yy_cp = (yy_c_buf_p);
1095 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1098 case EOB_ACT_LAST_MATCH:
1100 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1102 yy_current_state = yy_get_previous_state( );
1104 yy_cp = (yy_c_buf_p);
1105 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1106 goto yy_find_action;
1113 "fatal flex scanner internal error--no action found" );
1114 } /* end of action switch */
1115 } /* end of scanning one token */
1116 } /* end of gras_ddt_parse_lex */
1118 /* yy_get_next_buffer - try to read in a new buffer
1120 * Returns a code representing an action:
1121 * EOB_ACT_LAST_MATCH -
1122 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1123 * EOB_ACT_END_OF_FILE - end of file
1125 static int yy_get_next_buffer (void)
1127 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1128 register char *source = (yytext_ptr);
1129 register int number_to_move, i;
1132 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1134 "fatal flex scanner internal error--end of buffer missed" );
1136 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1137 { /* Don't try to fill the buffer, so this is an EOF. */
1138 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1140 /* We matched a single character, the EOB, so
1141 * treat this as a final EOF.
1143 return EOB_ACT_END_OF_FILE;
1148 /* We matched some text prior to the EOB, first
1151 return EOB_ACT_LAST_MATCH;
1155 /* Try to read more data. */
1157 /* First move last chars to start of buffer. */
1158 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1160 for ( i = 0; i < number_to_move; ++i )
1161 *(dest++) = *(source++);
1163 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1164 /* don't do the read, it's not guaranteed to return an EOF,
1167 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1171 size_t num_to_read =
1172 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1174 while ( num_to_read <= 0 )
1175 { /* Not enough room in the buffer - grow it. */
1177 /* just a shorter name for the current buffer */
1178 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1180 int yy_c_buf_p_offset =
1181 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1183 if ( b->yy_is_our_buffer )
1185 int new_size = b->yy_buf_size * 2;
1187 if ( new_size <= 0 )
1188 b->yy_buf_size += b->yy_buf_size / 8;
1190 b->yy_buf_size *= 2;
1192 b->yy_ch_buf = (char *)
1193 /* Include room in for 2 EOB chars. */
1194 gras_ddt_parse_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1197 /* Can't grow it, we don't own it. */
1200 if ( ! b->yy_ch_buf )
1202 "fatal error - scanner input buffer overflow" );
1204 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1206 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1211 if ( num_to_read > YY_READ_BUF_SIZE )
1212 num_to_read = YY_READ_BUF_SIZE;
1214 /* Read in more data. */
1215 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1216 (yy_n_chars), num_to_read );
1218 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1221 if ( (yy_n_chars) == 0 )
1223 if ( number_to_move == YY_MORE_ADJ )
1225 ret_val = EOB_ACT_END_OF_FILE;
1226 gras_ddt_parse_restart(gras_ddt_parse_in );
1231 ret_val = EOB_ACT_LAST_MATCH;
1232 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1233 YY_BUFFER_EOF_PENDING;
1238 ret_val = EOB_ACT_CONTINUE_SCAN;
1240 (yy_n_chars) += number_to_move;
1241 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1242 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1244 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1249 /* yy_get_previous_state - get the state just before the EOB char was reached */
1251 static yy_state_type yy_get_previous_state (void)
1253 register yy_state_type yy_current_state;
1254 register char *yy_cp;
1256 yy_current_state = (yy_start);
1258 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1260 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1261 if ( yy_accept[yy_current_state] )
1263 (yy_last_accepting_state) = yy_current_state;
1264 (yy_last_accepting_cpos) = yy_cp;
1266 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1268 yy_current_state = (int) yy_def[yy_current_state];
1269 if ( yy_current_state >= 61 )
1270 yy_c = yy_meta[(unsigned int) yy_c];
1272 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1275 return yy_current_state;
1278 /* yy_try_NUL_trans - try to make a transition on the NUL character
1281 * next_state = yy_try_NUL_trans( current_state );
1283 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1285 register int yy_is_jam;
1286 register char *yy_cp = (yy_c_buf_p);
1288 register YY_CHAR yy_c = 1;
1289 if ( yy_accept[yy_current_state] )
1291 (yy_last_accepting_state) = yy_current_state;
1292 (yy_last_accepting_cpos) = yy_cp;
1294 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1296 yy_current_state = (int) yy_def[yy_current_state];
1297 if ( yy_current_state >= 61 )
1298 yy_c = yy_meta[(unsigned int) yy_c];
1300 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1301 yy_is_jam = (yy_current_state == 60);
1303 return yy_is_jam ? 0 : yy_current_state;
1306 static void yyunput (int c, register char * yy_bp )
1308 register char *yy_cp;
1310 yy_cp = (yy_c_buf_p);
1312 /* undo effects of setting up gras_ddt_parse_text */
1313 *yy_cp = (yy_hold_char);
1315 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1316 { /* need to shift things up to make room */
1317 /* +2 for EOB chars. */
1318 register int number_to_move = (yy_n_chars) + 2;
1319 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1320 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1321 register char *source =
1322 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1324 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1325 *--dest = *--source;
1327 yy_cp += (int) (dest - source);
1328 yy_bp += (int) (dest - source);
1329 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1330 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1332 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1333 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1336 *--yy_cp = (char) c;
1338 (yytext_ptr) = yy_bp;
1339 (yy_hold_char) = *yy_cp;
1340 (yy_c_buf_p) = yy_cp;
1345 static int yyinput (void)
1347 static int input (void)
1353 *(yy_c_buf_p) = (yy_hold_char);
1355 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1357 /* yy_c_buf_p now points to the character we want to return.
1358 * If this occurs *before* the EOB characters, then it's a
1359 * valid NUL; if not, then we've hit the end of the buffer.
1361 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1362 /* This was really a NUL. */
1363 *(yy_c_buf_p) = '\0';
1366 { /* need more input */
1367 int offset = (yy_c_buf_p) - (yytext_ptr);
1370 switch ( yy_get_next_buffer( ) )
1372 case EOB_ACT_LAST_MATCH:
1373 /* This happens because yy_g_n_b()
1374 * sees that we've accumulated a
1375 * token and flags that we need to
1376 * try matching the token before
1377 * proceeding. But for input(),
1378 * there's no matching to consider.
1379 * So convert the EOB_ACT_LAST_MATCH
1380 * to EOB_ACT_END_OF_FILE.
1383 /* Reset buffer status. */
1384 gras_ddt_parse_restart(gras_ddt_parse_in );
1388 case EOB_ACT_END_OF_FILE:
1390 if ( gras_ddt_parse_wrap( ) )
1393 if ( ! (yy_did_buffer_switch_on_eof) )
1402 case EOB_ACT_CONTINUE_SCAN:
1403 (yy_c_buf_p) = (yytext_ptr) + offset;
1409 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1410 *(yy_c_buf_p) = '\0'; /* preserve gras_ddt_parse_text */
1411 (yy_hold_char) = *++(yy_c_buf_p);
1415 #endif /* ifndef YY_NO_INPUT */
1417 /** Immediately switch to a different input stream.
1418 * @param input_file A readable stream.
1420 * @note This function does not reset the start condition to @c INITIAL .
1422 void gras_ddt_parse_restart (FILE * input_file )
1425 if ( ! YY_CURRENT_BUFFER ){
1426 gras_ddt_parse_ensure_buffer_stack ();
1427 YY_CURRENT_BUFFER_LVALUE =
1428 gras_ddt_parse__create_buffer(gras_ddt_parse_in,YY_BUF_SIZE );
1431 gras_ddt_parse__init_buffer(YY_CURRENT_BUFFER,input_file );
1432 gras_ddt_parse__load_buffer_state( );
1435 /** Switch to a different input buffer.
1436 * @param new_buffer The new input buffer.
1439 void gras_ddt_parse__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1442 /* TODO. We should be able to replace this entire function body
1444 * gras_ddt_parse_pop_buffer_state();
1445 * gras_ddt_parse_push_buffer_state(new_buffer);
1447 gras_ddt_parse_ensure_buffer_stack ();
1448 if ( YY_CURRENT_BUFFER == new_buffer )
1451 if ( YY_CURRENT_BUFFER )
1453 /* Flush out information for old buffer. */
1454 *(yy_c_buf_p) = (yy_hold_char);
1455 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1456 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1459 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1460 gras_ddt_parse__load_buffer_state( );
1462 /* We don't actually know whether we did this switch during
1463 * EOF (gras_ddt_parse_wrap()) processing, but the only time this flag
1464 * is looked at is after gras_ddt_parse_wrap() is called, so it's safe
1465 * to go ahead and always set it.
1467 (yy_did_buffer_switch_on_eof) = 1;
1470 static void gras_ddt_parse__load_buffer_state (void)
1472 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1473 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1474 gras_ddt_parse_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1475 (yy_hold_char) = *(yy_c_buf_p);
1478 /** Allocate and initialize an input buffer state.
1479 * @param file A readable stream.
1480 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1482 * @return the allocated buffer state.
1484 YY_BUFFER_STATE gras_ddt_parse__create_buffer (FILE * file, int size )
1488 b = (YY_BUFFER_STATE) gras_ddt_parse_alloc(sizeof( struct yy_buffer_state ) );
1490 YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__create_buffer()" );
1492 b->yy_buf_size = size;
1494 /* yy_ch_buf has to be 2 characters longer than the size given because
1495 * we need to put in 2 end-of-buffer characters.
1497 b->yy_ch_buf = (char *) gras_ddt_parse_alloc(b->yy_buf_size + 2 );
1498 if ( ! b->yy_ch_buf )
1499 YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__create_buffer()" );
1501 b->yy_is_our_buffer = 1;
1503 gras_ddt_parse__init_buffer(b,file );
1508 /** Destroy the buffer.
1509 * @param b a buffer created with gras_ddt_parse__create_buffer()
1512 void gras_ddt_parse__delete_buffer (YY_BUFFER_STATE b )
1518 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1519 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1521 if ( b->yy_is_our_buffer )
1522 gras_ddt_parse_free((void *) b->yy_ch_buf );
1524 gras_ddt_parse_free((void *) b );
1528 extern int isatty (int );
1529 #endif /* __cplusplus */
1531 /* Initializes or reinitializes a buffer.
1532 * This function is sometimes called more than once on the same buffer,
1533 * such as during a gras_ddt_parse_restart() or at EOF.
1535 static void gras_ddt_parse__init_buffer (YY_BUFFER_STATE b, FILE * file )
1540 gras_ddt_parse__flush_buffer(b );
1542 b->yy_input_file = file;
1543 b->yy_fill_buffer = 1;
1545 /* If b is the current buffer, then gras_ddt_parse__init_buffer was _probably_
1546 * called from gras_ddt_parse_restart() or through yy_get_next_buffer.
1547 * In that case, we don't want to reset the lineno or column.
1549 if (b != YY_CURRENT_BUFFER){
1550 b->yy_bs_lineno = 1;
1551 b->yy_bs_column = 0;
1554 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1559 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1560 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1563 void gras_ddt_parse__flush_buffer (YY_BUFFER_STATE b )
1570 /* We always need two end-of-buffer characters. The first causes
1571 * a transition to the end-of-buffer state. The second causes
1572 * a jam in that state.
1574 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1575 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1577 b->yy_buf_pos = &b->yy_ch_buf[0];
1580 b->yy_buffer_status = YY_BUFFER_NEW;
1582 if ( b == YY_CURRENT_BUFFER )
1583 gras_ddt_parse__load_buffer_state( );
1586 /** Pushes the new state onto the stack. The new state becomes
1587 * the current state. This function will allocate the stack
1589 * @param new_buffer The new state.
1592 void gras_ddt_parse_push_buffer_state (YY_BUFFER_STATE new_buffer )
1594 if (new_buffer == NULL)
1597 gras_ddt_parse_ensure_buffer_stack();
1599 /* This block is copied from gras_ddt_parse__switch_to_buffer. */
1600 if ( YY_CURRENT_BUFFER )
1602 /* Flush out information for old buffer. */
1603 *(yy_c_buf_p) = (yy_hold_char);
1604 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1605 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1608 /* Only push if top exists. Otherwise, replace top. */
1609 if (YY_CURRENT_BUFFER)
1610 (yy_buffer_stack_top)++;
1611 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1613 /* copied from gras_ddt_parse__switch_to_buffer. */
1614 gras_ddt_parse__load_buffer_state( );
1615 (yy_did_buffer_switch_on_eof) = 1;
1618 /** Removes and deletes the top of the stack, if present.
1619 * The next element becomes the new top.
1622 void gras_ddt_parse_pop_buffer_state (void)
1624 if (!YY_CURRENT_BUFFER)
1627 gras_ddt_parse__delete_buffer(YY_CURRENT_BUFFER );
1628 YY_CURRENT_BUFFER_LVALUE = NULL;
1629 if ((yy_buffer_stack_top) > 0)
1630 --(yy_buffer_stack_top);
1632 if (YY_CURRENT_BUFFER) {
1633 gras_ddt_parse__load_buffer_state( );
1634 (yy_did_buffer_switch_on_eof) = 1;
1638 /* Allocates the stack if it does not exist.
1639 * Guarantees space for at least one push.
1641 static void gras_ddt_parse_ensure_buffer_stack (void)
1645 if (!(yy_buffer_stack)) {
1647 /* First allocation is just for 2 elements, since we don't know if this
1648 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1649 * immediate realloc on the next call.
1652 (yy_buffer_stack) = (struct yy_buffer_state**)gras_ddt_parse_alloc
1653 (num_to_alloc * sizeof(struct yy_buffer_state*)
1656 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1658 (yy_buffer_stack_max) = num_to_alloc;
1659 (yy_buffer_stack_top) = 0;
1663 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1665 /* Increase the buffer to prepare for a possible push. */
1666 int grow_size = 8 /* arbitrary grow size */;
1668 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1669 (yy_buffer_stack) = (struct yy_buffer_state**)gras_ddt_parse_realloc
1671 num_to_alloc * sizeof(struct yy_buffer_state*)
1674 /* zero only the new slots.*/
1675 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1676 (yy_buffer_stack_max) = num_to_alloc;
1680 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1681 * @param base the character buffer
1682 * @param size the size in bytes of the character buffer
1684 * @return the newly allocated buffer state object.
1686 YY_BUFFER_STATE gras_ddt_parse__scan_buffer (char * base, yy_size_t size )
1691 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1692 base[size-1] != YY_END_OF_BUFFER_CHAR )
1693 /* They forgot to leave room for the EOB's. */
1696 b = (YY_BUFFER_STATE) gras_ddt_parse_alloc(sizeof( struct yy_buffer_state ) );
1698 YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__scan_buffer()" );
1700 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1701 b->yy_buf_pos = b->yy_ch_buf = base;
1702 b->yy_is_our_buffer = 0;
1703 b->yy_input_file = 0;
1704 b->yy_n_chars = b->yy_buf_size;
1705 b->yy_is_interactive = 0;
1707 b->yy_fill_buffer = 0;
1708 b->yy_buffer_status = YY_BUFFER_NEW;
1710 gras_ddt_parse__switch_to_buffer(b );
1715 /** Setup the input buffer state to scan a string. The next call to gras_ddt_parse_lex() will
1716 * scan from a @e copy of @a str.
1717 * @param str a NUL-terminated string to scan
1719 * @return the newly allocated buffer state object.
1720 * @note If you want to scan bytes that may contain NUL values, then use
1721 * gras_ddt_parse__scan_bytes() instead.
1723 YY_BUFFER_STATE gras_ddt_parse__scan_string (yyconst char * yy_str )
1726 return gras_ddt_parse__scan_bytes(yy_str,strlen(yy_str) );
1729 /** Setup the input buffer state to scan the given bytes. The next call to gras_ddt_parse_lex() will
1730 * scan from a @e copy of @a bytes.
1731 * @param bytes the byte buffer to scan
1732 * @param len the number of bytes in the buffer pointed to by @a bytes.
1734 * @return the newly allocated buffer state object.
1736 YY_BUFFER_STATE gras_ddt_parse__scan_bytes (yyconst char * bytes, int len )
1743 /* Get memory for full buffer, including space for trailing EOB's. */
1745 buf = (char *) gras_ddt_parse_alloc(n );
1747 YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__scan_bytes()" );
1749 for ( i = 0; i < len; ++i )
1752 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1754 b = gras_ddt_parse__scan_buffer(buf,n );
1756 YY_FATAL_ERROR( "bad buffer in gras_ddt_parse__scan_bytes()" );
1758 /* It's okay to grow etc. this buffer, and we should throw it
1759 * away when we're done.
1761 b->yy_is_our_buffer = 1;
1766 #ifndef YY_EXIT_FAILURE
1767 #define YY_EXIT_FAILURE 2
1770 static void yy_fatal_error (yyconst char* msg )
1772 (void) fprintf( stderr, "%s\n", msg );
1773 exit( YY_EXIT_FAILURE );
1776 /* Redefine yyless() so it works in section 3 code. */
1782 /* Undo effects of setting up gras_ddt_parse_text. */ \
1783 int yyless_macro_arg = (n); \
1784 YY_LESS_LINENO(yyless_macro_arg);\
1785 gras_ddt_parse_text[gras_ddt_parse_leng] = (yy_hold_char); \
1786 (yy_c_buf_p) = gras_ddt_parse_text + yyless_macro_arg; \
1787 (yy_hold_char) = *(yy_c_buf_p); \
1788 *(yy_c_buf_p) = '\0'; \
1789 gras_ddt_parse_leng = yyless_macro_arg; \
1793 /* Accessor methods (get/set functions) to struct members. */
1795 /** Get the current line number.
1798 int gras_ddt_parse_get_lineno (void)
1801 return gras_ddt_parse_lineno;
1804 /** Get the input stream.
1807 FILE *gras_ddt_parse_get_in (void)
1809 return gras_ddt_parse_in;
1812 /** Get the output stream.
1815 FILE *gras_ddt_parse_get_out (void)
1817 return gras_ddt_parse_out;
1820 /** Get the length of the current token.
1823 int gras_ddt_parse_get_leng (void)
1825 return gras_ddt_parse_leng;
1828 /** Get the current token.
1832 char *gras_ddt_parse_get_text (void)
1834 return gras_ddt_parse_text;
1837 /** Set the current line number.
1838 * @param line_number
1841 void gras_ddt_parse_set_lineno (int line_number )
1844 gras_ddt_parse_lineno = line_number;
1847 /** Set the input stream. This does not discard the current
1849 * @param in_str A readable stream.
1851 * @see gras_ddt_parse__switch_to_buffer
1853 void gras_ddt_parse_set_in (FILE * in_str )
1855 gras_ddt_parse_in = in_str ;
1858 void gras_ddt_parse_set_out (FILE * out_str )
1860 gras_ddt_parse_out = out_str ;
1863 int gras_ddt_parse_get_debug (void)
1865 return gras_ddt_parse__flex_debug;
1868 void gras_ddt_parse_set_debug (int bdebug )
1870 gras_ddt_parse__flex_debug = bdebug ;
1873 /* gras_ddt_parse_lex_destroy is for both reentrant and non-reentrant scanners. */
1874 int gras_ddt_parse_lex_destroy (void)
1877 /* Pop the buffer stack, destroying each element. */
1878 while(YY_CURRENT_BUFFER){
1879 gras_ddt_parse__delete_buffer(YY_CURRENT_BUFFER );
1880 YY_CURRENT_BUFFER_LVALUE = NULL;
1881 gras_ddt_parse_pop_buffer_state();
1884 /* Destroy the stack itself. */
1885 gras_ddt_parse_free((yy_buffer_stack) );
1886 (yy_buffer_stack) = NULL;
1892 * Internal utility routines.
1896 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1899 for ( i = 0; i < n; ++i )
1904 #ifdef YY_NEED_STRLEN
1905 static int yy_flex_strlen (yyconst char * s )
1908 for ( n = 0; s[n]; ++n )
1915 void *gras_ddt_parse_alloc (yy_size_t size )
1917 return (void *) malloc( size );
1920 void *gras_ddt_parse_realloc (void * ptr, yy_size_t size )
1922 /* The cast to (char *) in the following accommodates both
1923 * implementations that use char* generic pointers, and those
1924 * that use void* generic pointers. It works with the latter
1925 * because both ANSI C and C++ allow castless assignment from
1926 * any pointer type to void*, and deal with argument conversions
1927 * as though doing an assignment.
1929 return (void *) realloc( (char *) ptr, size );
1932 void gras_ddt_parse_free (void * ptr )
1934 free( (char *) ptr ); /* see gras_ddt_parse_realloc() for (char *) cast */
1937 #define YYTABLES_NAME "yytables"
1940 #undef YY_FLUSH_BUFFER
1942 #undef yy_new_buffer
1943 #undef yy_set_interactive
1945 #undef YY_DO_BEFORE_ACTION
1947 #ifdef YY_DECL_IS_OURS
1948 #undef YY_DECL_IS_OURS
1951 #line 172 "gras/DataDesc/ddt_parse.yy.l"
1954 /* {space}+ { return(TOKEN_SPACE);} */
1956 void gras_ddt_parse_dump(void) {
1957 switch(gras_ddt_parse_tok_num) {
1958 case GRAS_DDT_PARSE_TOKEN_LA : {printf("TOKEN_LA ");break;}
1959 case GRAS_DDT_PARSE_TOKEN_RA : {printf("TOKEN_RA ");break;}
1960 case GRAS_DDT_PARSE_TOKEN_WORD : {printf("TOKEN_WORD ");break;}
1961 /* case GRAS_DDT_PARSE_TOKEN_SPACE : {printf("TOKEN_SPACE ");break;}*/
1962 /* case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}*/
1963 case GRAS_DDT_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;}
1964 case GRAS_DDT_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;}
1965 default : {printf("Unknown token %d\n", gras_ddt_parse_tok_num);return;}
1967 printf("-->%s<-- [line %d, pos %d]\n",gras_ddt_parse_text,gras_ddt_parse_line_pos,gras_ddt_parse_char_pos);
1971 int gras_ddt_parse_lex_n_dump(void) {
1972 gras_ddt_parse_tok_num = gras_ddt_parse_lex();
1973 /* gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text);*/
1974 return(gras_ddt_parse_tok_num);
1977 void gras_ddt_parse_pointer_init(const char *file) {
1978 gras_ddt_file_to_parse = fopen(file,"r");
1979 gras_ddt_input_buffer = gras_ddt_parse__create_buffer(gras_ddt_file_to_parse,10 );
1980 gras_ddt_parse__switch_to_buffer(gras_ddt_input_buffer);
1982 gras_ddt_parse_line_pos = 1;
1983 gras_ddt_parse_char_pos = 0;
1984 gras_ddt_parse_col_pos = 0;
1985 gras_ddt_parse_tok_num = 0;
1988 void gras_ddt_parse_pointer_close(void) {
1989 gras_ddt_parse__delete_buffer(gras_ddt_input_buffer);
1990 fclose(gras_ddt_file_to_parse);
1992 gras_ddt_parse_line_pos = 1;
1993 gras_ddt_parse_char_pos = 0;
1994 gras_ddt_parse_tok_num = 0;
1998 void gras_ddt_parse_pointer_string_init(const char *string_to_parse) {
1999 gras_ddt_input_buffer = gras_ddt_parse__scan_string (string_to_parse);
2000 definition = string_to_parse;
2001 gras_ddt_parse__switch_to_buffer(gras_ddt_input_buffer);
2003 gras_ddt_parse_line_pos = 1;
2004 gras_ddt_parse_char_pos = 0;
2005 gras_ddt_parse_tok_num = 0;
2008 void gras_ddt_parse_pointer_string_close(void) {
2009 gras_ddt_parse__delete_buffer(gras_ddt_input_buffer);
2011 gras_ddt_parse_line_pos = 1;
2012 gras_ddt_parse_char_pos = 0;
2013 gras_ddt_parse_tok_num = 0;
2016 yyunput('\0',NULL); /* fake a use of this function to calm gcc down */
2019 /* Local variables:*/