X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2b1ea50ce582ef6c9cf41de8a9707669677b7a26..3c7b741ce2f591d3f8ebfd44aaa136d99e06fae8:/src/gras/DataDesc/ddt_parse.yy.c diff --git a/src/gras/DataDesc/ddt_parse.yy.c b/src/gras/DataDesc/ddt_parse.yy.c index b7662f2e35..acb8213ea3 100644 --- a/src/gras/DataDesc/ddt_parse.yy.c +++ b/src/gras/DataDesc/ddt_parse.yy.c @@ -1,15 +1,33 @@ -#line 2 "DataDesc/ddt_parse.yy.c" -#line 4 "DataDesc/ddt_parse.yy.c" +#line 3 "src/gras/DataDesc/ddt_parse.yy.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ +#define yy_create_buffer gras_ddt_parse__create_buffer +#define yy_delete_buffer gras_ddt_parse__delete_buffer +#define yy_flex_debug gras_ddt_parse__flex_debug +#define yy_init_buffer gras_ddt_parse__init_buffer +#define yy_flush_buffer gras_ddt_parse__flush_buffer +#define yy_load_buffer_state gras_ddt_parse__load_buffer_state +#define yy_switch_to_buffer gras_ddt_parse__switch_to_buffer +#define yyin gras_ddt_parse_in +#define yyleng gras_ddt_parse_leng +#define yylex gras_ddt_parse_lex +#define yylineno gras_ddt_parse_lineno +#define yyout gras_ddt_parse_out +#define yyrestart gras_ddt_parse_restart +#define yytext gras_ddt_parse_text +#define yywrap gras_ddt_parse_wrap +#define yyalloc gras_ddt_parse_alloc +#define yyrealloc gras_ddt_parse_realloc +#define yyfree gras_ddt_parse_free + #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 31 +#define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -31,7 +49,15 @@ /* C99 systems have . Non-C99 systems may or may not. */ -#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; @@ -46,7 +72,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -77,6 +102,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -86,11 +113,12 @@ typedef unsigned int flex_uint32_t; #else /* ! __cplusplus */ -#if __STDC__ +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) #define YY_USE_CONST -#endif /* __STDC__ */ +#endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST @@ -132,9 +160,21 @@ typedef unsigned int flex_uint32_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; @@ -166,14 +206,9 @@ extern FILE *gras_ddt_parse_in, *gras_ddt_parse_out; #define unput(c) yyunput( c, (yytext_ptr) ) -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ - #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T -typedef unsigned int yy_size_t; +typedef size_t yy_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -268,7 +303,7 @@ int gras_ddt_parse_leng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ +static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow gras_ddt_parse_wrap()'s to do buffer switches @@ -355,8 +390,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 30 -#define YY_END_OF_BUFFER 31 +#define YY_NUM_RULES 26 +#define YY_END_OF_BUFFER 27 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -364,32 +399,32 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[53] = +static yyconst flex_int16_t yy_accept[61] = { 0, - 20, 20, 4, 4, 0, 0, 0, 0, 31, 29, - 28, 8, 25, 27, 20, 29, 26, 23, 24, 21, - 22, 4, 6, 5, 30, 30, 19, 10, 9, 30, - 20, 2, 1, 4, 5, 5, 7, 3, 19, 18, - 11, 12, 16, 17, 13, 15, 14, 1, 11, 12, - 11, 0 + 14, 14, 7, 7, 10, 10, 0, 0, 27, 25, + 24, 19, 20, 21, 23, 14, 25, 22, 17, 18, + 15, 16, 7, 7, 6, 7, 7, 10, 12, 11, + 26, 26, 14, 0, 1, 7, 7, 7, 5, 7, + 10, 11, 11, 13, 0, 0, 2, 1, 4, 0, + 3, 0, 2, 0, 3, 0, 0, 8, 9, 0 } ; static yyconst flex_int32_t yy_ec[256] = { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, - 1, 4, 1, 5, 6, 6, 7, 8, 8, 8, - 8, 8, 8, 8, 8, 9, 9, 1, 10, 1, - 1, 1, 1, 1, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 11, 12, 13, 1, 6, 1, 6, 14, 6, 6, - - 6, 15, 6, 6, 6, 6, 6, 6, 6, 16, - 6, 6, 6, 17, 6, 18, 6, 6, 6, 6, - 6, 6, 19, 1, 20, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 4, + 5, 6, 1, 7, 8, 8, 9, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 1, 11, 1, + 1, 1, 1, 1, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 12, 1, 13, 14, 8, 1, 8, 8, 8, 8, + + 8, 8, 15, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 16, 1, 17, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -406,66 +441,64 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[21] = +static yyconst flex_int32_t yy_meta[18] = { 0, - 1, 2, 3, 4, 1, 5, 1, 5, 5, 1, - 1, 3, 1, 5, 5, 5, 5, 5, 1, 1 + 1, 1, 2, 1, 1, 3, 1, 4, 1, 4, + 1, 1, 1, 1, 4, 1, 1 } ; -static yyconst flex_int16_t yy_base[62] = +static yyconst flex_int16_t yy_base[69] = { 0, - 0, 0, 19, 20, 76, 71, 23, 25, 75, 97, - 97, 97, 97, 97, 0, 25, 97, 97, 97, 97, - 97, 0, 97, 26, 97, 69, 0, 97, 97, 30, - 0, 97, 0, 0, 27, 36, 97, 97, 0, 97, - 33, 41, 97, 97, 97, 97, 97, 0, 43, 45, - 47, 97, 56, 61, 66, 31, 71, 76, 81, 86, - 91 + 0, 0, 16, 30, 17, 18, 78, 77, 85, 88, + 88, 88, 88, 88, 88, 0, 19, 88, 88, 88, + 88, 88, 0, 24, 88, 75, 77, 0, 88, 21, + 88, 76, 0, 22, 0, 0, 27, 75, 0, 71, + 0, 29, 34, 88, 29, 65, 76, 0, 0, 63, + 74, 60, 72, 56, 65, 51, 50, 88, 88, 88, + 45, 49, 53, 55, 57, 61, 65, 69 } ; -static yyconst flex_int16_t yy_def[62] = +static yyconst flex_int16_t yy_def[69] = { 0, - 52, 1, 53, 53, 54, 54, 55, 55, 52, 52, - 52, 52, 52, 52, 56, 52, 52, 52, 52, 52, - 52, 57, 52, 58, 52, 52, 59, 52, 52, 60, - 56, 52, 61, 57, 58, 58, 52, 52, 59, 52, - 52, 52, 52, 52, 52, 52, 52, 61, 52, 52, - 52, 0, 52, 52, 52, 52, 52, 52, 52, 52, - 52 + 60, 1, 61, 61, 62, 62, 63, 63, 60, 60, + 60, 60, 60, 60, 60, 64, 60, 60, 60, 60, + 60, 60, 65, 65, 60, 65, 65, 66, 60, 67, + 60, 60, 64, 60, 68, 65, 65, 65, 65, 65, + 66, 67, 67, 60, 60, 60, 60, 68, 65, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 0, + 60, 60, 60, 60, 60, 60, 60, 60 } ; -static yyconst flex_int16_t yy_nxt[118] = +static yyconst flex_int16_t yy_nxt[106] = { 0, - 10, 11, 12, 13, 14, 15, 16, 15, 15, 17, - 18, 10, 19, 15, 15, 15, 15, 15, 20, 21, - 23, 23, 24, 24, 28, 29, 28, 29, 32, 36, - 52, 33, 37, 52, 30, 31, 30, 41, 42, 36, - 49, 50, 37, 43, 44, 45, 46, 47, 50, 50, - 51, 50, 50, 50, 50, 50, 22, 22, 22, 22, - 22, 25, 25, 25, 25, 25, 27, 27, 27, 27, - 27, 34, 38, 34, 52, 34, 35, 26, 35, 35, - 35, 39, 26, 52, 39, 39, 40, 40, 40, 40, - 40, 48, 52, 48, 48, 48, 9, 52, 52, 52, - - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 52, 52, 52, 52, 52, 52 + 10, 10, 11, 12, 13, 14, 15, 16, 17, 16, + 18, 19, 20, 10, 16, 21, 22, 24, 25, 29, + 29, 26, 30, 30, 34, 37, 43, 35, 37, 44, + 27, 24, 25, 46, 60, 26, 47, 60, 38, 43, + 50, 38, 44, 51, 27, 23, 23, 23, 23, 28, + 28, 28, 28, 31, 31, 31, 31, 36, 33, 36, + 36, 41, 59, 58, 41, 42, 55, 42, 42, 48, + 57, 48, 48, 53, 56, 55, 54, 53, 52, 49, + 40, 45, 40, 39, 60, 32, 32, 9, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + + 60, 60, 60, 60, 60 } ; -static yyconst flex_int16_t yy_chk[118] = +static yyconst flex_int16_t yy_chk[106] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 4, 3, 4, 7, 7, 8, 8, 16, 24, - 35, 16, 24, 35, 7, 56, 8, 30, 30, 36, - 41, 41, 36, 30, 30, 30, 30, 30, 42, 42, - 49, 49, 50, 50, 51, 51, 53, 53, 53, 53, - 53, 54, 54, 54, 54, 54, 55, 55, 55, 55, - 55, 57, 26, 57, 9, 57, 58, 6, 58, 58, - 58, 59, 5, 0, 59, 59, 60, 60, 60, 60, - 60, 61, 0, 61, 61, 61, 52, 52, 52, 52, - - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 52, 52, 52, 52, 52, 52 + 1, 1, 1, 1, 1, 1, 1, 3, 3, 5, + 6, 3, 5, 6, 17, 24, 30, 17, 37, 30, + 3, 4, 4, 34, 42, 4, 34, 42, 24, 43, + 45, 37, 43, 45, 4, 61, 61, 61, 61, 62, + 62, 62, 62, 63, 63, 63, 63, 65, 64, 65, + 65, 66, 57, 56, 66, 67, 55, 67, 67, 68, + 54, 68, 68, 53, 52, 51, 50, 47, 46, 40, + 38, 32, 27, 26, 9, 8, 7, 60, 60, 60, + 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, + + 60, 60, 60, 60, 60 } ; static yy_state_type yy_last_accepting_state; @@ -482,33 +515,28 @@ int gras_ddt_parse__flex_debug = 0; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *gras_ddt_parse_text; -#line 1 "DataDesc/ddt_parse.yy.l" -/* $Id$ */ /* DataDesc/ddt_parse -- automatic parsing of data structures */ -/* Authors: Arnaud Legrand, Martin Quinson */ -/* Copyright (C) 2003, 2004 Martin Quinson. */ +/* Copyright (c) 2004 Arnaud Legrand, Martin Quinson. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it - under the terms of the license (GNU LGPL) which comes with this package. */ -#line 13 "DataDesc/ddt_parse.yy.l" -#include"DataDesc/datadesc_private.h" -#include"DataDesc/ddt_parse.yy.h" + * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "gras/DataDesc/datadesc_private.h" +#include "gras/DataDesc/ddt_parse.yy.h" #include - YY_BUFFER_STATE input_buffer; - FILE *file_to_parse; + YY_BUFFER_STATE gras_ddt_input_buffer; + FILE *gras_ddt_file_to_parse; int gras_ddt_parse_line_pos = 1; int gras_ddt_parse_col_pos = 0; int gras_ddt_parse_char_pos = 0; int gras_ddt_parse_tok_num = 0; - GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(lexer,parse); -#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) - -#line 507 "DataDesc/ddt_parse.yy.c" + const char *definition; + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(gras_ddt_lexer,gras_ddt_parse,"The crude internals of the lexer used for type parsing"); +#define SHOW_WHERE XBT_DEBUG("%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) #define INITIAL 0 -#define comment 1 -#define foo 2 -#define str 3 +#define annotate 1 +#define comment 2 +#define foo 3 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way @@ -522,6 +550,37 @@ char *gras_ddt_parse_text; #define YY_EXTRA_TYPE void * #endif +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int gras_ddt_parse_lex_destroy (void ); + +int gras_ddt_parse_get_debug (void ); + +void gras_ddt_parse_set_debug (int debug_flag ); + +YY_EXTRA_TYPE gras_ddt_parse_get_extra (void ); + +void gras_ddt_parse_set_extra (YY_EXTRA_TYPE user_defined ); + +FILE *gras_ddt_parse_get_in (void ); + +void gras_ddt_parse_set_in (FILE * in_str ); + +FILE *gras_ddt_parse_get_out (void ); + +void gras_ddt_parse_set_out (FILE * out_str ); + +int gras_ddt_parse_get_leng (void ); + +char *gras_ddt_parse_get_text (void ); + +int gras_ddt_parse_get_lineno (void ); + +void gras_ddt_parse_set_lineno (int line_number ); + /* Macros after this point can all be overridden by user definitions in * section 1. */ @@ -556,7 +615,12 @@ static int input (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -564,7 +628,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( gras_ddt_parse_text, gras_ddt_parse_leng, 1, gras_ddt_parse_out ) +#define ECHO do { if (fwrite( gras_ddt_parse_text, gras_ddt_parse_leng, 1, gras_ddt_parse_out )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -657,18 +721,12 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 32 "DataDesc/ddt_parse.yy.l" - - int comment_caller=0; - - char string_buf[GRAS_DDT_PARSE_MAX_STR_CONST]; - char *string_buf_ptr = NULL; - -#line 668 "DataDesc/ddt_parse.yy.c" + int comment_caller=0; + int annotate_caller=0; - if ( (yy_init) ) + if ( !(yy_init) ) { - (yy_init) = 0; + (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; @@ -717,13 +775,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 53 ) + if ( yy_current_state >= 61 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 97 ); + while ( yy_base[yy_current_state] != 88 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -749,229 +807,167 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 38 "DataDesc/ddt_parse.yy.l" YY_BREAK case 2: YY_RULE_SETUP -#line 39 "DataDesc/ddt_parse.yy.l" -{ - comment_caller = INITIAL; - BEGIN(comment); - } +{ /****************** ANNOTATION ************************/ + XBT_DEBUG("Begin annotation"); + annotate_caller = INITIAL; + gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text); + gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text); + BEGIN(annotate); +} YY_BREAK case 3: YY_RULE_SETUP -#line 44 "DataDesc/ddt_parse.yy.l" -{ - comment_caller = foo; - BEGIN(comment); - } +{ /* trim annotation */ + XBT_DEBUG("Begin annotation"); + annotate_caller = foo; + gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text); + gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text); + BEGIN(annotate); +} YY_BREAK case 4: YY_RULE_SETUP -#line 49 "DataDesc/ddt_parse.yy.l" -/* eat anything that's not a '*' */ +{ + XBT_DEBUG("End annotation"); + gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text); + gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text); + BEGIN(annotate_caller); +} YY_BREAK case 5: YY_RULE_SETUP -#line 50 "DataDesc/ddt_parse.yy.l" -/* eat up '*'s not followed by '/'s */ +{ + PARSE_ERROR("``/*g'' construct closed by a regular ``*/''"); +} YY_BREAK case 6: /* rule 6 can match eol */ YY_RULE_SETUP -#line 51 "DataDesc/ddt_parse.yy.l" { - ++gras_ddt_parse_line_pos; - gras_ddt_parse_col_pos=0; - gras_ddt_parse_char_pos++; + PARSE_ERROR("Type annotation cannot spread over several lines"); } YY_BREAK case 7: YY_RULE_SETUP -#line 56 "DataDesc/ddt_parse.yy.l" -BEGIN(comment_caller); +{ /* eat the rest */ + gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text); + gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text); + return GRAS_DDT_PARSE_TOKEN_ANNOTATE; +} YY_BREAK case 8: YY_RULE_SETUP -#line 58 "DataDesc/ddt_parse.yy.l" -string_buf_ptr = string_buf; gras_ddt_parse_char_pos++;gras_ddt_parse_col_pos++; BEGIN(str); +{ /****************** COMMENTS ************************/ + /* constructs like : */ + /*g [string] g*/ + /* are not comments but size annotations */ + comment_caller = INITIAL; + BEGIN(comment); +} YY_BREAK case 9: YY_RULE_SETUP -#line 60 "DataDesc/ddt_parse.yy.l" -{ /* saw closing quote - all done */ - BEGIN(INITIAL); - *string_buf_ptr = '\0'; - gras_ddt_parse_text=string_buf; - gras_ddt_parse_char_pos++; - gras_ddt_parse_col_pos++; - return GRAS_DDT_PARSE_TOKEN_WORD; - /* return string constant token type and - * value to parser - */ - } +{ + comment_caller = foo; + BEGIN(comment); +} YY_BREAK case 10: -/* rule 10 can match eol */ YY_RULE_SETUP -#line 72 "DataDesc/ddt_parse.yy.l" -{ - /* error - unterminated string constant */ - /* generate error message */ - } +{ /* eat anything that's not a '*' */ +} YY_BREAK case 11: YY_RULE_SETUP -#line 77 "DataDesc/ddt_parse.yy.l" -{ - /* octal escape sequence */ - int result; - - (void) sscanf( gras_ddt_parse_text + 1, "%o", &result ); - - if ( result > 0xff ) - /* error, constant is out-of-bounds */ - - *string_buf_ptr++ = result; - gras_ddt_parse_char_pos++; - gras_ddt_parse_col_pos++; - } +{ /* eat up '*'s not followed by '/'s */ +} YY_BREAK case 12: +/* rule 12 can match eol */ YY_RULE_SETUP -#line 91 "DataDesc/ddt_parse.yy.l" { - /* generate error - bad escape sequence; something - * like '\48' or '\0777777' - */ - } + ++gras_ddt_parse_line_pos; + gras_ddt_parse_col_pos=0; + gras_ddt_parse_char_pos++; +} YY_BREAK case 13: YY_RULE_SETUP -#line 97 "DataDesc/ddt_parse.yy.l" { - *string_buf_ptr++ = '\n'; - gras_ddt_parse_char_pos++; - gras_ddt_parse_col_pos++; + gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text); + gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text); + BEGIN(comment_caller); } YY_BREAK case 14: YY_RULE_SETUP -#line 102 "DataDesc/ddt_parse.yy.l" -{ - *string_buf_ptr++ = '\t'; - gras_ddt_parse_char_pos++; - gras_ddt_parse_col_pos++; +{ /****************** STATEMENTS ************************/ + gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text); + gras_ddt_parse_col_pos += strlen(gras_ddt_parse_text); + SHOW_WHERE; + return(GRAS_DDT_PARSE_TOKEN_WORD); } YY_BREAK case 15: YY_RULE_SETUP -#line 107 "DataDesc/ddt_parse.yy.l" -{ - *string_buf_ptr++ = '\r'; - gras_ddt_parse_char_pos++; - gras_ddt_parse_col_pos++; +{ + gras_ddt_parse_char_pos++; + gras_ddt_parse_col_pos++; + SHOW_WHERE; + return(GRAS_DDT_PARSE_TOKEN_LA); } YY_BREAK case 16: YY_RULE_SETUP -#line 112 "DataDesc/ddt_parse.yy.l" { - *string_buf_ptr++ = '\b'; gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; + SHOW_WHERE; + return(GRAS_DDT_PARSE_TOKEN_RA); } YY_BREAK case 17: YY_RULE_SETUP -#line 117 "DataDesc/ddt_parse.yy.l" -{ - *string_buf_ptr++ = '\f'; - gras_ddt_parse_char_pos++; - gras_ddt_parse_col_pos++; -} - YY_BREAK -case 18: -/* rule 18 can match eol */ -YY_RULE_SETUP -#line 123 "DataDesc/ddt_parse.yy.l" -{ - *string_buf_ptr++ = gras_ddt_parse_text[1]; - if(gras_ddt_parse_text[1]=='\n') { - ++gras_ddt_parse_line_pos; - gras_ddt_parse_col_pos=0; - } else { - gras_ddt_parse_col_pos++; - } - gras_ddt_parse_char_pos++; -} - YY_BREAK -case 19: -YY_RULE_SETUP -#line 134 "DataDesc/ddt_parse.yy.l" -{ - char *yptr = gras_ddt_parse_text; - - while ( *yptr ) - *string_buf_ptr++ = *yptr++; - gras_ddt_parse_char_pos++; - gras_ddt_parse_col_pos++; -} - YY_BREAK -case 20: -YY_RULE_SETUP -#line 143 "DataDesc/ddt_parse.yy.l" -{ - gras_ddt_parse_char_pos+= strlen(gras_ddt_parse_text); - gras_ddt_parse_col_pos+= strlen(gras_ddt_parse_text); - return(GRAS_DDT_PARSE_TOKEN_WORD); -} - YY_BREAK -case 21: -YY_RULE_SETUP -#line 148 "DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; SHOW_WHERE; - return(GRAS_DDT_PARSE_TOKEN_LP); + return(GRAS_DDT_PARSE_TOKEN_LB); } YY_BREAK -case 22: +case 18: YY_RULE_SETUP -#line 154 "DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; SHOW_WHERE; - return(GRAS_DDT_PARSE_TOKEN_RP); + return(GRAS_DDT_PARSE_TOKEN_RB); } YY_BREAK -case 23: +case 19: YY_RULE_SETUP -#line 160 "DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; SHOW_WHERE; - return(GRAS_DDT_PARSE_TOKEN_LB); + return(GRAS_DDT_PARSE_TOKEN_LP); } YY_BREAK -case 24: +case 20: YY_RULE_SETUP -#line 166 "DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; SHOW_WHERE; - return(GRAS_DDT_PARSE_TOKEN_RB); + return(GRAS_DDT_PARSE_TOKEN_RP); } YY_BREAK -case 25: +case 21: YY_RULE_SETUP -#line 172 "DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; @@ -979,9 +975,8 @@ YY_RULE_SETUP return(GRAS_DDT_PARSE_TOKEN_STAR); } YY_BREAK -case 26: +case 22: YY_RULE_SETUP -#line 178 "DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; @@ -989,9 +984,8 @@ YY_RULE_SETUP return(GRAS_DDT_PARSE_TOKEN_SEMI_COLON); } YY_BREAK -case 27: +case 23: YY_RULE_SETUP -#line 184 "DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; @@ -999,10 +993,9 @@ YY_RULE_SETUP return(GRAS_DDT_PARSE_TOKEN_COLON); } YY_BREAK -case 28: -/* rule 28 can match eol */ +case 24: +/* rule 24 can match eol */ YY_RULE_SETUP -#line 190 "DataDesc/ddt_parse.yy.l" { gras_ddt_parse_line_pos++; gras_ddt_parse_char_pos++; @@ -1010,25 +1003,22 @@ YY_RULE_SETUP SHOW_WHERE; } YY_BREAK -case 29: +case 25: YY_RULE_SETUP -#line 196 "DataDesc/ddt_parse.yy.l" { gras_ddt_parse_char_pos++; gras_ddt_parse_col_pos++; SHOW_WHERE; } YY_BREAK -case 30: +case 26: YY_RULE_SETUP -#line 201 "DataDesc/ddt_parse.yy.l" ECHO; YY_BREAK -#line 1028 "DataDesc/ddt_parse.yy.c" case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(annotate): case YY_STATE_EOF(comment): case YY_STATE_EOF(foo): -case YY_STATE_EOF(str): yyterminate(); case YY_END_OF_BUFFER: @@ -1213,7 +1203,7 @@ static int yy_get_next_buffer (void) else { - size_t num_to_read = + int num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -1258,7 +1248,7 @@ static int yy_get_next_buffer (void) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); + (yy_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } @@ -1282,6 +1272,14 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) gras_ddt_parse_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + (yy_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; @@ -1311,7 +1309,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 53 ) + if ( yy_current_state >= 61 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1339,11 +1337,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 53 ) + if ( yy_current_state >= 61 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 52); + yy_is_jam = (yy_current_state == 60); return yy_is_jam ? 0 : yy_current_state; } @@ -1697,7 +1695,9 @@ static void gras_ddt_parse_ensure_buffer_stack (void) (yy_buffer_stack) = (struct yy_buffer_state**)gras_ddt_parse_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); - + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse_ensure_buffer_stack()" ); + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); (yy_buffer_stack_max) = num_to_alloc; @@ -1715,6 +1715,8 @@ static void gras_ddt_parse_ensure_buffer_stack (void) ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse_ensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -1759,26 +1761,26 @@ YY_BUFFER_STATE gras_ddt_parse__scan_buffer (char * base, yy_size_t size ) /** Setup the input buffer state to scan a string. The next call to gras_ddt_parse_lex() will * scan from a @e copy of @a str. - * @param str a NUL-terminated string to scan + * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * gras_ddt_parse__scan_bytes() instead. */ -YY_BUFFER_STATE gras_ddt_parse__scan_string (yyconst char * yy_str ) +YY_BUFFER_STATE gras_ddt_parse__scan_string (yyconst char * yystr ) { - return gras_ddt_parse__scan_bytes(yy_str,strlen(yy_str) ); + return gras_ddt_parse__scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to gras_ddt_parse_lex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE gras_ddt_parse__scan_bytes (yyconst char * bytes, int len ) +YY_BUFFER_STATE gras_ddt_parse__scan_bytes (yyconst char * yybytes, int _yybytes_len ) { YY_BUFFER_STATE b; char *buf; @@ -1786,15 +1788,15 @@ YY_BUFFER_STATE gras_ddt_parse__scan_bytes (yyconst char * bytes, int len ) int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; + n = _yybytes_len + 2; buf = (char *) gras_ddt_parse_alloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in gras_ddt_parse__scan_bytes()" ); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; b = gras_ddt_parse__scan_buffer(buf,n ); if ( ! b ) @@ -1915,6 +1917,34 @@ void gras_ddt_parse_set_debug (int bdebug ) gras_ddt_parse__flex_debug = bdebug ; } +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from gras_ddt_parse_lex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + gras_ddt_parse_in = stdin; + gras_ddt_parse_out = stdout; +#else + gras_ddt_parse_in = (FILE *) 0; + gras_ddt_parse_out = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * gras_ddt_parse_lex_init() + */ + return 0; +} + /* gras_ddt_parse_lex_destroy is for both reentrant and non-reentrant scanners. */ int gras_ddt_parse_lex_destroy (void) { @@ -1930,6 +1960,10 @@ int gras_ddt_parse_lex_destroy (void) gras_ddt_parse_free((yy_buffer_stack) ); (yy_buffer_stack) = NULL; + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * gras_ddt_parse_lex() is called, initialization will occur. */ + yy_init_globals( ); + return 0; } @@ -1941,7 +1975,7 @@ int gras_ddt_parse_lex_destroy (void) static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { register int i; - for ( i = 0; i < n; ++i ) + for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif @@ -1950,7 +1984,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) static int yy_flex_strlen (yyconst char * s ) { register int n; - for ( n = 0; s[n]; ++n ) + for ( n = 0; s[n]; ++n ) ; return n; @@ -1981,30 +2015,15 @@ void gras_ddt_parse_free (void * ptr ) #define YYTABLES_NAME "yytables" -#undef YY_NEW_FILE -#undef YY_FLUSH_BUFFER -#undef yy_set_bol -#undef yy_new_buffer -#undef yy_set_interactive -#undef yytext_ptr -#undef YY_DO_BEFORE_ACTION - -#ifdef YY_DECL_IS_OURS -#undef YY_DECL_IS_OURS -#undef YY_DECL -#endif -#line 201 "DataDesc/ddt_parse.yy.l" - - /* {space}+ { return(TOKEN_SPACE);} */ void gras_ddt_parse_dump(void) { switch(gras_ddt_parse_tok_num) { - case GRAS_DDT_PARSE_TOKEN_LP : {printf("TOKEN_LP ");break;} - case GRAS_DDT_PARSE_TOKEN_RP : {printf("TOKEN_RP ");break;} + case GRAS_DDT_PARSE_TOKEN_LA : {printf("TOKEN_LA ");break;} + case GRAS_DDT_PARSE_TOKEN_RA : {printf("TOKEN_RA ");break;} case GRAS_DDT_PARSE_TOKEN_WORD : {printf("TOKEN_WORD ");break;} - // case GRAS_DDT_PARSE_TOKEN_SPACE : {printf("TOKEN_SPACE ");break;} - // case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;} + /* case GRAS_DDT_PARSE_TOKEN_SPACE : {printf("TOKEN_SPACE ");break;}*/ + /* case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}*/ case GRAS_DDT_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;} case GRAS_DDT_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;} default : {printf("Unknown token %d\n", gras_ddt_parse_tok_num);return;} @@ -2015,14 +2034,14 @@ void gras_ddt_parse_dump(void) { int gras_ddt_parse_lex_n_dump(void) { gras_ddt_parse_tok_num = gras_ddt_parse_lex(); - // gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text); + /* gras_ddt_parse_char_pos += strlen(gras_ddt_parse_text);*/ return(gras_ddt_parse_tok_num); } void gras_ddt_parse_pointer_init(const char *file) { - file_to_parse = fopen(file,"r"); - input_buffer = gras_ddt_parse__create_buffer(file_to_parse,10 ); - gras_ddt_parse__switch_to_buffer(input_buffer); + gras_ddt_file_to_parse = fopen(file,"r"); + gras_ddt_input_buffer = gras_ddt_parse__create_buffer(gras_ddt_file_to_parse,10 ); + gras_ddt_parse__switch_to_buffer(gras_ddt_input_buffer); gras_ddt_parse_line_pos = 1; gras_ddt_parse_char_pos = 0; @@ -2031,18 +2050,18 @@ void gras_ddt_parse_pointer_init(const char *file) { } void gras_ddt_parse_pointer_close(void) { - gras_ddt_parse__delete_buffer(input_buffer); - fclose(file_to_parse); + gras_ddt_parse__delete_buffer(gras_ddt_input_buffer); + fclose(gras_ddt_file_to_parse); gras_ddt_parse_line_pos = 1; gras_ddt_parse_char_pos = 0; gras_ddt_parse_tok_num = 0; } - void gras_ddt_parse_pointer_string_init(const char *string_to_parse) { - input_buffer = gras_ddt_parse__scan_string (string_to_parse); - gras_ddt_parse__switch_to_buffer(input_buffer); + gras_ddt_input_buffer = gras_ddt_parse__scan_string (string_to_parse); + definition = string_to_parse; + gras_ddt_parse__switch_to_buffer(gras_ddt_input_buffer); gras_ddt_parse_line_pos = 1; gras_ddt_parse_char_pos = 0; @@ -2050,14 +2069,17 @@ void gras_ddt_parse_pointer_string_init(const char *string_to_parse) { } void gras_ddt_parse_pointer_string_close(void) { - gras_ddt_parse__delete_buffer(input_buffer); + gras_ddt_parse__delete_buffer(gras_ddt_input_buffer); gras_ddt_parse_line_pos = 1; gras_ddt_parse_char_pos = 0; gras_ddt_parse_tok_num = 0; + + if (0) + yyunput('\0',NULL); /* fake a use of this function to calm gcc down */ } -// Local variables: -// mode: c -// End: +/* Local variables:*/ +/* mode: c */ +/* End: */