2 #line 3 "src/xbt/datadesc/ddt_parse.yy.c"
4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex */
8 #define yy_create_buffer xbt_ddt_parse__create_buffer
9 #define yy_delete_buffer xbt_ddt_parse__delete_buffer
10 #define yy_flex_debug xbt_ddt_parse__flex_debug
11 #define yy_init_buffer xbt_ddt_parse__init_buffer
12 #define yy_flush_buffer xbt_ddt_parse__flush_buffer
13 #define yy_load_buffer_state xbt_ddt_parse__load_buffer_state
14 #define yy_switch_to_buffer xbt_ddt_parse__switch_to_buffer
15 #define yyin xbt_ddt_parse_in
16 #define yyleng xbt_ddt_parse_leng
17 #define yylex xbt_ddt_parse_lex
18 #define yylineno xbt_ddt_parse_lineno
19 #define yyout xbt_ddt_parse_out
20 #define yyrestart xbt_ddt_parse_restart
21 #define yytext xbt_ddt_parse_text
22 #define yywrap xbt_ddt_parse_wrap
23 #define yyalloc xbt_ddt_parse_alloc
24 #define yyrealloc xbt_ddt_parse_realloc
25 #define yyfree xbt_ddt_parse_free
28 #define YY_FLEX_MAJOR_VERSION 2
29 #define YY_FLEX_MINOR_VERSION 5
30 #define YY_FLEX_SUBMINOR_VERSION 35
31 #if YY_FLEX_SUBMINOR_VERSION > 0
35 /* First, we deal with platform-specific or compiler-specific issues. */
37 /* begin standard C headers. */
43 /* end standard C headers. */
45 /* flex integer type definitions */
50 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
52 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
54 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
55 * if you want the limit (max/min) macros for int types.
57 #ifndef __STDC_LIMIT_MACROS
58 #define __STDC_LIMIT_MACROS 1
62 typedef int8_t flex_int8_t;
63 typedef uint8_t flex_uint8_t;
64 typedef int16_t flex_int16_t;
65 typedef uint16_t flex_uint16_t;
66 typedef int32_t flex_int32_t;
67 typedef uint32_t flex_uint32_t;
69 typedef signed char flex_int8_t;
70 typedef short int flex_int16_t;
71 typedef int flex_int32_t;
72 typedef unsigned char flex_uint8_t;
73 typedef unsigned short int flex_uint16_t;
74 typedef unsigned int flex_uint32_t;
77 /* Limits of integral types. */
79 #define INT8_MIN (-128)
82 #define INT16_MIN (-32767-1)
85 #define INT32_MIN (-2147483647-1)
88 #define INT8_MAX (127)
91 #define INT16_MAX (32767)
94 #define INT32_MAX (2147483647)
97 #define UINT8_MAX (255U)
100 #define UINT16_MAX (65535U)
103 #define UINT32_MAX (4294967295U)
106 #endif /* ! FLEXINT_H */
110 /* The "const" storage-class-modifier is valid. */
113 #else /* ! __cplusplus */
115 /* C99 requires __STDC__ to be defined as 1. */
116 #if defined (__STDC__)
120 #endif /* defined (__STDC__) */
121 #endif /* ! __cplusplus */
124 #define yyconst const
129 /* Returned upon end-of-file. */
132 /* Promotes a possibly negative, possibly signed char to an unsigned
133 * integer for use as an array index. If the signed char is negative,
134 * we want to instead treat it as an 8-bit unsigned char, hence the
137 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
139 /* Enter a start condition. This macro really ought to take a parameter,
140 * but we do it the disgusting crufty way forced on us by the ()-less
141 * definition of BEGIN.
143 #define BEGIN (yy_start) = 1 + 2 *
145 /* Translate the current start state into a value that can be later handed
146 * to BEGIN to return to the state. The YYSTATE alias is for lex
149 #define YY_START (((yy_start) - 1) / 2)
150 #define YYSTATE YY_START
152 /* Action number for EOF rule of a given start state. */
153 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
155 /* Special action meaning "start processing a new file". */
156 #define YY_NEW_FILE xbt_ddt_parse_restart(xbt_ddt_parse_in )
158 #define YY_END_OF_BUFFER_CHAR 0
160 /* Size of default input buffer. */
162 #define YY_BUF_SIZE 16384
165 /* The state buf must be large enough to hold one state per character in the main buffer.
167 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
169 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
170 #define YY_TYPEDEF_YY_BUFFER_STATE
171 typedef struct yy_buffer_state *YY_BUFFER_STATE;
174 extern int xbt_ddt_parse_leng;
176 extern FILE *xbt_ddt_parse_in, *xbt_ddt_parse_out;
178 #define EOB_ACT_CONTINUE_SCAN 0
179 #define EOB_ACT_END_OF_FILE 1
180 #define EOB_ACT_LAST_MATCH 2
182 #define YY_LESS_LINENO(n)
184 /* Return all but the first "n" matched characters back to the input stream. */
188 /* Undo effects of setting up xbt_ddt_parse_text. */ \
189 int yyless_macro_arg = (n); \
190 YY_LESS_LINENO(yyless_macro_arg);\
191 *yy_cp = (yy_hold_char); \
192 YY_RESTORE_YY_MORE_OFFSET \
193 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
194 YY_DO_BEFORE_ACTION; /* set up xbt_ddt_parse_text again */ \
198 #define unput(c) yyunput( c, (yytext_ptr) )
200 #ifndef YY_TYPEDEF_YY_SIZE_T
201 #define YY_TYPEDEF_YY_SIZE_T
202 typedef size_t yy_size_t;
205 #ifndef YY_STRUCT_YY_BUFFER_STATE
206 #define YY_STRUCT_YY_BUFFER_STATE
207 struct yy_buffer_state
211 char *yy_ch_buf; /* input buffer */
212 char *yy_buf_pos; /* current position in input buffer */
214 /* Size of input buffer in bytes, not including room for EOB
217 yy_size_t yy_buf_size;
219 /* Number of characters read into yy_ch_buf, not including EOB
224 /* Whether we "own" the buffer - i.e., we know we created it,
225 * and can realloc() it to grow it, and should free() it to
228 int yy_is_our_buffer;
230 /* Whether this is an "interactive" input source; if so, and
231 * if we're using stdio for input, then we want to use getc()
232 * instead of fread(), to make sure we stop fetching input after
235 int yy_is_interactive;
237 /* Whether we're considered to be at the beginning of a line.
238 * If so, '^' rules will be active on the next match, otherwise
243 int yy_bs_lineno; /**< The line count. */
244 int yy_bs_column; /**< The column count. */
246 /* Whether to try to fill the input buffer when we reach the
251 int yy_buffer_status;
253 #define YY_BUFFER_NEW 0
254 #define YY_BUFFER_NORMAL 1
255 /* When an EOF's been seen but there's still some text to process
256 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
257 * shouldn't try reading from the input source any more. We might
258 * still have a bunch of tokens to match, though, because of
259 * possible backing-up.
261 * When we actually see the EOF, we change the status to "new"
262 * (via xbt_ddt_parse_restart()), so that the user can continue scanning by
263 * just pointing xbt_ddt_parse_in at a new input file.
265 #define YY_BUFFER_EOF_PENDING 2
268 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
270 /* Stack of input buffers. */
271 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
272 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
273 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
275 /* We provide macros for accessing buffer states in case in the
276 * future we want to put the buffer states in a more general
279 * Returns the top of the stack, or NULL.
281 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
282 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
285 /* Same as previous macro, but useful when we know that the buffer stack is not
286 * NULL or when we need an lvalue. For internal use only.
288 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
290 /* yy_hold_char holds the character lost when xbt_ddt_parse_text is formed. */
291 static char yy_hold_char;
292 static int yy_n_chars; /* number of characters read into yy_ch_buf */
293 int xbt_ddt_parse_leng;
295 /* Points to current character in buffer. */
296 static char *yy_c_buf_p = (char *) 0;
297 static int yy_init = 0; /* whether we need to initialize */
298 static int yy_start = 0; /* start state number */
300 /* Flag which is used to allow xbt_ddt_parse_wrap()'s to do buffer switches
301 * instead of setting up a fresh xbt_ddt_parse_in. A bit of a hack ...
303 static int yy_did_buffer_switch_on_eof;
305 void xbt_ddt_parse_restart (FILE *input_file );
306 void xbt_ddt_parse__switch_to_buffer (YY_BUFFER_STATE new_buffer );
307 YY_BUFFER_STATE xbt_ddt_parse__create_buffer (FILE *file,int size );
308 void xbt_ddt_parse__delete_buffer (YY_BUFFER_STATE b );
309 void xbt_ddt_parse__flush_buffer (YY_BUFFER_STATE b );
310 void xbt_ddt_parse_push_buffer_state (YY_BUFFER_STATE new_buffer );
311 void xbt_ddt_parse_pop_buffer_state (void );
313 static void xbt_ddt_parse_ensure_buffer_stack (void );
314 static void xbt_ddt_parse__load_buffer_state (void );
315 static void xbt_ddt_parse__init_buffer (YY_BUFFER_STATE b,FILE *file );
317 #define YY_FLUSH_BUFFER xbt_ddt_parse__flush_buffer(YY_CURRENT_BUFFER )
319 YY_BUFFER_STATE xbt_ddt_parse__scan_buffer (char *base,yy_size_t size );
320 YY_BUFFER_STATE xbt_ddt_parse__scan_string (yyconst char *yy_str );
321 YY_BUFFER_STATE xbt_ddt_parse__scan_bytes (yyconst char *bytes,int len );
323 void *xbt_ddt_parse_alloc (yy_size_t );
324 void *xbt_ddt_parse_realloc (void *,yy_size_t );
325 void xbt_ddt_parse_free (void * );
327 #define yy_new_buffer xbt_ddt_parse__create_buffer
329 #define yy_set_interactive(is_interactive) \
331 if ( ! YY_CURRENT_BUFFER ){ \
332 xbt_ddt_parse_ensure_buffer_stack (); \
333 YY_CURRENT_BUFFER_LVALUE = \
334 xbt_ddt_parse__create_buffer(xbt_ddt_parse_in,YY_BUF_SIZE ); \
336 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
339 #define yy_set_bol(at_bol) \
341 if ( ! YY_CURRENT_BUFFER ){\
342 xbt_ddt_parse_ensure_buffer_stack (); \
343 YY_CURRENT_BUFFER_LVALUE = \
344 xbt_ddt_parse__create_buffer(xbt_ddt_parse_in,YY_BUF_SIZE ); \
346 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
349 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
351 /* Begin user sect3 */
353 #define xbt_ddt_parse_wrap(n) 1
354 #define YY_SKIP_YYWRAP
356 typedef unsigned char YY_CHAR;
358 FILE *xbt_ddt_parse_in = (FILE *) 0, *xbt_ddt_parse_out = (FILE *) 0;
360 typedef int yy_state_type;
362 extern int xbt_ddt_parse_lineno;
364 int xbt_ddt_parse_lineno = 1;
366 extern char *xbt_ddt_parse_text;
367 #define yytext_ptr xbt_ddt_parse_text
369 static yy_state_type yy_get_previous_state (void );
370 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
371 static int yy_get_next_buffer (void );
372 static void yy_fatal_error (yyconst char msg[] );
374 /* Done after the current pattern has been matched and before the
375 * corresponding action - sets up xbt_ddt_parse_text.
377 #define YY_DO_BEFORE_ACTION \
378 (yytext_ptr) = yy_bp; \
379 xbt_ddt_parse_leng = (size_t) (yy_cp - yy_bp); \
380 (yy_hold_char) = *yy_cp; \
382 (yy_c_buf_p) = yy_cp;
384 #define YY_NUM_RULES 26
385 #define YY_END_OF_BUFFER 27
386 /* This struct is not used in this scanner,
387 but its presence is necessary. */
390 flex_int32_t yy_verify;
393 static yyconst flex_int16_t yy_accept[61] =
395 14, 14, 7, 7, 10, 10, 0, 0, 27, 25,
396 24, 19, 20, 21, 23, 14, 25, 22, 17, 18,
397 15, 16, 7, 7, 6, 7, 7, 10, 12, 11,
398 26, 26, 14, 0, 1, 7, 7, 7, 5, 7,
399 10, 11, 11, 13, 0, 0, 2, 1, 4, 0,
400 3, 0, 2, 0, 3, 0, 0, 8, 9, 0
403 static yyconst flex_int32_t yy_ec[256] =
405 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
408 1, 2, 1, 1, 1, 1, 1, 1, 1, 4,
409 5, 6, 1, 7, 8, 8, 9, 10, 10, 10,
410 10, 10, 10, 10, 10, 10, 10, 1, 11, 1,
411 1, 1, 1, 1, 8, 8, 8, 8, 8, 8,
412 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
413 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
414 12, 1, 13, 14, 8, 1, 8, 8, 8, 8,
416 8, 8, 15, 8, 8, 8, 8, 8, 8, 8,
417 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
418 8, 8, 16, 1, 17, 1, 1, 1, 1, 1,
419 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
420 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
421 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
435 static yyconst flex_int32_t yy_meta[18] =
437 1, 1, 2, 1, 1, 3, 1, 4, 1, 4,
441 static yyconst flex_int16_t yy_base[69] =
443 0, 0, 16, 30, 17, 18, 78, 77, 85, 88,
444 88, 88, 88, 88, 88, 0, 19, 88, 88, 88,
445 88, 88, 0, 24, 88, 75, 77, 0, 88, 21,
446 88, 76, 0, 22, 0, 0, 27, 75, 0, 71,
447 0, 29, 34, 88, 29, 65, 76, 0, 0, 63,
448 74, 60, 72, 56, 65, 51, 50, 88, 88, 88,
449 45, 49, 53, 55, 57, 61, 65, 69
452 static yyconst flex_int16_t yy_def[69] =
454 60, 1, 61, 61, 62, 62, 63, 63, 60, 60,
455 60, 60, 60, 60, 60, 64, 60, 60, 60, 60,
456 60, 60, 65, 65, 60, 65, 65, 66, 60, 67,
457 60, 60, 64, 60, 68, 65, 65, 65, 65, 65,
458 66, 67, 67, 60, 60, 60, 60, 68, 65, 60,
459 60, 60, 60, 60, 60, 60, 60, 60, 60, 0,
460 60, 60, 60, 60, 60, 60, 60, 60
463 static yyconst flex_int16_t yy_nxt[106] =
465 10, 10, 11, 12, 13, 14, 15, 16, 17, 16,
466 18, 19, 20, 10, 16, 21, 22, 24, 25, 29,
467 29, 26, 30, 30, 34, 37, 43, 35, 37, 44,
468 27, 24, 25, 46, 60, 26, 47, 60, 38, 43,
469 50, 38, 44, 51, 27, 23, 23, 23, 23, 28,
470 28, 28, 28, 31, 31, 31, 31, 36, 33, 36,
471 36, 41, 59, 58, 41, 42, 55, 42, 42, 48,
472 57, 48, 48, 53, 56, 55, 54, 53, 52, 49,
473 40, 45, 40, 39, 60, 32, 32, 9, 60, 60,
474 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
479 static yyconst flex_int16_t yy_chk[106] =
481 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
482 1, 1, 1, 1, 1, 1, 1, 3, 3, 5,
483 6, 3, 5, 6, 17, 24, 30, 17, 37, 30,
484 3, 4, 4, 34, 42, 4, 34, 42, 24, 43,
485 45, 37, 43, 45, 4, 61, 61, 61, 61, 62,
486 62, 62, 62, 63, 63, 63, 63, 65, 64, 65,
487 65, 66, 57, 56, 66, 67, 55, 67, 67, 68,
488 54, 68, 68, 53, 52, 51, 50, 47, 46, 40,
489 38, 32, 27, 26, 9, 8, 7, 60, 60, 60,
490 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
495 static yy_state_type yy_last_accepting_state;
496 static char *yy_last_accepting_cpos;
498 extern int xbt_ddt_parse__flex_debug;
499 int xbt_ddt_parse__flex_debug = 0;
501 /* The intent behind this definition is that it'll catch
502 * any uses of REJECT which flex missed.
504 #define REJECT reject_used_but_not_detected
505 #define yymore() yymore_used_but_not_detected
506 #define YY_MORE_ADJ 0
507 #define YY_RESTORE_YY_MORE_OFFSET
508 char *xbt_ddt_parse_text;
509 /* datadesc/ddt_parse -- automatic parsing of data structures */
510 /* Copyright (c) 2004 Arnaud Legrand, Martin Quinson. All rights reserved. */
511 /* This program is free software; you can redistribute it and/or modify it
512 * under the terms of the license (GNU LGPL) which comes with this package. */
513 #include "xbt/datadesc/datadesc_private.h"
514 #include "xbt/datadesc/ddt_parse.yy.h"
516 YY_BUFFER_STATE xbt_ddt_input_buffer;
517 FILE *xbt_ddt_file_to_parse;
519 int xbt_ddt_parse_line_pos = 1;
520 int xbt_ddt_parse_col_pos = 0;
521 int xbt_ddt_parse_char_pos = 0;
522 int xbt_ddt_parse_tok_num = 0;
523 const char *definition;
524 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ddt_lexer,xbt_ddt_parse,"The crude internals of the lexer used for type parsing");
525 #define SHOW_WHERE XBT_DEBUG("%d:%d (char #%d): seen '%s'", xbt_ddt_parse_line_pos,xbt_ddt_parse_col_pos,xbt_ddt_parse_char_pos,xbt_ddt_parse_text)
532 #ifndef YY_NO_UNISTD_H
533 /* Special case for "unistd.h", since it is non-ANSI. We include it way
534 * down here because we want the user's section 1 to have been scanned first.
535 * The user has a chance to override it with an option.
540 #ifndef YY_EXTRA_TYPE
541 #define YY_EXTRA_TYPE void *
544 static int yy_init_globals (void );
546 /* Accessor methods to globals.
547 These are made visible to non-reentrant scanners for convenience. */
549 int xbt_ddt_parse_lex_destroy (void );
551 int xbt_ddt_parse_get_debug (void );
553 void xbt_ddt_parse_set_debug (int debug_flag );
555 YY_EXTRA_TYPE xbt_ddt_parse_get_extra (void );
557 void xbt_ddt_parse_set_extra (YY_EXTRA_TYPE user_defined );
559 FILE *xbt_ddt_parse_get_in (void );
561 void xbt_ddt_parse_set_in (FILE * in_str );
563 FILE *xbt_ddt_parse_get_out (void );
565 void xbt_ddt_parse_set_out (FILE * out_str );
567 int xbt_ddt_parse_get_leng (void );
569 char *xbt_ddt_parse_get_text (void );
571 int xbt_ddt_parse_get_lineno (void );
573 void xbt_ddt_parse_set_lineno (int line_number );
575 /* Macros after this point can all be overridden by user definitions in
579 #ifndef YY_SKIP_YYWRAP
581 extern "C" int xbt_ddt_parse_wrap (void );
583 extern int xbt_ddt_parse_wrap (void );
587 static void yyunput (int c,char *buf_ptr );
590 static void yy_flex_strncpy (char *,yyconst char *,int );
593 #ifdef YY_NEED_STRLEN
594 static int yy_flex_strlen (yyconst char * );
600 static int yyinput (void );
602 static int input (void );
607 /* Amount of stuff to slurp up with each read. */
608 #ifndef YY_READ_BUF_SIZE
609 #define YY_READ_BUF_SIZE 8192
612 /* Copy whatever the last rule matched to the standard output. */
614 /* This used to be an fputs(), but since the string might contain NUL's,
615 * we now use fwrite().
617 #define ECHO do { if (fwrite( xbt_ddt_parse_text, xbt_ddt_parse_leng, 1, xbt_ddt_parse_out )) {} } while (0)
620 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
621 * is returned in "result".
624 #define YY_INPUT(buf,result,max_size) \
625 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
629 for ( n = 0; n < max_size && \
630 (c = getc( xbt_ddt_parse_in )) != EOF && c != '\n'; ++n ) \
633 buf[n++] = (char) c; \
634 if ( c == EOF && ferror( xbt_ddt_parse_in ) ) \
635 YY_FATAL_ERROR( "input in flex scanner failed" ); \
641 while ( (result = fread(buf, 1, max_size, xbt_ddt_parse_in))==0 && ferror(xbt_ddt_parse_in)) \
643 if( errno != EINTR) \
645 YY_FATAL_ERROR( "input in flex scanner failed" ); \
649 clearerr(xbt_ddt_parse_in); \
656 /* No semi-colon after return; correct usage is to write "yyterminate();" -
657 * we don't want an extra ';' after the "return" because that will cause
658 * some compilers to complain about unreachable statements.
661 #define yyterminate() return YY_NULL
664 /* Number of entries by which start-condition stack grows. */
665 #ifndef YY_START_STACK_INCR
666 #define YY_START_STACK_INCR 25
669 /* Report a fatal error. */
670 #ifndef YY_FATAL_ERROR
671 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
674 /* end tables serialization structures and prototypes */
676 /* Default declaration of generated scanner - a define so the user can
677 * easily add parameters.
680 #define YY_DECL_IS_OURS 1
682 extern int xbt_ddt_parse_lex (void);
684 #define YY_DECL int xbt_ddt_parse_lex (void)
685 #endif /* !YY_DECL */
687 /* Code executed at the beginning of each rule, after xbt_ddt_parse_text and xbt_ddt_parse_leng
690 #ifndef YY_USER_ACTION
691 #define YY_USER_ACTION
694 /* Code executed at the end of each rule. */
696 #define YY_BREAK break;
699 #define YY_RULE_SETUP \
702 /** The main scanner function which does all the work.
706 register yy_state_type yy_current_state;
707 register char *yy_cp, *yy_bp;
710 int comment_caller=0;
711 int annotate_caller=0;
722 (yy_start) = 1; /* first start state */
724 if ( ! xbt_ddt_parse_in )
725 xbt_ddt_parse_in = stdin;
727 if ( ! xbt_ddt_parse_out )
728 xbt_ddt_parse_out = stdout;
730 if ( ! YY_CURRENT_BUFFER ) {
731 xbt_ddt_parse_ensure_buffer_stack ();
732 YY_CURRENT_BUFFER_LVALUE =
733 xbt_ddt_parse__create_buffer(xbt_ddt_parse_in,YY_BUF_SIZE );
736 xbt_ddt_parse__load_buffer_state( );
739 while ( 1 ) /* loops until end-of-file is reached */
741 yy_cp = (yy_c_buf_p);
743 /* Support of xbt_ddt_parse_text. */
744 *yy_cp = (yy_hold_char);
746 /* yy_bp points to the position in yy_ch_buf of the start of
751 yy_current_state = (yy_start);
755 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
756 if ( yy_accept[yy_current_state] )
758 (yy_last_accepting_state) = yy_current_state;
759 (yy_last_accepting_cpos) = yy_cp;
761 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
763 yy_current_state = (int) yy_def[yy_current_state];
764 if ( yy_current_state >= 61 )
765 yy_c = yy_meta[(unsigned int) yy_c];
767 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
770 while ( yy_base[yy_current_state] != 88 );
773 yy_act = yy_accept[yy_current_state];
775 { /* have to back up */
776 yy_cp = (yy_last_accepting_cpos);
777 yy_current_state = (yy_last_accepting_state);
778 yy_act = yy_accept[yy_current_state];
783 do_action: /* This label is used only to access EOF actions. */
786 { /* beginning of action switch */
787 case 0: /* must back up */
788 /* undo the effects of YY_DO_BEFORE_ACTION */
789 *yy_cp = (yy_hold_char);
790 yy_cp = (yy_last_accepting_cpos);
791 yy_current_state = (yy_last_accepting_state);
800 { /****************** ANNOTATION ************************/
801 XBT_DEBUG("Begin annotation");
802 annotate_caller = INITIAL;
803 xbt_ddt_parse_char_pos+= strlen(xbt_ddt_parse_text);
804 xbt_ddt_parse_col_pos+= strlen(xbt_ddt_parse_text);
810 { /* trim annotation */
811 XBT_DEBUG("Begin annotation");
812 annotate_caller = foo;
813 xbt_ddt_parse_char_pos+= strlen(xbt_ddt_parse_text);
814 xbt_ddt_parse_col_pos+= strlen(xbt_ddt_parse_text);
821 XBT_DEBUG("End annotation");
822 xbt_ddt_parse_char_pos+= strlen(xbt_ddt_parse_text);
823 xbt_ddt_parse_col_pos+= strlen(xbt_ddt_parse_text);
824 BEGIN(annotate_caller);
830 PARSE_ERROR("``/*g'' construct closed by a regular ``*/''");
834 /* rule 6 can match eol */
837 PARSE_ERROR("Type annotation cannot spread over several lines");
843 xbt_ddt_parse_char_pos+= strlen(xbt_ddt_parse_text);
844 xbt_ddt_parse_col_pos+= strlen(xbt_ddt_parse_text);
845 return XBT_DDT_PARSE_TOKEN_ANNOTATE;
850 { /****************** COMMENTS ************************/
851 /* constructs like : */
853 /* are not comments but size annotations */
854 comment_caller = INITIAL;
861 comment_caller = foo;
867 { /* eat anything that's not a '*' */
872 { /* eat up '*'s not followed by '/'s */
876 /* rule 12 can match eol */
879 ++xbt_ddt_parse_line_pos;
880 xbt_ddt_parse_col_pos=0;
881 xbt_ddt_parse_char_pos++;
887 xbt_ddt_parse_char_pos+= strlen(xbt_ddt_parse_text);
888 xbt_ddt_parse_col_pos+= strlen(xbt_ddt_parse_text);
889 BEGIN(comment_caller);
894 { /****************** STATEMENTS ************************/
895 xbt_ddt_parse_char_pos += strlen(xbt_ddt_parse_text);
896 xbt_ddt_parse_col_pos += strlen(xbt_ddt_parse_text);
898 return(XBT_DDT_PARSE_TOKEN_WORD);
904 xbt_ddt_parse_char_pos++;
905 xbt_ddt_parse_col_pos++;
907 return(XBT_DDT_PARSE_TOKEN_LA);
913 xbt_ddt_parse_char_pos++;
914 xbt_ddt_parse_col_pos++;
916 return(XBT_DDT_PARSE_TOKEN_RA);
922 xbt_ddt_parse_char_pos++;
923 xbt_ddt_parse_col_pos++;
925 return(XBT_DDT_PARSE_TOKEN_LB);
931 xbt_ddt_parse_char_pos++;
932 xbt_ddt_parse_col_pos++;
934 return(XBT_DDT_PARSE_TOKEN_RB);
940 xbt_ddt_parse_char_pos++;
941 xbt_ddt_parse_col_pos++;
943 return(XBT_DDT_PARSE_TOKEN_LP);
949 xbt_ddt_parse_char_pos++;
950 xbt_ddt_parse_col_pos++;
952 return(XBT_DDT_PARSE_TOKEN_RP);
958 xbt_ddt_parse_char_pos++;
959 xbt_ddt_parse_col_pos++;
961 return(XBT_DDT_PARSE_TOKEN_STAR);
967 xbt_ddt_parse_char_pos++;
968 xbt_ddt_parse_col_pos++;
970 return(XBT_DDT_PARSE_TOKEN_SEMI_COLON);
976 xbt_ddt_parse_char_pos++;
977 xbt_ddt_parse_col_pos++;
979 return(XBT_DDT_PARSE_TOKEN_COLON);
983 /* rule 24 can match eol */
986 xbt_ddt_parse_line_pos++;
987 xbt_ddt_parse_char_pos++;
988 xbt_ddt_parse_col_pos=0;
995 xbt_ddt_parse_char_pos++;
996 xbt_ddt_parse_col_pos++;
1004 case YY_STATE_EOF(INITIAL):
1005 case YY_STATE_EOF(annotate):
1006 case YY_STATE_EOF(comment):
1007 case YY_STATE_EOF(foo):
1010 case YY_END_OF_BUFFER:
1012 /* Amount of text matched not including the EOB char. */
1013 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1015 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1016 *yy_cp = (yy_hold_char);
1017 YY_RESTORE_YY_MORE_OFFSET
1019 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1021 /* We're scanning a new file or input source. It's
1022 * possible that this happened because the user
1023 * just pointed xbt_ddt_parse_in at a new source and called
1024 * xbt_ddt_parse_lex(). If so, then we have to assure
1025 * consistency between YY_CURRENT_BUFFER and our
1026 * globals. Here is the right place to do so, because
1027 * this is the first action (other than possibly a
1028 * back-up) that will match for the new input source.
1030 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1031 YY_CURRENT_BUFFER_LVALUE->yy_input_file = xbt_ddt_parse_in;
1032 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1035 /* Note that here we test for yy_c_buf_p "<=" to the position
1036 * of the first EOB in the buffer, since yy_c_buf_p will
1037 * already have been incremented past the NUL character
1038 * (since all states make transitions on EOB to the
1039 * end-of-buffer state). Contrast this with the test
1042 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1043 { /* This was really a NUL. */
1044 yy_state_type yy_next_state;
1046 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1048 yy_current_state = yy_get_previous_state( );
1050 /* Okay, we're now positioned to make the NUL
1051 * transition. We couldn't have
1052 * yy_get_previous_state() go ahead and do it
1053 * for us because it doesn't know how to deal
1054 * with the possibility of jamming (and we don't
1055 * want to build jamming into it because then it
1056 * will run more slowly).
1059 yy_next_state = yy_try_NUL_trans( yy_current_state );
1061 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1063 if ( yy_next_state )
1065 /* Consume the NUL. */
1066 yy_cp = ++(yy_c_buf_p);
1067 yy_current_state = yy_next_state;
1073 yy_cp = (yy_c_buf_p);
1074 goto yy_find_action;
1078 else switch ( yy_get_next_buffer( ) )
1080 case EOB_ACT_END_OF_FILE:
1082 (yy_did_buffer_switch_on_eof) = 0;
1084 if ( xbt_ddt_parse_wrap( ) )
1086 /* Note: because we've taken care in
1087 * yy_get_next_buffer() to have set up
1088 * xbt_ddt_parse_text, we can now set up
1089 * yy_c_buf_p so that if some total
1090 * hoser (like flex itself) wants to
1091 * call the scanner after we return the
1092 * YY_NULL, it'll still work - another
1093 * YY_NULL will get returned.
1095 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1097 yy_act = YY_STATE_EOF(YY_START);
1103 if ( ! (yy_did_buffer_switch_on_eof) )
1109 case EOB_ACT_CONTINUE_SCAN:
1111 (yytext_ptr) + yy_amount_of_matched_text;
1113 yy_current_state = yy_get_previous_state( );
1115 yy_cp = (yy_c_buf_p);
1116 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1119 case EOB_ACT_LAST_MATCH:
1121 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1123 yy_current_state = yy_get_previous_state( );
1125 yy_cp = (yy_c_buf_p);
1126 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1127 goto yy_find_action;
1134 "fatal flex scanner internal error--no action found" );
1135 } /* end of action switch */
1136 } /* end of scanning one token */
1137 } /* end of xbt_ddt_parse_lex */
1139 /* yy_get_next_buffer - try to read in a new buffer
1141 * Returns a code representing an action:
1142 * EOB_ACT_LAST_MATCH -
1143 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1144 * EOB_ACT_END_OF_FILE - end of file
1146 static int yy_get_next_buffer (void)
1148 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1149 register char *source = (yytext_ptr);
1150 register int number_to_move, i;
1153 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1155 "fatal flex scanner internal error--end of buffer missed" );
1157 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1158 { /* Don't try to fill the buffer, so this is an EOF. */
1159 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1161 /* We matched a single character, the EOB, so
1162 * treat this as a final EOF.
1164 return EOB_ACT_END_OF_FILE;
1169 /* We matched some text prior to the EOB, first
1172 return EOB_ACT_LAST_MATCH;
1176 /* Try to read more data. */
1178 /* First move last chars to start of buffer. */
1179 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1181 for ( i = 0; i < number_to_move; ++i )
1182 *(dest++) = *(source++);
1184 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1185 /* don't do the read, it's not guaranteed to return an EOF,
1188 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1193 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1195 while ( num_to_read <= 0 )
1196 { /* Not enough room in the buffer - grow it. */
1198 /* just a shorter name for the current buffer */
1199 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1201 int yy_c_buf_p_offset =
1202 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1204 if ( b->yy_is_our_buffer )
1206 int new_size = b->yy_buf_size * 2;
1208 if ( new_size <= 0 )
1209 b->yy_buf_size += b->yy_buf_size / 8;
1211 b->yy_buf_size *= 2;
1213 b->yy_ch_buf = (char *)
1214 /* Include room in for 2 EOB chars. */
1215 xbt_ddt_parse_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1218 /* Can't grow it, we don't own it. */
1221 if ( ! b->yy_ch_buf )
1223 "fatal error - scanner input buffer overflow" );
1225 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1227 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1232 if ( num_to_read > YY_READ_BUF_SIZE )
1233 num_to_read = YY_READ_BUF_SIZE;
1235 /* Read in more data. */
1236 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1237 (yy_n_chars), (size_t) num_to_read );
1239 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1242 if ( (yy_n_chars) == 0 )
1244 if ( number_to_move == YY_MORE_ADJ )
1246 ret_val = EOB_ACT_END_OF_FILE;
1247 xbt_ddt_parse_restart(xbt_ddt_parse_in );
1252 ret_val = EOB_ACT_LAST_MATCH;
1253 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1254 YY_BUFFER_EOF_PENDING;
1259 ret_val = EOB_ACT_CONTINUE_SCAN;
1261 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1262 /* Extend the array by 50%, plus the number we really need. */
1263 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1264 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) xbt_ddt_parse_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1265 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1266 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1269 (yy_n_chars) += number_to_move;
1270 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1271 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1273 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1278 /* yy_get_previous_state - get the state just before the EOB char was reached */
1280 static yy_state_type yy_get_previous_state (void)
1282 register yy_state_type yy_current_state;
1283 register char *yy_cp;
1285 yy_current_state = (yy_start);
1287 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1289 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1290 if ( yy_accept[yy_current_state] )
1292 (yy_last_accepting_state) = yy_current_state;
1293 (yy_last_accepting_cpos) = yy_cp;
1295 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1297 yy_current_state = (int) yy_def[yy_current_state];
1298 if ( yy_current_state >= 61 )
1299 yy_c = yy_meta[(unsigned int) yy_c];
1301 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1304 return yy_current_state;
1307 /* yy_try_NUL_trans - try to make a transition on the NUL character
1310 * next_state = yy_try_NUL_trans( current_state );
1312 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1314 register int yy_is_jam;
1315 register char *yy_cp = (yy_c_buf_p);
1317 register YY_CHAR yy_c = 1;
1318 if ( yy_accept[yy_current_state] )
1320 (yy_last_accepting_state) = yy_current_state;
1321 (yy_last_accepting_cpos) = yy_cp;
1323 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1325 yy_current_state = (int) yy_def[yy_current_state];
1326 if ( yy_current_state >= 61 )
1327 yy_c = yy_meta[(unsigned int) yy_c];
1329 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1330 yy_is_jam = (yy_current_state == 60);
1332 return yy_is_jam ? 0 : yy_current_state;
1335 static void yyunput (int c, register char * yy_bp )
1337 register char *yy_cp;
1339 yy_cp = (yy_c_buf_p);
1341 /* undo effects of setting up xbt_ddt_parse_text */
1342 *yy_cp = (yy_hold_char);
1344 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1345 { /* need to shift things up to make room */
1346 /* +2 for EOB chars. */
1347 register int number_to_move = (yy_n_chars) + 2;
1348 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1349 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1350 register char *source =
1351 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1353 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1354 *--dest = *--source;
1356 yy_cp += (int) (dest - source);
1357 yy_bp += (int) (dest - source);
1358 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1359 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1361 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1362 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1365 *--yy_cp = (char) c;
1367 (yytext_ptr) = yy_bp;
1368 (yy_hold_char) = *yy_cp;
1369 (yy_c_buf_p) = yy_cp;
1374 static int yyinput (void)
1376 static int input (void)
1382 *(yy_c_buf_p) = (yy_hold_char);
1384 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1386 /* yy_c_buf_p now points to the character we want to return.
1387 * If this occurs *before* the EOB characters, then it's a
1388 * valid NUL; if not, then we've hit the end of the buffer.
1390 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1391 /* This was really a NUL. */
1392 *(yy_c_buf_p) = '\0';
1395 { /* need more input */
1396 int offset = (yy_c_buf_p) - (yytext_ptr);
1399 switch ( yy_get_next_buffer( ) )
1401 case EOB_ACT_LAST_MATCH:
1402 /* This happens because yy_g_n_b()
1403 * sees that we've accumulated a
1404 * token and flags that we need to
1405 * try matching the token before
1406 * proceeding. But for input(),
1407 * there's no matching to consider.
1408 * So convert the EOB_ACT_LAST_MATCH
1409 * to EOB_ACT_END_OF_FILE.
1412 /* Reset buffer status. */
1413 xbt_ddt_parse_restart(xbt_ddt_parse_in );
1417 case EOB_ACT_END_OF_FILE:
1419 if ( xbt_ddt_parse_wrap( ) )
1422 if ( ! (yy_did_buffer_switch_on_eof) )
1431 case EOB_ACT_CONTINUE_SCAN:
1432 (yy_c_buf_p) = (yytext_ptr) + offset;
1438 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1439 *(yy_c_buf_p) = '\0'; /* preserve xbt_ddt_parse_text */
1440 (yy_hold_char) = *++(yy_c_buf_p);
1444 #endif /* ifndef YY_NO_INPUT */
1446 /** Immediately switch to a different input stream.
1447 * @param input_file A readable stream.
1449 * @note This function does not reset the start condition to @c INITIAL .
1451 void xbt_ddt_parse_restart (FILE * input_file )
1454 if ( ! YY_CURRENT_BUFFER ){
1455 xbt_ddt_parse_ensure_buffer_stack ();
1456 YY_CURRENT_BUFFER_LVALUE =
1457 xbt_ddt_parse__create_buffer(xbt_ddt_parse_in,YY_BUF_SIZE );
1460 xbt_ddt_parse__init_buffer(YY_CURRENT_BUFFER,input_file );
1461 xbt_ddt_parse__load_buffer_state( );
1464 /** Switch to a different input buffer.
1465 * @param new_buffer The new input buffer.
1468 void xbt_ddt_parse__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1471 /* TODO. We should be able to replace this entire function body
1473 * xbt_ddt_parse_pop_buffer_state();
1474 * xbt_ddt_parse_push_buffer_state(new_buffer);
1476 xbt_ddt_parse_ensure_buffer_stack ();
1477 if ( YY_CURRENT_BUFFER == new_buffer )
1480 if ( YY_CURRENT_BUFFER )
1482 /* Flush out information for old buffer. */
1483 *(yy_c_buf_p) = (yy_hold_char);
1484 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1485 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1488 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1489 xbt_ddt_parse__load_buffer_state( );
1491 /* We don't actually know whether we did this switch during
1492 * EOF (xbt_ddt_parse_wrap()) processing, but the only time this flag
1493 * is looked at is after xbt_ddt_parse_wrap() is called, so it's safe
1494 * to go ahead and always set it.
1496 (yy_did_buffer_switch_on_eof) = 1;
1499 static void xbt_ddt_parse__load_buffer_state (void)
1501 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1502 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1503 xbt_ddt_parse_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1504 (yy_hold_char) = *(yy_c_buf_p);
1507 /** Allocate and initialize an input buffer state.
1508 * @param file A readable stream.
1509 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1511 * @return the allocated buffer state.
1513 YY_BUFFER_STATE xbt_ddt_parse__create_buffer (FILE * file, int size )
1517 b = (YY_BUFFER_STATE) xbt_ddt_parse_alloc(sizeof( struct yy_buffer_state ) );
1519 YY_FATAL_ERROR( "out of dynamic memory in xbt_ddt_parse__create_buffer()" );
1521 b->yy_buf_size = size;
1523 /* yy_ch_buf has to be 2 characters longer than the size given because
1524 * we need to put in 2 end-of-buffer characters.
1526 b->yy_ch_buf = (char *) xbt_ddt_parse_alloc(b->yy_buf_size + 2 );
1527 if ( ! b->yy_ch_buf )
1528 YY_FATAL_ERROR( "out of dynamic memory in xbt_ddt_parse__create_buffer()" );
1530 b->yy_is_our_buffer = 1;
1532 xbt_ddt_parse__init_buffer(b,file );
1537 /** Destroy the buffer.
1538 * @param b a buffer created with xbt_ddt_parse__create_buffer()
1541 void xbt_ddt_parse__delete_buffer (YY_BUFFER_STATE b )
1547 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1548 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1550 if ( b->yy_is_our_buffer )
1551 xbt_ddt_parse_free((void *) b->yy_ch_buf );
1553 xbt_ddt_parse_free((void *) b );
1557 extern int isatty (int );
1558 #endif /* __cplusplus */
1560 /* Initializes or reinitializes a buffer.
1561 * This function is sometimes called more than once on the same buffer,
1562 * such as during a xbt_ddt_parse_restart() or at EOF.
1564 static void xbt_ddt_parse__init_buffer (YY_BUFFER_STATE b, FILE * file )
1569 xbt_ddt_parse__flush_buffer(b );
1571 b->yy_input_file = file;
1572 b->yy_fill_buffer = 1;
1574 /* If b is the current buffer, then xbt_ddt_parse__init_buffer was _probably_
1575 * called from xbt_ddt_parse_restart() or through yy_get_next_buffer.
1576 * In that case, we don't want to reset the lineno or column.
1578 if (b != YY_CURRENT_BUFFER){
1579 b->yy_bs_lineno = 1;
1580 b->yy_bs_column = 0;
1583 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1588 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1589 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1592 void xbt_ddt_parse__flush_buffer (YY_BUFFER_STATE b )
1599 /* We always need two end-of-buffer characters. The first causes
1600 * a transition to the end-of-buffer state. The second causes
1601 * a jam in that state.
1603 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1604 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1606 b->yy_buf_pos = &b->yy_ch_buf[0];
1609 b->yy_buffer_status = YY_BUFFER_NEW;
1611 if ( b == YY_CURRENT_BUFFER )
1612 xbt_ddt_parse__load_buffer_state( );
1615 /** Pushes the new state onto the stack. The new state becomes
1616 * the current state. This function will allocate the stack
1618 * @param new_buffer The new state.
1621 void xbt_ddt_parse_push_buffer_state (YY_BUFFER_STATE new_buffer )
1623 if (new_buffer == NULL)
1626 xbt_ddt_parse_ensure_buffer_stack();
1628 /* This block is copied from xbt_ddt_parse__switch_to_buffer. */
1629 if ( YY_CURRENT_BUFFER )
1631 /* Flush out information for old buffer. */
1632 *(yy_c_buf_p) = (yy_hold_char);
1633 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1634 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1637 /* Only push if top exists. Otherwise, replace top. */
1638 if (YY_CURRENT_BUFFER)
1639 (yy_buffer_stack_top)++;
1640 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1642 /* copied from xbt_ddt_parse__switch_to_buffer. */
1643 xbt_ddt_parse__load_buffer_state( );
1644 (yy_did_buffer_switch_on_eof) = 1;
1647 /** Removes and deletes the top of the stack, if present.
1648 * The next element becomes the new top.
1651 void xbt_ddt_parse_pop_buffer_state (void)
1653 if (!YY_CURRENT_BUFFER)
1656 xbt_ddt_parse__delete_buffer(YY_CURRENT_BUFFER );
1657 YY_CURRENT_BUFFER_LVALUE = NULL;
1658 if ((yy_buffer_stack_top) > 0)
1659 --(yy_buffer_stack_top);
1661 if (YY_CURRENT_BUFFER) {
1662 xbt_ddt_parse__load_buffer_state( );
1663 (yy_did_buffer_switch_on_eof) = 1;
1667 /* Allocates the stack if it does not exist.
1668 * Guarantees space for at least one push.
1670 static void xbt_ddt_parse_ensure_buffer_stack (void)
1674 if (!(yy_buffer_stack)) {
1676 /* First allocation is just for 2 elements, since we don't know if this
1677 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1678 * immediate realloc on the next call.
1681 (yy_buffer_stack) = (struct yy_buffer_state**)xbt_ddt_parse_alloc
1682 (num_to_alloc * sizeof(struct yy_buffer_state*)
1684 if ( ! (yy_buffer_stack) )
1685 YY_FATAL_ERROR( "out of dynamic memory in xbt_ddt_parse_ensure_buffer_stack()" );
1687 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1689 (yy_buffer_stack_max) = num_to_alloc;
1690 (yy_buffer_stack_top) = 0;
1694 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1696 /* Increase the buffer to prepare for a possible push. */
1697 int grow_size = 8 /* arbitrary grow size */;
1699 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1700 (yy_buffer_stack) = (struct yy_buffer_state**)xbt_ddt_parse_realloc
1702 num_to_alloc * sizeof(struct yy_buffer_state*)
1704 if ( ! (yy_buffer_stack) )
1705 YY_FATAL_ERROR( "out of dynamic memory in xbt_ddt_parse_ensure_buffer_stack()" );
1707 /* zero only the new slots.*/
1708 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1709 (yy_buffer_stack_max) = num_to_alloc;
1713 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1714 * @param base the character buffer
1715 * @param size the size in bytes of the character buffer
1717 * @return the newly allocated buffer state object.
1719 YY_BUFFER_STATE xbt_ddt_parse__scan_buffer (char * base, yy_size_t size )
1724 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1725 base[size-1] != YY_END_OF_BUFFER_CHAR )
1726 /* They forgot to leave room for the EOB's. */
1729 b = (YY_BUFFER_STATE) xbt_ddt_parse_alloc(sizeof( struct yy_buffer_state ) );
1731 YY_FATAL_ERROR( "out of dynamic memory in xbt_ddt_parse__scan_buffer()" );
1733 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1734 b->yy_buf_pos = b->yy_ch_buf = base;
1735 b->yy_is_our_buffer = 0;
1736 b->yy_input_file = 0;
1737 b->yy_n_chars = b->yy_buf_size;
1738 b->yy_is_interactive = 0;
1740 b->yy_fill_buffer = 0;
1741 b->yy_buffer_status = YY_BUFFER_NEW;
1743 xbt_ddt_parse__switch_to_buffer(b );
1748 /** Setup the input buffer state to scan a string. The next call to xbt_ddt_parse_lex() will
1749 * scan from a @e copy of @a str.
1750 * @param yystr a NUL-terminated string to scan
1752 * @return the newly allocated buffer state object.
1753 * @note If you want to scan bytes that may contain NUL values, then use
1754 * xbt_ddt_parse__scan_bytes() instead.
1756 YY_BUFFER_STATE xbt_ddt_parse__scan_string (yyconst char * yystr )
1759 return xbt_ddt_parse__scan_bytes(yystr,strlen(yystr) );
1762 /** Setup the input buffer state to scan the given bytes. The next call to xbt_ddt_parse_lex() will
1763 * scan from a @e copy of @a bytes.
1764 * @param bytes the byte buffer to scan
1765 * @param len the number of bytes in the buffer pointed to by @a bytes.
1767 * @return the newly allocated buffer state object.
1769 YY_BUFFER_STATE xbt_ddt_parse__scan_bytes (yyconst char * yybytes, int _yybytes_len )
1776 /* Get memory for full buffer, including space for trailing EOB's. */
1777 n = _yybytes_len + 2;
1778 buf = (char *) xbt_ddt_parse_alloc(n );
1780 YY_FATAL_ERROR( "out of dynamic memory in xbt_ddt_parse__scan_bytes()" );
1782 for ( i = 0; i < _yybytes_len; ++i )
1783 buf[i] = yybytes[i];
1785 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1787 b = xbt_ddt_parse__scan_buffer(buf,n );
1789 YY_FATAL_ERROR( "bad buffer in xbt_ddt_parse__scan_bytes()" );
1791 /* It's okay to grow etc. this buffer, and we should throw it
1792 * away when we're done.
1794 b->yy_is_our_buffer = 1;
1799 #ifndef YY_EXIT_FAILURE
1800 #define YY_EXIT_FAILURE 2
1803 static void yy_fatal_error (yyconst char* msg )
1805 (void) fprintf( stderr, "%s\n", msg );
1806 exit( YY_EXIT_FAILURE );
1809 /* Redefine yyless() so it works in section 3 code. */
1815 /* Undo effects of setting up xbt_ddt_parse_text. */ \
1816 int yyless_macro_arg = (n); \
1817 YY_LESS_LINENO(yyless_macro_arg);\
1818 xbt_ddt_parse_text[xbt_ddt_parse_leng] = (yy_hold_char); \
1819 (yy_c_buf_p) = xbt_ddt_parse_text + yyless_macro_arg; \
1820 (yy_hold_char) = *(yy_c_buf_p); \
1821 *(yy_c_buf_p) = '\0'; \
1822 xbt_ddt_parse_leng = yyless_macro_arg; \
1826 /* Accessor methods (get/set functions) to struct members. */
1828 /** Get the current line number.
1831 int xbt_ddt_parse_get_lineno (void)
1834 return xbt_ddt_parse_lineno;
1837 /** Get the input stream.
1840 FILE *xbt_ddt_parse_get_in (void)
1842 return xbt_ddt_parse_in;
1845 /** Get the output stream.
1848 FILE *xbt_ddt_parse_get_out (void)
1850 return xbt_ddt_parse_out;
1853 /** Get the length of the current token.
1856 int xbt_ddt_parse_get_leng (void)
1858 return xbt_ddt_parse_leng;
1861 /** Get the current token.
1865 char *xbt_ddt_parse_get_text (void)
1867 return xbt_ddt_parse_text;
1870 /** Set the current line number.
1871 * @param line_number
1874 void xbt_ddt_parse_set_lineno (int line_number )
1877 xbt_ddt_parse_lineno = line_number;
1880 /** Set the input stream. This does not discard the current
1882 * @param in_str A readable stream.
1884 * @see xbt_ddt_parse__switch_to_buffer
1886 void xbt_ddt_parse_set_in (FILE * in_str )
1888 xbt_ddt_parse_in = in_str ;
1891 void xbt_ddt_parse_set_out (FILE * out_str )
1893 xbt_ddt_parse_out = out_str ;
1896 int xbt_ddt_parse_get_debug (void)
1898 return xbt_ddt_parse__flex_debug;
1901 void xbt_ddt_parse_set_debug (int bdebug )
1903 xbt_ddt_parse__flex_debug = bdebug ;
1906 static int yy_init_globals (void)
1908 /* Initialization is the same as for the non-reentrant scanner.
1909 * This function is called from xbt_ddt_parse_lex_destroy(), so don't allocate here.
1912 (yy_buffer_stack) = 0;
1913 (yy_buffer_stack_top) = 0;
1914 (yy_buffer_stack_max) = 0;
1915 (yy_c_buf_p) = (char *) 0;
1919 /* Defined in main.c */
1921 xbt_ddt_parse_in = stdin;
1922 xbt_ddt_parse_out = stdout;
1924 xbt_ddt_parse_in = (FILE *) 0;
1925 xbt_ddt_parse_out = (FILE *) 0;
1928 /* For future reference: Set errno on error, since we are called by
1929 * xbt_ddt_parse_lex_init()
1934 /* xbt_ddt_parse_lex_destroy is for both reentrant and non-reentrant scanners. */
1935 int xbt_ddt_parse_lex_destroy (void)
1938 /* Pop the buffer stack, destroying each element. */
1939 while(YY_CURRENT_BUFFER){
1940 xbt_ddt_parse__delete_buffer(YY_CURRENT_BUFFER );
1941 YY_CURRENT_BUFFER_LVALUE = NULL;
1942 xbt_ddt_parse_pop_buffer_state();
1945 /* Destroy the stack itself. */
1946 xbt_ddt_parse_free((yy_buffer_stack) );
1947 (yy_buffer_stack) = NULL;
1949 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1950 * xbt_ddt_parse_lex() is called, initialization will occur. */
1957 * Internal utility routines.
1961 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1964 for ( i = 0; i < n; ++i )
1969 #ifdef YY_NEED_STRLEN
1970 static int yy_flex_strlen (yyconst char * s )
1973 for ( n = 0; s[n]; ++n )
1980 void *xbt_ddt_parse_alloc (yy_size_t size )
1982 return (void *) malloc( size );
1985 void *xbt_ddt_parse_realloc (void * ptr, yy_size_t size )
1987 /* The cast to (char *) in the following accommodates both
1988 * implementations that use char* generic pointers, and those
1989 * that use void* generic pointers. It works with the latter
1990 * because both ANSI C and C++ allow castless assignment from
1991 * any pointer type to void*, and deal with argument conversions
1992 * as though doing an assignment.
1994 return (void *) realloc( (char *) ptr, size );
1997 void xbt_ddt_parse_free (void * ptr )
1999 free( (char *) ptr ); /* see xbt_ddt_parse_realloc() for (char *) cast */
2002 #define YYTABLES_NAME "yytables"
2004 /* {space}+ { return(TOKEN_SPACE);} */
2006 void xbt_ddt_parse_dump(void) {
2007 switch(xbt_ddt_parse_tok_num) {
2008 case XBT_DDT_PARSE_TOKEN_LA : {printf("TOKEN_LA ");break;}
2009 case XBT_DDT_PARSE_TOKEN_RA : {printf("TOKEN_RA ");break;}
2010 case XBT_DDT_PARSE_TOKEN_WORD : {printf("TOKEN_WORD ");break;}
2011 /* case XBT_DDT_PARSE_TOKEN_SPACE : {printf("TOKEN_SPACE ");break;}*/
2012 /* case XBT_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}*/
2013 case XBT_DDT_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;}
2014 case XBT_DDT_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;}
2015 default : {printf("Unknown token %d\n", xbt_ddt_parse_tok_num);return;}
2017 printf("-->%s<-- [line %d, pos %d]\n",xbt_ddt_parse_text,xbt_ddt_parse_line_pos,xbt_ddt_parse_char_pos);
2021 int xbt_ddt_parse_lex_n_dump(void) {
2022 xbt_ddt_parse_tok_num = xbt_ddt_parse_lex();
2023 /* xbt_ddt_parse_char_pos += strlen(xbt_ddt_parse_text);*/
2024 return(xbt_ddt_parse_tok_num);
2027 void xbt_ddt_parse_pointer_init(const char *file) {
2028 xbt_ddt_file_to_parse = fopen(file,"r");
2029 xbt_ddt_input_buffer = xbt_ddt_parse__create_buffer(xbt_ddt_file_to_parse,10 );
2030 xbt_ddt_parse__switch_to_buffer(xbt_ddt_input_buffer);
2032 xbt_ddt_parse_line_pos = 1;
2033 xbt_ddt_parse_char_pos = 0;
2034 xbt_ddt_parse_col_pos = 0;
2035 xbt_ddt_parse_tok_num = 0;
2038 void xbt_ddt_parse_pointer_close(void) {
2039 xbt_ddt_parse__delete_buffer(xbt_ddt_input_buffer);
2040 fclose(xbt_ddt_file_to_parse);
2042 xbt_ddt_parse_line_pos = 1;
2043 xbt_ddt_parse_char_pos = 0;
2044 xbt_ddt_parse_tok_num = 0;
2047 void xbt_ddt_parse_pointer_string_init(const char *string_to_parse) {
2048 xbt_ddt_input_buffer = xbt_ddt_parse__scan_string (string_to_parse);
2049 definition = string_to_parse;
2050 xbt_ddt_parse__switch_to_buffer(xbt_ddt_input_buffer);
2052 xbt_ddt_parse_line_pos = 1;
2053 xbt_ddt_parse_char_pos = 0;
2054 xbt_ddt_parse_tok_num = 0;
2057 void xbt_ddt_parse_pointer_string_close(void) {
2058 xbt_ddt_parse__delete_buffer(xbt_ddt_input_buffer);
2060 xbt_ddt_parse_line_pos = 1;
2061 xbt_ddt_parse_char_pos = 0;
2062 xbt_ddt_parse_tok_num = 0;
2065 yyunput('\0',NULL); /* fake a use of this function to calm gcc down */
2068 /* Local variables:*/