1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#include "LexerTest.h"
//int main(int argc, char* argv[])
//{
// LexerTest test;
// test.testLexer();
//
// return 0;
//}
#define MYSQL_LEX 1
#define MYSQL_SERVER
//extern "C"
//{
extern int pthread_dummy(int) { return 0; }
//}
typedef void* YYSTYPE;
#define YYSTYPE_IS_DECLARED
#include <sstream>
#include "myx_lex_helpers.h"
#include "mysql_version.h"
#include "my_global.h"
#include "my_sys.h"
#include "sql_string.h"
#include "unireg.h"
#include "structs.h"
#include <m_ctype.h>
#include <hash.h>
#include "sql_lex.h"
int MYSQLlex(void **arg, void *yylex);
void lex_init(void);
void lex_start(LEX *lex, const uchar *buf, uint length);
int main(int argc, char* argv[])
{
YYSTYPE yystype;
lex_init();
const char *query= "CREATE TABLE test.t1 (id INT NOT NULL PRIMARY KEY, t TEXT)";
LEX lex;
lex_start(&lex, reinterpret_cast<const unsigned char *>(query), (unsigned int)strlen(query));
lex.charset= get_charset_by_name("utf8_bin", MYF(0));
lex_args.arg1= &yystype;
lex_args.arg2= &lex;
yytokentype retval;
while(1)
{
retval= (yytokentype)yylex(&yystype);
retval= retval;
}
//LexerTest test;
//test.stringParse(query);
return 0;
}
|