skslc now uses a more recent version of Flex

Bug: 6447
Change-Id: Ie1cb674752442a8992dd247abb2bcace8497c1f4
Reviewed-on: https://skia-review.googlesource.com/11014
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
Ethan Nicholas 2017-03-31 17:06:42 -04:00 committed by Skia Commit-Bot
parent e684483408
commit 9442194381
4 changed files with 659 additions and 502 deletions

View File

@ -12,6 +12,9 @@
#define register
#include "disable_flex_warnings.h"
#include "lex.sksl.c"
static_assert(YY_FLEX_MAJOR_VERSION * 100 + YY_FLEX_MINOR_VERSION * 10 +
YY_FLEX_SUBMINOR_VERSION >= 261,
"we require Flex 2.6.1 or better for security reasons");
#undef register
#ifdef __clang__
#pragma clang diagnostic pop

View File

@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
#line 3 "lex.layout.c"
#line 2 "lex.layout.c"
#define YY_INT_ALIGNED short int
@ -13,12 +13,82 @@
#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 3
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
#define yy_create_buffer layout_create_buffer
#define yy_delete_buffer layout_delete_buffer
#define yy_scan_buffer layout_scan_buffer
#define yy_scan_string layout_scan_string
#define yy_scan_bytes layout_scan_bytes
#define yy_init_buffer layout_init_buffer
#define yy_flush_buffer layout_flush_buffer
#define yy_load_buffer_state layout_load_buffer_state
#define yy_switch_to_buffer layout_switch_to_buffer
#define yypush_buffer_state layoutpush_buffer_state
#define yypop_buffer_state layoutpop_buffer_state
#define yyensure_buffer_stack layoutensure_buffer_stack
#define yylex layoutlex
#define yyrestart layoutrestart
#define yylex_init layoutlex_init
#define yylex_init_extra layoutlex_init_extra
#define yylex_destroy layoutlex_destroy
#define yyget_debug layoutget_debug
#define yyset_debug layoutset_debug
#define yyget_extra layoutget_extra
#define yyset_extra layoutset_extra
#define yyget_in layoutget_in
#define yyset_in layoutset_in
#define yyget_out layoutget_out
#define yyset_out layoutset_out
#define yyget_leng layoutget_leng
#define yyget_text layoutget_text
#define yyget_lineno layoutget_lineno
#define yyset_lineno layoutset_lineno
#define yyget_column layoutget_column
#define yyset_column layoutset_column
#define yywrap layoutwrap
#define yyalloc layoutalloc
#define yyrealloc layoutrealloc
#define yyfree layoutfree
/* First, we deal with platform-specific or compiler-specific issues. */
/* begin standard C headers. */
@ -52,7 +122,6 @@ typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
typedef uint64_t flex_uint64_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
@ -60,7 +129,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
@ -91,38 +159,26 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
#else /* ! __cplusplus */
/* C99 requires __STDC__ to be defined as 1. */
#if defined (__STDC__)
#define YY_USE_CONST
#endif /* defined (__STDC__) */
#endif /* ! __cplusplus */
#ifdef YY_USE_CONST
/* TODO: this is always defined, so inline it */
#define yyconst const
#if defined(__GNUC__) && __GNUC__ >= 3
#define yynoreturn __attribute__((__noreturn__))
#else
#define yyconst
#define yynoreturn
#endif
/* Returned upon end-of-file. */
#define YY_NULL 0
/* Promotes a possibly negative, possibly signed char to an unsigned
* integer for use as an array index. If the signed char is negative,
* we want to instead treat it as an 8-bit unsigned char, hence the
* double cast.
/* Promotes a possibly negative, possibly signed char to an
* integer in range [0..255] for use as an array index.
*/
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
/* An opaque pointer. */
#ifndef YY_TYPEDEF_YY_SCANNER_T
@ -146,25 +202,29 @@ typedef void* yyscan_t;
* definition of BEGIN.
*/
#define BEGIN yyg->yy_start = 1 + 2 *
/* Translate the current start state into a value that can be later handed
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
*/
#define YY_START ((yyg->yy_start - 1) / 2)
#define YYSTATE YY_START
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE layoutrestart(yyin ,yyscanner )
#define YY_END_OF_BUFFER_CHAR 0
/* 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.
@ -194,11 +254,18 @@ typedef size_t yy_size_t;
*/
#define YY_LESS_LINENO(n) \
do { \
yy_size_t yyl;\
int yyl;\
for ( yyl = n; yyl < yyleng; ++yyl )\
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) \
@ -213,7 +280,6 @@ typedef size_t yy_size_t;
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \
while ( 0 )
#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
#ifndef YY_STRUCT_YY_BUFFER_STATE
@ -228,12 +294,12 @@ struct yy_buffer_state
/* Size of input buffer in bytes, not including room for EOB
* characters.
*/
yy_size_t yy_buf_size;
int yy_buf_size;
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
yy_size_t yy_n_chars;
int 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
@ -290,7 +356,6 @@ struct yy_buffer_state
#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
: NULL)
/* Same as previous macro, but useful when we know that the buffer stack is not
* NULL or when we need an lvalue. For internal use only.
*/
@ -307,19 +372,17 @@ void layoutpop_buffer_state (yyscan_t yyscanner );
static void layoutensure_buffer_stack ( yyscan_t yyscanner );
static void layout_load_buffer_state ( yyscan_t yyscanner );
static void layout_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
#define YY_FLUSH_BUFFER layout_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
YY_BUFFER_STATE layout_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
YY_BUFFER_STATE layout_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
YY_BUFFER_STATE layout_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
YY_BUFFER_STATE layout_scan_string ( const char *yy_str , yyscan_t yyscanner );
YY_BUFFER_STATE layout_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
void *layoutalloc ( yy_size_t , yyscan_t yyscanner );
void *layoutrealloc ( void *, yy_size_t , yyscan_t yyscanner );
void layoutfree ( void * , yyscan_t yyscanner );
#define yy_new_buffer layout_create_buffer
#define yy_set_interactive(is_interactive) \
{ \
if ( ! YY_CURRENT_BUFFER ){ \
@ -329,7 +392,6 @@ void layoutfree (void * ,yyscan_t yyscanner );
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
#define yy_set_bol(at_bol) \
{ \
if ( ! YY_CURRENT_BUFFER ){\
@ -339,12 +401,10 @@ void layoutfree (void * ,yyscan_t yyscanner );
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
/* Begin user sect3 */
typedef unsigned char YY_CHAR;
typedef flex_uint8_t YY_CHAR;
typedef int yy_state_type;
@ -353,18 +413,17 @@ 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 );
static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
#define YY_DO_BEFORE_ACTION \
yyg->yytext_ptr = yy_bp; \
yyleng = (yy_size_t) (yy_cp - yy_bp); \
yyleng = (int) (yy_cp - yy_bp); \
yyg->yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 22
#define YY_END_OF_BUFFER 23
/* This struct is not used in this scanner,
@ -374,7 +433,7 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[204] =
static const flex_int16_t yy_accept[204] =
{ 0,
0, 0, 23, 21, 22, 21, 21, 21, 21, 21,
21, 21, 21, 0, 0, 0, 0, 0, 0, 0,
@ -401,7 +460,7 @@ static yyconst flex_int16_t yy_accept[204] =
0, 10, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
static const YY_CHAR yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -433,14 +492,14 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
static yyconst flex_int32_t yy_meta[27] =
static const YY_CHAR yy_meta[27] =
{ 0,
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
} ;
static yyconst flex_int16_t yy_base[205] =
static const flex_int16_t yy_base[205] =
{ 0,
0, 21, 218, 219, 219, 17, 201, 7, 212, 21,
11, 207, 194, 197, 204, 199, 30, 194, 203, 183,
@ -467,7 +526,7 @@ static yyconst flex_int16_t yy_base[205] =
11, 219, 219, 0
} ;
static yyconst flex_int16_t yy_def[205] =
static const flex_int16_t yy_def[205] =
{ 0,
204, 204, 203, 203, 203, 203, 203, 203, 203, 203,
203, 203, 203, 203, 203, 203, 203, 203, 203, 203,
@ -494,7 +553,7 @@ static yyconst flex_int16_t yy_def[205] =
203, 203, 0, 203
} ;
static yyconst flex_int16_t yy_nxt[246] =
static const flex_int16_t yy_nxt[246] =
{ 0,
4, 5, 203, 203, 6, 203, 65, 203, 123, 203,
203, 7, 203, 8, 9, 203, 10, 11, 18, 203,
@ -525,7 +584,7 @@ static yyconst flex_int16_t yy_nxt[246] =
203, 203, 203, 203, 203
} ;
static yyconst flex_int16_t yy_chk[246] =
static const flex_int16_t yy_chk[246] =
{ 0,
204, 1, 0, 0, 1, 0, 50, 0, 113, 0,
0, 1, 0, 1, 1, 0, 1, 1, 8, 0,
@ -557,7 +616,7 @@ static yyconst flex_int16_t yy_chk[246] =
} ;
/* Table of booleans, true if rule could match eol. */
static yyconst flex_int32_t yy_rule_can_match_eol[23] =
static const flex_int32_t yy_rule_can_match_eol[23] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, };
@ -592,7 +651,8 @@ static yyconst flex_int32_t yy_rule_can_match_eol[23] =
#define YY_NO_UNISTD_H 1
#line 29 "layout.flex"
#include "SkSLToken.h"
#line 590 "lex.layout.c"
#line 648 "lex.layout.c"
#line 649 "lex.layout.c"
#define INITIAL 0
@ -621,8 +681,8 @@ struct yyguts_t
size_t yy_buffer_stack_max; /**< capacity of stack. */
YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
char yy_hold_char;
yy_size_t yy_n_chars;
yy_size_t yyleng_r;
int yy_n_chars;
int yyleng_r;
char *yy_c_buf_p;
int yy_init;
int yy_start;
@ -663,19 +723,23 @@ void layoutset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
FILE *layoutget_in ( yyscan_t yyscanner );
void layoutset_in (FILE * in_str ,yyscan_t yyscanner );
void layoutset_in ( FILE * _in_str , yyscan_t yyscanner );
FILE *layoutget_out ( yyscan_t yyscanner );
void layoutset_out (FILE * out_str ,yyscan_t yyscanner );
void layoutset_out ( FILE * _out_str , yyscan_t yyscanner );
yy_size_t layoutget_leng (yyscan_t yyscanner );
int layoutget_leng ( yyscan_t yyscanner );
char *layoutget_text ( yyscan_t yyscanner );
int layoutget_lineno ( yyscan_t yyscanner );
void layoutset_lineno (int line_number ,yyscan_t yyscanner );
void layoutset_lineno ( int _line_number , yyscan_t yyscanner );
int layoutget_column ( yyscan_t yyscanner );
void layoutset_column ( int _column_no , yyscan_t yyscanner );
/* Macros after this point can all be overridden by user definitions in
* section 1.
@ -689,18 +753,21 @@ extern int layoutwrap (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);
static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput ( yyscan_t yyscanner );
#else
@ -711,7 +778,12 @@ static int input (yyscan_t yyscanner );
/* 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. */
@ -719,7 +791,7 @@ static int input (yyscan_t yyscanner );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO fwrite( yytext, yyleng, 1, yyout )
#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@ -730,7 +802,7 @@ static int input (yyscan_t yyscanner );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
yy_size_t n; \
int n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@ -743,7 +815,7 @@ static int input (yyscan_t yyscanner );
else \
{ \
errno=0; \
while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
{ \
if( errno != EINTR) \
{ \
@ -798,7 +870,7 @@ extern int layoutlex (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 \
@ -808,16 +880,11 @@ extern int layoutlex (yyscan_t yyscanner);
*/
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
yy_state_type yy_current_state;
char *yy_cp, *yy_bp;
int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
#line 32 "layout.flex"
#line 814 "lex.layout.c"
if ( !yyg->yy_init )
{
yyg->yy_init = 1;
@ -844,7 +911,13 @@ YY_DECL
layout_load_buffer_state(yyscanner );
}
while ( 1 ) /* loops until end-of-file is reached */
{
#line 32 "layout.flex"
#line 912 "lex.layout.c"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
yy_cp = yyg->yy_c_buf_p;
@ -860,7 +933,7 @@ YY_DECL
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@ -870,9 +943,9 @@ yy_match:
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 204 )
yy_c = yy_meta[(unsigned int) yy_c];
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
while ( yy_current_state != 203 );
@ -886,7 +959,7 @@ yy_find_action:
if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
{
yy_size_t yyl;
int yyl;
for ( yyl = 0; yyl < yyleng; ++yyl )
if ( yytext[yyl] == '\n' )
@ -1017,7 +1090,7 @@ YY_RULE_SETUP
#line 57 "layout.flex"
ECHO;
YY_BREAK
#line 1015 "lex.layout.c"
#line 1087 "lex.layout.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
@ -1149,6 +1222,7 @@ case YY_STATE_EOF(INITIAL):
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
} /* end of user's declarations */
} /* end of layoutlex */
/* yy_get_next_buffer - try to read in a new buffer
@ -1161,9 +1235,9 @@ case YY_STATE_EOF(INITIAL):
static int yy_get_next_buffer (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
register char *source = yyg->yytext_ptr;
register int number_to_move, i;
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
char *source = yyg->yytext_ptr;
int 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] )
@ -1192,7 +1266,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 = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
@ -1205,21 +1279,21 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
else
{
yy_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 )
{ /* 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 )
{
yy_size_t new_size = b->yy_buf_size * 2;
int new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
@ -1228,11 +1302,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
layoutrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
layoutrealloc((void *) b->yy_ch_buf,(yy_size_t) (b->yy_buf_size + 2) ,yyscanner );
}
else
/* Can't grow it, we don't own it. */
b->yy_ch_buf = 0;
b->yy_ch_buf = NULL;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
@ -1274,10 +1348,10 @@ 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);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) layoutrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) layoutrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,(yy_size_t) new_size ,yyscanner );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
}
@ -1295,15 +1369,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_state_type yy_current_state;
char *yy_cp;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yy_current_state = yyg->yy_start;
for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@ -1313,9 +1387,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 204 )
yy_c = yy_meta[(unsigned int) yy_c];
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
}
return yy_current_state;
@ -1328,11 +1402,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
{
register int yy_is_jam;
int yy_is_jam;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
register char *yy_cp = yyg->yy_c_buf_p;
char *yy_cp = yyg->yy_c_buf_p;
register YY_CHAR yy_c = 1;
YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@ -1342,17 +1416,20 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 204 )
yy_c = yy_meta[(unsigned int) yy_c];
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
yy_is_jam = (yy_current_state == 203);
(void)yyg;
return yy_is_jam ? 0 : yy_current_state;
}
static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
#ifndef YY_NO_UNPUT
static void yyunput (int c, char * yy_bp , yyscan_t yyscanner)
{
register char *yy_cp;
char *yy_cp;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yy_cp = yyg->yy_c_buf_p;
@ -1363,10 +1440,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
register yy_size_t number_to_move = yyg->yy_n_chars + 2;
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
int 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];
register char *source =
char *source =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
@ -1375,7 +1452,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
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;
yyg->yy_n_chars = (int) 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" );
@ -1392,6 +1469,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
yyg->yy_c_buf_p = yy_cp;
}
#endif
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput (yyscan_t yyscanner)
@ -1417,7 +1496,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
else
{ /* need more input */
yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
++yyg->yy_c_buf_p;
switch ( yy_get_next_buffer( yyscanner ) )
@ -1557,7 +1636,7 @@ static void layout_load_buffer_state (yyscan_t yyscanner)
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
b->yy_ch_buf = (char *) layoutalloc(b->yy_buf_size + 2 ,yyscanner );
b->yy_ch_buf = (char *) layoutalloc((yy_size_t) (b->yy_buf_size + 2) ,yyscanner );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in layout_create_buffer()" );
@ -1713,7 +1792,7 @@ static void layoutensure_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**)layoutalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
, yyscanner);
@ -1730,7 +1809,7 @@ static void layoutensure_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**)layoutrealloc
@ -1760,16 +1839,16 @@ YY_BUFFER_STATE layout_scan_buffer (char * base, yy_size_t size , yyscan_t yys
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
return 0;
return NULL;
b = (YY_BUFFER_STATE) layoutalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in layout_scan_buffer()" );
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
b->yy_input_file = 0;
b->yy_input_file = NULL;
b->yy_n_chars = b->yy_buf_size;
b->yy_is_interactive = 0;
b->yy_at_bol = 1;
@ -1789,27 +1868,28 @@ YY_BUFFER_STATE layout_scan_buffer (char * base, yy_size_t size , yyscan_t yys
* @note If you want to scan bytes that may contain NUL values, then use
* layout_scan_bytes() instead.
*/
YY_BUFFER_STATE layout_scan_string (yyconst char * yystr , yyscan_t yyscanner)
YY_BUFFER_STATE layout_scan_string (const char * yystr , yyscan_t yyscanner)
{
return layout_scan_bytes(yystr,strlen(yystr) ,yyscanner);
return layout_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner);
}
/** Setup the input buffer state to scan the given bytes. The next call to layoutlex() 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.
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE layout_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
YY_BUFFER_STATE layout_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n, i;
yy_size_t n;
int i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
n = (yy_size_t) (_yybytes_len + 2);
buf = (char *) layoutalloc(n ,yyscanner );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in layout_scan_bytes()" );
@ -1835,8 +1915,10 @@ YY_BUFFER_STATE layout_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_
#define YY_EXIT_FAILURE 2
#endif
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
(void)yyg;
(void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
@ -1916,7 +1998,7 @@ FILE *layoutget_out (yyscan_t yyscanner)
/** Get the length of the current token.
* @param yyscanner The scanner object.
*/
yy_size_t layoutget_leng (yyscan_t yyscanner)
int layoutget_leng (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yyleng;
@ -1943,51 +2025,51 @@ void layoutset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
}
/** Set the current line number.
* @param line_number
* @param _line_number line number
* @param yyscanner The scanner object.
*/
void layoutset_lineno (int line_number , yyscan_t yyscanner)
void layoutset_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( "layoutset_lineno called with no buffer" , yyscanner);
YY_FATAL_ERROR( "layoutset_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 layoutset_column (int column_no , yyscan_t yyscanner)
void layoutset_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( "layoutset_column called with no buffer" , yyscanner);
YY_FATAL_ERROR( "layoutset_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 layout_switch_to_buffer
*/
void layoutset_in (FILE * in_str , yyscan_t yyscanner)
void layoutset_in (FILE * _in_str , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yyin = in_str ;
yyin = _in_str ;
}
void layoutset_out (FILE * out_str , yyscan_t yyscanner)
void layoutset_out (FILE * _out_str , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yyout = out_str ;
yyout = _out_str ;
}
int layoutget_debug (yyscan_t yyscanner)
@ -1996,10 +2078,10 @@ int layoutget_debug (yyscan_t yyscanner)
return yy_flex_debug;
}
void layoutset_debug (int bdebug , yyscan_t yyscanner)
void layoutset_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 */
@ -2010,9 +2092,7 @@ void layoutset_debug (int bdebug , yyscan_t yyscanner)
* the ONLY reentrant function that doesn't take the scanner as the last argument.
* That's why we explicitly handle the declaration, instead of using our macros.
*/
int layoutlex_init(yyscan_t* ptr_yy_globals)
{
if (ptr_yy_globals == NULL){
errno = EINVAL;
@ -2039,9 +2119,7 @@ int layoutlex_init(yyscan_t* ptr_yy_globals)
* The user defined value in the first argument will be available to layoutalloc in
* the yyextra field.
*/
int layoutlex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
{
struct yyguts_t dummy_yyguts;
@ -2075,10 +2153,10 @@ static int yy_init_globals (yyscan_t yyscanner)
* This function is called from layoutlex_destroy(), so don't allocate here.
*/
yyg->yy_buffer_stack = 0;
yyg->yy_buffer_stack = NULL;
yyg->yy_buffer_stack_top = 0;
yyg->yy_buffer_stack_max = 0;
yyg->yy_c_buf_p = (char *) 0;
yyg->yy_c_buf_p = NULL;
yyg->yy_init = 0;
yyg->yy_start = 0;
@ -2091,8 +2169,8 @@ static int yy_init_globals (yyscan_t yyscanner)
yyin = stdin;
yyout = stdout;
#else
yyin = (FILE *) 0;
yyout = (FILE *) 0;
yyin = NULL;
yyout = NULL;
#endif
/* For future reference: Set errno on error, since we are called by
@ -2136,18 +2214,21 @@ int layoutlex_destroy (yyscan_t yyscanner)
*/
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
{
register int i;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
(void)yyg;
int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
{
register int n;
int n;
for ( n = 0; s[n]; ++n )
;
@ -2157,11 +2238,16 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
void *layoutalloc (yy_size_t size , yyscan_t yyscanner)
{
return (void *) malloc( size );
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
(void)yyg;
return malloc(size);
}
void *layoutrealloc (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
@ -2169,11 +2255,13 @@ void *layoutrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
return (void *) realloc( (char *) ptr, size );
return realloc(ptr, size);
}
void layoutfree (void * ptr , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
(void)yyg;
free( (char *) ptr ); /* see layoutrealloc() for (char *) cast */
}
@ -2182,7 +2270,6 @@ void layoutfree (void * ptr , yyscan_t yyscanner)
#line 57 "layout.flex"
int layoutwrap(yyscan_t scanner) {
return 1; // terminate
}

View File

@ -7,3 +7,6 @@
#include "disable_flex_warnings.h"
#include "lex.layout.c"
static_assert(YY_FLEX_MAJOR_VERSION * 100 + YY_FLEX_MINOR_VERSION * 10 +
YY_FLEX_SUBMINOR_VERSION >= 261,
"we require Flex 2.6.1 or better for security reasons");

File diff suppressed because it is too large Load Diff