Merge branch 'master' of https://github.com/hyrise/sql-parser into limit-offset

This commit is contained in:
Markus Dreseler 2018-02-08 17:25:30 +01:00
commit 8ec540fc52
No known key found for this signature in database
GPG Key ID: B172BF793484C274
6 changed files with 432 additions and 495 deletions

File diff suppressed because it is too large Load Diff

View File

@ -48,7 +48,7 @@
extern int hsql_debug; extern int hsql_debug;
#endif #endif
/* "%code requires" blocks. */ /* "%code requires" blocks. */
#line 35 "bison_parser.y" /* yacc.c:1909 */ #line 35 "bison_parser.y" /* yacc.c:1915 */
// %code requires block // %code requires block
@ -72,7 +72,7 @@ extern int hsql_debug;
} \ } \
} }
#line 76 "bison_parser.h" /* yacc.c:1909 */ #line 76 "bison_parser.h" /* yacc.c:1915 */
/* Token type. */ /* Token type. */
#ifndef HSQL_TOKENTYPE #ifndef HSQL_TOKENTYPE
@ -218,7 +218,7 @@ extern int hsql_debug;
union HSQL_STYPE union HSQL_STYPE
{ {
#line 95 "bison_parser.y" /* yacc.c:1909 */ #line 95 "bison_parser.y" /* yacc.c:1915 */
double fval; double fval;
int64_t ival; int64_t ival;
@ -257,7 +257,7 @@ union HSQL_STYPE
std::vector<hsql::Expr*>* expr_vec; std::vector<hsql::Expr*>* expr_vec;
std::vector<hsql::OrderDescription*>* order_vec; std::vector<hsql::OrderDescription*>* order_vec;
#line 261 "bison_parser.h" /* yacc.c:1909 */ #line 261 "bison_parser.h" /* yacc.c:1915 */
}; };
typedef union HSQL_STYPE HSQL_STYPE; typedef union HSQL_STYPE HSQL_STYPE;

View File

