mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 17:33:44 +01:00
Support user-function callbacks for processing results of FETCH statements
in InnoDB's SQL parser.
This commit is contained in:
parent
cf058e6542
commit
148369f5b1
14 changed files with 1156 additions and 901 deletions
|
@ -1229,7 +1229,7 @@ dict_create_or_check_foreign_constraint_tables(void)
|
|||
"COMMIT WORK;\n"
|
||||
"END;\n";
|
||||
|
||||
graph = pars_sql(str);
|
||||
graph = pars_sql(NULL, str);
|
||||
|
||||
ut_a(graph);
|
||||
|
||||
|
@ -1403,7 +1403,7 @@ loop:
|
|||
|
||||
ut_a(sqlend == sql + len + 1);
|
||||
|
||||
graph = pars_sql(sql);
|
||||
graph = pars_sql(NULL, sql);
|
||||
|
||||
ut_a(graph);
|
||||
|
||||
|
|
|
@ -116,7 +116,8 @@
|
|||
PARS_WORK_TOKEN = 342,
|
||||
PARS_UNSIGNED_TOKEN = 343,
|
||||
PARS_EXIT_TOKEN = 344,
|
||||
NEG = 345
|
||||
PARS_FUNCTION_TOKEN = 345,
|
||||
NEG = 346
|
||||
};
|
||||
#endif
|
||||
#define PARS_INT_LIT 258
|
||||
|
@ -206,7 +207,8 @@
|
|||
#define PARS_WORK_TOKEN 342
|
||||
#define PARS_UNSIGNED_TOKEN 343
|
||||
#define PARS_EXIT_TOKEN 344
|
||||
#define NEG 345
|
||||
#define PARS_FUNCTION_TOKEN 345
|
||||
#define NEG 346
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ que_t*
|
|||
pars_sql(
|
||||
/*=====*/
|
||||
/* out, own: the query graph */
|
||||
pars_info_t* info, /* in: extra information, or NULL */
|
||||
const char* str); /* in: SQL string */
|
||||
/*****************************************************************
|
||||
Retrieves characters to the lexical analyzer. */
|
||||
|
@ -157,6 +158,15 @@ pars_cursor_declaration(
|
|||
table */
|
||||
sel_node_t* select_node); /* in: select node */
|
||||
/*************************************************************************
|
||||
Parses a function declaration. */
|
||||
|
||||
que_node_t*
|
||||
pars_function_declaration(
|
||||
/*======================*/
|
||||
/* out: sym_node */
|
||||
sym_node_t* sym_node); /* in: function id node in the symbol
|
||||
table */
|
||||
/*************************************************************************
|
||||
Parses a select statement. */
|
||||
|
||||
sel_node_t*
|
||||
|
@ -301,14 +311,16 @@ pars_assignment_statement(
|
|||
sym_node_t* var, /* in: variable to assign */
|
||||
que_node_t* val); /* in: value to assign */
|
||||
/*************************************************************************
|
||||
Parses a fetch statement. */
|
||||
Parses a fetch statement. into_list or user_func (but not both) must be
|
||||
non-NULL. */
|
||||
|
||||
fetch_node_t*
|
||||
pars_fetch_statement(
|
||||
/*=================*/
|
||||
/* out: fetch statement node */
|
||||
sym_node_t* cursor, /* in: cursor node */
|
||||
sym_node_t* into_list); /* in: variables to set */
|
||||
sym_node_t* into_list, /* in: variables to set, or NULL */
|
||||
sym_node_t* user_func); /* in: user function name, or NULL */
|
||||
/*************************************************************************
|
||||
Parses an open or close cursor statement. */
|
||||
|
||||
|
@ -427,6 +439,39 @@ pars_complete_graph_for_exec(
|
|||
trx_t* trx, /* in: transaction handle */
|
||||
mem_heap_t* heap); /* in: memory heap from which allocated */
|
||||
|
||||
/********************************************************************
|
||||
Get user function with the given name.*/
|
||||
|
||||
pars_user_func_t*
|
||||
pars_info_get_user_func(
|
||||
/*====================*/
|
||||
/* out: user func, or NULL if not
|
||||
found */
|
||||
pars_info_t* info, /* in: info struct */
|
||||
const char* name); /* in: function name to find*/
|
||||
|
||||
|
||||
/* Extra information (possibly) supplied for pars_sql(). */
|
||||
struct pars_info_struct {
|
||||
pars_user_func_t* funcs; /* User functions, owned by
|
||||
the user, who's responsible
|
||||
for freeing them as
|
||||
necessary. */
|
||||
ulint n_funcs; /* number of user functions */
|
||||
};
|
||||
|
||||
/* Type of the user functions. The first argument is always InnoDB-supplied
|
||||
and varies in type, while 'user_arg' is a user-supplied argument. The
|
||||
meaning of the return type also varies. See the individual use cases, e.g.
|
||||
the FETCH statement, for details on them. */
|
||||
typedef void* (*pars_user_func_cb_t)(void* arg, void* user_arg);
|
||||
|
||||
/* User-supplied function and argument. */
|
||||
struct pars_user_func_struct {
|
||||
const char* name; /* function name */
|
||||
pars_user_func_cb_t func; /* function address */
|
||||
void* arg; /* user-supplied argument */
|
||||
};
|
||||
|
||||
/* Struct used to denote a reserved word in a parsing tree */
|
||||
struct pars_res_word_struct{
|
||||
|
|
|
@ -158,6 +158,7 @@ struct sym_tab_struct{
|
|||
/* position of the next character in
|
||||
sql_string to give to the lexical
|
||||
analyzer */
|
||||
pars_info_t* info; /* extra information, or NULL */
|
||||
sym_node_list_t sym_list;
|
||||
/* list of symbol nodes in the symbol
|
||||
table */
|
||||
|
@ -180,6 +181,7 @@ struct sym_tab_struct{
|
|||
#define SYM_CURSOR 96 /* named cursor */
|
||||
#define SYM_PROCEDURE_NAME 97 /* stored procedure name */
|
||||
#define SYM_INDEX 98 /* database index name */
|
||||
#define SYM_FUNCTION 99 /* user function name */
|
||||
|
||||
#ifndef UNIV_NONINL
|
||||
#include "pars0sym.ic"
|
||||
|
|
|
@ -9,6 +9,8 @@ Created 1/11/1998 Heikki Tuuri
|
|||
#ifndef pars0types_h
|
||||
#define pars0types_h
|
||||
|
||||
typedef struct pars_info_struct pars_info_t;
|
||||
typedef struct pars_user_func_struct pars_user_func_t;
|
||||
typedef struct sym_node_struct sym_node_t;
|
||||
typedef struct sym_tab_struct sym_tab_t;
|
||||
typedef struct pars_res_word_struct pars_res_word_t;
|
||||
|
|
|
@ -78,6 +78,15 @@ fetch_step(
|
|||
/*=======*/
|
||||
/* out: query thread to run next or NULL */
|
||||
que_thr_t* thr); /* in: query thread */
|
||||
/********************************************************************
|
||||
Sample callback function for fetch that prints each row.*/
|
||||
|
||||
void*
|
||||
row_fetch_print(
|
||||
/*============*/
|
||||
/* out: always returns non-NULL */
|
||||
void* row, /* in: sel_node_t* */
|
||||
void* user_arg); /* in: not used */
|
||||
/***************************************************************
|
||||
Prints a row in a select result. */
|
||||
|
||||
|
@ -311,6 +320,20 @@ struct fetch_node_struct{
|
|||
que_common_t common; /* type: QUE_NODE_FETCH */
|
||||
sel_node_t* cursor_def; /* cursor definition */
|
||||
sym_node_t* into_list; /* variables to set */
|
||||
|
||||
pars_user_func_t*
|
||||
func; /* User callback function or NULL.
|
||||
The first argument to the function
|
||||
is a sel_node_t*, containing the
|
||||
results of the SELECT operation for
|
||||
one row. If the function returns
|
||||
NULL, it is not interested in
|
||||
further rows and the cursor is
|
||||
modified so (cursor % NOTFOUND) is
|
||||
true. If it returns not-NULL,
|
||||
continue normally. See
|
||||
row_fetch_print() for an example
|
||||
(and a useful debugging tool). */
|
||||
};
|
||||
|
||||
/* Open or close cursor statement node */
|
||||
|
|
529
pars/lexyy.c
529
pars/lexyy.c
|
@ -356,8 +356,8 @@ static void yy_fatal_error (yyconst char msg[] );
|
|||
*yy_cp = '\0'; \
|
||||
(yy_c_buf_p) = yy_cp;
|
||||
|
||||
#define YY_NUM_RULES 114
|
||||
#define YY_END_OF_BUFFER 115
|
||||
#define YY_NUM_RULES 115
|
||||
#define YY_END_OF_BUFFER 116
|
||||
/* This struct is not used in this scanner,
|
||||
but its presence is necessary. */
|
||||
struct yy_trans_info
|
||||
|
@ -365,50 +365,52 @@ struct yy_trans_info
|
|||
flex_int32_t yy_verify;
|
||||
flex_int32_t yy_nxt;
|
||||
};
|
||||
static yyconst flex_int16_t yy_accept[386] =
|
||||
static yyconst flex_int16_t yy_accept[393] =
|
||||
{ 0,
|
||||
0, 0, 109, 109, 0, 0, 0, 0, 115, 113,
|
||||
112, 112, 6, 104, 3, 93, 99, 102, 100, 97,
|
||||
101, 113, 103, 1, 113, 98, 96, 94, 95, 107,
|
||||
87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
|
||||
87, 87, 87, 87, 87, 87, 87, 87, 105, 106,
|
||||
109, 110, 4, 5, 7, 8, 112, 88, 108, 2,
|
||||
1, 89, 90, 92, 91, 87, 87, 87, 87, 87,
|
||||
87, 43, 87, 87, 87, 87, 87, 87, 87, 87,
|
||||
87, 87, 87, 87, 87, 87, 87, 26, 15, 23,
|
||||
87, 87, 87, 87, 53, 60, 87, 12, 87, 87,
|
||||
0, 0, 110, 110, 0, 0, 0, 0, 116, 114,
|
||||
113, 113, 6, 105, 3, 94, 100, 103, 101, 98,
|
||||
102, 114, 104, 1, 114, 99, 97, 95, 96, 108,
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 106, 107,
|
||||
110, 111, 4, 5, 7, 8, 113, 89, 109, 2,
|
||||
1, 90, 91, 93, 92, 88, 88, 88, 88, 88,
|
||||
88, 43, 88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 26, 15,
|
||||
23, 88, 88, 88, 88, 53, 60, 88, 12, 88,
|
||||
|
||||
87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
|
||||
87, 87, 87, 87, 87, 109, 110, 110, 111, 4,
|
||||
5, 7, 8, 2, 11, 44, 87, 87, 87, 87,
|
||||
87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
|
||||
87, 87, 87, 87, 25, 87, 87, 87, 39, 87,
|
||||
87, 87, 19, 87, 87, 13, 87, 87, 87, 16,
|
||||
87, 87, 87, 87, 87, 79, 87, 87, 87, 50,
|
||||
10, 87, 34, 87, 87, 87, 87, 87, 87, 87,
|
||||
87, 87, 87, 87, 87, 87, 87, 18, 22, 87,
|
||||
87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 110, 111, 111, 112,
|
||||
4, 5, 7, 8, 2, 11, 44, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 25, 88, 88, 88, 39,
|
||||
88, 88, 88, 88, 19, 88, 88, 13, 88, 88,
|
||||
88, 16, 88, 88, 88, 88, 88, 79, 88, 88,
|
||||
88, 50, 10, 88, 34, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 88, 88, 88, 88, 18,
|
||||
22, 88, 88, 88, 88, 88, 88, 88, 88, 88,
|
||||
|
||||
45, 87, 87, 28, 87, 86, 87, 87, 37, 87,
|
||||
87, 87, 87, 47, 87, 30, 87, 9, 63, 87,
|
||||
87, 87, 41, 87, 87, 87, 87, 87, 87, 87,
|
||||
87, 87, 27, 87, 87, 87, 87, 87, 87, 87,
|
||||
87, 87, 84, 87, 24, 87, 65, 87, 87, 87,
|
||||
87, 35, 87, 87, 87, 87, 87, 87, 87, 29,
|
||||
64, 21, 56, 87, 74, 87, 87, 87, 42, 87,
|
||||
87, 87, 87, 87, 87, 87, 87, 87, 87, 55,
|
||||
87, 87, 87, 87, 87, 87, 87, 38, 31, 78,
|
||||
17, 87, 82, 73, 87, 54, 87, 62, 87, 51,
|
||||
88, 88, 45, 88, 88, 28, 88, 86, 88, 88,
|
||||
37, 88, 88, 88, 88, 88, 47, 88, 30, 88,
|
||||
9, 63, 88, 88, 88, 41, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 27, 88, 88, 88, 88,
|
||||
88, 88, 88, 88, 88, 84, 88, 24, 88, 65,
|
||||
88, 88, 88, 88, 35, 88, 88, 88, 88, 88,
|
||||
88, 88, 29, 64, 21, 88, 56, 88, 74, 88,
|
||||
88, 88, 42, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 55, 88, 88, 88, 88, 88, 88,
|
||||
88, 38, 31, 78, 17, 88, 82, 73, 88, 54,
|
||||
|
||||
88, 62, 88, 51, 88, 88, 88, 46, 88, 75,
|
||||
88, 77, 88, 88, 32, 88, 88, 88, 33, 71,
|
||||
88, 88, 88, 88, 57, 88, 49, 48, 88, 88,
|
||||
88, 52, 61, 88, 88, 88, 20, 88, 88, 72,
|
||||
80, 88, 88, 76, 88, 67, 88, 88, 88, 88,
|
||||
88, 36, 88, 87, 66, 88, 83, 88, 88, 88,
|
||||
85, 88, 58, 88, 88, 14, 88, 69, 68, 88,
|
||||
40, 88, 81, 88, 88, 88, 88, 88, 88, 88,
|
||||
88, 88, 88, 70, 88, 88, 88, 88, 88, 88,
|
||||
59, 0
|
||||
|
||||
87, 87, 46, 87, 75, 87, 77, 87, 87, 32,
|
||||
87, 87, 87, 33, 71, 87, 87, 87, 87, 57,
|
||||
87, 49, 48, 87, 87, 87, 52, 61, 87, 87,
|
||||
20, 87, 87, 72, 80, 87, 87, 76, 87, 67,
|
||||
87, 87, 87, 87, 87, 36, 87, 66, 87, 83,
|
||||
87, 87, 87, 85, 87, 58, 87, 87, 14, 87,
|
||||
69, 68, 87, 40, 87, 81, 87, 87, 87, 87,
|
||||
87, 87, 87, 87, 87, 87, 70, 87, 87, 87,
|
||||
87, 87, 87, 59, 0
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_ec[256] =
|
||||
|
@ -452,103 +454,103 @@ static yyconst flex_int32_t yy_meta[50] =
|
|||
5, 5, 5, 5, 5, 5, 5, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_base[394] =
|
||||
static yyconst flex_int16_t yy_base[401] =
|
||||
{ 0,
|
||||
0, 0, 417, 416, 418, 417, 418, 417, 420, 427,
|
||||
48, 50, 427, 427, 427, 427, 427, 427, 427, 427,
|
||||
427, 406, 409, 41, 398, 427, 38, 427, 397, 427,
|
||||
20, 33, 32, 46, 40, 44, 0, 51, 58, 45,
|
||||
61, 376, 66, 67, 68, 27, 392, 70, 427, 427,
|
||||
0, 98, 0, 407, 0, 408, 108, 427, 427, 396,
|
||||
54, 427, 427, 427, 427, 0, 385, 84, 381, 373,
|
||||
371, 0, 384, 53, 80, 379, 365, 92, 363, 376,
|
||||
361, 375, 369, 357, 361, 357, 359, 0, 93, 0,
|
||||
359, 357, 351, 358, 0, 0, 364, 364, 347, 87,
|
||||
0, 0, 424, 423, 425, 424, 425, 424, 427, 434,
|
||||
48, 50, 434, 434, 434, 434, 434, 434, 434, 434,
|
||||
434, 413, 416, 41, 405, 434, 38, 434, 404, 434,
|
||||
20, 33, 32, 46, 40, 44, 0, 54, 52, 48,
|
||||
60, 383, 65, 66, 74, 27, 399, 69, 434, 434,
|
||||
0, 97, 0, 414, 0, 415, 111, 434, 434, 403,
|
||||
54, 434, 434, 434, 434, 0, 392, 69, 388, 380,
|
||||
378, 0, 391, 79, 82, 386, 372, 94, 370, 383,
|
||||
368, 382, 376, 364, 368, 364, 366, 366, 0, 82,
|
||||
0, 365, 363, 357, 364, 0, 0, 370, 370, 353,
|
||||
|
||||
98, 362, 86, 88, 353, 103, 345, 361, 357, 335,
|
||||
98, 356, 347, 101, 340, 0, 127, 131, 427, 0,
|
||||
372, 0, 373, 361, 0, 0, 349, 344, 351, 349,
|
||||
332, 330, 329, 334, 118, 332, 344, 104, 332, 338,
|
||||
339, 321, 321, 120, 0, 319, 335, 336, 0, 323,
|
||||
330, 121, 123, 327, 317, 326, 319, 316, 324, 0,
|
||||
314, 324, 322, 313, 303, 297, 310, 295, 315, 0,
|
||||
0, 300, 0, 314, 305, 302, 128, 298, 305, 312,
|
||||
291, 293, 298, 298, 290, 293, 288, 0, 0, 300,
|
||||
284, 294, 301, 292, 280, 279, 293, 282, 295, 275,
|
||||
89, 98, 368, 93, 95, 359, 106, 351, 367, 363,
|
||||
341, 101, 362, 353, 112, 346, 0, 134, 135, 434,
|
||||
0, 378, 0, 379, 367, 0, 0, 355, 350, 357,
|
||||
355, 338, 336, 335, 340, 106, 338, 350, 93, 338,
|
||||
344, 345, 327, 327, 121, 0, 325, 341, 342, 0,
|
||||
329, 338, 335, 119, 126, 332, 322, 331, 324, 321,
|
||||
329, 0, 319, 329, 327, 318, 308, 302, 315, 300,
|
||||
320, 0, 0, 305, 0, 319, 310, 307, 130, 303,
|
||||
310, 317, 296, 298, 303, 303, 295, 298, 293, 0,
|
||||
0, 305, 289, 299, 306, 297, 285, 284, 298, 287,
|
||||
|
||||
0, 285, 267, 0, 286, 0, 283, 270, 0, 265,
|
||||
270, 269, 279, 0, 265, 0, 269, 0, 0, 265,
|
||||
262, 276, 0, 261, 261, 259, 275, 260, 272, 254,
|
||||
272, 267, 0, 262, 262, 248, 247, 260, 246, 260,
|
||||
259, 258, 0, 242, 0, 236, 0, 255, 239, 238,
|
||||
238, 0, 251, 241, 236, 235, 247, 237, 236, 0,
|
||||
0, 0, 0, 229, 0, 243, 239, 225, 0, 239,
|
||||
240, 223, 228, 221, 239, 221, 218, 219, 216, 0,
|
||||
221, 233, 220, 227, 217, 225, 210, 0, 0, 0,
|
||||
202, 209, 0, 0, 206, 0, 205, 0, 219, 0,
|
||||
300, 280, 0, 290, 272, 0, 291, 0, 288, 275,
|
||||
0, 274, 269, 274, 273, 283, 0, 269, 0, 273,
|
||||
0, 0, 269, 266, 280, 0, 265, 265, 263, 279,
|
||||
264, 276, 258, 276, 271, 0, 266, 266, 252, 251,
|
||||
264, 250, 264, 263, 262, 0, 246, 0, 240, 0,
|
||||
259, 243, 242, 242, 0, 255, 245, 240, 239, 251,
|
||||
241, 240, 0, 0, 0, 244, 0, 232, 0, 246,
|
||||
242, 228, 0, 242, 243, 226, 231, 224, 242, 224,
|
||||
221, 222, 219, 0, 224, 236, 223, 230, 220, 228,
|
||||
213, 0, 0, 0, 205, 212, 0, 0, 209, 0,
|
||||
|
||||
220, 207, 0, 203, 0, 206, 0, 198, 200, 0,
|
||||
199, 213, 206, 0, 0, 209, 212, 194, 209, 0,
|
||||
205, 0, 0, 189, 203, 202, 0, 0, 186, 185,
|
||||
0, 200, 185, 0, 0, 191, 187, 0, 182, 0,
|
||||
194, 194, 182, 192, 181, 0, 168, 0, 188, 0,
|
||||
172, 166, 172, 0, 163, 0, 168, 181, 0, 180,
|
||||
0, 0, 171, 0, 175, 0, 162, 162, 168, 154,
|
||||
177, 169, 169, 156, 143, 114, 0, 126, 131, 122,
|
||||
119, 115, 107, 0, 427, 163, 168, 173, 143, 178,
|
||||
183, 188, 193
|
||||
208, 0, 222, 0, 223, 210, 209, 0, 205, 0,
|
||||
208, 0, 200, 202, 0, 201, 215, 208, 0, 0,
|
||||
211, 214, 196, 211, 0, 207, 0, 0, 191, 205,
|
||||
204, 0, 0, 188, 187, 192, 0, 201, 186, 0,
|
||||
0, 192, 188, 0, 183, 0, 195, 195, 183, 193,
|
||||
182, 0, 169, 0, 0, 189, 0, 173, 167, 173,
|
||||
0, 164, 0, 169, 182, 0, 181, 0, 0, 172,
|
||||
0, 176, 0, 163, 163, 169, 155, 178, 167, 167,
|
||||
149, 125, 116, 0, 127, 133, 124, 121, 117, 109,
|
||||
0, 434, 165, 170, 175, 145, 180, 185, 190, 195
|
||||
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_def[394] =
|
||||
static yyconst flex_int16_t yy_def[401] =
|
||||
{ 0,
|
||||
385, 1, 386, 386, 387, 387, 388, 388, 385, 385,
|
||||
385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
|
||||
385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 385, 385,
|
||||
390, 391, 392, 385, 393, 385, 385, 385, 385, 385,
|
||||
385, 385, 385, 385, 385, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
392, 1, 393, 393, 394, 394, 395, 395, 392, 392,
|
||||
392, 392, 392, 392, 392, 392, 392, 392, 392, 392,
|
||||
392, 392, 392, 392, 392, 392, 392, 392, 392, 392,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 392, 392,
|
||||
397, 398, 399, 392, 400, 392, 392, 392, 392, 392,
|
||||
392, 392, 392, 392, 392, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 390, 391, 391, 385, 392,
|
||||
385, 393, 385, 385, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 397, 398, 398, 392,
|
||||
399, 392, 400, 392, 392, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
|
||||
389, 389, 389, 389, 0, 385, 385, 385, 385, 385,
|
||||
385, 385, 385
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
|
||||
396, 0, 392, 392, 392, 392, 392, 392, 392, 392
|
||||
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_nxt[477] =
|
||||
static yyconst flex_int16_t yy_nxt[484] =
|
||||
{ 0,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||
|
@ -556,55 +558,56 @@ static yyconst flex_int16_t yy_nxt[477] =
|
|||
37, 37, 39, 37, 40, 41, 42, 37, 43, 44,
|
||||
45, 46, 47, 48, 37, 37, 37, 49, 50, 57,
|
||||
57, 57, 57, 60, 67, 61, 63, 64, 69, 68,
|
||||
73, 111, 70, 112, 74, 71, 60, 75, 61, 84,
|
||||
76, 78, 81, 77, 82, 79, 85, 88, 72, 86,
|
||||
93, 80, 87, 91, 83, 89, 94, 95, 132, 108,
|
||||
90, 101, 104, 92, 133, 96, 109, 97, 114, 98,
|
||||
73, 112, 70, 113, 74, 71, 60, 75, 61, 84,
|
||||
76, 78, 81, 77, 82, 79, 85, 92, 72, 86,
|
||||
89, 80, 87, 94, 83, 88, 96, 93, 90, 95,
|
||||
102, 105, 127, 91, 97, 109, 98, 115, 99, 103,
|
||||
|
||||
102, 103, 99, 110, 105, 115, 118, 126, 106, 57,
|
||||
57, 119, 107, 134, 135, 139, 161, 151, 167, 163,
|
||||
169, 136, 162, 127, 140, 172, 182, 178, 170, 168,
|
||||
183, 141, 152, 153, 164, 385, 173, 179, 165, 118,
|
||||
385, 193, 197, 198, 119, 204, 211, 66, 213, 205,
|
||||
234, 235, 384, 383, 382, 381, 380, 194, 214, 379,
|
||||
378, 212, 236, 51, 51, 51, 51, 51, 53, 53,
|
||||
53, 53, 53, 55, 55, 55, 55, 55, 116, 116,
|
||||
116, 377, 116, 117, 117, 117, 117, 117, 120, 120,
|
||||
376, 120, 120, 122, 375, 122, 122, 122, 374, 373,
|
||||
104, 100, 110, 106, 116, 119, 153, 107, 128, 111,
|
||||
120, 108, 57, 57, 133, 135, 136, 140, 163, 165,
|
||||
134, 154, 155, 137, 164, 169, 141, 171, 174, 195,
|
||||
180, 199, 200, 142, 166, 172, 170, 184, 167, 175,
|
||||
181, 185, 392, 119, 214, 196, 206, 392, 120, 66,
|
||||
207, 216, 237, 238, 391, 390, 389, 388, 387, 215,
|
||||
386, 217, 385, 384, 239, 51, 51, 51, 51, 51,
|
||||
53, 53, 53, 53, 53, 55, 55, 55, 55, 55,
|
||||
117, 117, 117, 383, 117, 118, 118, 118, 118, 118,
|
||||
121, 121, 382, 121, 121, 123, 381, 123, 123, 123,
|
||||
|
||||
372, 371, 370, 369, 368, 367, 366, 365, 364, 363,
|
||||
362, 361, 360, 359, 358, 357, 356, 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,
|
||||
380, 379, 378, 377, 376, 375, 374, 373, 372, 371,
|
||||
370, 369, 368, 367, 366, 365, 364, 363, 362, 361,
|
||||
360, 359, 358, 357, 356, 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,
|
||||
|
||||
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, 233, 232, 231, 230,
|
||||
229, 228, 227, 226, 225, 224, 223, 222, 221, 220,
|
||||
219, 218, 217, 216, 215, 210, 209, 208, 207, 206,
|
||||
203, 202, 201, 200, 199, 196, 195, 192, 191, 190,
|
||||
189, 188, 187, 186, 185, 124, 123, 121, 184, 181,
|
||||
180, 177, 176, 175, 174, 171, 166, 160, 159, 158,
|
||||
157, 156, 155, 154, 150, 149, 148, 147, 146, 145,
|
||||
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, 236, 235, 234, 233, 232, 231, 230, 229, 228,
|
||||
227, 226, 225, 224, 223, 222, 221, 220, 219, 218,
|
||||
213, 212, 211, 210, 209, 208, 205, 204, 203, 202,
|
||||
201, 198, 197, 194, 193, 192, 191, 190, 189, 188,
|
||||
187, 125, 124, 122, 186, 183, 182, 179, 178, 177,
|
||||
176, 173, 168, 162, 161, 160, 159, 158, 157, 156,
|
||||
|
||||
144, 143, 142, 138, 137, 131, 130, 129, 128, 125,
|
||||
124, 123, 121, 113, 100, 65, 62, 59, 58, 385,
|
||||
56, 56, 54, 54, 52, 52, 9, 385, 385, 385,
|
||||
385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
|
||||
385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
|
||||
385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
|
||||
385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
|
||||
385, 385, 385, 385, 385, 385
|
||||
152, 151, 150, 149, 148, 147, 146, 145, 144, 143,
|
||||
139, 138, 132, 131, 130, 129, 126, 125, 124, 122,
|
||||
114, 101, 65, 62, 59, 58, 392, 56, 56, 54,
|
||||
54, 52, 52, 9, 392, 392, 392, 392, 392, 392,
|
||||
392, 392, 392, 392, 392, 392, 392, 392, 392, 392,
|
||||
392, 392, 392, 392, 392, 392, 392, 392, 392, 392,
|
||||
392, 392, 392, 392, 392, 392, 392, 392, 392, 392,
|
||||
392, 392, 392, 392, 392, 392, 392, 392, 392, 392,
|
||||
392, 392, 392
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_chk[477] =
|
||||
static yyconst flex_int16_t yy_chk[484] =
|
||||
{ 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
|
@ -613,51 +616,52 @@ static yyconst flex_int16_t yy_chk[477] =
|
|||
1, 1, 1, 1, 1, 1, 1, 1, 1, 11,
|
||||
11, 12, 12, 24, 31, 24, 27, 27, 32, 31,
|
||||
33, 46, 32, 46, 33, 32, 61, 33, 61, 36,
|
||||
33, 34, 35, 33, 35, 34, 36, 38, 32, 36,
|
||||
40, 34, 36, 39, 35, 38, 40, 41, 74, 45,
|
||||
38, 43, 44, 39, 74, 41, 45, 41, 48, 41,
|
||||
33, 34, 35, 33, 35, 34, 36, 39, 32, 36,
|
||||
38, 34, 36, 40, 35, 36, 41, 39, 38, 40,
|
||||
43, 44, 68, 38, 41, 45, 41, 48, 41, 43,
|
||||
|
||||
43, 43, 41, 45, 44, 48, 52, 68, 44, 57,
|
||||
57, 52, 44, 75, 75, 78, 100, 89, 103, 101,
|
||||
104, 75, 100, 68, 78, 106, 114, 111, 104, 103,
|
||||
114, 78, 89, 89, 101, 117, 106, 111, 101, 118,
|
||||
117, 135, 138, 138, 118, 144, 152, 389, 153, 144,
|
||||
177, 177, 383, 382, 381, 380, 379, 135, 153, 378,
|
||||
376, 152, 177, 386, 386, 386, 386, 386, 387, 387,
|
||||
387, 387, 387, 388, 388, 388, 388, 388, 390, 390,
|
||||
390, 375, 390, 391, 391, 391, 391, 391, 392, 392,
|
||||
374, 392, 392, 393, 373, 393, 393, 393, 372, 371,
|
||||
43, 41, 45, 44, 48, 52, 90, 44, 68, 45,
|
||||
52, 44, 57, 57, 74, 75, 75, 78, 101, 102,
|
||||
74, 90, 90, 75, 101, 104, 78, 105, 107, 136,
|
||||
112, 139, 139, 78, 102, 105, 104, 115, 102, 107,
|
||||
112, 115, 118, 119, 154, 136, 145, 118, 119, 396,
|
||||
145, 155, 179, 179, 390, 389, 388, 387, 386, 154,
|
||||
385, 155, 383, 382, 179, 393, 393, 393, 393, 393,
|
||||
394, 394, 394, 394, 394, 395, 395, 395, 395, 395,
|
||||
397, 397, 397, 381, 397, 398, 398, 398, 398, 398,
|
||||
399, 399, 380, 399, 399, 400, 379, 400, 400, 400,
|
||||
|
||||
370, 369, 368, 367, 365, 363, 360, 358, 357, 355,
|
||||
353, 352, 351, 349, 347, 345, 344, 343, 342, 341,
|
||||
339, 337, 336, 333, 332, 330, 329, 326, 325, 324,
|
||||
321, 319, 318, 317, 316, 313, 312, 311, 309, 308,
|
||||
306, 304, 302, 301, 299, 297, 295, 292, 291, 287,
|
||||
286, 285, 284, 283, 282, 281, 279, 278, 277, 276,
|
||||
275, 274, 273, 272, 271, 270, 268, 267, 266, 264,
|
||||
259, 258, 257, 256, 255, 254, 253, 251, 250, 249,
|
||||
248, 246, 244, 242, 241, 240, 239, 238, 237, 236,
|
||||
235, 234, 232, 231, 230, 229, 228, 227, 226, 225,
|
||||
378, 377, 376, 375, 374, 372, 370, 367, 365, 364,
|
||||
362, 360, 359, 358, 356, 353, 351, 350, 349, 348,
|
||||
347, 345, 343, 342, 339, 338, 336, 335, 334, 331,
|
||||
330, 329, 326, 324, 323, 322, 321, 318, 317, 316,
|
||||
314, 313, 311, 309, 307, 306, 305, 303, 301, 299,
|
||||
296, 295, 291, 290, 289, 288, 287, 286, 285, 283,
|
||||
282, 281, 280, 279, 278, 277, 276, 275, 274, 272,
|
||||
271, 270, 268, 266, 262, 261, 260, 259, 258, 257,
|
||||
256, 254, 253, 252, 251, 249, 247, 245, 244, 243,
|
||||
242, 241, 240, 239, 238, 237, 235, 234, 233, 232,
|
||||
|
||||
224, 222, 221, 220, 217, 215, 213, 212, 211, 210,
|
||||
208, 207, 205, 203, 202, 200, 199, 198, 197, 196,
|
||||
195, 194, 193, 192, 191, 190, 187, 186, 185, 184,
|
||||
183, 182, 181, 180, 179, 178, 176, 175, 174, 172,
|
||||
169, 168, 167, 166, 165, 164, 163, 162, 161, 159,
|
||||
158, 157, 156, 155, 154, 151, 150, 148, 147, 146,
|
||||
143, 142, 141, 140, 139, 137, 136, 134, 133, 132,
|
||||
131, 130, 129, 128, 127, 124, 123, 121, 115, 113,
|
||||
112, 110, 109, 108, 107, 105, 102, 99, 98, 97,
|
||||
94, 93, 92, 91, 87, 86, 85, 84, 83, 82,
|
||||
231, 230, 229, 228, 227, 225, 224, 223, 220, 218,
|
||||
216, 215, 214, 213, 212, 210, 209, 207, 205, 204,
|
||||
202, 201, 200, 199, 198, 197, 196, 195, 194, 193,
|
||||
192, 189, 188, 187, 186, 185, 184, 183, 182, 181,
|
||||
180, 178, 177, 176, 174, 171, 170, 169, 168, 167,
|
||||
166, 165, 164, 163, 161, 160, 159, 158, 157, 156,
|
||||
153, 152, 151, 149, 148, 147, 144, 143, 142, 141,
|
||||
140, 138, 137, 135, 134, 133, 132, 131, 130, 129,
|
||||
128, 125, 124, 122, 116, 114, 113, 111, 110, 109,
|
||||
108, 106, 103, 100, 99, 98, 95, 94, 93, 92,
|
||||
|
||||
81, 80, 79, 77, 76, 73, 71, 70, 69, 67,
|
||||
60, 56, 54, 47, 42, 29, 25, 23, 22, 9,
|
||||
8, 7, 6, 5, 4, 3, 385, 385, 385, 385,
|
||||
385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
|
||||
385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
|
||||
385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
|
||||
385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
|
||||
385, 385, 385, 385, 385, 385
|
||||
88, 87, 86, 85, 84, 83, 82, 81, 80, 79,
|
||||
77, 76, 73, 71, 70, 69, 67, 60, 56, 54,
|
||||
47, 42, 29, 25, 23, 22, 9, 8, 7, 6,
|
||||
5, 4, 3, 392, 392, 392, 392, 392, 392, 392,
|
||||
392, 392, 392, 392, 392, 392, 392, 392, 392, 392,
|
||||
392, 392, 392, 392, 392, 392, 392, 392, 392, 392,
|
||||
392, 392, 392, 392, 392, 392, 392, 392, 392, 392,
|
||||
392, 392, 392, 392, 392, 392, 392, 392, 392, 392,
|
||||
392, 392, 392
|
||||
} ;
|
||||
|
||||
static yy_state_type yy_last_accepting_state;
|
||||
|
@ -746,7 +750,7 @@ string_append(
|
|||
|
||||
|
||||
|
||||
#line 749 "_flex_tmp.c"
|
||||
#line 753 "_flex_tmp.c"
|
||||
|
||||
#define INITIAL 0
|
||||
#define comment 1
|
||||
|
@ -901,7 +905,7 @@ YY_DECL
|
|||
#line 89 "pars0lex.l"
|
||||
|
||||
|
||||
#line 904 "_flex_tmp.c"
|
||||
#line 908 "_flex_tmp.c"
|
||||
|
||||
if ( (yy_init) )
|
||||
{
|
||||
|
@ -954,13 +958,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 >= 386 )
|
||||
if ( yy_current_state >= 393 )
|
||||
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_current_state != 385 );
|
||||
while ( yy_current_state != 392 );
|
||||
yy_cp = (yy_last_accepting_cpos);
|
||||
yy_current_state = (yy_last_accepting_state);
|
||||
|
||||
|
@ -1653,6 +1657,13 @@ YY_RULE_SETUP
|
|||
case 87:
|
||||
YY_RULE_SETUP
|
||||
#line 497 "pars0lex.l"
|
||||
{
|
||||
return(PARS_FUNCTION_TOKEN);
|
||||
}
|
||||
YY_BREAK
|
||||
case 88:
|
||||
YY_RULE_SETUP
|
||||
#line 501 "pars0lex.l"
|
||||
{
|
||||
yylval = sym_tab_add_id(pars_sym_tab_global,
|
||||
(byte*)yytext,
|
||||
|
@ -1660,52 +1671,44 @@ YY_RULE_SETUP
|
|||
return(PARS_ID_TOKEN);
|
||||
}
|
||||
YY_BREAK
|
||||
case 88:
|
||||
YY_RULE_SETUP
|
||||
#line 504 "pars0lex.l"
|
||||
{
|
||||
return(PARS_DDOT_TOKEN);
|
||||
}
|
||||
YY_BREAK
|
||||
case 89:
|
||||
YY_RULE_SETUP
|
||||
#line 508 "pars0lex.l"
|
||||
{
|
||||
return(PARS_ASSIGN_TOKEN);
|
||||
return(PARS_DDOT_TOKEN);
|
||||
}
|
||||
YY_BREAK
|
||||
case 90:
|
||||
YY_RULE_SETUP
|
||||
#line 512 "pars0lex.l"
|
||||
{
|
||||
return(PARS_LE_TOKEN);
|
||||
return(PARS_ASSIGN_TOKEN);
|
||||
}
|
||||
YY_BREAK
|
||||
case 91:
|
||||
YY_RULE_SETUP
|
||||
#line 516 "pars0lex.l"
|
||||
{
|
||||
return(PARS_GE_TOKEN);
|
||||
return(PARS_LE_TOKEN);
|
||||
}
|
||||
YY_BREAK
|
||||
case 92:
|
||||
YY_RULE_SETUP
|
||||
#line 520 "pars0lex.l"
|
||||
{
|
||||
return(PARS_NE_TOKEN);
|
||||
return(PARS_GE_TOKEN);
|
||||
}
|
||||
YY_BREAK
|
||||
case 93:
|
||||
YY_RULE_SETUP
|
||||
#line 524 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
return(PARS_NE_TOKEN);
|
||||
}
|
||||
YY_BREAK
|
||||
case 94:
|
||||
YY_RULE_SETUP
|
||||
#line 529 "pars0lex.l"
|
||||
#line 528 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1713,7 +1716,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 95:
|
||||
YY_RULE_SETUP
|
||||
#line 534 "pars0lex.l"
|
||||
#line 533 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1721,7 +1724,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 96:
|
||||
YY_RULE_SETUP
|
||||
#line 539 "pars0lex.l"
|
||||
#line 538 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1729,7 +1732,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 97:
|
||||
YY_RULE_SETUP
|
||||
#line 544 "pars0lex.l"
|
||||
#line 543 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1737,7 +1740,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 98:
|
||||
YY_RULE_SETUP
|
||||
#line 549 "pars0lex.l"
|
||||
#line 548 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1745,7 +1748,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 99:
|
||||
YY_RULE_SETUP
|
||||
#line 554 "pars0lex.l"
|
||||
#line 553 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1753,7 +1756,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 100:
|
||||
YY_RULE_SETUP
|
||||
#line 559 "pars0lex.l"
|
||||
#line 558 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1761,7 +1764,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 101:
|
||||
YY_RULE_SETUP
|
||||
#line 564 "pars0lex.l"
|
||||
#line 563 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1769,7 +1772,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 102:
|
||||
YY_RULE_SETUP
|
||||
#line 569 "pars0lex.l"
|
||||
#line 568 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1777,7 +1780,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 103:
|
||||
YY_RULE_SETUP
|
||||
#line 574 "pars0lex.l"
|
||||
#line 573 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1785,7 +1788,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 104:
|
||||
YY_RULE_SETUP
|
||||
#line 579 "pars0lex.l"
|
||||
#line 578 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1793,7 +1796,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 105:
|
||||
YY_RULE_SETUP
|
||||
#line 584 "pars0lex.l"
|
||||
#line 583 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1801,7 +1804,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 106:
|
||||
YY_RULE_SETUP
|
||||
#line 589 "pars0lex.l"
|
||||
#line 588 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1809,7 +1812,7 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 107:
|
||||
YY_RULE_SETUP
|
||||
#line 594 "pars0lex.l"
|
||||
#line 593 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
|
@ -1817,35 +1820,43 @@ YY_RULE_SETUP
|
|||
YY_BREAK
|
||||
case 108:
|
||||
YY_RULE_SETUP
|
||||
#line 599 "pars0lex.l"
|
||||
BEGIN(comment); /* eat up comment */
|
||||
#line 598 "pars0lex.l"
|
||||
{
|
||||
|
||||
return((int)(*yytext));
|
||||
}
|
||||
YY_BREAK
|
||||
case 109:
|
||||
/* rule 109 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 601 "pars0lex.l"
|
||||
|
||||
#line 603 "pars0lex.l"
|
||||
BEGIN(comment); /* eat up comment */
|
||||
YY_BREAK
|
||||
case 110:
|
||||
/* rule 110 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 602 "pars0lex.l"
|
||||
#line 605 "pars0lex.l"
|
||||
|
||||
YY_BREAK
|
||||
case 111:
|
||||
/* rule 111 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 603 "pars0lex.l"
|
||||
BEGIN(INITIAL);
|
||||
#line 606 "pars0lex.l"
|
||||
|
||||
YY_BREAK
|
||||
case 112:
|
||||
/* rule 112 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 605 "pars0lex.l"
|
||||
/* eat up whitespace */
|
||||
#line 607 "pars0lex.l"
|
||||
BEGIN(INITIAL);
|
||||
YY_BREAK
|
||||
case 113:
|
||||
/* rule 113 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 608 "pars0lex.l"
|
||||
#line 609 "pars0lex.l"
|
||||
/* eat up whitespace */
|
||||
YY_BREAK
|
||||
case 114:
|
||||
YY_RULE_SETUP
|
||||
#line 612 "pars0lex.l"
|
||||
{
|
||||
fprintf(stderr,"Unrecognized character: %02x\n",
|
||||
*yytext);
|
||||
|
@ -1855,12 +1866,12 @@ YY_RULE_SETUP
|
|||
return(0);
|
||||
}
|
||||
YY_BREAK
|
||||
case 114:
|
||||
case 115:
|
||||
YY_RULE_SETUP
|
||||
#line 617 "pars0lex.l"
|
||||
#line 621 "pars0lex.l"
|
||||
YY_FATAL_ERROR( "flex scanner jammed" );
|
||||
YY_BREAK
|
||||
#line 1863 "_flex_tmp.c"
|
||||
#line 1874 "_flex_tmp.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(comment):
|
||||
case YY_STATE_EOF(quoted):
|
||||
|
@ -2148,7 +2159,7 @@ static int yy_get_next_buffer (void)
|
|||
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 >= 386 )
|
||||
if ( yy_current_state >= 393 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
|
@ -2176,11 +2187,11 @@ static int yy_get_next_buffer (void)
|
|||
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 >= 386 )
|
||||
if ( yy_current_state >= 393 )
|
||||
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 == 385);
|
||||
yy_is_jam = (yy_current_state == 392);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
|
@ -2703,7 +2714,7 @@ void yyfree (void * ptr )
|
|||
#undef YY_DECL_IS_OURS
|
||||
#undef YY_DECL
|
||||
#endif
|
||||
#line 617 "pars0lex.l"
|
||||
#line 621 "pars0lex.l"
|
||||
|
||||
|
||||
|
||||
|
|
1264
pars/pars0grm.c
1264
pars/pars0grm.c
File diff suppressed because it is too large
Load diff
|
@ -116,7 +116,8 @@
|
|||
PARS_WORK_TOKEN = 342,
|
||||
PARS_UNSIGNED_TOKEN = 343,
|
||||
PARS_EXIT_TOKEN = 344,
|
||||
NEG = 345
|
||||
PARS_FUNCTION_TOKEN = 345,
|
||||
NEG = 346
|
||||
};
|
||||
#endif
|
||||
#define PARS_INT_LIT 258
|
||||
|
@ -206,7 +207,8 @@
|
|||
#define PARS_WORK_TOKEN 342
|
||||
#define PARS_UNSIGNED_TOKEN 343
|
||||
#define PARS_EXIT_TOKEN 344
|
||||
#define NEG 345
|
||||
#define PARS_FUNCTION_TOKEN 345
|
||||
#define NEG 346
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@ yylex(void);
|
|||
%token PARS_WORK_TOKEN
|
||||
%token PARS_UNSIGNED_TOKEN
|
||||
%token PARS_EXIT_TOKEN
|
||||
%token PARS_FUNCTION_TOKEN
|
||||
|
||||
%left PARS_AND_TOKEN PARS_OR_TOKEN
|
||||
%left PARS_NOT_TOKEN
|
||||
|
@ -228,6 +229,10 @@ predefined_procedure_name:
|
|||
| PARS_ASSERT_TOKEN { $$ = &pars_assert_token; }
|
||||
;
|
||||
|
||||
user_function_call:
|
||||
PARS_ID_TOKEN '(' ')' { $$ = $1; }
|
||||
;
|
||||
|
||||
table_list:
|
||||
PARS_ID_TOKEN { $$ = que_node_list_add_last(NULL, $1); }
|
||||
| table_list ',' PARS_ID_TOKEN
|
||||
|
@ -453,7 +458,9 @@ close_cursor_statement:
|
|||
|
||||
fetch_statement:
|
||||
PARS_FETCH_TOKEN PARS_ID_TOKEN PARS_INTO_TOKEN variable_list
|
||||
{ $$ = pars_fetch_statement($2, $4); }
|
||||
{ $$ = pars_fetch_statement($2, $4, NULL); }
|
||||
| PARS_FETCH_TOKEN PARS_ID_TOKEN PARS_INTO_TOKEN user_function_call
|
||||
{ $$ = pars_fetch_statement($2, NULL, $4); }
|
||||
;
|
||||
|
||||
column_def:
|
||||
|
@ -575,10 +582,20 @@ cursor_declaration:
|
|||
{ $$ = pars_cursor_declaration($3, $5); }
|
||||
;
|
||||
|
||||
function_declaration:
|
||||
PARS_DECLARE_TOKEN PARS_FUNCTION_TOKEN PARS_ID_TOKEN ';'
|
||||
{ $$ = pars_function_declaration($3); }
|
||||
;
|
||||
|
||||
declaration:
|
||||
cursor_declaration
|
||||
| function_declaration
|
||||
;
|
||||
|
||||
declaration_list:
|
||||
/* Nothing */
|
||||
| cursor_declaration
|
||||
| declaration_list cursor_declaration
|
||||
| declaration
|
||||
| declaration_list declaration
|
||||
;
|
||||
|
||||
procedure_definition:
|
||||
|
|
|
@ -494,6 +494,10 @@ In the state 'id', only two actions are possible (defined below). */
|
|||
return(PARS_EXIT_TOKEN);
|
||||
}
|
||||
|
||||
"FUNCTION" {
|
||||
return(PARS_FUNCTION_TOKEN);
|
||||
}
|
||||
|
||||
{ID} {
|
||||
yylval = sym_tab_add_id(pars_sym_tab_global,
|
||||
(byte*)yytext,
|
||||
|
|
|
@ -373,14 +373,15 @@ pars_resolve_exp_variables_and_types(
|
|||
}
|
||||
|
||||
/* Not resolved yet: look in the symbol table for a variable
|
||||
or a cursor with the same name */
|
||||
or a cursor or a function with the same name */
|
||||
|
||||
node = UT_LIST_GET_FIRST(pars_sym_tab_global->sym_list);
|
||||
|
||||
while (node) {
|
||||
if (node->resolved
|
||||
&& ((node->token_type == SYM_VAR)
|
||||
|| (node->token_type == SYM_CURSOR))
|
||||
|| (node->token_type == SYM_CURSOR)
|
||||
|| (node->token_type == SYM_FUNCTION))
|
||||
&& node->name
|
||||
&& (sym_node->name_len == node->name_len)
|
||||
&& (ut_memcmp(sym_node->name, node->name,
|
||||
|
@ -786,6 +787,26 @@ pars_cursor_declaration(
|
|||
return(sym_node);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Parses a function declaration. */
|
||||
|
||||
que_node_t*
|
||||
pars_function_declaration(
|
||||
/*======================*/
|
||||
/* out: sym_node */
|
||||
sym_node_t* sym_node) /* in: function id node in the symbol
|
||||
table */
|
||||
{
|
||||
sym_node->resolved = TRUE;
|
||||
sym_node->token_type = SYM_FUNCTION;
|
||||
|
||||
/* Check that the function exists. */
|
||||
ut_a(pars_info_get_user_func(pars_sym_tab_global->info,
|
||||
sym_node->name));
|
||||
|
||||
return(sym_node);
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
Parses a delete or update statement start. */
|
||||
|
||||
|
@ -1433,26 +1454,42 @@ pars_procedure_call(
|
|||
}
|
||||
|
||||
/*************************************************************************
|
||||
Parses a fetch statement. */
|
||||
Parses a fetch statement. into_list or user_func (but not both) must be
|
||||
non-NULL. */
|
||||
|
||||
fetch_node_t*
|
||||
pars_fetch_statement(
|
||||
/*=================*/
|
||||
/* out: fetch statement node */
|
||||
sym_node_t* cursor, /* in: cursor node */
|
||||
sym_node_t* into_list) /* in: variables to set */
|
||||
sym_node_t* into_list, /* in: variables to set, or NULL */
|
||||
sym_node_t* user_func) /* in: user function name, or NULL */
|
||||
{
|
||||
sym_node_t* cursor_decl;
|
||||
fetch_node_t* node;
|
||||
|
||||
/* Logical XOR. */
|
||||
ut_a(!into_list != !user_func);
|
||||
|
||||
node = mem_heap_alloc(pars_sym_tab_global->heap, sizeof(fetch_node_t));
|
||||
|
||||
node->common.type = QUE_NODE_FETCH;
|
||||
|
||||
pars_resolve_exp_variables_and_types(NULL, cursor);
|
||||
pars_resolve_exp_list_variables_and_types(NULL, into_list);
|
||||
|
||||
node->into_list = into_list;
|
||||
if (into_list) {
|
||||
pars_resolve_exp_list_variables_and_types(NULL, into_list);
|
||||
node->into_list = into_list;
|
||||
node->func = NULL;
|
||||
} else {
|
||||
pars_resolve_exp_variables_and_types(NULL, user_func);
|
||||
|
||||
node->func = pars_info_get_user_func(pars_sym_tab_global->info,
|
||||
user_func->name);
|
||||
ut_a(node->func);
|
||||
|
||||
node->into_list = NULL;
|
||||
}
|
||||
|
||||
cursor_decl = cursor->alias;
|
||||
|
||||
|
@ -1460,8 +1497,11 @@ pars_fetch_statement(
|
|||
|
||||
node->cursor_def = cursor_decl->cursor_def;
|
||||
|
||||
ut_a(que_node_list_get_len(into_list)
|
||||
== que_node_list_get_len(node->cursor_def->select_list));
|
||||
if (into_list) {
|
||||
ut_a(que_node_list_get_len(into_list)
|
||||
== que_node_list_get_len(
|
||||
node->cursor_def->select_list));
|
||||
}
|
||||
|
||||
return(node);
|
||||
}
|
||||
|
@ -1822,6 +1862,7 @@ que_t*
|
|||
pars_sql(
|
||||
/*=====*/
|
||||
/* out, own: the query graph */
|
||||
pars_info_t* info, /* in: extra information, or NULL */
|
||||
const char* str) /* in: SQL string */
|
||||
{
|
||||
sym_node_t* sym_node;
|
||||
|
@ -1841,6 +1882,7 @@ pars_sql(
|
|||
pars_sym_tab_global->sql_string = mem_heap_strdup(heap, str);
|
||||
pars_sym_tab_global->string_len = strlen(str);
|
||||
pars_sym_tab_global->next_char_pos = 0;
|
||||
pars_sym_tab_global->info = info;
|
||||
|
||||
yyparse();
|
||||
|
||||
|
@ -1891,3 +1933,29 @@ pars_complete_graph_for_exec(
|
|||
|
||||
return(thr);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
Get user function with the given name.*/
|
||||
|
||||
pars_user_func_t*
|
||||
pars_info_get_user_func(
|
||||
/*====================*/
|
||||
/* out: user func, or NULL if not
|
||||
found */
|
||||
pars_info_t* info, /* in: info struct */
|
||||
const char* name) /* in: function name to find*/
|
||||
{
|
||||
ulint i;
|
||||
|
||||
if (!info) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
for (i = 0; i < info->n_funcs; i++) {
|
||||
if (strcmp(info->funcs[i].name, name) == 0) {
|
||||
return(&info->funcs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
|
|
@ -2510,7 +2510,7 @@ do not allow the discard. We also reserve the data dictionary latch. */
|
|||
(ulong) ut_dulint_get_high(new_id),
|
||||
(ulong) ut_dulint_get_low(new_id));
|
||||
|
||||
graph = pars_sql(buf);
|
||||
graph = pars_sql(NULL, buf);
|
||||
|
||||
ut_a(graph);
|
||||
|
||||
|
@ -2942,7 +2942,7 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
|
|||
(ulong) ut_dulint_get_high(new_id),
|
||||
(ulong) ut_dulint_get_low(new_id));
|
||||
|
||||
graph = pars_sql(sql);
|
||||
graph = pars_sql(NULL, sql);
|
||||
|
||||
ut_a(graph);
|
||||
|
||||
|
@ -3166,7 +3166,7 @@ row_drop_table_for_mysql(
|
|||
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
graph = pars_sql(sql);
|
||||
graph = pars_sql(NULL, sql);
|
||||
|
||||
ut_a(graph);
|
||||
mem_free(sql);
|
||||
|
@ -3781,7 +3781,7 @@ row_rename_table_for_mysql(
|
|||
|
||||
ut_a(sqlend == sql + len + 1);
|
||||
|
||||
graph = pars_sql(sql);
|
||||
graph = pars_sql(NULL, sql);
|
||||
|
||||
ut_a(graph);
|
||||
mem_free(sql);
|
||||
|
|
|
@ -1975,7 +1975,18 @@ fetch_step(
|
|||
|
||||
if (sel_node->state != SEL_NODE_NO_MORE_ROWS) {
|
||||
|
||||
sel_assign_into_var_values(node->into_list, sel_node);
|
||||
if (node->into_list) {
|
||||
sel_assign_into_var_values(node->into_list,
|
||||
sel_node);
|
||||
} else {
|
||||
void* ret = (*node->func->func)(sel_node,
|
||||
node->func->arg);
|
||||
|
||||
if (!ret) {
|
||||
sel_node->state =
|
||||
SEL_NODE_NO_MORE_ROWS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
thr->run_node = que_node_get_parent(node);
|
||||
|
@ -2004,6 +2015,46 @@ fetch_step(
|
|||
return(thr);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
Sample callback function for fetch that prints each row.*/
|
||||
|
||||
void*
|
||||
row_fetch_print(
|
||||
/*============*/
|
||||
/* out: always returns non-NULL */
|
||||
void* row, /* in: sel_node_t* */
|
||||
void* user_arg) /* in: not used */
|
||||
{
|
||||
sel_node_t* node = row;
|
||||
que_node_t* exp;
|
||||
ulint i = 0;
|
||||
|
||||
UT_NOT_USED(user_arg);
|
||||
|
||||
fprintf(stderr, "row_fetch_print: row %p\n", row);
|
||||
|
||||
exp = node->select_list;
|
||||
|
||||
while (exp) {
|
||||
dfield_t* dfield = que_node_get_val(exp);
|
||||
dtype_t* type = dfield_get_type(dfield);
|
||||
|
||||
fprintf(stderr, " column %lu:\n", (ulong)i);
|
||||
|
||||
dtype_print(type);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
ut_print_buf(stderr, dfield_get_data(dfield),
|
||||
dfield_get_len(dfield));
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
exp = que_node_get_next(exp);
|
||||
i++;
|
||||
}
|
||||
|
||||
return((void*)42);
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
Prints a row in a select result. */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue