diff options
Diffstat (limited to 'lib/sl/slc-lex.c')
| -rw-r--r-- | lib/sl/slc-lex.c | 226 | 
1 files changed, 108 insertions, 118 deletions
diff --git a/lib/sl/slc-lex.c b/lib/sl/slc-lex.c index d89b39c1f03b..7bba1531a13d 100644 --- a/lib/sl/slc-lex.c +++ b/lib/sl/slc-lex.c @@ -8,7 +8,7 @@  #define FLEX_SCANNER  #define YY_FLEX_MAJOR_VERSION 2  #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 33 +#define YY_FLEX_SUBMINOR_VERSION 35  #if YY_FLEX_SUBMINOR_VERSION > 0  #define FLEX_BETA  #endif @@ -30,7 +30,7 @@  /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ -#if __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.  @@ -93,11 +93,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 @@ -151,7 +152,12 @@ typedef unsigned int flex_uint32_t;  typedef struct yy_buffer_state *YY_BUFFER_STATE;  #endif -extern int yyleng; +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern yy_size_t yyleng;  extern FILE *yyin, *yyout; @@ -177,16 +183,6 @@ extern FILE *yyin, *yyout;  #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; -#endif -  #ifndef YY_STRUCT_YY_BUFFER_STATE  #define YY_STRUCT_YY_BUFFER_STATE  struct yy_buffer_state @@ -204,7 +200,7 @@ struct yy_buffer_state  	/* Number of characters read into yy_ch_buf, not including EOB  	 * characters.  	 */ -	int yy_n_chars; +	yy_size_t yy_n_chars;  	/* Whether we "own" the buffer - i.e., we know we created it,  	 * and can realloc() it to grow it, and should free() it to @@ -274,8 +270,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */  /* yy_hold_char holds the character lost when yytext is formed. */  static char yy_hold_char; -static int yy_n_chars;		/* number of characters read into yy_ch_buf */ -int yyleng; +static yy_size_t yy_n_chars;		/* number of characters read into yy_ch_buf */ +yy_size_t yyleng;  /* Points to current character in buffer. */  static char *yy_c_buf_p = (char *) 0; @@ -303,7 +299,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );  YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );  YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len  ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len  );  void *yyalloc (yy_size_t  );  void *yyrealloc (void *,yy_size_t  ); @@ -458,39 +454,39 @@ char *yytext;  #line 1 "slc-lex.l"  #line 2 "slc-lex.l"  /* - * Copyright (c) 2004 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden).  - * All rights reserved.  + * Copyright (c) 2004 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved.   * - * Redistribution and use in source and binary forms, with or without  - * modification, are permitted provided that the following conditions  - * are met:  + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met:   * - * 1. Redistributions of source code must retain the above copyright  - *    notice, this list of conditions and the following disclaimer.  + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions and the following disclaimer.   * - * 2. Redistributions in binary form must reproduce the above copyright  - *    notice, this list of conditions and the following disclaimer in the  - *    documentation and/or other materials provided with the distribution.  + * 2. Redistributions in binary form must reproduce the above copyright + *    notice, this list of conditions and the following disclaimer in the + *    documentation and/or other materials provided with the distribution.   * - * 3. Neither the name of the Institute nor the names of its contributors  - *    may be used to endorse or promote products derived from this software  - *    without specific prior written permission.  + * 3. Neither the name of the Institute nor the names of its contributors + *    may be used to endorse or promote products derived from this software + *    without specific prior written permission.   * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND  - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE  - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE  - * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE  - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL  - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS  - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)  - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT  - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY  - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF  - * SUCH DAMAGE.  + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE.   */ -/* $Id: slc-lex.l 15118 2005-05-10 22:19:01Z lha $ */ +/* $Id$ */  #undef ECHO @@ -509,7 +505,7 @@ static char * handle_string(void);  #undef ECHO -#line 513 "slc-lex.c" +#line 509 "slc-lex.c"  #define INITIAL 0 @@ -527,6 +523,35 @@ static char * handle_string(void);  static int yy_init_globals (void ); +/* Accessor methods to globals. +   These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag  ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined  ); + +FILE *yyget_in (void ); + +void yyset_in  (FILE * in_str  ); + +FILE *yyget_out (void ); + +void yyset_out  (FILE * out_str  ); + +yy_size_t yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number  ); +  /* Macros after this point can all be overridden by user definitions in   * section 1.   */ @@ -539,8 +564,6 @@ extern int yywrap (void );  #endif  #endif -    static void yyunput (int c,char *buf_ptr  ); -      #ifndef yytext_ptr  static void yy_flex_strncpy (char *,yyconst char *,int );  #endif @@ -569,7 +592,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( yytext, yyleng, 1, yyout ) +#define ECHO fwrite( yytext, yyleng, 1, yyout )  #endif  /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL, @@ -580,7 +603,7 @@ static int input (void );  	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \  		{ \  		int c = '*'; \ -		size_t n; \ +		yy_size_t n; \  		for ( n = 0; n < max_size && \  			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \  			buf[n] = (char) c; \ @@ -662,9 +685,9 @@ YY_DECL  	register char *yy_cp, *yy_bp;  	register int yy_act; -#line 55 "slc-lex.l" +#line 58 "slc-lex.l" -#line 668 "slc-lex.c" +#line 691 "slc-lex.c"  	if ( !(yy_init) )  		{ @@ -749,7 +772,7 @@ do_action:	/* This label is used only to access EOF actions. */  case 1:  YY_RULE_SETUP -#line 56 "slc-lex.l" +#line 59 "slc-lex.l"  {  			  yylval.string = strdup ((const char *)yytext);  			  return LITERAL; @@ -757,36 +780,36 @@ YY_RULE_SETUP  	YY_BREAK  case 2:  YY_RULE_SETUP -#line 60 "slc-lex.l" +#line 63 "slc-lex.l"  { yylval.string = handle_string(); return STRING; }  	YY_BREAK  case 3:  /* rule 3 can match eol */  YY_RULE_SETUP -#line 61 "slc-lex.l" +#line 64 "slc-lex.l"  { ++lineno; }  	YY_BREAK  case 4:  YY_RULE_SETUP -#line 62 "slc-lex.l" +#line 65 "slc-lex.l"  { handle_comment(); }  	YY_BREAK  case 5:  YY_RULE_SETUP -#line 63 "slc-lex.l" +#line 66 "slc-lex.l"  { return *yytext; }  	YY_BREAK  case 6:  YY_RULE_SETUP -#line 64 "slc-lex.l" +#line 67 "slc-lex.l"  ;  	YY_BREAK  case 7:  YY_RULE_SETUP -#line 65 "slc-lex.l" +#line 68 "slc-lex.l"  ECHO;  	YY_BREAK -#line 790 "slc-lex.c" +#line 813 "slc-lex.c"  case YY_STATE_EOF(INITIAL):  	yyterminate(); @@ -972,7 +995,7 @@ static int yy_get_next_buffer (void)  	else  		{ -			int num_to_read = +			yy_size_t num_to_read =  			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;  		while ( num_to_read <= 0 ) @@ -986,7 +1009,7 @@ static int yy_get_next_buffer (void)  			if ( b->yy_is_our_buffer )  				{ -				int new_size = b->yy_buf_size * 2; +				yy_size_t new_size = b->yy_buf_size * 2;  				if ( new_size <= 0 )  					b->yy_buf_size += b->yy_buf_size / 8; @@ -1041,6 +1064,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 *) yyrealloc((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; @@ -1107,43 +1138,6 @@ static int yy_get_next_buffer (void)  	return yy_is_jam ? 0 : yy_current_state;  } -    static void yyunput (int c, register char * yy_bp ) -{ -	register char *yy_cp; -     -    yy_cp = (yy_c_buf_p); - -	/* undo effects of setting up yytext */ -	*yy_cp = (yy_hold_char); - -	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) -		{ /* need to shift things up to make room */ -		/* +2 for EOB chars. */ -		register int number_to_move = (yy_n_chars) + 2; -		register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ -					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; -		register char *source = -				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - -		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) -			*--dest = *--source; - -		yy_cp += (int) (dest - source); -		yy_bp += (int) (dest - source); -		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = -			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - -		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) -			YY_FATAL_ERROR( "flex scanner push-back overflow" ); -		} - -	*--yy_cp = (char) c; - -	(yytext_ptr) = yy_bp; -	(yy_hold_char) = *yy_cp; -	(yy_c_buf_p) = yy_cp; -} -  #ifndef YY_NO_INPUT  #ifdef __cplusplus      static int yyinput (void) @@ -1168,7 +1162,7 @@ static int yy_get_next_buffer (void)  		else  			{ /* need more input */ -			int offset = (yy_c_buf_p) - (yytext_ptr); +			yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);  			++(yy_c_buf_p);  			switch ( yy_get_next_buffer(  ) ) @@ -1444,7 +1438,7 @@ void yypop_buffer_state (void)   */  static void yyensure_buffer_stack (void)  { -	int num_to_alloc; +	yy_size_t num_to_alloc;  	if (!(yy_buffer_stack)) { @@ -1456,7 +1450,9 @@ static void yyensure_buffer_stack (void)  		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc  								(num_to_alloc * sizeof(struct yy_buffer_state*)  								); -		 +		if ( ! (yy_buffer_stack) ) +			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); +								    		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));  		(yy_buffer_stack_max) = num_to_alloc; @@ -1474,6 +1470,8 @@ static void yyensure_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 yyensure_buffer_stack()" );  		/* zero only the new slots.*/  		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -1518,7 +1516,7 @@ YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )  /** Setup the input buffer state to scan a string. The next call to yylex() 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 @@ -1537,12 +1535,11 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )   *    * @return the newly allocated buffer state object.   */ -YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len ) +YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )  {  	YY_BUFFER_STATE b;  	char *buf; -	yy_size_t n; -	int i; +	yy_size_t n, i;  	/* Get memory for full buffer, including space for trailing EOB's. */  	n = _yybytes_len + 2; @@ -1624,7 +1621,7 @@ FILE *yyget_out  (void)  /** Get the length of the current token.   *    */ -int yyget_leng  (void) +yy_size_t yyget_leng  (void)  {          return yyleng;  } @@ -1772,7 +1769,7 @@ void yyfree (void * ptr )  #define YYTABLES_NAME "yytables" -#line 65 "slc-lex.l" +#line 68 "slc-lex.l" @@ -1812,19 +1809,12 @@ handle_comment(void)  	    }  	    seen_slash = 1;  	    continue; -	} -	if(seen_star && c == '/') { -	    if(--level == 0) -		return; -	    seen_star = 0; -	    continue; -	} -	if(c == '*') { +	} else if(c == '*') {  	    if(seen_slash) {  		level++;  		seen_star = seen_slash = 0;  		continue; -	    }  +	    }  	    seen_star = 1;  	    continue;  	} @@ -1870,7 +1860,7 @@ handle_string(void)  }  int -yywrap ()  +yywrap ()  {       return 1;  }  | 