@ -8,8 +8,8 @@
#define FLEX_SCANNER #define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 0 #define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0 #if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA #define FLEX_BETA
#endif #endif
@ -47,6 +47,7 @@ typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t; typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t; typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t; typedef uint32_t flex_uint32_t;
typedef uint64_t flex_uint64_t;
#else #else
typedef signed char flex_int8_t; typedef signed char flex_int8_t;
typedef short int flex_int16_t; typedef short int flex_int16_t;
@ -54,6 +55,7 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t; typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t; typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t; typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */ /* Limits of integral types. */
#ifndef INT8_MIN #ifndef INT8_MIN
@ -84,8 +86,6 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U) #define UINT32_MAX (4294967295U)
#endif #endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */ #endif /* ! FLEXINT_H */
#ifdef __cplusplus #ifdef __cplusplus
@ -159,15 +159,7 @@ typedef void* yyscan_t;
/* Size of default input buffer. */ /* Size of default input buffer. */
#ifndef YY_BUF_SIZE #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 #define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif #endif
/* The state buf must be large enough to hold one state per character in the main buffer. /* The state buf must be large enough to hold one state per character in the main buffer.
@ -189,7 +181,6 @@ typedef size_t yy_size_t;
#define EOB_ACT_LAST_MATCH 2 #define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n) #define YY_LESS_LINENO(n)
#define YY_LINENO_REWIND_TO(ptr)
/* Return all but the first "n" matched characters back to the input stream. */ /* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \ #define yyless(n) \
@ -224,7 +215,7 @@ struct yy_buffer_state
/* Number of characters read into yy_ch_buf, not including EOB /* Number of characters read into yy_ch_buf, not including EOB
* characters. * characters.
*/ */
int yy_n_chars; yy_size_t yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it, /* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to * and can realloc() it to grow it, and should free() it to
@ -335,7 +326,7 @@ void hsql_free (void * ,yyscan_t yyscanner );
/* Begin user sect3 */ /* Begin user sect3 */
#define hsql_wrap(yyscanner) (/*CONSTCOND*/1) #define hsql_wrap(n) 1
#define YY_SKIP_YYWRAP #define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR; typedef unsigned char YY_CHAR;
@ -347,9 +338,6 @@ typedef int yy_state_type;
static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); 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 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 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 ); static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
/* Done after the current pattern has been matched and before the /* Done after the current pattern has been matched and before the
@ -357,7 +345,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*/ */
#define YY_DO_BEFORE_ACTION \ #define YY_DO_BEFORE_ACTION \
yyg->yytext_ptr = yy_bp; \ yyg->yytext_ptr = yy_bp; \
yyleng = (size_t) (yy_cp - yy_bp); \ yyleng = (yy_size_t) (yy_cp - yy_bp); \
yyg->yy_hold_char = *yy_cp; \ yyg->yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \ *yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp; yyg->yy_c_buf_p = yy_cp;
@ -479,7 +467,7 @@ static yyconst flex_int16_t yy_accept[942] =
0 0
} ; } ;
static yyconst YY_CHAR yy_ec[256] = static yyconst flex_int32_t yy_ec[256] =
{ 0, { 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -511,7 +499,7 @@ static yyconst YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1 1, 1, 1, 1, 1
} ; } ;
static yyconst YY_CHAR yy_meta[68] = static yyconst flex_int32_t yy_meta[68] =
{ 0, { 0,
1, 1, 2, 1, 3, 1, 1, 1, 1, 4, 1, 1, 2, 1, 3, 1, 1, 1, 1, 4,
1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4,
@ -522,7 +510,7 @@ static yyconst YY_CHAR yy_meta[68] =
4, 4, 4, 4, 4, 4, 1 4, 4, 4, 4, 4, 4, 1
} ; } ;
static yyconst flex_uint16_t yy_base[949] = static yyconst flex_int16_t yy_base[949] =
{ 0, { 0,
0, 0, 67, 0, 454, 3713, 133, 135, 423, 0, 0, 0, 67, 0, 454, 3713, 133, 135, 423, 0,
3713, 426, 131, 420, 133, 132, 405, 399, 129, 129, 3713, 426, 131, 420, 133, 132, 405, 399, 129, 129,
@ -738,7 +726,7 @@ static yyconst flex_int16_t yy_def[949] =
0, 941, 941, 941, 941, 941, 941, 941 0, 941, 941, 941, 941, 941, 941, 941
} ; } ;
static yyconst flex_uint16_t yy_nxt[3781] = static yyconst flex_int16_t yy_nxt[3781] =
{ 0, { 0,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
@ -1612,7 +1600,7 @@ static yyconst flex_int16_t yy_chk[3781] =
/*************************** /***************************
** Section 3: Rules ** Section 3: Rules
***************************/ ***************************/
#line 1616 "flex_lexer.cpp" #line 1604 "flex_lexer.cpp"
#define INITIAL 0 #define INITIAL 0
#define COMMENT 1 #define COMMENT 1
@ -1642,7 +1630,7 @@ struct yyguts_t
size_t yy_buffer_stack_max; /**< capacity of stack. */ size_t yy_buffer_stack_max; /**< capacity of stack. */
YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
char yy_hold_char; char yy_hold_char;
int yy_n_chars; yy_size_t yy_n_chars;
yy_size_t yyleng_r; yy_size_t yyleng_r;
char *yy_c_buf_p; char *yy_c_buf_p;
int yy_init; int yy_init;
@ -1694,11 +1682,11 @@ void hsql_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
FILE *hsql_get_in (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 ); 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 );
yy_size_t hsql_get_leng (yyscan_t yyscanner ); yy_size_t hsql_get_leng (yyscan_t yyscanner );
@ -1706,11 +1694,7 @@ char *hsql_get_text (yyscan_t yyscanner );
int hsql_get_lineno (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 ); YYSTYPE * hsql_get_lval (yyscan_t yyscanner );
@ -1732,10 +1716,6 @@ extern int hsql_wrap (yyscan_t yyscanner );
#endif #endif
#endif #endif
#ifndef YY_NO_UNPUT
#endif
#ifndef yytext_ptr #ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
#endif #endif
@ -1756,12 +1736,7 @@ static int input (yyscan_t yyscanner );
/* Amount of stuff to slurp up with each read. */ /* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE #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 #define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#endif #endif
/* Copy whatever the last rule matched to the standard output. */ /* Copy whatever the last rule matched to the standard output. */
@ -1769,7 +1744,7 @@ static int input (yyscan_t yyscanner );
/* This used to be an fputs(), but since the string might contain NUL's, /* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite(). * we now use fwrite().
*/ */
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #define ECHO fwrite( yytext, yyleng, 1, yyout )
#endif #endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@ -1780,7 +1755,7 @@ static int input (yyscan_t yyscanner );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \ { \
int c = '*'; \ int c = '*'; \
size_t n; \ yy_size_t n; \
for ( n = 0; n < max_size && \ for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \ buf[n] = (char) c; \
@ -1850,7 +1825,7 @@ extern int hsql_lex \
/* Code executed at the end of each rule. */ /* Code executed at the end of each rule. */
#ifndef YY_BREAK #ifndef YY_BREAK
#define YY_BREAK /*LINTED*/break; #define YY_BREAK break;
#endif #endif
#define YY_RULE_SETUP \ #define YY_RULE_SETUP \
@ -1860,11 +1835,16 @@ extern int hsql_lex \
*/ */
YY_DECL YY_DECL
{ {
yy_state_type yy_current_state; register yy_state_type yy_current_state;
char *yy_cp, *yy_bp; register char *yy_cp, *yy_bp;
int yy_act; register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
#line 51 "flex_lexer.l"
#line 1847 "flex_lexer.cpp"
yylval = yylval_param; yylval = yylval_param;
yylloc = yylloc_param; yylloc = yylloc_param;
@ -1895,13 +1875,7 @@ YY_DECL
hsql__load_buffer_state(yyscanner ); hsql__load_buffer_state(yyscanner );
} }
{ while ( 1 ) /* loops until end-of-file is reached */
#line 51 "flex_lexer.l"
#line 1903 "flex_lexer.cpp"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{ {
yy_cp = yyg->yy_c_buf_p; yy_cp = yyg->yy_c_buf_p;
@ -1917,7 +1891,7 @@ YY_DECL
yy_match: yy_match:
do do
{ {
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] ) if ( yy_accept[yy_current_state] )
{ {
yyg->yy_last_accepting_state = yy_current_state; yyg->yy_last_accepting_state = yy_current_state;
@ -2654,7 +2628,7 @@ YY_RULE_SETUP
#line 219 "flex_lexer.l" #line 219 "flex_lexer.l"
ECHO; ECHO;
YY_BREAK YY_BREAK
#line 2658 "flex_lexer.cpp" #line 2632 "flex_lexer.cpp"
case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(COMMENT):
yyterminate(); yyterminate();
@ -2787,7 +2761,6 @@ case YY_STATE_EOF(COMMENT):
"fatal flex scanner internal error--no action found" ); "fatal flex scanner internal error--no action found" );
} /* end of action switch */ } /* end of action switch */
} /* end of scanning one token */ } /* end of scanning one token */
} /* end of user's declarations */
} /* end of hsql_lex */ } /* end of hsql_lex */
/* yy_get_next_buffer - try to read in a new buffer /* yy_get_next_buffer - try to read in a new buffer
@ -2800,9 +2773,9 @@ case YY_STATE_EOF(COMMENT):
static int yy_get_next_buffer (yyscan_t yyscanner) static int yy_get_next_buffer (yyscan_t yyscanner)
{ {
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
char *source = yyg->yytext_ptr; register char *source = yyg->yytext_ptr;
yy_size_t number_to_move, i; register int number_to_move, i;
int ret_val; int ret_val;
if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
@ -2831,7 +2804,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
/* Try to read more data. */ /* Try to read more data. */
/* First move last chars to start of buffer. */ /* First move last chars to start of buffer. */
number_to_move = (yy_size_t) (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 ) for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++); *(dest++) = *(source++);
@ -2851,7 +2824,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
{ /* Not enough room in the buffer - grow it. */ { /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */ /* just a shorter name for the current buffer */
YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
int yy_c_buf_p_offset = int yy_c_buf_p_offset =
(int) (yyg->yy_c_buf_p - b->yy_ch_buf); (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
@ -2913,9 +2886,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
else else
ret_val = EOB_ACT_CONTINUE_SCAN; ret_val = EOB_ACT_CONTINUE_SCAN;
if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { if ((yy_size_t) (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. */ /* Extend the array by 50%, plus the number we really need. */
int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); 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 *) hsql_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); 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 ) if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
@ -2934,15 +2907,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
static yy_state_type yy_get_previous_state (yyscan_t yyscanner) static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
{ {
yy_state_type yy_current_state; register yy_state_type yy_current_state;
char *yy_cp; register char *yy_cp;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yy_current_state = yyg->yy_start; yy_current_state = yyg->yy_start;
for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
{ {
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] ) if ( yy_accept[yy_current_state] )
{ {
yyg->yy_last_accepting_state = yy_current_state; yyg->yy_last_accepting_state = yy_current_state;
@ -2967,11 +2940,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) static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
{ {
int yy_is_jam; register int yy_is_jam;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
char *yy_cp = yyg->yy_c_buf_p; register char *yy_cp = yyg->yy_c_buf_p;
YY_CHAR yy_c = 1; register YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] ) if ( yy_accept[yy_current_state] )
{ {
yyg->yy_last_accepting_state = yy_current_state; yyg->yy_last_accepting_state = yy_current_state;
@ -2986,14 +2959,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 941); yy_is_jam = (yy_current_state == 941);
(void)yyg;
return yy_is_jam ? 0 : yy_current_state; return yy_is_jam ? 0 : yy_current_state;
} }
#ifndef YY_NO_UNPUT
#endif
#ifndef YY_NO_INPUT #ifndef YY_NO_INPUT
#ifdef __cplusplus #ifdef __cplusplus
static int yyinput (yyscan_t yyscanner) static int yyinput (yyscan_t yyscanner)
@ -3043,7 +3011,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
case EOB_ACT_END_OF_FILE: case EOB_ACT_END_OF_FILE:
{ {
if ( hsql_wrap(yyscanner ) ) if ( hsql_wrap(yyscanner ) )
return EOF; return 0;
if ( ! yyg->yy_did_buffer_switch_on_eof ) if ( ! yyg->yy_did_buffer_switch_on_eof )
YY_NEW_FILE; YY_NEW_FILE;
@ -3147,7 +3115,7 @@ static void hsql__load_buffer_state (yyscan_t yyscanner)
if ( ! b ) if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in hsql__create_buffer()" ); YY_FATAL_ERROR( "out of dynamic memory in hsql__create_buffer()" );
b->yy_buf_size = (yy_size_t)size; b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because /* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters. * we need to put in 2 end-of-buffer characters.
@ -3308,7 +3276,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 * scanner will even need a stack. We use 2 instead of 1 to avoid an
* immediate realloc on the next call. * immediate realloc on the next call.
*/ */
num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ num_to_alloc = 1;
yyg->yy_buffer_stack = (struct yy_buffer_state**)hsql_alloc yyg->yy_buffer_stack = (struct yy_buffer_state**)hsql_alloc
(num_to_alloc * sizeof(struct yy_buffer_state*) (num_to_alloc * sizeof(struct yy_buffer_state*)
, yyscanner); , yyscanner);
@ -3325,7 +3293,7 @@ static void hsql_ensure_buffer_stack (yyscan_t yyscanner)
if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
/* Increase the buffer to prepare for a possible push. */ /* Increase the buffer to prepare for a possible push. */
yy_size_t grow_size = 8 /* arbitrary grow size */; int grow_size = 8 /* arbitrary grow size */;
num_to_alloc = yyg->yy_buffer_stack_max + grow_size; num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
yyg->yy_buffer_stack = (struct yy_buffer_state**)hsql_realloc yyg->yy_buffer_stack = (struct yy_buffer_state**)hsql_realloc
@ -3392,8 +3360,8 @@ YY_BUFFER_STATE hsql__scan_string (yyconst char * yystr , yyscan_t yyscanner)
/** Setup the input buffer state to scan the given bytes. The next call to hsql_lex() will /** Setup the input buffer state to scan the given bytes. The next call to hsql_lex() will
* scan from a @e copy of @a bytes. * scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan * @param bytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object. * @param yyscanner The scanner object.
* @return the newly allocated buffer state object. * @return the newly allocated buffer state object.
*/ */
@ -3401,8 +3369,7 @@ YY_BUFFER_STATE hsql__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_l
{ {
YY_BUFFER_STATE b; YY_BUFFER_STATE b;
char *buf; char *buf;
yy_size_t n; yy_size_t n, i;
yy_size_t i;
/* Get memory for full buffer, including space for trailing EOB's. */ /* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2; n = _yybytes_len + 2;
@ -3433,9 +3400,7 @@ YY_BUFFER_STATE hsql__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_l
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
{ {
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; (void) fprintf( stderr, "%s\n", msg );
(void)yyg;
(void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE ); exit( YY_EXIT_FAILURE );
} }
@ -3541,51 +3506,51 @@ void hsql_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
} }
/** Set the current line number. /** Set the current line number.
* @param _line_number line number * @param line_number
* @param yyscanner The scanner object. * @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; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* lineno is only valid if an input buffer exists. */ /* lineno is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER ) if (! YY_CURRENT_BUFFER )
YY_FATAL_ERROR( "hsql_set_lineno called with no buffer" ); yy_fatal_error( "hsql_set_lineno called with no buffer" , yyscanner);
yylineno = _line_number; yylineno = line_number;
} }
/** Set the current column. /** Set the current column.
* @param _column_no column number * @param line_number
* @param yyscanner The scanner object. * @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; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* column is only valid if an input buffer exists. */ /* column is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER ) if (! YY_CURRENT_BUFFER )
YY_FATAL_ERROR( "hsql_set_column called with no buffer" ); yy_fatal_error( "hsql_set_column called with no buffer" , yyscanner);
yycolumn = _column_no; yycolumn = column_no;
} }
/** Set the input stream. This does not discard the current /** Set the input stream. This does not discard the current
* input buffer. * input buffer.
* @param _in_str A readable stream. * @param in_str A readable stream.
* @param yyscanner The scanner object. * @param yyscanner The scanner object.
* @see hsql__switch_to_buffer * @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; 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; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yyout = _out_str ; yyout = out_str ;
} }
int hsql_get_debug (yyscan_t yyscanner) int hsql_get_debug (yyscan_t yyscanner)
@ -3594,10 +3559,10 @@ int hsql_get_debug (yyscan_t yyscanner)
return yy_flex_debug; 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; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yy_flex_debug = _bdebug ; yy_flex_debug = bdebug ;
} }
/* Accessor methods for yylval and yylloc */ /* Accessor methods for yylval and yylloc */
@ -3760,10 +3725,7 @@ int hsql_lex_destroy (yyscan_t yyscanner)
#ifndef yytext_ptr #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, yyconst char * s2, int n , yyscan_t yyscanner)
{ {
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; register int i;
(void)yyg;
int i;
for ( i = 0; i < n; ++i ) for ( i = 0; i < n; ++i )
s1[i] = s2[i]; s1[i] = s2[i];
} }
@ -3772,7 +3734,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca
#ifdef YY_NEED_STRLEN #ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
{ {
int n; register int n;
for ( n = 0; s[n]; ++n ) for ( n = 0; s[n]; ++n )
; ;
@ -3782,16 +3744,11 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
void *hsql_alloc (yy_size_t size , yyscan_t yyscanner) void *hsql_alloc (yy_size_t size , yyscan_t yyscanner)
{ {
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
(void)yyg;
return (void *) malloc( size ); return (void *) malloc( size );
} }
void *hsql_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) 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 /* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those * implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter * that use void* generic pointers. It works with the latter
@ -3804,8 +3761,6 @@ void *hsql_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
void hsql_free (void * ptr , yyscan_t yyscanner) 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 */ free( (char *) ptr ); /* see hsql_realloc() for (char *) cast */
} }

View File

@ -12,8 +12,8 @@
#define FLEX_SCANNER #define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 6 #define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 0 #define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0 #if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA #define FLEX_BETA
#endif #endif
@ -51,6 +51,7 @@ typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t; typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t; typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t; typedef uint32_t flex_uint32_t;
typedef uint64_t flex_uint64_t;
#else #else
typedef signed char flex_int8_t; typedef signed char flex_int8_t;
typedef short int flex_int16_t; typedef short int flex_int16_t;
@ -58,6 +59,7 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t; typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t; typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t; typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
/* Limits of integral types. */ /* Limits of integral types. */
#ifndef INT8_MIN #ifndef INT8_MIN
@ -88,8 +90,6 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U) #define UINT32_MAX (4294967295U)
#endif #endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */ #endif /* ! FLEXINT_H */
#ifdef __cplusplus #ifdef __cplusplus
@ -132,15 +132,7 @@ typedef void* yyscan_t;
/* Size of default input buffer. */ /* Size of default input buffer. */
#ifndef YY_BUF_SIZE #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 #define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif #endif
#ifndef YY_TYPEDEF_YY_BUFFER_STATE #ifndef YY_TYPEDEF_YY_BUFFER_STATE
@ -170,7 +162,7 @@ struct yy_buffer_state
/* Number of characters read into yy_ch_buf, not including EOB /* Number of characters read into yy_ch_buf, not including EOB
* characters. * characters.
*/ */
int yy_n_chars; yy_size_t yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it, /* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to * and can realloc() it to grow it, and should free() it to
@ -222,7 +214,7 @@ void hsql_free (void * ,yyscan_t yyscanner );
/* Begin user sect3 */ /* Begin user sect3 */
#define hsql_wrap(yyscanner) (/*CONSTCOND*/1) #define hsql_wrap(n) 1
#define YY_SKIP_YYWRAP #define YY_SKIP_YYWRAP
#define yytext_ptr yytext_r #define yytext_ptr yytext_r
@ -264,11 +256,11 @@ void hsql_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
FILE *hsql_get_in (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 ); 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 );
yy_size_t hsql_get_leng (yyscan_t yyscanner ); yy_size_t hsql_get_leng (yyscan_t yyscanner );
@ -276,11 +268,7 @@ char *hsql_get_text (yyscan_t yyscanner );
int hsql_get_lineno (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 ); YYSTYPE * hsql_get_lval (yyscan_t yyscanner );
@ -316,12 +304,7 @@ static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
/* Amount of stuff to slurp up with each read. */ /* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE #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 #define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#endif #endif
/* Number of entries by which start-condition stack grows. */ /* Number of entries by which start-condition stack grows. */
@ -359,6 +342,6 @@ extern int hsql_lex \
#line 219 "flex_lexer.l" #line 219 "flex_lexer.l"
#line 363 "flex_lexer.h" #line 346 "flex_lexer.h"
#undef hsql_IN_HEADER #undef hsql_IN_HEADER
#endif /* hsql_HEADER_H */ #endif /* hsql_HEADER_H */

View File

@ -70,7 +70,9 @@ namespace hsql {
Expr* Expr::makeCaseList(Expr* caseListElement) { Expr* Expr::makeCaseList(Expr* caseListElement) {
Expr* e = new Expr(kExprOperator); Expr* e = new Expr(kExprOperator);
e->opType = kOpCaseList; // Case list expressions are temporary and will be integrated into the case expressions exprList - thus assign
// operator type kOpNone
e->opType = kOpNone;
e->exprList = new std::vector<Expr*>(); e->exprList = new std::vector<Expr*>();
e->exprList->push_back(caseListElement); e->exprList->push_back(caseListElement);
return e; return e;

View File

@ -25,9 +25,7 @@ namespace hsql {
kExprSelect, kExprSelect,
kExprHint, kExprHint,
kExprArray, kExprArray,
kExprArrayIndex, kExprArrayIndex
kExprCaseList,
kExprCaseListElement
}; };
// Operator types. These are important for expressions of type kExprOperator. // Operator types. These are important for expressions of type kExprOperator.
@ -39,7 +37,6 @@ namespace hsql {
// n-nary special case // n-nary special case
kOpCase, kOpCase,
kOpCaseList, // Contains n >= 1 kExprCaseListElement in its exprList
kOpCaseListElement, // `WHEN expr THEN expr` kOpCaseListElement, // `WHEN expr THEN expr`
// Binary operators. // Binary operators.