Commit 5e522f36 authored by unknown's avatar unknown

InnoDB: Handle quotes properly in the InnoDB SQL parser


innobase/include/pars0pars.h:
  Remove dummy yywrap() function (use %noyywrap in pars0lex.l)
innobase/pars/lexyy.c:
  New version corresponding to pars0lex.l
innobase/pars/pars0lex.l:
  Add %option statements
  Add string_append()
  Allow quotes within quotes
  Simplify the patterns for matching comments
innobase/pars/pars0pars.c:
  Remove dummy yywrap() function (use %noyywrap in pars0lex.l)
innobase/pars/pars0sym.c:
  Remove quote handling from sym_tab_add_str_lit()
parent 41aa345d
......@@ -87,13 +87,6 @@ pars_get_lex_chars(
int max_size); /* in: maximum number of characters which fit
in the buffer */
/*****************************************************************
Instructs the lexical analyzer to stop when it receives the EOF integer. */
int
yywrap(void);
/*========*/
/* out: returns TRUE */
/*****************************************************************
Called by yyparse on error. */
void
......
......@@ -8,7 +8,6 @@
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#include "univ.i"
#include <stdio.h>
......@@ -262,6 +261,9 @@ static void yy_flex_free YY_PROTO(( void * ));
#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
#define yywrap() 1
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
typedef int yy_state_type;
......@@ -285,48 +287,48 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
#define YY_NUM_RULES 107
#define YY_END_OF_BUFFER 108
static yyconst short int yy_accept[366] =
static yyconst short int yy_accept[367] =
{ 0,
0, 0, 100, 100, 108, 106, 105, 105, 95, 106,
84, 90, 93, 91, 88, 92, 106, 94, 1, 106,
89, 87, 85, 86, 98, 78, 78, 78, 78, 78,
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
78, 78, 78, 96, 97, 100, 101, 102, 105, 0,
3, 79, 99, 2, 1, 80, 81, 83, 82, 78,
78, 78, 78, 78, 36, 78, 78, 78, 78, 78,
78, 78, 78, 78, 78, 78, 78, 78, 78, 19,
10, 16, 78, 78, 78, 78, 46, 53, 78, 7,
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
78, 78, 78, 78, 78, 78, 78, 100, 101, 102,
103, 102, 104, 2, 6, 37, 78, 78, 78, 78,
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
78, 78, 78, 18, 78, 78, 32, 78, 78, 78,
12, 78, 78, 8, 78, 78, 78, 11, 78, 78,
78, 78, 78, 72, 78, 78, 78, 43, 5, 78,
27, 78, 78, 78, 78, 78, 78, 78, 78, 78,
78, 78, 78, 78, 15, 78, 78, 78, 78, 78,
78, 78, 78, 78, 78, 78, 38, 78, 78, 21,
78, 78, 78, 30, 78, 78, 78, 78, 40, 78,
23, 78, 4, 56, 78, 78, 78, 34, 78, 78,
78, 78, 78, 78, 78, 78, 78, 20, 78, 78,
78, 78, 78, 78, 78, 78, 77, 78, 17, 78,
58, 78, 78, 78, 78, 28, 78, 78, 78, 78,
78, 78, 78, 22, 57, 14, 49, 78, 67, 78,
78, 78, 35, 78, 78, 78, 78, 78, 78, 78,
78, 78, 78, 48, 78, 78, 78, 78, 78, 78,
31, 24, 71, 78, 78, 75, 66, 78, 47, 78,
55, 78, 44, 78, 78, 39, 78, 68, 78, 70,
78, 78, 25, 78, 78, 78, 26, 64, 78, 78,
78, 78, 50, 42, 41, 78, 78, 78, 45, 54,
78, 78, 13, 78, 78, 65, 73, 78, 78, 69,
78, 60, 78, 78, 78, 78, 29, 78, 59, 78,
76, 78, 78, 78, 78, 51, 78, 78, 9, 78,
62, 61, 78, 33, 78, 74, 78, 78, 78, 78,
78, 78, 78, 78, 78, 78, 63, 78, 78, 78,
78, 78, 78, 52, 0
0, 0, 102, 102, 0, 0, 108, 106, 105, 105,
97, 3, 86, 92, 95, 93, 90, 94, 106, 96,
1, 106, 91, 89, 87, 88, 100, 80, 80, 80,
80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
80, 80, 80, 80, 80, 98, 99, 102, 103, 4,
5, 105, 81, 101, 2, 1, 82, 83, 85, 84,
80, 80, 80, 80, 80, 38, 80, 80, 80, 80,
80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
21, 12, 18, 80, 80, 80, 80, 48, 55, 80,
9, 80, 80, 80, 80, 80, 80, 80, 80, 80,
80, 80, 80, 80, 80, 80, 80, 80, 102, 103,
103, 104, 4, 5, 2, 8, 39, 80, 80, 80,
80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
80, 80, 80, 80, 20, 80, 80, 34, 80, 80,
80, 14, 80, 80, 10, 80, 80, 80, 13, 80,
80, 80, 80, 80, 74, 80, 80, 80, 45, 7,
80, 29, 80, 80, 80, 80, 80, 80, 80, 80,
80, 80, 80, 80, 80, 17, 80, 80, 80, 80,
80, 80, 80, 80, 80, 80, 80, 40, 80, 80,
23, 80, 80, 80, 32, 80, 80, 80, 80, 42,
80, 25, 80, 6, 58, 80, 80, 80, 36, 80,
80, 80, 80, 80, 80, 80, 80, 80, 22, 80,
80, 80, 80, 80, 80, 80, 80, 79, 80, 19,
80, 60, 80, 80, 80, 80, 30, 80, 80, 80,
80, 80, 80, 80, 24, 59, 16, 51, 80, 69,
80, 80, 80, 37, 80, 80, 80, 80, 80, 80,
80, 80, 80, 80, 50, 80, 80, 80, 80, 80,
80, 33, 26, 73, 80, 80, 77, 68, 80, 49,
80, 57, 80, 46, 80, 80, 41, 80, 70, 80,
72, 80, 80, 27, 80, 80, 80, 28, 66, 80,
80, 80, 80, 52, 44, 43, 80, 80, 80, 47,
56, 80, 80, 15, 80, 80, 67, 75, 80, 80,
71, 80, 62, 80, 80, 80, 80, 31, 80, 61,
80, 78, 80, 80, 80, 80, 53, 80, 80, 11,
80, 64, 63, 80, 35, 80, 76, 80, 80, 80,
80, 80, 80, 80, 80, 80, 80, 65, 80, 80,
80, 80, 80, 80, 54, 0
} ;
static yyconst int yy_ec[256] =
......@@ -363,205 +365,207 @@ static yyconst int yy_ec[256] =
static yyconst int yy_meta[49] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 2, 1, 1,
1, 1, 1, 3, 1, 1, 1, 1, 1, 1,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 1, 1
1, 1, 1, 1, 2, 1, 1, 3, 1, 1,
1, 1, 1, 4, 1, 1, 1, 1, 1, 1,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 1, 1
} ;
static yyconst short int yy_base[371] =
static yyconst short int yy_base[373] =
{ 0,
0, 0, 46, 47, 393, 394, 49, 54, 394, 387,
394, 394, 394, 394, 394, 394, 379, 382, 46, 371,
394, 43, 394, 370, 394, 25, 38, 37, 41, 39,
49, 0, 51, 54, 45, 62, 349, 57, 68, 73,
61, 365, 71, 394, 394, 382, 394, 99, 108, 379,
394, 394, 394, 369, 102, 394, 394, 394, 394, 0,
358, 81, 354, 346, 0, 358, 80, 84, 353, 339,
96, 337, 350, 335, 349, 332, 336, 332, 334, 0,
98, 0, 334, 332, 326, 333, 0, 0, 339, 339,
322, 94, 103, 337, 98, 94, 328, 109, 320, 336,
332, 310, 326, 330, 321, 107, 314, 348, 394, 137,
394, 141, 394, 336, 0, 0, 324, 319, 326, 308,
306, 305, 310, 123, 308, 320, 109, 308, 314, 315,
297, 297, 126, 0, 312, 313, 0, 300, 307, 28,
128, 304, 294, 303, 296, 293, 301, 0, 291, 301,
299, 290, 280, 274, 287, 272, 292, 0, 0, 277,
0, 291, 282, 279, 134, 275, 290, 269, 271, 276,
276, 268, 271, 266, 0, 278, 262, 272, 279, 270,
258, 257, 271, 260, 273, 253, 0, 263, 245, 0,
264, 261, 248, 0, 243, 248, 247, 257, 0, 243,
0, 247, 0, 0, 243, 240, 254, 0, 239, 239,
237, 253, 238, 250, 232, 250, 245, 0, 240, 240,
226, 225, 225, 239, 238, 237, 0, 221, 0, 215,
0, 234, 218, 217, 217, 0, 230, 220, 215, 214,
226, 216, 215, 0, 0, 0, 0, 208, 0, 222,
218, 204, 0, 218, 219, 202, 207, 200, 218, 200,
197, 198, 195, 0, 200, 212, 199, 206, 205, 190,
0, 0, 0, 182, 189, 0, 0, 186, 0, 185,
0, 199, 0, 200, 187, 0, 183, 0, 186, 0,
178, 180, 0, 179, 193, 186, 0, 0, 189, 192,
174, 189, 0, 0, 0, 170, 184, 183, 0, 0,
167, 166, 0, 181, 166, 0, 0, 172, 168, 0,
163, 0, 175, 164, 174, 163, 0, 150, 0, 170,
0, 154, 148, 154, 145, 0, 150, 163, 0, 162,
0, 0, 153, 0, 157, 0, 144, 144, 150, 136,
159, 147, 142, 132, 127, 118, 0, 128, 135, 126,
123, 114, 88, 0, 394, 168, 171, 124, 174, 177
0, 0, 387, 386, 388, 387, 391, 396, 47, 49,
396, 396, 396, 396, 396, 396, 396, 396, 378, 381,
41, 370, 396, 38, 396, 369, 396, 20, 33, 32,
36, 34, 44, 0, 46, 49, 40, 57, 348, 52,
63, 68, 56, 364, 66, 396, 396, 0, 89, 0,
379, 103, 396, 396, 369, 95, 396, 396, 396, 396,
0, 358, 76, 354, 346, 0, 358, 75, 78, 353,
339, 90, 337, 350, 335, 349, 332, 336, 332, 334,
0, 93, 0, 334, 332, 326, 333, 0, 0, 339,
339, 322, 85, 100, 337, 91, 86, 328, 102, 320,
336, 332, 310, 326, 330, 321, 102, 314, 0, 117,
129, 396, 0, 346, 336, 0, 0, 324, 319, 326,
308, 306, 305, 310, 105, 308, 320, 100, 308, 314,
315, 297, 297, 116, 0, 312, 313, 0, 300, 307,
118, 121, 304, 294, 303, 296, 293, 301, 0, 291,
301, 299, 290, 280, 274, 287, 272, 292, 0, 0,
277, 0, 291, 282, 279, 125, 275, 290, 269, 271,
276, 276, 268, 271, 266, 0, 278, 262, 272, 279,
270, 258, 257, 271, 260, 273, 253, 0, 263, 245,
0, 264, 261, 248, 0, 243, 248, 247, 257, 0,
243, 0, 247, 0, 0, 243, 240, 254, 0, 239,
239, 237, 253, 238, 250, 232, 250, 245, 0, 240,
240, 226, 225, 225, 239, 238, 237, 0, 221, 0,
215, 0, 234, 218, 217, 217, 0, 230, 220, 215,
214, 226, 216, 215, 0, 0, 0, 0, 208, 0,
222, 218, 204, 0, 218, 219, 202, 207, 200, 218,
200, 197, 198, 195, 0, 200, 212, 199, 206, 205,
190, 0, 0, 0, 182, 189, 0, 0, 186, 0,
185, 0, 199, 0, 200, 187, 0, 183, 0, 186,
0, 178, 180, 0, 179, 193, 186, 0, 0, 189,
192, 174, 189, 0, 0, 0, 170, 184, 183, 0,
0, 167, 166, 0, 181, 166, 0, 0, 172, 168,
0, 163, 0, 175, 164, 174, 163, 0, 150, 0,
170, 0, 154, 148, 154, 145, 0, 150, 163, 0,
162, 0, 0, 153, 0, 157, 0, 144, 144, 150,
136, 159, 151, 152, 136, 119, 109, 0, 121, 128,
119, 116, 112, 104, 0, 396, 159, 163, 59, 167,
171, 175
} ;
static yyconst short int yy_def[371] =
static yyconst short int yy_def[373] =
{ 0,
365, 1, 366, 366, 365, 365, 365, 365, 365, 367,
365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
365, 365, 365, 365, 365, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 365, 365, 369, 365, 370, 365, 367,
365, 365, 365, 365, 365, 365, 365, 365, 365, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 369, 365, 370,
365, 370, 365, 365, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
368, 368, 368, 368, 0, 365, 365, 365, 365, 365
366, 1, 367, 367, 368, 368, 366, 366, 366, 366,
366, 366, 366, 366, 366, 366, 366, 366, 366, 366,
366, 366, 366, 366, 366, 366, 366, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 366, 366, 370, 371, 372,
366, 366, 366, 366, 366, 366, 366, 366, 366, 366,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 370, 371,
371, 366, 372, 366, 366, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 369, 369, 369, 369, 369,
369, 369, 369, 369, 369, 0, 366, 366, 366, 366,
366, 366
} ;
static yyconst short int yy_nxt[443] =
static yyconst short int yy_nxt[445] =
{ 0,
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, 32, 33, 32,
32, 34, 32, 35, 36, 37, 32, 38, 39, 40,
41, 42, 43, 32, 32, 32, 44, 45, 47, 47,
49, 49, 196, 48, 48, 49, 49, 54, 61, 55,
57, 58, 63, 62, 66, 71, 64, 197, 67, 72,
74, 68, 75, 76, 69, 73, 80, 70, 83, 85,
77, 93, 65, 78, 81, 86, 79, 87, 84, 82,
94, 95, 96, 100, 103, 88, 104, 89, 106, 90,
101, 111, 91, 116, 97, 107, 112, 102, 98, 49,
49, 113, 99, 54, 121, 55, 123, 124, 128, 117,
122, 139, 149, 151, 125, 157, 60, 129, 150, 155,
160, 169, 364, 158, 130, 170, 140, 141, 152, 111,
156, 161, 153, 111, 365, 179, 183, 184, 112, 365,
190, 363, 198, 113, 191, 219, 220, 362, 361, 360,
359, 180, 199, 358, 357, 356, 355, 221, 46, 46,
46, 50, 50, 50, 108, 354, 108, 110, 110, 110,
353, 352, 351, 350, 349, 348, 347, 346, 345, 344,
343, 342, 341, 340, 339, 338, 337, 336, 335, 334,
333, 332, 331, 330, 329, 328, 327, 326, 325, 324,
323, 322, 321, 320, 319, 318, 317, 316, 315, 314,
313, 312, 311, 310, 309, 308, 307, 306, 305, 304,
303, 302, 301, 300, 299, 298, 297, 296, 295, 294,
293, 292, 291, 290, 289, 288, 287, 286, 285, 284,
283, 282, 281, 280, 279, 278, 277, 276, 275, 274,
273, 272, 271, 270, 269, 268, 267, 266, 265, 264,
263, 262, 261, 260, 259, 258, 257, 256, 255, 254,
253, 252, 251, 250, 249, 248, 247, 246, 245, 244,
243, 242, 241, 240, 239, 238, 237, 236, 235, 234,
233, 232, 231, 230, 229, 228, 227, 226, 225, 224,
223, 222, 218, 217, 216, 215, 214, 213, 212, 211,
210, 209, 208, 207, 206, 205, 204, 203, 202, 201,
200, 195, 194, 193, 192, 189, 188, 187, 186, 185,
182, 181, 178, 177, 176, 175, 174, 173, 172, 114,
109, 171, 168, 167, 166, 165, 164, 163, 162, 159,
154, 148, 147, 146, 145, 144, 143, 142, 138, 137,
136, 135, 134, 133, 132, 131, 127, 126, 120, 119,
118, 115, 114, 51, 109, 105, 92, 59, 56, 53,
52, 51, 365, 5, 365, 365, 365, 365, 365, 365,
365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
365, 365
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, 34, 35, 34,
34, 36, 34, 37, 38, 39, 34, 40, 41, 42,
43, 44, 45, 34, 34, 34, 46, 47, 52, 52,
52, 52, 55, 62, 56, 58, 59, 64, 63, 67,
72, 65, 61, 68, 73, 75, 69, 76, 77, 70,
74, 81, 71, 84, 86, 78, 94, 66, 79, 82,
87, 80, 88, 85, 83, 95, 96, 97, 101, 104,
89, 105, 90, 107, 91, 102, 111, 92, 117, 98,
108, 112, 103, 99, 52, 52, 55, 100, 56, 122,
124, 125, 129, 150, 118, 123, 140, 158, 126, 151,
152, 130, 156, 161, 366, 159, 170, 180, 131, 366,
171, 141, 142, 157, 162, 153, 111, 184, 185, 154,
191, 112, 197, 181, 192, 199, 220, 221, 365, 364,
363, 362, 361, 360, 359, 200, 358, 198, 222, 48,
48, 48, 48, 50, 50, 50, 50, 109, 109, 357,
109, 110, 110, 110, 110, 113, 356, 113, 113, 355,
354, 353, 352, 351, 350, 349, 348, 347, 346, 345,
344, 343, 342, 341, 340, 339, 338, 337, 336, 335,
334, 333, 332, 331, 330, 329, 328, 327, 326, 325,
324, 323, 322, 321, 320, 319, 318, 317, 316, 315,
314, 313, 312, 311, 310, 309, 308, 307, 306, 305,
304, 303, 302, 301, 300, 299, 298, 297, 296, 295,
294, 293, 292, 291, 290, 289, 288, 287, 286, 285,
284, 283, 282, 281, 280, 279, 278, 277, 276, 275,
274, 273, 272, 271, 270, 269, 268, 267, 266, 265,
264, 263, 262, 261, 260, 259, 258, 257, 256, 255,
254, 253, 252, 251, 250, 249, 248, 247, 246, 245,
244, 243, 242, 241, 240, 239, 238, 237, 236, 235,
234, 233, 232, 231, 230, 229, 228, 227, 226, 225,
224, 223, 219, 218, 217, 216, 215, 214, 213, 212,
211, 210, 209, 208, 207, 206, 205, 204, 203, 202,
201, 196, 195, 194, 193, 190, 189, 188, 187, 186,
183, 182, 179, 178, 177, 176, 175, 174, 173, 115,
114, 172, 169, 168, 167, 166, 165, 164, 163, 160,
155, 149, 148, 147, 146, 145, 144, 143, 139, 138,
137, 136, 135, 134, 133, 132, 128, 127, 121, 120,
119, 116, 115, 114, 106, 93, 60, 57, 54, 53,
366, 51, 51, 49, 49, 7, 366, 366, 366, 366,
366, 366, 366, 366, 366, 366, 366, 366, 366, 366,
366, 366, 366, 366, 366, 366, 366, 366, 366, 366,
366, 366, 366, 366, 366, 366, 366, 366, 366, 366,
366, 366, 366, 366, 366, 366, 366, 366, 366, 366,
366, 366, 366, 366
} ;
static yyconst short int yy_chk[443] =
static yyconst short int yy_chk[445] =
{ 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, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 3, 4,
7, 7, 140, 3, 4, 8, 8, 19, 26, 19,
22, 22, 27, 26, 28, 29, 27, 140, 28, 29,
30, 28, 30, 31, 28, 29, 33, 28, 34, 35,
31, 38, 27, 31, 33, 35, 31, 36, 34, 33,
38, 38, 39, 40, 41, 36, 41, 36, 43, 36,
40, 48, 36, 62, 39, 43, 48, 40, 39, 49,
49, 48, 39, 55, 67, 55, 68, 68, 71, 62,
67, 81, 92, 93, 68, 96, 368, 71, 92, 95,
98, 106, 363, 96, 71, 106, 81, 81, 93, 110,
95, 98, 93, 112, 110, 124, 127, 127, 112, 110,
133, 362, 141, 112, 133, 165, 165, 361, 360, 359,
358, 124, 141, 356, 355, 354, 353, 165, 366, 366,
366, 367, 367, 367, 369, 352, 369, 370, 370, 370,
351, 350, 349, 348, 347, 345, 343, 340, 338, 337,
335, 334, 333, 332, 330, 328, 326, 325, 324, 323,
321, 319, 318, 315, 314, 312, 311, 308, 307, 306,
302, 301, 300, 299, 296, 295, 294, 292, 291, 289,
287, 285, 284, 282, 280, 278, 275, 274, 270, 269,
268, 267, 266, 265, 263, 262, 261, 260, 259, 258,
257, 256, 255, 254, 252, 251, 250, 248, 243, 242,
241, 240, 239, 238, 237, 235, 234, 233, 232, 230,
228, 226, 225, 224, 223, 222, 221, 220, 219, 217,
216, 215, 214, 213, 212, 211, 210, 209, 207, 206,
205, 202, 200, 198, 197, 196, 195, 193, 192, 191,
189, 188, 186, 185, 184, 183, 182, 181, 180, 179,
178, 177, 176, 174, 173, 172, 171, 170, 169, 168,
167, 166, 164, 163, 162, 160, 157, 156, 155, 154,
153, 152, 151, 150, 149, 147, 146, 145, 144, 143,
142, 139, 138, 136, 135, 132, 131, 130, 129, 128,
126, 125, 123, 122, 121, 120, 119, 118, 117, 114,
108, 107, 105, 104, 103, 102, 101, 100, 99, 97,
94, 91, 90, 89, 86, 85, 84, 83, 79, 78,
77, 76, 75, 74, 73, 72, 70, 69, 66, 64,
63, 61, 54, 50, 46, 42, 37, 24, 20, 18,
17, 10, 5, 365, 365, 365, 365, 365, 365, 365,
365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
365, 365, 365, 365, 365, 365, 365, 365, 365, 365,
365, 365
1, 1, 1, 1, 1, 1, 1, 1, 9, 9,
10, 10, 21, 28, 21, 24, 24, 29, 28, 30,
31, 29, 369, 30, 31, 32, 30, 32, 33, 30,
31, 35, 30, 36, 37, 33, 40, 29, 33, 35,
37, 33, 38, 36, 35, 40, 40, 41, 42, 43,
38, 43, 38, 45, 38, 42, 49, 38, 63, 41,
45, 49, 42, 41, 52, 52, 56, 41, 56, 68,
69, 69, 72, 93, 63, 68, 82, 97, 69, 93,
94, 72, 96, 99, 110, 97, 107, 125, 72, 110,
107, 82, 82, 96, 99, 94, 111, 128, 128, 94,
134, 111, 141, 125, 134, 142, 166, 166, 364, 363,
362, 361, 360, 359, 357, 142, 356, 141, 166, 367,
367, 367, 367, 368, 368, 368, 368, 370, 370, 355,
370, 371, 371, 371, 371, 372, 354, 372, 372, 353,
352, 351, 350, 349, 348, 346, 344, 341, 339, 338,
336, 335, 334, 333, 331, 329, 327, 326, 325, 324,
322, 320, 319, 316, 315, 313, 312, 309, 308, 307,
303, 302, 301, 300, 297, 296, 295, 293, 292, 290,
288, 286, 285, 283, 281, 279, 276, 275, 271, 270,
269, 268, 267, 266, 264, 263, 262, 261, 260, 259,
258, 257, 256, 255, 253, 252, 251, 249, 244, 243,
242, 241, 240, 239, 238, 236, 235, 234, 233, 231,
229, 227, 226, 225, 224, 223, 222, 221, 220, 218,
217, 216, 215, 214, 213, 212, 211, 210, 208, 207,
206, 203, 201, 199, 198, 197, 196, 194, 193, 192,
190, 189, 187, 186, 185, 184, 183, 182, 181, 180,
179, 178, 177, 175, 174, 173, 172, 171, 170, 169,
168, 167, 165, 164, 163, 161, 158, 157, 156, 155,
154, 153, 152, 151, 150, 148, 147, 146, 145, 144,
143, 140, 139, 137, 136, 133, 132, 131, 130, 129,
127, 126, 124, 123, 122, 121, 120, 119, 118, 115,
114, 108, 106, 105, 104, 103, 102, 101, 100, 98,
95, 92, 91, 90, 87, 86, 85, 84, 80, 79,
78, 77, 76, 75, 74, 73, 71, 70, 67, 65,
64, 62, 55, 51, 44, 39, 26, 22, 20, 19,
7, 6, 5, 4, 3, 366, 366, 366, 366, 366,
366, 366, 366, 366, 366, 366, 366, 366, 366, 366,
366, 366, 366, 366, 366, 366, 366, 366, 366, 366,
366, 366, 366, 366, 366, 366, 366, 366, 366, 366,
366, 366, 366, 366, 366, 366, 366, 366, 366, 366,
366, 366, 366, 366
} ;
static yy_state_type yy_last_accepting_state;
......@@ -613,7 +617,13 @@ How to make the InnoDB parser and lexer C files:
These instructions seem to work at least with bison-1.28 and flex-2.5.4 on
Linux.
*******************************************************/
#line 36 "pars0lex.l"
#define YY_NEVER_INTERACTIVE 1
#define YY_NO_INPUT 1
#define YY_NO_UNPUT 1
#define YY_NO_SCAN_BUFFER 1
#define YY_NO_SCAN_BYTES 1
#define YY_NO_SCAN_STRING 1
#line 52 "pars0lex.l"
#define YYSTYPE que_node_t*
#include "univ.i"
......@@ -623,16 +633,46 @@ Linux.
#include "mem0mem.h"
#include "os0proc.h"
#define isatty(A) 0
#define malloc(A) mem_alloc(A)
#define free(A) mem_free(A)
#define realloc(P, A) mem_realloc(P, A, __FILE__, __LINE__)
#define exit(A) ut_error
#define YY_INPUT(buf, result, max_size) pars_get_lex_chars(buf, &result, max_size)
/* String buffer for removing quotes */
static ulint stringbuf_len_alloc = 0; /* Allocated length */
static ulint stringbuf_len = 0; /* Current length */
static char* stringbuf; /* Start of buffer */
/* Appends a string to the buffer. */
static
void
string_append(
/*==========*/
const char* str, /* in: string to be appended */
ulint len) /* in: length of the string */
{
if (stringbuf_len + len > stringbuf_len_alloc) {
if (stringbuf_len_alloc == 0) {
stringbuf_len_alloc++;
}
while (stringbuf_len + len > stringbuf_len_alloc) {
stringbuf_len_alloc <<= 1;
}
stringbuf = stringbuf
? realloc(stringbuf, stringbuf_len_alloc)
: malloc(stringbuf_len_alloc);
}
memcpy(stringbuf + stringbuf_len, str, len);
stringbuf_len += len;
}
#define comment 1
#line 632 "lex.yy.c"
#define quoted 2
#line 676 "lex.yy.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
......@@ -783,10 +823,10 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
#line 57 "pars0lex.l"
#line 102 "pars0lex.l"
#line 786 "lex.yy.c"
#line 830 "lex.yy.c"
if ( yy_init )
{
......@@ -837,13 +877,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 366 )
if ( yy_current_state >= 367 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_base[yy_current_state] != 394 );
while ( yy_base[yy_current_state] != 396 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
......@@ -871,7 +911,7 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
#line 59 "pars0lex.l"
#line 104 "pars0lex.l"
{
yylval = sym_tab_add_int_lit(pars_sym_tab_global,
atoi(yytext));
......@@ -880,7 +920,7 @@ YY_RULE_SETUP
YY_BREAK
case 2:
YY_RULE_SETUP
#line 65 "pars0lex.l"
#line 110 "pars0lex.l"
{
ut_error; /* not implemented */
......@@ -889,542 +929,556 @@ YY_RULE_SETUP
YY_BREAK
case 3:
YY_RULE_SETUP
#line 71 "pars0lex.l"
#line 116 "pars0lex.l"
{
/* Remove the single quotes around the string */
yylval = sym_tab_add_str_lit(pars_sym_tab_global,
(byte*)yytext,
ut_strlen(yytext));
return(PARS_STR_LIT);
BEGIN(quoted);
stringbuf_len = 0;
}
YY_BREAK
case 4:
YY_RULE_SETUP
#line 80 "pars0lex.l"
#line 120 "pars0lex.l"
string_append(yytext, yyleng);
YY_BREAK
case 5:
YY_RULE_SETUP
#line 121 "pars0lex.l"
{ string_append(yytext, yyleng / 2);
if (yyleng % 2) {
BEGIN(INITIAL);
yylval = sym_tab_add_str_lit(
pars_sym_tab_global,
stringbuf, stringbuf_len);
return(PARS_STR_LIT);
}
}
YY_BREAK
case 6:
YY_RULE_SETUP
#line 131 "pars0lex.l"
{
yylval = sym_tab_add_null_lit(pars_sym_tab_global);
return(PARS_NULL_LIT);
}
YY_BREAK
case 5:
case 7:
YY_RULE_SETUP
#line 86 "pars0lex.l"
#line 137 "pars0lex.l"
{
/* Implicit cursor name */
yylval = sym_tab_add_str_lit(pars_sym_tab_global,
(byte*)"\'SQL\'", 5);
yytext, yyleng);
return(PARS_SQL_TOKEN);
}
YY_BREAK
case 6:
case 8:
YY_RULE_SETUP
#line 93 "pars0lex.l"
#line 144 "pars0lex.l"
{
return(PARS_AND_TOKEN);
}
YY_BREAK
case 7:
case 9:
YY_RULE_SETUP
#line 97 "pars0lex.l"
#line 148 "pars0lex.l"
{
return(PARS_OR_TOKEN);
}
YY_BREAK
case 8:
case 10:
YY_RULE_SETUP
#line 101 "pars0lex.l"
#line 152 "pars0lex.l"
{
return(PARS_NOT_TOKEN);
}
YY_BREAK
case 9:
case 11:
YY_RULE_SETUP
#line 105 "pars0lex.l"
#line 156 "pars0lex.l"
{
return(PARS_PROCEDURE_TOKEN);
}
YY_BREAK
case 10:
case 12:
YY_RULE_SETUP
#line 109 "pars0lex.l"
#line 160 "pars0lex.l"
{
return(PARS_IN_TOKEN);
}
YY_BREAK
case 11:
case 13:
YY_RULE_SETUP
#line 113 "pars0lex.l"
#line 164 "pars0lex.l"
{
return(PARS_OUT_TOKEN);
}
YY_BREAK
case 12:
case 14:
YY_RULE_SETUP
#line 117 "pars0lex.l"
#line 168 "pars0lex.l"
{
return(PARS_INT_TOKEN);
}
YY_BREAK
case 13:
case 15:
YY_RULE_SETUP
#line 121 "pars0lex.l"
#line 172 "pars0lex.l"
{
return(PARS_INT_TOKEN);
}
YY_BREAK
case 14:
case 16:
YY_RULE_SETUP
#line 125 "pars0lex.l"
#line 176 "pars0lex.l"
{
return(PARS_FLOAT_TOKEN);
}
YY_BREAK
case 15:
case 17:
YY_RULE_SETUP
#line 129 "pars0lex.l"
#line 180 "pars0lex.l"
{
return(PARS_CHAR_TOKEN);
}
YY_BREAK
case 16:
case 18:
YY_RULE_SETUP
#line 133 "pars0lex.l"
#line 184 "pars0lex.l"
{
return(PARS_IS_TOKEN);
}
YY_BREAK
case 17:
case 19:
YY_RULE_SETUP
#line 137 "pars0lex.l"
#line 188 "pars0lex.l"
{
return(PARS_BEGIN_TOKEN);
}
YY_BREAK
case 18:
case 20:
YY_RULE_SETUP
#line 141 "pars0lex.l"
#line 192 "pars0lex.l"
{
return(PARS_END_TOKEN);
}
YY_BREAK
case 19:
case 21:
YY_RULE_SETUP
#line 145 "pars0lex.l"
#line 196 "pars0lex.l"
{
return(PARS_IF_TOKEN);
}
YY_BREAK
case 20:
case 22:
YY_RULE_SETUP
#line 149 "pars0lex.l"
#line 200 "pars0lex.l"
{
return(PARS_THEN_TOKEN);
}
YY_BREAK
case 21:
case 23:
YY_RULE_SETUP
#line 153 "pars0lex.l"
#line 204 "pars0lex.l"
{
return(PARS_ELSE_TOKEN);
}
YY_BREAK
case 22:
case 24:
YY_RULE_SETUP
#line 157 "pars0lex.l"
#line 208 "pars0lex.l"
{
return(PARS_ELSIF_TOKEN);
}
YY_BREAK
case 23:
case 25:
YY_RULE_SETUP
#line 161 "pars0lex.l"
#line 212 "pars0lex.l"
{
return(PARS_LOOP_TOKEN);
}
YY_BREAK
case 24:
case 26:
YY_RULE_SETUP
#line 165 "pars0lex.l"
#line 216 "pars0lex.l"
{
return(PARS_WHILE_TOKEN);
}
YY_BREAK
case 25:
case 27:
YY_RULE_SETUP
#line 169 "pars0lex.l"
#line 220 "pars0lex.l"
{
return(PARS_RETURN_TOKEN);
}
YY_BREAK
case 26:
case 28:
YY_RULE_SETUP
#line 173 "pars0lex.l"
#line 224 "pars0lex.l"
{
return(PARS_SELECT_TOKEN);
}
YY_BREAK
case 27:
case 29:
YY_RULE_SETUP
#line 177 "pars0lex.l"
#line 228 "pars0lex.l"
{
return(PARS_SUM_TOKEN);
}
YY_BREAK
case 28:
case 30:
YY_RULE_SETUP
#line 181 "pars0lex.l"
#line 232 "pars0lex.l"
{
return(PARS_COUNT_TOKEN);
}
YY_BREAK
case 29:
case 31:
YY_RULE_SETUP
#line 185 "pars0lex.l"
#line 236 "pars0lex.l"
{
return(PARS_DISTINCT_TOKEN);
}
YY_BREAK
case 30:
case 32:
YY_RULE_SETUP
#line 189 "pars0lex.l"
#line 240 "pars0lex.l"
{
return(PARS_FROM_TOKEN);
}
YY_BREAK
case 31:
case 33:
YY_RULE_SETUP
#line 193 "pars0lex.l"
#line 244 "pars0lex.l"
{
return(PARS_WHERE_TOKEN);
}
YY_BREAK
case 32:
case 34:
YY_RULE_SETUP
#line 197 "pars0lex.l"
#line 248 "pars0lex.l"
{
return(PARS_FOR_TOKEN);
}
YY_BREAK
case 33:
case 35:
YY_RULE_SETUP
#line 201 "pars0lex.l"
#line 252 "pars0lex.l"
{
return(PARS_CONSISTENT_TOKEN);
}
YY_BREAK
case 34:
case 36:
YY_RULE_SETUP
#line 205 "pars0lex.l"
#line 256 "pars0lex.l"
{
return(PARS_READ_TOKEN);
}
YY_BREAK
case 35:
case 37:
YY_RULE_SETUP
#line 209 "pars0lex.l"
#line 260 "pars0lex.l"
{
return(PARS_ORDER_TOKEN);
}
YY_BREAK
case 36:
case 38:
YY_RULE_SETUP
#line 213 "pars0lex.l"
#line 264 "pars0lex.l"
{
return(PARS_BY_TOKEN);
}
YY_BREAK
case 37:
case 39:
YY_RULE_SETUP
#line 217 "pars0lex.l"
#line 268 "pars0lex.l"
{
return(PARS_ASC_TOKEN);
}
YY_BREAK
case 38:
case 40:
YY_RULE_SETUP
#line 221 "pars0lex.l"
#line 272 "pars0lex.l"
{
return(PARS_DESC_TOKEN);
}
YY_BREAK
case 39:
case 41:
YY_RULE_SETUP
#line 225 "pars0lex.l"
#line 276 "pars0lex.l"
{
return(PARS_INSERT_TOKEN);
}
YY_BREAK
case 40:
case 42:
YY_RULE_SETUP
#line 229 "pars0lex.l"
#line 280 "pars0lex.l"
{
return(PARS_INTO_TOKEN);
}
YY_BREAK
case 41:
case 43:
YY_RULE_SETUP
#line 233 "pars0lex.l"
#line 284 "pars0lex.l"
{
return(PARS_VALUES_TOKEN);
}
YY_BREAK
case 42:
case 44:
YY_RULE_SETUP
#line 237 "pars0lex.l"
#line 288 "pars0lex.l"
{
return(PARS_UPDATE_TOKEN);
}
YY_BREAK
case 43:
case 45:
YY_RULE_SETUP
#line 241 "pars0lex.l"
#line 292 "pars0lex.l"
{
return(PARS_SET_TOKEN);
}
YY_BREAK
case 44:
case 46:
YY_RULE_SETUP
#line 245 "pars0lex.l"
#line 296 "pars0lex.l"
{
return(PARS_DELETE_TOKEN);
}
YY_BREAK
case 45:
case 47:
YY_RULE_SETUP
#line 249 "pars0lex.l"
#line 300 "pars0lex.l"
{
return(PARS_CURRENT_TOKEN);
}
YY_BREAK
case 46:
case 48:
YY_RULE_SETUP
#line 253 "pars0lex.l"
#line 304 "pars0lex.l"
{
return(PARS_OF_TOKEN);
}
YY_BREAK
case 47:
case 49:
YY_RULE_SETUP
#line 257 "pars0lex.l"
#line 308 "pars0lex.l"
{
return(PARS_CREATE_TOKEN);
}
YY_BREAK
case 48:
case 50:
YY_RULE_SETUP
#line 261 "pars0lex.l"
#line 312 "pars0lex.l"
{
return(PARS_TABLE_TOKEN);
}
YY_BREAK
case 49:
case 51:
YY_RULE_SETUP
#line 265 "pars0lex.l"
#line 316 "pars0lex.l"
{
return(PARS_INDEX_TOKEN);
}
YY_BREAK
case 50:
case 52:
YY_RULE_SETUP
#line 269 "pars0lex.l"
#line 320 "pars0lex.l"
{
return(PARS_UNIQUE_TOKEN);
}
YY_BREAK
case 51:
case 53:
YY_RULE_SETUP
#line 273 "pars0lex.l"
#line 324 "pars0lex.l"
{
return(PARS_CLUSTERED_TOKEN);
}
YY_BREAK
case 52:
case 54:
YY_RULE_SETUP
#line 277 "pars0lex.l"
#line 328 "pars0lex.l"
{
return(PARS_DOES_NOT_FIT_IN_MEM_TOKEN);
}
YY_BREAK
case 53:
case 55:
YY_RULE_SETUP
#line 281 "pars0lex.l"
#line 332 "pars0lex.l"
{
return(PARS_ON_TOKEN);
}
YY_BREAK
case 54:
case 56:
YY_RULE_SETUP
#line 285 "pars0lex.l"
#line 336 "pars0lex.l"
{
return(PARS_DECLARE_TOKEN);
}
YY_BREAK
case 55:
case 57:
YY_RULE_SETUP
#line 289 "pars0lex.l"
#line 340 "pars0lex.l"
{
return(PARS_CURSOR_TOKEN);
}
YY_BREAK
case 56:
case 58:
YY_RULE_SETUP
#line 293 "pars0lex.l"
#line 344 "pars0lex.l"
{
return(PARS_OPEN_TOKEN);
}
YY_BREAK
case 57:
case 59:
YY_RULE_SETUP
#line 297 "pars0lex.l"
#line 348 "pars0lex.l"
{
return(PARS_FETCH_TOKEN);
}
YY_BREAK
case 58:
case 60:
YY_RULE_SETUP
#line 301 "pars0lex.l"
#line 352 "pars0lex.l"
{
return(PARS_CLOSE_TOKEN);
}
YY_BREAK
case 59:
case 61:
YY_RULE_SETUP
#line 305 "pars0lex.l"
#line 356 "pars0lex.l"
{
return(PARS_NOTFOUND_TOKEN);
}
YY_BREAK
case 60:
case 62:
YY_RULE_SETUP
#line 309 "pars0lex.l"
#line 360 "pars0lex.l"
{
return(PARS_TO_CHAR_TOKEN);
}
YY_BREAK
case 61:
case 63:
YY_RULE_SETUP
#line 313 "pars0lex.l"
#line 364 "pars0lex.l"
{
return(PARS_TO_NUMBER_TOKEN);
}
YY_BREAK
case 62:
case 64:
YY_RULE_SETUP
#line 317 "pars0lex.l"
#line 368 "pars0lex.l"
{
return(PARS_TO_BINARY_TOKEN);
}
YY_BREAK
case 63:
case 65:
YY_RULE_SETUP
#line 321 "pars0lex.l"
#line 372 "pars0lex.l"
{
return(PARS_BINARY_TO_NUMBER_TOKEN);
}
YY_BREAK
case 64:
case 66:
YY_RULE_SETUP
#line 325 "pars0lex.l"
#line 376 "pars0lex.l"
{
return(PARS_SUBSTR_TOKEN);
}
YY_BREAK
case 65:
case 67:
YY_RULE_SETUP
#line 329 "pars0lex.l"
#line 380 "pars0lex.l"
{
return(PARS_REPLSTR_TOKEN);
}
YY_BREAK
case 66:
case 68:
YY_RULE_SETUP
#line 333 "pars0lex.l"
#line 384 "pars0lex.l"
{
return(PARS_CONCAT_TOKEN);
}
YY_BREAK
case 67:
case 69:
YY_RULE_SETUP
#line 337 "pars0lex.l"
#line 388 "pars0lex.l"
{
return(PARS_INSTR_TOKEN);
}
YY_BREAK
case 68:
case 70:
YY_RULE_SETUP
#line 341 "pars0lex.l"
#line 392 "pars0lex.l"
{
return(PARS_LENGTH_TOKEN);
}
YY_BREAK
case 69:
case 71:
YY_RULE_SETUP
#line 345 "pars0lex.l"
#line 396 "pars0lex.l"
{
return(PARS_SYSDATE_TOKEN);
}
YY_BREAK
case 70:
case 72:
YY_RULE_SETUP
#line 349 "pars0lex.l"
#line 400 "pars0lex.l"
{
return(PARS_PRINTF_TOKEN);
}
YY_BREAK
case 71:
case 73:
YY_RULE_SETUP
#line 353 "pars0lex.l"
#line 404 "pars0lex.l"
{
return(PARS_ASSERT_TOKEN);
}
YY_BREAK
case 72:
case 74:
YY_RULE_SETUP
#line 357 "pars0lex.l"
#line 408 "pars0lex.l"
{
return(PARS_RND_TOKEN);
}
YY_BREAK
case 73:
case 75:
YY_RULE_SETUP
#line 361 "pars0lex.l"
#line 412 "pars0lex.l"
{
return(PARS_RND_STR_TOKEN);
}
YY_BREAK
case 74:
case 76:
YY_RULE_SETUP
#line 365 "pars0lex.l"
#line 416 "pars0lex.l"
{
return(PARS_ROW_PRINTF_TOKEN);
}
YY_BREAK
case 75:
case 77:
YY_RULE_SETUP
#line 369 "pars0lex.l"
#line 420 "pars0lex.l"
{
return(PARS_COMMIT_TOKEN);
}
YY_BREAK
case 76:
case 78:
YY_RULE_SETUP
#line 373 "pars0lex.l"
#line 424 "pars0lex.l"
{
return(PARS_ROLLBACK_TOKEN);
}
YY_BREAK
case 77:
case 79:
YY_RULE_SETUP
#line 377 "pars0lex.l"
#line 428 "pars0lex.l"
{
return(PARS_WORK_TOKEN);
}
YY_BREAK
case 78:
case 80:
YY_RULE_SETUP
#line 381 "pars0lex.l"
#line 432 "pars0lex.l"
{
yylval = sym_tab_add_id(pars_sym_tab_global,
(byte*)yytext,
......@@ -1432,60 +1486,44 @@ YY_RULE_SETUP
return(PARS_ID_TOKEN);
}
YY_BREAK
case 79:
YY_RULE_SETUP
#line 388 "pars0lex.l"
{
return(PARS_DDOT_TOKEN);
}
YY_BREAK
case 80:
YY_RULE_SETUP
#line 392 "pars0lex.l"
{
return(PARS_ASSIGN_TOKEN);
}
YY_BREAK
case 81:
YY_RULE_SETUP
#line 396 "pars0lex.l"
#line 439 "pars0lex.l"
{
return(PARS_LE_TOKEN);
return(PARS_DDOT_TOKEN);
}
YY_BREAK
case 82:
YY_RULE_SETUP
#line 400 "pars0lex.l"
#line 443 "pars0lex.l"
{
return(PARS_GE_TOKEN);
return(PARS_ASSIGN_TOKEN);
}
YY_BREAK
case 83:
YY_RULE_SETUP
#line 404 "pars0lex.l"
#line 447 "pars0lex.l"
{
return(PARS_NE_TOKEN);
return(PARS_LE_TOKEN);
}
YY_BREAK
case 84:
YY_RULE_SETUP
#line 408 "pars0lex.l"
#line 451 "pars0lex.l"
{
return((int)(*yytext));
return(PARS_GE_TOKEN);
}
YY_BREAK
case 85:
YY_RULE_SETUP
#line 413 "pars0lex.l"
#line 455 "pars0lex.l"
{
return((int)(*yytext));
return(PARS_NE_TOKEN);
}
YY_BREAK
case 86:
YY_RULE_SETUP
#line 418 "pars0lex.l"
#line 459 "pars0lex.l"
{
return((int)(*yytext));
......@@ -1493,7 +1531,7 @@ YY_RULE_SETUP
YY_BREAK
case 87:
YY_RULE_SETUP
#line 423 "pars0lex.l"
#line 464 "pars0lex.l"
{
return((int)(*yytext));
......@@ -1501,7 +1539,7 @@ YY_RULE_SETUP
YY_BREAK
case 88:
YY_RULE_SETUP
#line 428 "pars0lex.l"
#line 469 "pars0lex.l"
{
return((int)(*yytext));
......@@ -1509,7 +1547,7 @@ YY_RULE_SETUP
YY_BREAK
case 89:
YY_RULE_SETUP
#line 433 "pars0lex.l"
#line 474 "pars0lex.l"
{
return((int)(*yytext));
......@@ -1517,7 +1555,7 @@ YY_RULE_SETUP
YY_BREAK
case 90:
YY_RULE_SETUP
#line 438 "pars0lex.l"
#line 479 "pars0lex.l"
{
return((int)(*yytext));
......@@ -1525,7 +1563,7 @@ YY_RULE_SETUP
YY_BREAK
case 91:
YY_RULE_SETUP
#line 443 "pars0lex.l"
#line 484 "pars0lex.l"
{
return((int)(*yytext));
......@@ -1533,7 +1571,7 @@ YY_RULE_SETUP
YY_BREAK
case 92:
YY_RULE_SETUP
#line 448 "pars0lex.l"
#line 489 "pars0lex.l"
{
return((int)(*yytext));
......@@ -1541,7 +1579,7 @@ YY_RULE_SETUP
YY_BREAK
case 93:
YY_RULE_SETUP
#line 453 "pars0lex.l"
#line 494 "pars0lex.l"
{
return((int)(*yytext));
......@@ -1549,7 +1587,7 @@ YY_RULE_SETUP
YY_BREAK
case 94:
YY_RULE_SETUP
#line 458 "pars0lex.l"
#line 499 "pars0lex.l"
{
return((int)(*yytext));
......@@ -1557,7 +1595,7 @@ YY_RULE_SETUP
YY_BREAK
case 95:
YY_RULE_SETUP
#line 463 "pars0lex.l"
#line 504 "pars0lex.l"
{
return((int)(*yytext));
......@@ -1565,7 +1603,7 @@ YY_RULE_SETUP
YY_BREAK
case 96:
YY_RULE_SETUP
#line 468 "pars0lex.l"
#line 509 "pars0lex.l"
{
return((int)(*yytext));
......@@ -1573,7 +1611,7 @@ YY_RULE_SETUP
YY_BREAK
case 97:
YY_RULE_SETUP
#line 473 "pars0lex.l"
#line 514 "pars0lex.l"
{
return((int)(*yytext));
......@@ -1581,7 +1619,7 @@ YY_RULE_SETUP
YY_BREAK
case 98:
YY_RULE_SETUP
#line 478 "pars0lex.l"
#line 519 "pars0lex.l"
{
return((int)(*yytext));
......@@ -1589,44 +1627,51 @@ YY_RULE_SETUP
YY_BREAK
case 99:
YY_RULE_SETUP
#line 483 "pars0lex.l"
BEGIN(comment); /* eat up comment */
#line 524 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
case 100:
YY_RULE_SETUP
#line 485 "pars0lex.l"
#line 529 "pars0lex.l"
{
return((int)(*yytext));
}
YY_BREAK
case 101:
YY_RULE_SETUP
#line 486 "pars0lex.l"
#line 534 "pars0lex.l"
BEGIN(comment); /* eat up comment */
YY_BREAK
case 102:
YY_RULE_SETUP
#line 487 "pars0lex.l"
#line 536 "pars0lex.l"
YY_BREAK
case 103:
YY_RULE_SETUP
#line 488 "pars0lex.l"
#line 537 "pars0lex.l"
YY_BREAK
case 104:
YY_RULE_SETUP
#line 489 "pars0lex.l"
#line 538 "pars0lex.l"
BEGIN(INITIAL);
YY_BREAK
case 105:
YY_RULE_SETUP
#line 491 "pars0lex.l"
#line 540 "pars0lex.l"
/* eat up whitespace */
YY_BREAK
case 106:
YY_RULE_SETUP
#line 494 "pars0lex.l"
#line 543 "pars0lex.l"
{
printf("Unrecognized character: %s\n", yytext);
fprintf(stderr,"Unrecognized character: %02x\n",
*yytext);
ut_error;
......@@ -1635,12 +1680,13 @@ YY_RULE_SETUP
YY_BREAK
case 107:
YY_RULE_SETUP
#line 502 "pars0lex.l"
ECHO;
#line 552 "pars0lex.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
#line 1638 "lex.yy.c"
#line 1687 "lex.yy.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(comment):
case YY_STATE_EOF(quoted):
yyterminate();
case YY_END_OF_BUFFER:
......@@ -1931,7 +1977,7 @@ static yy_state_type yy_get_previous_state()
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 366 )
if ( yy_current_state >= 367 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
......@@ -1966,11 +2012,11 @@ yy_state_type yy_current_state;
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 366 )
if ( yy_current_state >= 367 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 365);
yy_is_jam = (yy_current_state == 366);
return yy_is_jam ? 0 : yy_current_state;
}
......@@ -2205,7 +2251,7 @@ YY_BUFFER_STATE b;
#ifndef YY_ALWAYS_INTERACTIVE
#ifndef YY_NEVER_INTERACTIVE
extern int isatty YY_PROTO(( int ));
#endif
#endif
......@@ -2525,5 +2571,5 @@ int main()
return 0;
}
#endif
#line 502 "pars0lex.l"
#line 552 "pars0lex.l"
......@@ -35,6 +35,19 @@ These instructions seem to work at least with bison-1.28 and flex-2.5.4 on
Linux.
*******************************************************/
%option nostdinit
%option 8bit
%option warn
%option pointer
%option never-interactive
%option nodefault
%option noinput
%option nounput
%option noyywrap
%option noyy_scan_buffer
%option noyy_scan_bytes
%option noyy_scan_string
%{
#define YYSTYPE que_node_t*
......@@ -45,18 +58,47 @@ Linux.
#include "mem0mem.h"
#include "os0proc.h"
#define isatty(A) 0
#define malloc(A) mem_alloc(A)
#define free(A) mem_free(A)
#define realloc(P, A) mem_realloc(P, A, __FILE__, __LINE__)
#define exit(A) ut_a(0)
#define exit(A) ut_error
#define YY_INPUT(buf, result, max_size) pars_get_lex_chars(buf, &result, max_size)
/* String buffer for removing quotes */
static ulint stringbuf_len_alloc = 0; /* Allocated length */
static ulint stringbuf_len = 0; /* Current length */
static char* stringbuf; /* Start of buffer */
/* Appends a string to the buffer. */
static
void
string_append(
/*==========*/
const char* str, /* in: string to be appended */
ulint len) /* in: length of the string */
{
if (stringbuf_len + len > stringbuf_len_alloc) {
if (stringbuf_len_alloc == 0) {
stringbuf_len_alloc++;
}
while (stringbuf_len + len > stringbuf_len_alloc) {
stringbuf_len_alloc <<= 1;
}
stringbuf = stringbuf
? realloc(stringbuf, stringbuf_len_alloc)
: malloc(stringbuf_len_alloc);
}
memcpy(stringbuf + stringbuf_len, str, len);
stringbuf_len += len;
}
%}
DIGIT [0-9]
ID [a-z_A-Z][a-z_A-Z0-9]*
%x comment
%x quoted
%%
{DIGIT}+ {
......@@ -71,13 +113,19 @@ ID [a-z_A-Z][a-z_A-Z0-9]*
return(PARS_FLOAT_LIT);
}
"\'"[^\']*"\'" {
/* Remove the single quotes around the string */
yylval = sym_tab_add_str_lit(pars_sym_tab_global,
(byte*)yytext,
ut_strlen(yytext));
"'" {
BEGIN(quoted);
stringbuf_len = 0;
}
<quoted>[^\']+ string_append(yytext, yyleng);
<quoted>"'"+ { string_append(yytext, yyleng / 2);
if (yyleng % 2) {
BEGIN(INITIAL);
yylval = sym_tab_add_str_lit(
pars_sym_tab_global,
stringbuf, stringbuf_len);
return(PARS_STR_LIT);
}
}
"NULL" {
......@@ -89,7 +137,7 @@ ID [a-z_A-Z][a-z_A-Z0-9]*
"SQL" {
/* Implicit cursor name */
yylval = sym_tab_add_str_lit(pars_sym_tab_global,
(byte*)"\'SQL\'", 5);
yytext, yyleng);
return(PARS_SQL_TOKEN);
}
......@@ -485,17 +533,16 @@ ID [a-z_A-Z][a-z_A-Z0-9]*
"/*" BEGIN(comment); /* eat up comment */
<comment>[^*\n]*
<comment>[^*\n]*\n
<comment>"*"+[^*/\n]*
<comment>"*"+[^*/\n]*\n
<comment>[^*]*
<comment>"*"+[^*/]*
<comment>"*"+"/" BEGIN(INITIAL);
[ \t\n]+ /* eat up whitespace */
. {
printf("Unrecognized character: %s\n", yytext);
fprintf(stderr,"Unrecognized character: %02x\n",
*yytext);
ut_error;
......
......@@ -1707,17 +1707,6 @@ pars_get_lex_chars(
pars_sym_tab_global->next_char_pos += len;
}
/*****************************************************************
Instructs the lexical analyzer to stop when it receives the EOF integer. */
int
yywrap(void)
/*========*/
/* out: returns TRUE */
{
return(1);
}
/*****************************************************************
Called by yyparse on error. */
......
......@@ -127,18 +127,12 @@ sym_tab_add_str_lit(
/*================*/
/* out: symbol table node */
sym_tab_t* sym_tab, /* in: symbol table */
byte* str, /* in: string starting with a single
quote; the string literal will
extend to the next single quote, but
the quotes are not included in it */
byte* str, /* in: string with no quotes around
it */
ulint len) /* in: string length */
{
sym_node_t* node;
byte* data;
ulint i;
ut_a(len > 1);
ut_a(str[0] == '\'');
node = mem_heap_alloc(sym_tab->heap, sizeof(sym_node_t));
......@@ -151,23 +145,14 @@ sym_tab_add_str_lit(
dtype_set(&(node->common.val.type), DATA_VARCHAR, DATA_ENGLISH, 0, 0);
for (i = 1;; i++) {
ut_a(i < len);
if (str[i] == '\'') {
break;
}
}
if (i > 1) {
data = mem_heap_alloc(sym_tab->heap, i - 1);
ut_memcpy(data, str + 1, i - 1);
if (len) {
data = mem_heap_alloc(sym_tab->heap, len);
ut_memcpy(data, str, len);
} else {
data = NULL;
}
dfield_set_data(&(node->common.val), data, i - 1);
dfield_set_data(&(node->common.val), data, len);
node->common.val_buf_size = 0;
node->prefetch_buf = NULL;
......
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