pars0grm.h, pars0grm.c, lexyy.c:

  The lexer of InnoDB to 8-bit, it was 7-bit which made it crash on table names containing char codes > 127
pars0lex.l, pars0grm.y:
  Add InnoDB internal SQL interpreter grammar and lexer sources
parent 48e20a0b
#ifndef YYSTYPE
#define YYSTYPE int
#endif
#define PARS_INT_LIT 258
#define PARS_FLOAT_LIT 259
#define PARS_STR_LIT 260
#define PARS_NULL_LIT 261
#define PARS_ID_TOKEN 262
#define PARS_AND_TOKEN 263
#define PARS_OR_TOKEN 264
#define PARS_NOT_TOKEN 265
#define PARS_GE_TOKEN 266
#define PARS_LE_TOKEN 267
#define PARS_NE_TOKEN 268
#define PARS_PROCEDURE_TOKEN 269
#define PARS_IN_TOKEN 270
#define PARS_OUT_TOKEN 271
#define PARS_INT_TOKEN 272
#define PARS_INTEGER_TOKEN 273
#define PARS_FLOAT_TOKEN 274
#define PARS_CHAR_TOKEN 275
#define PARS_IS_TOKEN 276
#define PARS_BEGIN_TOKEN 277
#define PARS_END_TOKEN 278
#define PARS_IF_TOKEN 279
#define PARS_THEN_TOKEN 280
#define PARS_ELSE_TOKEN 281
#define PARS_ELSIF_TOKEN 282
#define PARS_LOOP_TOKEN 283
#define PARS_WHILE_TOKEN 284
#define PARS_RETURN_TOKEN 285
#define PARS_SELECT_TOKEN 286
#define PARS_SUM_TOKEN 287
#define PARS_COUNT_TOKEN 288
#define PARS_DISTINCT_TOKEN 289
#define PARS_FROM_TOKEN 290
#define PARS_WHERE_TOKEN 291
#define PARS_FOR_TOKEN 292
#define PARS_DDOT_TOKEN 293
#define PARS_CONSISTENT_TOKEN 294
#define PARS_READ_TOKEN 295
#define PARS_ORDER_TOKEN 296
#define PARS_BY_TOKEN 297
#define PARS_ASC_TOKEN 298
#define PARS_DESC_TOKEN 299
#define PARS_INSERT_TOKEN 300
#define PARS_INTO_TOKEN 301
#define PARS_VALUES_TOKEN 302
#define PARS_UPDATE_TOKEN 303
#define PARS_SET_TOKEN 304
#define PARS_DELETE_TOKEN 305
#define PARS_CURRENT_TOKEN 306
#define PARS_OF_TOKEN 307
#define PARS_CREATE_TOKEN 308
#define PARS_TABLE_TOKEN 309
#define PARS_INDEX_TOKEN 310
#define PARS_UNIQUE_TOKEN 311
#define PARS_CLUSTERED_TOKEN 312
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 313
#define PARS_ON_TOKEN 314
#define PARS_ASSIGN_TOKEN 315
#define PARS_DECLARE_TOKEN 316
#define PARS_CURSOR_TOKEN 317
#define PARS_SQL_TOKEN 318
#define PARS_OPEN_TOKEN 319
#define PARS_FETCH_TOKEN 320
#define PARS_CLOSE_TOKEN 321
#define PARS_NOTFOUND_TOKEN 322
#define PARS_TO_CHAR_TOKEN 323
#define PARS_TO_NUMBER_TOKEN 324
#define PARS_TO_BINARY_TOKEN 325
#define PARS_BINARY_TO_NUMBER_TOKEN 326
#define PARS_SUBSTR_TOKEN 327
#define PARS_REPLSTR_TOKEN 328
#define PARS_CONCAT_TOKEN 329
#define PARS_INSTR_TOKEN 330
#define PARS_LENGTH_TOKEN 331
#define PARS_SYSDATE_TOKEN 332
#define PARS_PRINTF_TOKEN 333
#define PARS_ASSERT_TOKEN 334
#define PARS_RND_TOKEN 335
#define PARS_RND_STR_TOKEN 336
#define PARS_ROW_PRINTF_TOKEN 337
#define PARS_COMMIT_TOKEN 338
#define PARS_ROLLBACK_TOKEN 339
#define PARS_WORK_TOKEN 340
#define NEG 341
#define PARS_INT_LIT 257
#define PARS_FLOAT_LIT 258
#define PARS_STR_LIT 259
#define PARS_NULL_LIT 260
#define PARS_ID_TOKEN 261
#define PARS_AND_TOKEN 262
#define PARS_OR_TOKEN 263
#define PARS_NOT_TOKEN 264
#define PARS_GE_TOKEN 265
#define PARS_LE_TOKEN 266
#define PARS_NE_TOKEN 267
#define PARS_PROCEDURE_TOKEN 268
#define PARS_IN_TOKEN 269
#define PARS_OUT_TOKEN 270
#define PARS_INT_TOKEN 271
#define PARS_INTEGER_TOKEN 272
#define PARS_FLOAT_TOKEN 273
#define PARS_CHAR_TOKEN 274
#define PARS_IS_TOKEN 275
#define PARS_BEGIN_TOKEN 276
#define PARS_END_TOKEN 277
#define PARS_IF_TOKEN 278
#define PARS_THEN_TOKEN 279
#define PARS_ELSE_TOKEN 280
#define PARS_ELSIF_TOKEN 281
#define PARS_LOOP_TOKEN 282
#define PARS_WHILE_TOKEN 283
#define PARS_RETURN_TOKEN 284
#define PARS_SELECT_TOKEN 285
#define PARS_SUM_TOKEN 286
#define PARS_COUNT_TOKEN 287
#define PARS_DISTINCT_TOKEN 288
#define PARS_FROM_TOKEN 289
#define PARS_WHERE_TOKEN 290
#define PARS_FOR_TOKEN 291
#define PARS_DDOT_TOKEN 292
#define PARS_CONSISTENT_TOKEN 293
#define PARS_READ_TOKEN 294
#define PARS_ORDER_TOKEN 295
#define PARS_BY_TOKEN 296
#define PARS_ASC_TOKEN 297
#define PARS_DESC_TOKEN 298
#define PARS_INSERT_TOKEN 299
#define PARS_INTO_TOKEN 300
#define PARS_VALUES_TOKEN 301
#define PARS_UPDATE_TOKEN 302
#define PARS_SET_TOKEN 303
#define PARS_DELETE_TOKEN 304
#define PARS_CURRENT_TOKEN 305
#define PARS_OF_TOKEN 306
#define PARS_CREATE_TOKEN 307
#define PARS_TABLE_TOKEN 308
#define PARS_INDEX_TOKEN 309
#define PARS_UNIQUE_TOKEN 310
#define PARS_CLUSTERED_TOKEN 311
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 312
#define PARS_ON_TOKEN 313
#define PARS_ASSIGN_TOKEN 314
#define PARS_DECLARE_TOKEN 315
#define PARS_CURSOR_TOKEN 316
#define PARS_SQL_TOKEN 317
#define PARS_OPEN_TOKEN 318
#define PARS_FETCH_TOKEN 319
#define PARS_CLOSE_TOKEN 320
#define PARS_NOTFOUND_TOKEN 321
#define PARS_TO_CHAR_TOKEN 322
#define PARS_TO_NUMBER_TOKEN 323
#define PARS_TO_BINARY_TOKEN 324
#define PARS_BINARY_TO_NUMBER_TOKEN 325
#define PARS_SUBSTR_TOKEN 326
#define PARS_REPLSTR_TOKEN 327
#define PARS_CONCAT_TOKEN 328
#define PARS_INSTR_TOKEN 329
#define PARS_LENGTH_TOKEN 330
#define PARS_SYSDATE_TOKEN 331
#define PARS_PRINTF_TOKEN 332
#define PARS_ASSERT_TOKEN 333
#define PARS_RND_TOKEN 334
#define PARS_RND_STR_TOKEN 335
#define PARS_ROW_PRINTF_TOKEN 336
#define PARS_COMMIT_TOKEN 337
#define PARS_ROLLBACK_TOKEN 338
#define PARS_WORK_TOKEN 339
#define NEG 340
extern YYSTYPE yylval;
This diff is collapsed.
This diff is collapsed.
#ifndef YYSTYPE
#define YYSTYPE int
#endif
#define PARS_INT_LIT 258
#define PARS_FLOAT_LIT 259
#define PARS_STR_LIT 260
#define PARS_NULL_LIT 261
#define PARS_ID_TOKEN 262
#define PARS_AND_TOKEN 263
#define PARS_OR_TOKEN 264
#define PARS_NOT_TOKEN 265
#define PARS_GE_TOKEN 266
#define PARS_LE_TOKEN 267
#define PARS_NE_TOKEN 268
#define PARS_PROCEDURE_TOKEN 269
#define PARS_IN_TOKEN 270
#define PARS_OUT_TOKEN 271
#define PARS_INT_TOKEN 272
#define PARS_INTEGER_TOKEN 273
#define PARS_FLOAT_TOKEN 274
#define PARS_CHAR_TOKEN 275
#define PARS_IS_TOKEN 276
#define PARS_BEGIN_TOKEN 277
#define PARS_END_TOKEN 278
#define PARS_IF_TOKEN 279
#define PARS_THEN_TOKEN 280
#define PARS_ELSE_TOKEN 281
#define PARS_ELSIF_TOKEN 282
#define PARS_LOOP_TOKEN 283
#define PARS_WHILE_TOKEN 284
#define PARS_RETURN_TOKEN 285
#define PARS_SELECT_TOKEN 286
#define PARS_SUM_TOKEN 287
#define PARS_COUNT_TOKEN 288
#define PARS_DISTINCT_TOKEN 289
#define PARS_FROM_TOKEN 290
#define PARS_WHERE_TOKEN 291
#define PARS_FOR_TOKEN 292
#define PARS_DDOT_TOKEN 293
#define PARS_CONSISTENT_TOKEN 294
#define PARS_READ_TOKEN 295
#define PARS_ORDER_TOKEN 296
#define PARS_BY_TOKEN 297
#define PARS_ASC_TOKEN 298
#define PARS_DESC_TOKEN 299
#define PARS_INSERT_TOKEN 300
#define PARS_INTO_TOKEN 301
#define PARS_VALUES_TOKEN 302
#define PARS_UPDATE_TOKEN 303
#define PARS_SET_TOKEN 304
#define PARS_DELETE_TOKEN 305
#define PARS_CURRENT_TOKEN 306
#define PARS_OF_TOKEN 307
#define PARS_CREATE_TOKEN 308
#define PARS_TABLE_TOKEN 309
#define PARS_INDEX_TOKEN 310
#define PARS_UNIQUE_TOKEN 311
#define PARS_CLUSTERED_TOKEN 312
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 313
#define PARS_ON_TOKEN 314
#define PARS_ASSIGN_TOKEN 315
#define PARS_DECLARE_TOKEN 316
#define PARS_CURSOR_TOKEN 317
#define PARS_SQL_TOKEN 318
#define PARS_OPEN_TOKEN 319
#define PARS_FETCH_TOKEN 320
#define PARS_CLOSE_TOKEN 321
#define PARS_NOTFOUND_TOKEN 322
#define PARS_TO_CHAR_TOKEN 323
#define PARS_TO_NUMBER_TOKEN 324
#define PARS_TO_BINARY_TOKEN 325
#define PARS_BINARY_TO_NUMBER_TOKEN 326
#define PARS_SUBSTR_TOKEN 327
#define PARS_REPLSTR_TOKEN 328
#define PARS_CONCAT_TOKEN 329
#define PARS_INSTR_TOKEN 330
#define PARS_LENGTH_TOKEN 331
#define PARS_SYSDATE_TOKEN 332
#define PARS_PRINTF_TOKEN 333
#define PARS_ASSERT_TOKEN 334
#define PARS_RND_TOKEN 335
#define PARS_RND_STR_TOKEN 336
#define PARS_ROW_PRINTF_TOKEN 337
#define PARS_COMMIT_TOKEN 338
#define PARS_ROLLBACK_TOKEN 339
#define PARS_WORK_TOKEN 340
#define NEG 341
#define PARS_INT_LIT 257
#define PARS_FLOAT_LIT 258
#define PARS_STR_LIT 259
#define PARS_NULL_LIT 260
#define PARS_ID_TOKEN 261
#define PARS_AND_TOKEN 262
#define PARS_OR_TOKEN 263
#define PARS_NOT_TOKEN 264
#define PARS_GE_TOKEN 265
#define PARS_LE_TOKEN 266
#define PARS_NE_TOKEN 267
#define PARS_PROCEDURE_TOKEN 268
#define PARS_IN_TOKEN 269
#define PARS_OUT_TOKEN 270
#define PARS_INT_TOKEN 271
#define PARS_INTEGER_TOKEN 272
#define PARS_FLOAT_TOKEN 273
#define PARS_CHAR_TOKEN 274
#define PARS_IS_TOKEN 275
#define PARS_BEGIN_TOKEN 276
#define PARS_END_TOKEN 277
#define PARS_IF_TOKEN 278
#define PARS_THEN_TOKEN 279
#define PARS_ELSE_TOKEN 280
#define PARS_ELSIF_TOKEN 281
#define PARS_LOOP_TOKEN 282
#define PARS_WHILE_TOKEN 283
#define PARS_RETURN_TOKEN 284
#define PARS_SELECT_TOKEN 285
#define PARS_SUM_TOKEN 286
#define PARS_COUNT_TOKEN 287
#define PARS_DISTINCT_TOKEN 288
#define PARS_FROM_TOKEN 289
#define PARS_WHERE_TOKEN 290
#define PARS_FOR_TOKEN 291
#define PARS_DDOT_TOKEN 292
#define PARS_CONSISTENT_TOKEN 293
#define PARS_READ_TOKEN 294
#define PARS_ORDER_TOKEN 295
#define PARS_BY_TOKEN 296
#define PARS_ASC_TOKEN 297
#define PARS_DESC_TOKEN 298
#define PARS_INSERT_TOKEN 299
#define PARS_INTO_TOKEN 300
#define PARS_VALUES_TOKEN 301
#define PARS_UPDATE_TOKEN 302
#define PARS_SET_TOKEN 303
#define PARS_DELETE_TOKEN 304
#define PARS_CURRENT_TOKEN 305
#define PARS_OF_TOKEN 306
#define PARS_CREATE_TOKEN 307
#define PARS_TABLE_TOKEN 308
#define PARS_INDEX_TOKEN 309
#define PARS_UNIQUE_TOKEN 310
#define PARS_CLUSTERED_TOKEN 311
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 312
#define PARS_ON_TOKEN 313
#define PARS_ASSIGN_TOKEN 314
#define PARS_DECLARE_TOKEN 315
#define PARS_CURSOR_TOKEN 316
#define PARS_SQL_TOKEN 317
#define PARS_OPEN_TOKEN 318
#define PARS_FETCH_TOKEN 319
#define PARS_CLOSE_TOKEN 320
#define PARS_NOTFOUND_TOKEN 321
#define PARS_TO_CHAR_TOKEN 322
#define PARS_TO_NUMBER_TOKEN 323
#define PARS_TO_BINARY_TOKEN 324
#define PARS_BINARY_TO_NUMBER_TOKEN 325
#define PARS_SUBSTR_TOKEN 326
#define PARS_REPLSTR_TOKEN 327
#define PARS_CONCAT_TOKEN 328
#define PARS_INSTR_TOKEN 329
#define PARS_LENGTH_TOKEN 330
#define PARS_SYSDATE_TOKEN 331
#define PARS_PRINTF_TOKEN 332
#define PARS_ASSERT_TOKEN 333
#define PARS_RND_TOKEN 334
#define PARS_RND_STR_TOKEN 335
#define PARS_ROW_PRINTF_TOKEN 336
#define PARS_COMMIT_TOKEN 337
#define PARS_ROLLBACK_TOKEN 338
#define PARS_WORK_TOKEN 339
#define NEG 340
extern YYSTYPE yylval;
......@@ -4,17 +4,21 @@ SQL parser: input file for the GNU Bison parser generator
(c) 1997 Innobase Oy
Created 12/14/1997 Heikki Tuuri
Published under the GPL version 2
Look from pars0lex.l for instructions how to generate the C files for
the InnoDB parser.
*******************************************************/
%{
/* The value of the semantic attribute is a pointer to a query tree node
que_node_t */
#define YYSTYPE que_node_t*
#include "univ.i"
#undef alloca
#define alloca mem_alloc
#include <math.h>
#include "univ.i"
#include "pars0pars.h"
#include "mem0mem.h"
#include "que0types.h"
......
......@@ -4,6 +4,30 @@ SQL parser lexical analyzer: input file for the GNU Flex lexer generator
(c) 1997 Innobase Oy
Created 12/14/1997 Heikki Tuuri
Published under the GPL version 2
The InnoDB parser is frozen because MySQL takes care of SQL parsing.
Therefore we normally keep the InnoDB parser C files as they are, and do
not automatically generate them from pars0grm.y and pars0lex.l.
How to make the InnoDB parser and lexer C files:
1. First do
bison -d pars0grm.y
That generates pars0grm.tab.c and pars0grm.tab.h.
2. Rename pars0grm.tab.c to pars0grm.c and pars0grm.tab.h to pars0grm.h.
3. Copy pars0grm.h also to /innobase/include
4. Do
flex pars0lex.l
That generates lex.yy.c.
5. Rename lex.yy.c to lexyy.c.
These instructions seem to work at least with bison-1.28 and flex-2.5.4 on
Linux.
*******************************************************/
%{
......@@ -19,11 +43,10 @@ Created 12/14/1997 Heikki Tuuri
#define isatty(A) 0
#define malloc(A) mem_alloc(A)
#define free(A) mem_free(A)
#define realloc(P, A) mem_realloc(P, A)
#define realloc(P, A) mem_realloc(P, A, __FILE__, __LINE__)
#define exit(A) ut_a(0)
#define YY_INPUT(buf, result, max_size) pars_get_lex_chars(buf, &result,\
max_size)
#define YY_INPUT(buf, result, max_size) pars_get_lex_chars(buf, &result, max_size)
%}
DIGIT [0-9]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment