cmListFileLexer: Update to flex 2.6
Revise the documented modifications we need to make to the flex-generated source file according to the needs of the new version. Update our own implementation to avoid warnings with flex types.
This commit is contained in:
parent
7d2a0aa76c
commit
e4a92dab3f
|
@ -1,2 +1,5 @@
|
|||
# Preserve upstream indentation style.
|
||||
cm_sha2.* whitespace=indent-with-non-tab
|
||||
|
||||
# Preserve indentation style in generated code.
|
||||
cmListFileLexer.c whitespace=-tab-in-indent,-indent-with-non-tab
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#define FLEX_SCANNER
|
||||
#define YY_FLEX_MAJOR_VERSION 2
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
#define YY_FLEX_SUBMINOR_VERSION 35
|
||||
#define YY_FLEX_MINOR_VERSION 6
|
||||
#define YY_FLEX_SUBMINOR_VERSION 0
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
|
@ -179,6 +179,11 @@ typedef void* yyscan_t;
|
|||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
#define EOB_ACT_CONTINUE_SCAN 0
|
||||
#define EOB_ACT_END_OF_FILE 1
|
||||
#define EOB_ACT_LAST_MATCH 2
|
||||
|
@ -197,6 +202,13 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
|||
if ( yytext[yyl] == '\n' )\
|
||||
--yylineno;\
|
||||
}while(0)
|
||||
#define YY_LINENO_REWIND_TO(dst) \
|
||||
do {\
|
||||
const char *p;\
|
||||
for ( p = yy_cp-1; p >= (dst); --p)\
|
||||
if ( *p == '\n' )\
|
||||
--yylineno;\
|
||||
}while(0)
|
||||
|
||||
/* Return all but the first "n" matched characters back to the input stream. */
|
||||
#define yyless(n) \
|
||||
|
@ -212,10 +224,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
|||
} \
|
||||
while ( 0 )
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
|
||||
|
||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
||||
#define YY_STRUCT_YY_BUFFER_STATE
|
||||
|
@ -313,7 +322,7 @@ static void cmListFileLexer_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan
|
|||
|
||||
YY_BUFFER_STATE cmListFileLexer_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
|
||||
YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
|
||||
YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
|
||||
YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
|
||||
|
||||
void *cmListFileLexer_yyalloc (yy_size_t ,yyscan_t yyscanner );
|
||||
void *cmListFileLexer_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
|
||||
|
@ -345,7 +354,7 @@ void cmListFileLexer_yyfree (void * ,yyscan_t yyscanner );
|
|||
|
||||
/* Begin user sect3 */
|
||||
|
||||
#define cmListFileLexer_yywrap(n) 1
|
||||
#define cmListFileLexer_yywrap(yyscanner) (/*CONSTCOND*/1)
|
||||
#define YY_SKIP_YYWRAP
|
||||
|
||||
typedef unsigned char YY_CHAR;
|
||||
|
@ -357,6 +366,9 @@ typedef int yy_state_type;
|
|||
static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
|
||||
static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
|
||||
static int yy_get_next_buffer (yyscan_t yyscanner );
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||
__attribute__((__noreturn__))
|
||||
#endif
|
||||
static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
|
||||
|
||||
/* Done after the current pattern has been matched and before the
|
||||
|
@ -390,7 +402,7 @@ static yyconst flex_int16_t yy_accept[77] =
|
|||
0, 0, 0, 0, 0, 0
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_ec[256] =
|
||||
static yyconst YY_CHAR yy_ec[256] =
|
||||
{ 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
|
||||
1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
|
||||
|
@ -422,13 +434,13 @@ static yyconst flex_int32_t yy_ec[256] =
|
|||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_meta[16] =
|
||||
static yyconst YY_CHAR yy_meta[16] =
|
||||
{ 0,
|
||||
1, 1, 2, 3, 4, 3, 1, 3, 5, 6,
|
||||
1, 6, 1, 1, 7
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_base[95] =
|
||||
static yyconst flex_uint16_t yy_base[95] =
|
||||
{ 0,
|
||||
0, 0, 13, 25, 14, 16, 17, 18, 90, 88,
|
||||
88, 39, 20, 237, 237, 74, 78, 237, 237, 13,
|
||||
|
@ -458,7 +470,7 @@ static yyconst flex_int16_t yy_def[95] =
|
|||
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_nxt[253] =
|
||||
static yyconst flex_uint16_t yy_nxt[253] =
|
||||
{ 0,
|
||||
12, 13, 14, 13, 15, 16, 17, 18, 19, 12,
|
||||
12, 20, 21, 22, 12, 24, 28, 25, 28, 28,
|
||||
|
@ -552,19 +564,16 @@ static yyconst flex_int32_t yy_rule_can_match_eol[25] =
|
|||
|
||||
This file must be translated to C and modified to build everywhere.
|
||||
|
||||
Run flex like this:
|
||||
Run flex >= 2.6 like this:
|
||||
|
||||
flex --prefix=cmListFileLexer_yy -ocmListFileLexer.c cmListFileLexer.in.l
|
||||
|
||||
Modify cmListFileLexer.c:
|
||||
- remove TABs
|
||||
- remove use of the 'register' storage class specifier
|
||||
- remove the yyunput function
|
||||
- add a statement "(void)yyscanner;" to the top of these methods:
|
||||
yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
|
||||
- remove trailing whitespace: sed -i 's/\s*$//' cmListFileLexer.c
|
||||
- remove blank lines at end of file
|
||||
- remove statement "yyscanner = NULL;" from cmListFileLexer_yylex_destroy
|
||||
- remove all YY_BREAK lines occurring right after return statements
|
||||
- remove the isatty forward declaration
|
||||
- remove unnecessary cast to (int) in yy_get_next_buffer
|
||||
|
||||
*/
|
||||
|
||||
|
@ -583,7 +592,7 @@ Modify cmListFileLexer.c:
|
|||
struct cmListFileLexer_s
|
||||
{
|
||||
cmListFileLexer_Token token;
|
||||
int bracket;
|
||||
yy_size_t bracket;
|
||||
int comment;
|
||||
int line;
|
||||
int column;
|
||||
|
@ -649,7 +658,7 @@ struct yyguts_t
|
|||
YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
|
||||
char yy_hold_char;
|
||||
int yy_n_chars;
|
||||
int yyleng_r;
|
||||
yy_size_t yyleng_r;
|
||||
char *yy_c_buf_p;
|
||||
int yy_init;
|
||||
int yy_start;
|
||||
|
@ -690,23 +699,23 @@ void cmListFileLexer_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner
|
|||
|
||||
FILE *cmListFileLexer_yyget_in (yyscan_t yyscanner );
|
||||
|
||||
void cmListFileLexer_yyset_in (FILE * in_str ,yyscan_t yyscanner );
|
||||
void cmListFileLexer_yyset_in (FILE * _in_str ,yyscan_t yyscanner );
|
||||
|
||||
FILE *cmListFileLexer_yyget_out (yyscan_t yyscanner );
|
||||
|
||||
void cmListFileLexer_yyset_out (FILE * out_str ,yyscan_t yyscanner );
|
||||
void cmListFileLexer_yyset_out (FILE * _out_str ,yyscan_t yyscanner );
|
||||
|
||||
int cmListFileLexer_yyget_leng (yyscan_t yyscanner );
|
||||
yy_size_t cmListFileLexer_yyget_leng (yyscan_t yyscanner );
|
||||
|
||||
char *cmListFileLexer_yyget_text (yyscan_t yyscanner );
|
||||
|
||||
int cmListFileLexer_yyget_lineno (yyscan_t yyscanner );
|
||||
|
||||
void cmListFileLexer_yyset_lineno (int line_number ,yyscan_t yyscanner );
|
||||
void cmListFileLexer_yyset_lineno (int _line_number ,yyscan_t yyscanner );
|
||||
|
||||
int cmListFileLexer_yyget_column (yyscan_t yyscanner );
|
||||
|
||||
void cmListFileLexer_yyset_column (int column_no ,yyscan_t yyscanner );
|
||||
void cmListFileLexer_yyset_column (int _column_no ,yyscan_t yyscanner );
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
|
@ -720,6 +729,12 @@ extern int cmListFileLexer_yywrap (yyscan_t yyscanner );
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_UNPUT
|
||||
|
||||
static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
|
||||
#endif
|
||||
|
@ -832,7 +847,7 @@ extern int cmListFileLexer_yylex (yyscan_t yyscanner);
|
|||
|
||||
/* Code executed at the end of each rule. */
|
||||
#ifndef YY_BREAK
|
||||
#define YY_BREAK break;
|
||||
#define YY_BREAK /*LINTED*/break;
|
||||
#endif
|
||||
|
||||
#define YY_RULE_SETUP \
|
||||
|
@ -847,11 +862,6 @@ YY_DECL
|
|||
int yy_act;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
#line 91 "cmListFileLexer.in.l"
|
||||
|
||||
|
||||
#line 865 "cmListFileLexer.c"
|
||||
|
||||
if ( !yyg->yy_init )
|
||||
{
|
||||
yyg->yy_init = 1;
|
||||
|
@ -878,7 +888,13 @@ YY_DECL
|
|||
cmListFileLexer_yy_load_buffer_state(yyscanner );
|
||||
}
|
||||
|
||||
while ( 1 ) /* loops until end-of-file is reached */
|
||||
{
|
||||
#line 88 "cmListFileLexer.in.l"
|
||||
|
||||
|
||||
#line 896 "cmListFileLexer.c"
|
||||
|
||||
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
|
||||
{
|
||||
yy_cp = yyg->yy_c_buf_p;
|
||||
|
||||
|
@ -924,7 +940,7 @@ yy_find_action:
|
|||
|
||||
if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
|
||||
{
|
||||
int yyl;
|
||||
yy_size_t yyl;
|
||||
for ( yyl = 0; yyl < yyleng; ++yyl )
|
||||
if ( yytext[yyl] == '\n' )
|
||||
|
||||
|
@ -948,7 +964,7 @@ do_action: /* This label is used only to access EOF actions. */
|
|||
case 1:
|
||||
/* rule 1 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 93 "cmListFileLexer.in.l"
|
||||
#line 90 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->token.type = cmListFileLexer_Token_Newline;
|
||||
cmListFileLexerSetToken(lexer, yytext, yyleng);
|
||||
|
@ -960,7 +976,7 @@ YY_RULE_SETUP
|
|||
case 2:
|
||||
/* rule 2 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 102 "cmListFileLexer.in.l"
|
||||
#line 99 "cmListFileLexer.in.l"
|
||||
{
|
||||
const char* bracket = yytext;
|
||||
lexer->comment = yytext[0] == '#';
|
||||
|
@ -974,7 +990,7 @@ YY_RULE_SETUP
|
|||
lexer->token.type = cmListFileLexer_Token_ArgumentBracket;
|
||||
}
|
||||
cmListFileLexerSetToken(lexer, "", 0);
|
||||
lexer->bracket = (int)(strchr(bracket+1, '[') - bracket);
|
||||
lexer->bracket = strchr(bracket+1, '[') - bracket;
|
||||
if(yytext[yyleng-1] == '\n')
|
||||
{
|
||||
++lexer->line;
|
||||
|
@ -989,7 +1005,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 128 "cmListFileLexer.in.l"
|
||||
#line 125 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->column += yyleng;
|
||||
BEGIN(COMMENT);
|
||||
|
@ -997,14 +1013,14 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 133 "cmListFileLexer.in.l"
|
||||
#line 130 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->column += yyleng;
|
||||
}
|
||||
YY_BREAK
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 137 "cmListFileLexer.in.l"
|
||||
#line 134 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->token.type = cmListFileLexer_Token_ParenLeft;
|
||||
cmListFileLexerSetToken(lexer, yytext, yyleng);
|
||||
|
@ -1013,7 +1029,7 @@ YY_RULE_SETUP
|
|||
}
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 144 "cmListFileLexer.in.l"
|
||||
#line 141 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->token.type = cmListFileLexer_Token_ParenRight;
|
||||
cmListFileLexerSetToken(lexer, yytext, yyleng);
|
||||
|
@ -1022,7 +1038,7 @@ YY_RULE_SETUP
|
|||
}
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 151 "cmListFileLexer.in.l"
|
||||
#line 148 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->token.type = cmListFileLexer_Token_Identifier;
|
||||
cmListFileLexerSetToken(lexer, yytext, yyleng);
|
||||
|
@ -1031,7 +1047,7 @@ YY_RULE_SETUP
|
|||
}
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 158 "cmListFileLexer.in.l"
|
||||
#line 155 "cmListFileLexer.in.l"
|
||||
{
|
||||
/* Handle ]]====]=======]*/
|
||||
cmListFileLexerAppend(lexer, yytext, yyleng);
|
||||
|
@ -1044,7 +1060,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 168 "cmListFileLexer.in.l"
|
||||
#line 165 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->column += yyleng;
|
||||
/* Erase the partial bracket from the token. */
|
||||
|
@ -1055,7 +1071,7 @@ YY_RULE_SETUP
|
|||
}
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 177 "cmListFileLexer.in.l"
|
||||
#line 174 "cmListFileLexer.in.l"
|
||||
{
|
||||
cmListFileLexerAppend(lexer, yytext, yyleng);
|
||||
lexer->column += yyleng;
|
||||
|
@ -1064,7 +1080,7 @@ YY_RULE_SETUP
|
|||
case 11:
|
||||
/* rule 11 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 182 "cmListFileLexer.in.l"
|
||||
#line 179 "cmListFileLexer.in.l"
|
||||
{
|
||||
cmListFileLexerAppend(lexer, yytext, yyleng);
|
||||
++lexer->line;
|
||||
|
@ -1074,7 +1090,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 189 "cmListFileLexer.in.l"
|
||||
#line 186 "cmListFileLexer.in.l"
|
||||
{
|
||||
cmListFileLexerAppend(lexer, yytext, yyleng);
|
||||
lexer->column += yyleng;
|
||||
|
@ -1083,7 +1099,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case YY_STATE_EOF(BRACKET):
|
||||
case YY_STATE_EOF(BRACKETEND):
|
||||
#line 195 "cmListFileLexer.in.l"
|
||||
#line 192 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->token.type = cmListFileLexer_Token_BadBracket;
|
||||
BEGIN(INITIAL);
|
||||
|
@ -1091,7 +1107,7 @@ case YY_STATE_EOF(BRACKETEND):
|
|||
}
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 201 "cmListFileLexer.in.l"
|
||||
#line 198 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
|
||||
cmListFileLexerSetToken(lexer, yytext, yyleng);
|
||||
|
@ -1100,7 +1116,7 @@ YY_RULE_SETUP
|
|||
}
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 208 "cmListFileLexer.in.l"
|
||||
#line 205 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
|
||||
cmListFileLexerSetToken(lexer, yytext, yyleng);
|
||||
|
@ -1109,7 +1125,7 @@ YY_RULE_SETUP
|
|||
}
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
#line 215 "cmListFileLexer.in.l"
|
||||
#line 212 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
|
||||
cmListFileLexerSetToken(lexer, yytext, yyleng);
|
||||
|
@ -1118,7 +1134,7 @@ YY_RULE_SETUP
|
|||
}
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 222 "cmListFileLexer.in.l"
|
||||
#line 219 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
|
||||
cmListFileLexerSetToken(lexer, "", 0);
|
||||
|
@ -1128,7 +1144,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 229 "cmListFileLexer.in.l"
|
||||
#line 226 "cmListFileLexer.in.l"
|
||||
{
|
||||
cmListFileLexerAppend(lexer, yytext, yyleng);
|
||||
lexer->column += yyleng;
|
||||
|
@ -1137,7 +1153,7 @@ YY_RULE_SETUP
|
|||
case 18:
|
||||
/* rule 18 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 234 "cmListFileLexer.in.l"
|
||||
#line 231 "cmListFileLexer.in.l"
|
||||
{
|
||||
/* Continuation: text is not part of string */
|
||||
++lexer->line;
|
||||
|
@ -1147,7 +1163,7 @@ YY_RULE_SETUP
|
|||
case 19:
|
||||
/* rule 19 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 240 "cmListFileLexer.in.l"
|
||||
#line 237 "cmListFileLexer.in.l"
|
||||
{
|
||||
cmListFileLexerAppend(lexer, yytext, yyleng);
|
||||
++lexer->line;
|
||||
|
@ -1156,7 +1172,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 20:
|
||||
YY_RULE_SETUP
|
||||
#line 246 "cmListFileLexer.in.l"
|
||||
#line 243 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->column += yyleng;
|
||||
BEGIN(INITIAL);
|
||||
|
@ -1164,14 +1180,14 @@ YY_RULE_SETUP
|
|||
}
|
||||
case 21:
|
||||
YY_RULE_SETUP
|
||||
#line 252 "cmListFileLexer.in.l"
|
||||
#line 249 "cmListFileLexer.in.l"
|
||||
{
|
||||
cmListFileLexerAppend(lexer, yytext, yyleng);
|
||||
lexer->column += yyleng;
|
||||
}
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(STRING):
|
||||
#line 257 "cmListFileLexer.in.l"
|
||||
#line 254 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->token.type = cmListFileLexer_Token_BadString;
|
||||
BEGIN(INITIAL);
|
||||
|
@ -1179,7 +1195,7 @@ case YY_STATE_EOF(STRING):
|
|||
}
|
||||
case 22:
|
||||
YY_RULE_SETUP
|
||||
#line 263 "cmListFileLexer.in.l"
|
||||
#line 260 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->token.type = cmListFileLexer_Token_Space;
|
||||
cmListFileLexerSetToken(lexer, yytext, yyleng);
|
||||
|
@ -1188,7 +1204,7 @@ YY_RULE_SETUP
|
|||
}
|
||||
case 23:
|
||||
YY_RULE_SETUP
|
||||
#line 270 "cmListFileLexer.in.l"
|
||||
#line 267 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->token.type = cmListFileLexer_Token_BadCharacter;
|
||||
cmListFileLexerSetToken(lexer, yytext, yyleng);
|
||||
|
@ -1197,7 +1213,7 @@ YY_RULE_SETUP
|
|||
}
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(COMMENT):
|
||||
#line 277 "cmListFileLexer.in.l"
|
||||
#line 274 "cmListFileLexer.in.l"
|
||||
{
|
||||
lexer->token.type = cmListFileLexer_Token_None;
|
||||
cmListFileLexerSetToken(lexer, 0, 0);
|
||||
|
@ -1205,10 +1221,10 @@ case YY_STATE_EOF(COMMENT):
|
|||
}
|
||||
case 24:
|
||||
YY_RULE_SETUP
|
||||
#line 283 "cmListFileLexer.in.l"
|
||||
#line 280 "cmListFileLexer.in.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 1238 "cmListFileLexer.c"
|
||||
#line 1242 "cmListFileLexer.c"
|
||||
|
||||
case YY_END_OF_BUFFER:
|
||||
{
|
||||
|
@ -1337,6 +1353,7 @@ ECHO;
|
|||
"fatal flex scanner internal error--no action found" );
|
||||
} /* end of action switch */
|
||||
} /* end of scanning one token */
|
||||
} /* end of user's declarations */
|
||||
} /* end of cmListFileLexer_yylex */
|
||||
|
||||
/* yy_get_next_buffer - try to read in a new buffer
|
||||
|
@ -1351,7 +1368,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
|
||||
char *source = yyg->yytext_ptr;
|
||||
int number_to_move, i;
|
||||
yy_size_t number_to_move, i;
|
||||
int ret_val;
|
||||
|
||||
if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
|
||||
|
@ -1380,7 +1397,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
/* Try to read more data. */
|
||||
|
||||
/* First move last chars to start of buffer. */
|
||||
number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
|
||||
number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
|
||||
|
||||
for ( i = 0; i < number_to_move; ++i )
|
||||
*(dest++) = *(source++);
|
||||
|
@ -1393,21 +1410,21 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
|
||||
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 )
|
||||
{ /* Not enough room in the buffer - grow it. */
|
||||
|
||||
/* just a shorter name for the current buffer */
|
||||
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
|
||||
YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
|
||||
|
||||
int yy_c_buf_p_offset =
|
||||
(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
|
||||
|
||||
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;
|
||||
|
@ -1438,7 +1455,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
|
||||
/* Read in more data. */
|
||||
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
|
||||
yyg->yy_n_chars, (size_t) num_to_read );
|
||||
yyg->yy_n_chars, num_to_read );
|
||||
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
|
||||
}
|
||||
|
@ -1462,9 +1479,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
else
|
||||
ret_val = EOB_ACT_CONTINUE_SCAN;
|
||||
|
||||
if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
|
||||
if ((yyg->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 = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
|
||||
int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) cmListFileLexer_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
|
||||
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
|
||||
|
@ -1535,9 +1552,56 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
yy_is_jam = (yy_current_state == 76);
|
||||
|
||||
(void)yyg;
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
|
||||
#ifndef YY_NO_UNPUT
|
||||
|
||||
static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)
|
||||
{
|
||||
char *yy_cp;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
yy_cp = yyg->yy_c_buf_p;
|
||||
|
||||
/* undo effects of setting up yytext */
|
||||
*yy_cp = yyg->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. */
|
||||
yy_size_t number_to_move = yyg->yy_n_chars + 2;
|
||||
char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
|
||||
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 =
|
||||
yyg->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;
|
||||
|
||||
if ( c == '\n' ){
|
||||
--yylineno;
|
||||
}
|
||||
|
||||
yyg->yytext_ptr = yy_bp;
|
||||
yyg->yy_hold_char = *yy_cp;
|
||||
yyg->yy_c_buf_p = yy_cp;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_INPUT
|
||||
#ifdef __cplusplus
|
||||
static int yyinput (yyscan_t yyscanner)
|
||||
|
@ -1563,7 +1627,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
|
||||
else
|
||||
{ /* need more input */
|
||||
int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
|
||||
yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
|
||||
++yyg->yy_c_buf_p;
|
||||
|
||||
switch ( yy_get_next_buffer( yyscanner ) )
|
||||
|
@ -1698,7 +1762,7 @@ static void cmListFileLexer_yy_load_buffer_state (yyscan_t yyscanner)
|
|||
if ( ! b )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in cmListFileLexer_yy_create_buffer()" );
|
||||
|
||||
b->yy_buf_size = size;
|
||||
b->yy_buf_size = (yy_size_t)size;
|
||||
|
||||
/* yy_ch_buf has to be 2 characters longer than the size given because
|
||||
* we need to put in 2 end-of-buffer characters.
|
||||
|
@ -1850,7 +1914,7 @@ void cmListFileLexer_yypop_buffer_state (yyscan_t yyscanner)
|
|||
*/
|
||||
static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner)
|
||||
{
|
||||
int num_to_alloc;
|
||||
yy_size_t num_to_alloc;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
if (!yyg->yy_buffer_stack) {
|
||||
|
@ -1859,7 +1923,7 @@ static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner)
|
|||
* scanner will even need a stack. We use 2 instead of 1 to avoid an
|
||||
* immediate realloc on the next call.
|
||||
*/
|
||||
num_to_alloc = 1;
|
||||
num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
|
||||
yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyalloc
|
||||
(num_to_alloc * sizeof(struct yy_buffer_state*)
|
||||
, yyscanner);
|
||||
|
@ -1876,7 +1940,7 @@ static void cmListFileLexer_yyensure_buffer_stack (yyscan_t yyscanner)
|
|||
if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
|
||||
|
||||
/* Increase the buffer to prepare for a possible push. */
|
||||
int grow_size = 8 /* arbitrary grow size */;
|
||||
yy_size_t grow_size = 8 /* arbitrary grow size */;
|
||||
|
||||
num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
|
||||
yyg->yy_buffer_stack = (struct yy_buffer_state**)cmListFileLexer_yyrealloc
|
||||
|
@ -1948,12 +2012,12 @@ YY_BUFFER_STATE cmListFileLexer_yy_scan_string (yyconst char * yystr , yyscan_t
|
|||
* @param yyscanner The scanner object.
|
||||
* @return the newly allocated buffer state object.
|
||||
*/
|
||||
YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
|
||||
YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
char *buf;
|
||||
yy_size_t n;
|
||||
int i;
|
||||
yy_size_t i;
|
||||
|
||||
/* Get memory for full buffer, including space for trailing EOB's. */
|
||||
n = _yybytes_len + 2;
|
||||
|
@ -1984,7 +2048,8 @@ YY_BUFFER_STATE cmListFileLexer_yy_scan_bytes (yyconst char * yybytes, int _yy
|
|||
|
||||
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
|
||||
{
|
||||
(void)yyscanner;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
(void)yyg;
|
||||
(void) fprintf( stderr, "%s\n", msg );
|
||||
exit( YY_EXIT_FAILURE );
|
||||
}
|
||||
|
@ -2064,7 +2129,7 @@ FILE *cmListFileLexer_yyget_out (yyscan_t yyscanner)
|
|||
/** Get the length of the current token.
|
||||
* @param yyscanner The scanner object.
|
||||
*/
|
||||
int cmListFileLexer_yyget_leng (yyscan_t yyscanner)
|
||||
yy_size_t cmListFileLexer_yyget_leng (yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
return yyleng;
|
||||
|
@ -2091,51 +2156,51 @@ void cmListFileLexer_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscann
|
|||
}
|
||||
|
||||
/** Set the current line number.
|
||||
* @param line_number
|
||||
* @param _line_number line number
|
||||
* @param yyscanner The scanner object.
|
||||
*/
|
||||
void cmListFileLexer_yyset_lineno (int line_number , yyscan_t yyscanner)
|
||||
void cmListFileLexer_yyset_lineno (int _line_number , yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
/* lineno is only valid if an input buffer exists. */
|
||||
if (! YY_CURRENT_BUFFER )
|
||||
yy_fatal_error( "cmListFileLexer_yyset_lineno called with no buffer" , yyscanner);
|
||||
YY_FATAL_ERROR( "cmListFileLexer_yyset_lineno called with no buffer" );
|
||||
|
||||
yylineno = line_number;
|
||||
yylineno = _line_number;
|
||||
}
|
||||
|
||||
/** Set the current column.
|
||||
* @param line_number
|
||||
* @param _column_no column number
|
||||
* @param yyscanner The scanner object.
|
||||
*/
|
||||
void cmListFileLexer_yyset_column (int column_no , yyscan_t yyscanner)
|
||||
void cmListFileLexer_yyset_column (int _column_no , yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
|
||||
/* column is only valid if an input buffer exists. */
|
||||
if (! YY_CURRENT_BUFFER )
|
||||
yy_fatal_error( "cmListFileLexer_yyset_column called with no buffer" , yyscanner);
|
||||
YY_FATAL_ERROR( "cmListFileLexer_yyset_column called with no buffer" );
|
||||
|
||||
yycolumn = column_no;
|
||||
yycolumn = _column_no;
|
||||
}
|
||||
|
||||
/** Set the input stream. This does not discard the current
|
||||
* input buffer.
|
||||
* @param in_str A readable stream.
|
||||
* @param _in_str A readable stream.
|
||||
* @param yyscanner The scanner object.
|
||||
* @see cmListFileLexer_yy_switch_to_buffer
|
||||
*/
|
||||
void cmListFileLexer_yyset_in (FILE * in_str , yyscan_t yyscanner)
|
||||
void cmListFileLexer_yyset_in (FILE * _in_str , yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
yyin = in_str ;
|
||||
yyin = _in_str ;
|
||||
}
|
||||
|
||||
void cmListFileLexer_yyset_out (FILE * out_str , yyscan_t yyscanner)
|
||||
void cmListFileLexer_yyset_out (FILE * _out_str , yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
yyout = out_str ;
|
||||
yyout = _out_str ;
|
||||
}
|
||||
|
||||
int cmListFileLexer_yyget_debug (yyscan_t yyscanner)
|
||||
|
@ -2144,10 +2209,10 @@ int cmListFileLexer_yyget_debug (yyscan_t yyscanner)
|
|||
return yy_flex_debug;
|
||||
}
|
||||
|
||||
void cmListFileLexer_yyset_debug (int bdebug , yyscan_t yyscanner)
|
||||
void cmListFileLexer_yyset_debug (int _bdebug , yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
yy_flex_debug = bdebug ;
|
||||
yy_flex_debug = _bdebug ;
|
||||
}
|
||||
|
||||
/* Accessor methods for yylval and yylloc */
|
||||
|
@ -2285,6 +2350,9 @@ int cmListFileLexer_yylex_destroy (yyscan_t yyscanner)
|
|||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
(void)yyg;
|
||||
|
||||
int i;
|
||||
for ( i = 0; i < n; ++i )
|
||||
s1[i] = s2[i];
|
||||
|
@ -2304,12 +2372,16 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
|
|||
|
||||
void *cmListFileLexer_yyalloc (yy_size_t size , yyscan_t yyscanner)
|
||||
{
|
||||
(void)yyscanner;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
(void)yyg;
|
||||
return (void *) malloc( size );
|
||||
}
|
||||
|
||||
void *cmListFileLexer_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
(void)yyg;
|
||||
|
||||
/* The cast to (char *) in the following accommodates both
|
||||
* implementations that use char* generic pointers, and those
|
||||
* that use void* generic pointers. It works with the latter
|
||||
|
@ -2317,19 +2389,19 @@ void *cmListFileLexer_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscann
|
|||
* any pointer type to void*, and deal with argument conversions
|
||||
* as though doing an assignment.
|
||||
*/
|
||||
(void)yyscanner;
|
||||
return (void *) realloc( (char *) ptr, size );
|
||||
}
|
||||
|
||||
void cmListFileLexer_yyfree (void * ptr , yyscan_t yyscanner)
|
||||
{
|
||||
(void)yyscanner;
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
(void)yyg;
|
||||
free( (char *) ptr ); /* see cmListFileLexer_yyrealloc() for (char *) cast */
|
||||
}
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 282 "cmListFileLexer.in.l"
|
||||
#line 280 "cmListFileLexer.in.l"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -14,19 +14,16 @@
|
|||
|
||||
This file must be translated to C and modified to build everywhere.
|
||||
|
||||
Run flex like this:
|
||||
Run flex >= 2.6 like this:
|
||||
|
||||
flex --prefix=cmListFileLexer_yy -ocmListFileLexer.c cmListFileLexer.in.l
|
||||
|
||||
Modify cmListFileLexer.c:
|
||||
- remove TABs
|
||||
- remove use of the 'register' storage class specifier
|
||||
- remove the yyunput function
|
||||
- add a statement "(void)yyscanner;" to the top of these methods:
|
||||
yy_fatal_error, cmListFileLexer_yyalloc, cmListFileLexer_yyrealloc, cmListFileLexer_yyfree
|
||||
- remove trailing whitespace: sed -i 's/\s*$//' cmListFileLexer.c
|
||||
- remove blank lines at end of file
|
||||
- remove statement "yyscanner = NULL;" from cmListFileLexer_yylex_destroy
|
||||
- remove all YY_BREAK lines occurring right after return statements
|
||||
- remove the isatty forward declaration
|
||||
- remove unnecessary cast to (int) in yy_get_next_buffer
|
||||
|
||||
*/
|
||||
|
||||
|
@ -45,7 +42,7 @@ Modify cmListFileLexer.c:
|
|||
struct cmListFileLexer_s
|
||||
{
|
||||
cmListFileLexer_Token token;
|
||||
int bracket;
|
||||
yy_size_t bracket;
|
||||
int comment;
|
||||
int line;
|
||||
int column;
|
||||
|
@ -112,7 +109,7 @@ LEGACY {MAKEVAR}|{UNQUOTED}|\"({MAKEVAR}|{UNQUOTED}|[ \t[=])*\"
|
|||
lexer->token.type = cmListFileLexer_Token_ArgumentBracket;
|
||||
}
|
||||
cmListFileLexerSetToken(lexer, "", 0);
|
||||
lexer->bracket = (int)(strchr(bracket+1, '[') - bracket);
|
||||
lexer->bracket = strchr(bracket+1, '[') - bracket;
|
||||
if(yytext[yyleng-1] == '\n')
|
||||
{
|
||||
++lexer->line;
|
||||
|
|
Loading…
Reference in New Issue