Merge pull request #33 from torpedro/build-install
Copy header files on `make install`
This commit is contained in:
commit
b5bb364ab6
12
Makefile
12
Makefile
|
@ -27,15 +27,17 @@ library: $(TARGET)
|
|||
$(TARGET): $(LIBOBJ)
|
||||
$(CXX) $(LIBFLAGS) -o $(TARGET) $(LIBOBJ)
|
||||
|
||||
|
||||
%.o: %.cpp $(PARSERFILES)
|
||||
$(CXX) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(SRCPARSER)/bison_parser.cpp: parser
|
||||
$(SRCPARSER)/flex_lexer.cpp: parser
|
||||
$(SRCPARSER)/bison_parser.cpp:
|
||||
make -C $(SRCPARSER)/ bison_parser.cpp
|
||||
|
||||
$(SRCPARSER)/flex_lexer.cpp:
|
||||
make -C $(SRCPARSER)/ flex_lexer.cpp
|
||||
|
||||
parser:
|
||||
make -C $(SRCPARSER)/
|
||||
make -C $(SRCPARSER) all
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET)
|
||||
|
@ -49,6 +51,8 @@ cleanall: clean cleanparser
|
|||
|
||||
install:
|
||||
cp $(TARGET) $(INSTALL)/lib/$(TARGET)
|
||||
cp -r src $(INSTALL)/include/hsql
|
||||
find $(INSTALL)/include/hsql -not -name '*.h' -type f | xargs rm
|
||||
|
||||
format:
|
||||
astyle --options=astyle.options $(ALLLIB)
|
||||
|
|
|
@ -36,7 +36,7 @@ To use the SQL parser in your own projects you simply have to follow these few s
|
|||
|
||||
First step to extending this parser is cloning the repository `git clone git@github.com:hyrise/sql-parser.git` and making sure everything works by running the following steps:
|
||||
|
||||
```
|
||||
```bash
|
||||
make parser # builds the bison parser and flex lexer
|
||||
make library # builds the libsqlparser.so
|
||||
make test # runs the tests with the library
|
||||
|
@ -44,7 +44,7 @@ make test # runs the tests with the library
|
|||
|
||||
Rerun these steps whenever you change part of the parse. To execute the entire pipeline automatically you can run:
|
||||
|
||||
```
|
||||
```bash
|
||||
make cleanall # cleans the parser build and library build
|
||||
make test # build parser, library and runs the tests
|
||||
```
|
||||
|
|
|
@ -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 1
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
|
@ -88,25 +88,13 @@ typedef unsigned int flex_uint32_t;
|
|||
|
||||
#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. */
|
||||
|
@ -179,11 +167,17 @@ 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
|
||||
|
||||
#define YY_LESS_LINENO(n)
|
||||
#define YY_LINENO_REWIND_TO(ptr)
|
||||
|
||||
/* Return all but the first "n" matched characters back to the input stream. */
|
||||
#define yyless(n) \
|
||||
|
@ -201,11 +195,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
|||
|
||||
#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
||||
#define YY_STRUCT_YY_BUFFER_STATE
|
||||
struct yy_buffer_state
|
||||
|
@ -218,7 +207,7 @@ 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.
|
||||
|
@ -334,7 +323,7 @@ void hsql_free (void * ,yyscan_t yyscanner );
|
|||
|
||||
/* Begin user sect3 */
|
||||
|
||||
#define hsql_wrap(n) 1
|
||||
#define hsql_wrap(yyscanner) (/*CONSTCOND*/1)
|
||||
#define YY_SKIP_YYWRAP
|
||||
|
||||
typedef unsigned char YY_CHAR;
|
||||
|
@ -346,14 +335,14 @@ 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 (yyconst 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 = (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;
|
||||
|
@ -472,7 +461,7 @@ static yyconst flex_int16_t yy_accept[914] =
|
|||
2, 2, 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, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
|
@ -504,7 +493,7 @@ static yyconst flex_int32_t yy_ec[256] =
|
|||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_meta[66] =
|
||||
static yyconst YY_CHAR yy_meta[66] =
|
||||
{ 0,
|
||||
1, 1, 2, 3, 1, 1, 1, 1, 4, 1,
|
||||
1, 1, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
|
@ -515,7 +504,7 @@ static yyconst flex_int32_t yy_meta[66] =
|
|||
4, 4, 4, 4, 4
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_base[921] =
|
||||
static yyconst flex_uint16_t yy_base[921] =
|
||||
{ 0,
|
||||
0, 0, 65, 0, 349, 3639, 129, 131, 0, 3639,
|
||||
338, 332, 310, 127, 126, 305, 123, 123, 131, 177,
|
||||
|
@ -725,7 +714,7 @@ static yyconst flex_int16_t yy_def[921] =
|
|||
52, 52, 0, 913, 913, 913, 913, 913, 913, 913
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_nxt[3705] =
|
||||
static yyconst flex_uint16_t yy_nxt[3705] =
|
||||
{ 0,
|
||||
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
10, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||
|
@ -1585,7 +1574,7 @@ static yyconst flex_int16_t yy_chk[3705] =
|
|||
/***************************
|
||||
** Section 3: Rules
|
||||
***************************/
|
||||
#line 1589 "flex_lexer.cpp"
|
||||
#line 1578 "flex_lexer.cpp"
|
||||
|
||||
#define INITIAL 0
|
||||
#define COMMENT 1
|
||||
|
@ -1667,19 +1656,23 @@ void hsql_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
|
|||
|
||||
FILE *hsql_get_in (yyscan_t yyscanner );
|
||||
|
||||
void hsql_set_in (FILE * in_str ,yyscan_t yyscanner );
|
||||
void hsql_set_in (FILE * _in_str ,yyscan_t yyscanner );
|
||||
|
||||
FILE *hsql_get_out (yyscan_t yyscanner );
|
||||
|
||||
void hsql_set_out (FILE * out_str ,yyscan_t yyscanner );
|
||||
void hsql_set_out (FILE * _out_str ,yyscan_t yyscanner );
|
||||
|
||||
int hsql_get_leng (yyscan_t yyscanner );
|
||||
int hsql_get_leng (yyscan_t yyscanner );
|
||||
|
||||
char *hsql_get_text (yyscan_t yyscanner );
|
||||
|
||||
int hsql_get_lineno (yyscan_t yyscanner );
|
||||
|
||||
void hsql_set_lineno (int line_number ,yyscan_t yyscanner );
|
||||
void hsql_set_lineno (int _line_number ,yyscan_t yyscanner );
|
||||
|
||||
int hsql_get_column (yyscan_t yyscanner );
|
||||
|
||||
void hsql_set_column (int _column_no ,yyscan_t yyscanner );
|
||||
|
||||
YYSTYPE * hsql_get_lval (yyscan_t yyscanner );
|
||||
|
||||
|
@ -1701,6 +1694,10 @@ extern int hsql_wrap (yyscan_t yyscanner );
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_UNPUT
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
|
||||
#endif
|
||||
|
@ -1734,7 +1731,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 do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
|
||||
#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,
|
||||
|
@ -1758,7 +1755,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, max_size, yyin))==0 && ferror(yyin)) \
|
||||
{ \
|
||||
if( errno != EINTR) \
|
||||
{ \
|
||||
|
@ -1815,7 +1812,7 @@ extern int hsql_lex \
|
|||
|
||||
/* 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 \
|
||||
|
@ -1825,16 +1822,11 @@ extern int hsql_lex \
|
|||
*/
|
||||
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 51 "flex_lexer.l"
|
||||
|
||||
|
||||
#line 1837 "flex_lexer.cpp"
|
||||
|
||||
yylval = yylval_param;
|
||||
|
||||
yylloc = yylloc_param;
|
||||
|
@ -1865,7 +1857,13 @@ YY_DECL
|
|||
hsql__load_buffer_state(yyscanner );
|
||||
}
|
||||
|
||||
while ( 1 ) /* loops until end-of-file is reached */
|
||||
{
|
||||
#line 51 "flex_lexer.l"
|
||||
|
||||
|
||||
#line 1865 "flex_lexer.cpp"
|
||||
|
||||
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
|
||||
{
|
||||
yy_cp = yyg->yy_c_buf_p;
|
||||
|
||||
|
@ -1881,7 +1879,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;
|
||||
|
@ -1893,7 +1891,7 @@ yy_match:
|
|||
if ( yy_current_state >= 914 )
|
||||
yy_c = yy_meta[(unsigned int) 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] + (flex_int16_t) yy_c];
|
||||
++yy_cp;
|
||||
}
|
||||
while ( yy_current_state != 913 );
|
||||
|
@ -2592,7 +2590,7 @@ YY_RULE_SETUP
|
|||
#line 213 "flex_lexer.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 2596 "flex_lexer.cpp"
|
||||
#line 2594 "flex_lexer.cpp"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(COMMENT):
|
||||
yyterminate();
|
||||
|
@ -2725,6 +2723,7 @@ case YY_STATE_EOF(COMMENT):
|
|||
"fatal flex scanner internal error--no action found" );
|
||||
} /* end of action switch */
|
||||
} /* end of scanning one token */
|
||||
} /* end of user's declarations */
|
||||
} /* end of hsql_lex */
|
||||
|
||||
/* yy_get_next_buffer - try to read in a new buffer
|
||||
|
@ -2737,9 +2736,9 @@ case YY_STATE_EOF(COMMENT):
|
|||
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;
|
||||
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] )
|
||||
|
@ -2768,7 +2767,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++);
|
||||
|
@ -2788,7 +2787,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
{ /* 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);
|
||||
|
@ -2808,7 +2807,7 @@ static int yy_get_next_buffer (yyscan_t 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(
|
||||
|
@ -2826,7 +2825,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;
|
||||
}
|
||||
|
@ -2850,9 +2849,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 ((int) (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 *) hsql_realloc((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()" );
|
||||
|
@ -2871,15 +2870,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;
|
||||
|
@ -2891,7 +2890,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
if ( yy_current_state >= 914 )
|
||||
yy_c = yy_meta[(unsigned int) 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] + (flex_int16_t) yy_c];
|
||||
}
|
||||
|
||||
return yy_current_state;
|
||||
|
@ -2904,11 +2903,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;
|
||||
|
@ -2920,12 +2919,17 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
if ( yy_current_state >= 914 )
|
||||
yy_c = yy_meta[(unsigned int) 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] + (flex_int16_t) yy_c];
|
||||
yy_is_jam = (yy_current_state == 913);
|
||||
|
||||
(void)yyg;
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
|
||||
#ifndef YY_NO_UNPUT
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_INPUT
|
||||
#ifdef __cplusplus
|
||||
static int yyinput (yyscan_t yyscanner)
|
||||
|
@ -2975,7 +2979,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
case EOB_ACT_END_OF_FILE:
|
||||
{
|
||||
if ( hsql_wrap(yyscanner ) )
|
||||
return EOF;
|
||||
return 0;
|
||||
|
||||
if ( ! yyg->yy_did_buffer_switch_on_eof )
|
||||
YY_NEW_FILE;
|
||||
|
@ -3079,7 +3083,7 @@ static void hsql__load_buffer_state (yyscan_t yyscanner)
|
|||
if ( ! b )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in hsql__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.
|
||||
|
@ -3240,7 +3244,7 @@ static void hsql_ensure_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**)hsql_alloc
|
||||
(num_to_alloc * sizeof(struct yy_buffer_state*)
|
||||
, yyscanner);
|
||||
|
@ -3257,7 +3261,7 @@ static void hsql_ensure_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**)hsql_realloc
|
||||
|
@ -3287,7 +3291,7 @@ YY_BUFFER_STATE hsql__scan_buffer (char * base, yy_size_t size , yyscan_t yysc
|
|||
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) hsql_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
|
||||
if ( ! b )
|
||||
|
@ -3296,7 +3300,7 @@ YY_BUFFER_STATE hsql__scan_buffer (char * base, yy_size_t size , yyscan_t yysc
|
|||
b->yy_buf_size = 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;
|
||||
|
@ -3319,7 +3323,7 @@ YY_BUFFER_STATE hsql__scan_buffer (char * base, yy_size_t size , yyscan_t yysc
|
|||
YY_BUFFER_STATE hsql__scan_string (yyconst char * yystr , yyscan_t yyscanner)
|
||||
{
|
||||
|
||||
return hsql__scan_bytes(yystr,strlen(yystr) ,yyscanner);
|
||||
return hsql__scan_bytes(yystr,(int) strlen(yystr) ,yyscanner);
|
||||
}
|
||||
|
||||
/** Setup the input buffer state to scan the given bytes. The next call to hsql_lex() will
|
||||
|
@ -3334,10 +3338,10 @@ YY_BUFFER_STATE hsql__scan_bytes (yyconst char * yybytes, int _yybytes_len , y
|
|||
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;
|
||||
n = (yy_size_t) _yybytes_len + 2;
|
||||
buf = (char *) hsql_alloc(n ,yyscanner );
|
||||
if ( ! buf )
|
||||
YY_FATAL_ERROR( "out of dynamic memory in hsql__scan_bytes()" );
|
||||
|
@ -3363,9 +3367,11 @@ YY_BUFFER_STATE hsql__scan_bytes (yyconst char * yybytes, int _yybytes_len , y
|
|||
#define YY_EXIT_FAILURE 2
|
||||
#endif
|
||||
|
||||
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
|
||||
static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
|
||||
{
|
||||
(void) fprintf( stderr, "%s\n", msg );
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
(void)yyg;
|
||||
(void) fprintf( stderr, "%s\n", msg );
|
||||
exit( YY_EXIT_FAILURE );
|
||||
}
|
||||
|
||||
|
@ -3471,51 +3477,51 @@ void hsql_set_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 hsql_set_lineno (int line_number , yyscan_t yyscanner)
|
||||
void hsql_set_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( "hsql_set_lineno called with no buffer" , yyscanner);
|
||||
YY_FATAL_ERROR( "hsql_set_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 hsql_set_column (int column_no , yyscan_t yyscanner)
|
||||
void hsql_set_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( "hsql_set_column called with no buffer" , yyscanner);
|
||||
YY_FATAL_ERROR( "hsql_set_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 hsql__switch_to_buffer
|
||||
*/
|
||||
void hsql_set_in (FILE * in_str , yyscan_t yyscanner)
|
||||
void hsql_set_in (FILE * _in_str , yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
yyin = in_str ;
|
||||
yyin = _in_str ;
|
||||
}
|
||||
|
||||
void hsql_set_out (FILE * out_str , yyscan_t yyscanner)
|
||||
void hsql_set_out (FILE * _out_str , yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
yyout = out_str ;
|
||||
yyout = _out_str ;
|
||||
}
|
||||
|
||||
int hsql_get_debug (yyscan_t yyscanner)
|
||||
|
@ -3524,10 +3530,10 @@ int hsql_get_debug (yyscan_t yyscanner)
|
|||
return yy_flex_debug;
|
||||
}
|
||||
|
||||
void hsql_set_debug (int bdebug , yyscan_t yyscanner)
|
||||
void hsql_set_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 */
|
||||
|
@ -3627,10 +3633,10 @@ static int yy_init_globals (yyscan_t yyscanner)
|
|||
* This function is called from hsql_lex_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;
|
||||
|
||||
|
@ -3643,8 +3649,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
|
||||
|
@ -3690,7 +3696,10 @@ int hsql_lex_destroy (yyscan_t yyscanner)
|
|||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy (char* s1, yyconst 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];
|
||||
}
|
||||
|
@ -3699,7 +3708,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca
|
|||
#ifdef YY_NEED_STRLEN
|
||||
static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
|
||||
{
|
||||
register int n;
|
||||
int n;
|
||||
for ( n = 0; s[n]; ++n )
|
||||
;
|
||||
|
||||
|
@ -3709,11 +3718,16 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
|
|||
|
||||
void *hsql_alloc (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 *hsql_realloc (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
|
||||
|
@ -3721,11 +3735,13 @@ void *hsql_realloc (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 hsql_free (void * ptr , yyscan_t yyscanner)
|
||||
{
|
||||
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
||||
(void)yyg;
|
||||
free( (char *) ptr ); /* see hsql_realloc() for (char *) cast */
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,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 1
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
|
@ -92,25 +92,13 @@ typedef unsigned int flex_uint32_t;
|
|||
|
||||
#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
|
||||
|
||||
/* An opaque pointer. */
|
||||
|
@ -165,7 +153,7 @@ 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.
|
||||
|
@ -222,7 +210,7 @@ void hsql_free (void * ,yyscan_t yyscanner );
|
|||
|
||||
/* Begin user sect3 */
|
||||
|
||||
#define hsql_wrap(n) 1
|
||||
#define hsql_wrap(yyscanner) (/*CONSTCOND*/1)
|
||||
#define YY_SKIP_YYWRAP
|
||||
|
||||
#define yytext_ptr yytext_r
|
||||
|
@ -264,19 +252,23 @@ void hsql_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
|
|||
|
||||
FILE *hsql_get_in (yyscan_t yyscanner );
|
||||
|
||||
void hsql_set_in (FILE * in_str ,yyscan_t yyscanner );
|
||||
void hsql_set_in (FILE * _in_str ,yyscan_t yyscanner );
|
||||
|
||||
FILE *hsql_get_out (yyscan_t yyscanner );
|
||||
|
||||
void hsql_set_out (FILE * out_str ,yyscan_t yyscanner );
|
||||
void hsql_set_out (FILE * _out_str ,yyscan_t yyscanner );
|
||||
|
||||
int hsql_get_leng (yyscan_t yyscanner );
|
||||
int hsql_get_leng (yyscan_t yyscanner );
|
||||
|
||||
char *hsql_get_text (yyscan_t yyscanner );
|
||||
|
||||
int hsql_get_lineno (yyscan_t yyscanner );
|
||||
|
||||
void hsql_set_lineno (int line_number ,yyscan_t yyscanner );
|
||||
void hsql_set_lineno (int _line_number ,yyscan_t yyscanner );
|
||||
|
||||
int hsql_get_column (yyscan_t yyscanner );
|
||||
|
||||
void hsql_set_column (int _column_no ,yyscan_t yyscanner );
|
||||
|
||||
YYSTYPE * hsql_get_lval (yyscan_t yyscanner );
|
||||
|
||||
|
@ -355,6 +347,6 @@ extern int hsql_lex \
|
|||
#line 213 "flex_lexer.l"
|
||||
|
||||
|
||||
#line 359 "flex_lexer.h"
|
||||
#line 351 "flex_lexer.h"
|
||||
#undef hsql_IN_HEADER
|
||||
#endif /* hsql_HEADER_H */
|
||||
|
|
|
@ -32,6 +32,7 @@ fi
|
|||
printf "\n${GREEN}Running memory leak checks...${NC}\n"
|
||||
valgrind --leak-check=full --error-exitcode=200 --log-fd=3 \
|
||||
./bin/sql_tests -f "test/valid_queries.sql" 3>&1 >/dev/null 2>/dev/null
|
||||
MEM_LEAK_RET=$?
|
||||
|
||||
if [ $MEM_LEAK_RET -ne 200 ]; then
|
||||
printf "${GREEN}Memory leak check succeeded!${NC}\n"
|
||||
|
|
Loading…
Reference in New Issue