1/*****************************************************************************
2
3Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
4Copyright (c) 2017, 2018, MariaDB Corporation.
5
6This program is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free Software
8Foundation; version 2 of the License.
9
10This program is distributed in the hope that it will be useful, but WITHOUT
11ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License along with
15this program; if not, write to the Free Software Foundation, Inc.,
1651 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
17
18*****************************************************************************/
19
20/**************************************************//**
21@file include/pars0pars.h
22SQL parser
23
24Created 11/19/1996 Heikki Tuuri
25*******************************************************/
26
27#ifndef pars0pars_h
28#define pars0pars_h
29
30#include "univ.i"
31#include "que0types.h"
32#include "pars0types.h"
33#include "row0types.h"
34#include "trx0types.h"
35#include "ut0vec.h"
36#include "row0mysql.h"
37
38/** Type of the user functions. The first argument is always InnoDB-supplied
39and varies in type, while 'user_arg' is a user-supplied argument. The
40meaning of the return type also varies. See the individual use cases, e.g.
41the FETCH statement, for details on them. */
42typedef ibool (*pars_user_func_cb_t)(void* arg, void* user_arg);
43
44/** If the following is set TRUE, the parser will emit debugging
45information */
46extern int yydebug;
47
48/* Global variable used while parsing a single procedure or query : the code is
49NOT re-entrant */
50extern sym_tab_t* pars_sym_tab_global;
51
52extern pars_res_word_t pars_to_char_token;
53extern pars_res_word_t pars_to_number_token;
54extern pars_res_word_t pars_to_binary_token;
55extern pars_res_word_t pars_binary_to_number_token;
56extern pars_res_word_t pars_substr_token;
57extern pars_res_word_t pars_replstr_token;
58extern pars_res_word_t pars_concat_token;
59extern pars_res_word_t pars_length_token;
60extern pars_res_word_t pars_instr_token;
61extern pars_res_word_t pars_sysdate_token;
62extern pars_res_word_t pars_printf_token;
63extern pars_res_word_t pars_assert_token;
64extern pars_res_word_t pars_rnd_token;
65extern pars_res_word_t pars_rnd_str_token;
66extern pars_res_word_t pars_count_token;
67extern pars_res_word_t pars_sum_token;
68extern pars_res_word_t pars_distinct_token;
69extern pars_res_word_t pars_binary_token;
70extern pars_res_word_t pars_blob_token;
71extern pars_res_word_t pars_int_token;
72extern pars_res_word_t pars_bigint_token;
73extern pars_res_word_t pars_char_token;
74extern pars_res_word_t pars_float_token;
75extern pars_res_word_t pars_update_token;
76extern pars_res_word_t pars_asc_token;
77extern pars_res_word_t pars_desc_token;
78extern pars_res_word_t pars_open_token;
79extern pars_res_word_t pars_close_token;
80extern pars_res_word_t pars_share_token;
81extern pars_res_word_t pars_unique_token;
82extern pars_res_word_t pars_clustered_token;
83
84extern ulint pars_star_denoter;
85
86/* Procedure parameter types */
87#define PARS_INPUT 0
88#define PARS_OUTPUT 1
89#define PARS_NOT_PARAM 2
90
91int
92yyparse(void);
93
94/*************************************************************//**
95Parses an SQL string returning the query graph.
96@return own: the query graph */
97que_t*
98pars_sql(
99/*=====*/
100 pars_info_t* info, /*!< in: extra information, or NULL */
101 const char* str); /*!< in: SQL string */
102/*************************************************************//**
103Retrieves characters to the lexical analyzer.
104@return number of characters copied or 0 on EOF */
105int
106pars_get_lex_chars(
107/*===============*/
108 char* buf, /*!< in/out: buffer where to copy */
109 int max_size); /*!< in: maximum number of characters which fit
110 in the buffer */
111/*************************************************************//**
112Called by yyparse on error. */
113void
114yyerror(
115/*====*/
116 const char* s); /*!< in: error message string */
117/*********************************************************************//**
118Parses a variable declaration.
119@return own: symbol table node of type SYM_VAR */
120sym_node_t*
121pars_variable_declaration(
122/*======================*/
123 sym_node_t* node, /*!< in: symbol table node allocated for the
124 id of the variable */
125 pars_res_word_t* type); /*!< in: pointer to a type token */
126/*********************************************************************//**
127Parses a function expression.
128@return own: function node in a query tree */
129func_node_t*
130pars_func(
131/*======*/
132 que_node_t* res_word,/*!< in: function name reserved word */
133 que_node_t* arg); /*!< in: first argument in the argument list */
134/*************************************************************************
135Rebind a LIKE search string. NOTE: We ignore any '%' characters embedded
136within the search string.
137@return own: function node in a query tree */
138int
139pars_like_rebind(
140/*=============*/
141 sym_node_t* node, /* in: The search string node.*/
142 const byte* ptr, /* in: literal to (re) bind */
143 ulint len); /* in: length of literal to (re) bind*/
144/*********************************************************************//**
145Parses an operator expression.
146@return own: function node in a query tree */
147func_node_t*
148pars_op(
149/*====*/
150 int func, /*!< in: operator token code */
151 que_node_t* arg1, /*!< in: first argument */
152 que_node_t* arg2); /*!< in: second argument or NULL for an unary
153 operator */
154/*********************************************************************//**
155Parses an ORDER BY clause. Order by a single column only is supported.
156@return own: order-by node in a query tree */
157order_node_t*
158pars_order_by(
159/*==========*/
160 sym_node_t* column, /*!< in: column name */
161 pars_res_word_t* asc); /*!< in: &pars_asc_token or pars_desc_token */
162/*********************************************************************//**
163Parses a select list; creates a query graph node for the whole SELECT
164statement.
165@return own: select node in a query tree */
166sel_node_t*
167pars_select_list(
168/*=============*/
169 que_node_t* select_list, /*!< in: select list */
170 sym_node_t* into_list); /*!< in: variables list or NULL */
171/*********************************************************************//**
172Parses a cursor declaration.
173@return sym_node */
174que_node_t*
175pars_cursor_declaration(
176/*====================*/
177 sym_node_t* sym_node, /*!< in: cursor id node in the symbol
178 table */
179 sel_node_t* select_node); /*!< in: select node */
180/*********************************************************************//**
181Parses a function declaration.
182@return sym_node */
183que_node_t*
184pars_function_declaration(
185/*======================*/
186 sym_node_t* sym_node); /*!< in: function id node in the symbol
187 table */
188/*********************************************************************//**
189Parses a select statement.
190@return own: select node in a query tree */
191sel_node_t*
192pars_select_statement(
193/*==================*/
194 sel_node_t* select_node, /*!< in: select node already containing
195 the select list */
196 sym_node_t* table_list, /*!< in: table list */
197 que_node_t* search_cond, /*!< in: search condition or NULL */
198 pars_res_word_t* for_update, /*!< in: NULL or &pars_update_token */
199 pars_res_word_t* consistent_read,/*!< in: NULL or
200 &pars_consistent_token */
201 order_node_t* order_by); /*!< in: NULL or an order-by node */
202/*********************************************************************//**
203Parses a column assignment in an update.
204@return column assignment node */
205col_assign_node_t*
206pars_column_assignment(
207/*===================*/
208 sym_node_t* column, /*!< in: column to assign */
209 que_node_t* exp); /*!< in: value to assign */
210/*********************************************************************//**
211Parses a delete or update statement start.
212@return own: update node in a query tree */
213upd_node_t*
214pars_update_statement_start(
215/*========================*/
216 ibool is_delete, /*!< in: TRUE if delete */
217 sym_node_t* table_sym, /*!< in: table name node */
218 col_assign_node_t* col_assign_list);/*!< in: column assignment list, NULL
219 if delete */
220/*********************************************************************//**
221Parses an update or delete statement.
222@return own: update node in a query tree */
223upd_node_t*
224pars_update_statement(
225/*==================*/
226 upd_node_t* node, /*!< in: update node */
227 sym_node_t* cursor_sym, /*!< in: pointer to a cursor entry in
228 the symbol table or NULL */
229 que_node_t* search_cond); /*!< in: search condition or NULL */
230/*********************************************************************//**
231Parses an insert statement.
232@return own: update node in a query tree */
233ins_node_t*
234pars_insert_statement(
235/*==================*/
236 sym_node_t* table_sym, /*!< in: table name node */
237 que_node_t* values_list, /*!< in: value expression list or NULL */
238 sel_node_t* select); /*!< in: select condition or NULL */
239/*********************************************************************//**
240Parses a procedure parameter declaration.
241@return own: symbol table node of type SYM_VAR */
242sym_node_t*
243pars_parameter_declaration(
244/*=======================*/
245 sym_node_t* node, /*!< in: symbol table node allocated for the
246 id of the parameter */
247 ulint param_type,
248 /*!< in: PARS_INPUT or PARS_OUTPUT */
249 pars_res_word_t* type); /*!< in: pointer to a type token */
250/*********************************************************************//**
251Parses an elsif element.
252@return elsif node */
253elsif_node_t*
254pars_elsif_element(
255/*===============*/
256 que_node_t* cond, /*!< in: if-condition */
257 que_node_t* stat_list); /*!< in: statement list */
258/*********************************************************************//**
259Parses an if-statement.
260@return if-statement node */
261if_node_t*
262pars_if_statement(
263/*==============*/
264 que_node_t* cond, /*!< in: if-condition */
265 que_node_t* stat_list, /*!< in: statement list */
266 que_node_t* else_part); /*!< in: else-part statement list */
267/*********************************************************************//**
268Parses a for-loop-statement.
269@return for-statement node */
270for_node_t*
271pars_for_statement(
272/*===============*/
273 sym_node_t* loop_var, /*!< in: loop variable */
274 que_node_t* loop_start_limit,/*!< in: loop start expression */
275 que_node_t* loop_end_limit, /*!< in: loop end expression */
276 que_node_t* stat_list); /*!< in: statement list */
277/*********************************************************************//**
278Parses a while-statement.
279@return while-statement node */
280while_node_t*
281pars_while_statement(
282/*=================*/
283 que_node_t* cond, /*!< in: while-condition */
284 que_node_t* stat_list); /*!< in: statement list */
285/*********************************************************************//**
286Parses an exit statement.
287@return exit statement node */
288exit_node_t*
289pars_exit_statement(void);
290/*=====================*/
291/*********************************************************************//**
292Parses a return-statement.
293@return return-statement node */
294return_node_t*
295pars_return_statement(void);
296/*=======================*/
297/*********************************************************************//**
298Parses a procedure call.
299@return function node */
300func_node_t*
301pars_procedure_call(
302/*================*/
303 que_node_t* res_word,/*!< in: procedure name reserved word */
304 que_node_t* args); /*!< in: argument list */
305/*********************************************************************//**
306Parses an assignment statement.
307@return assignment statement node */
308assign_node_t*
309pars_assignment_statement(
310/*======================*/
311 sym_node_t* var, /*!< in: variable to assign */
312 que_node_t* val); /*!< in: value to assign */
313/*********************************************************************//**
314Parses a fetch statement. into_list or user_func (but not both) must be
315non-NULL.
316@return fetch statement node */
317fetch_node_t*
318pars_fetch_statement(
319/*=================*/
320 sym_node_t* cursor, /*!< in: cursor node */
321 sym_node_t* into_list, /*!< in: variables to set, or NULL */
322 sym_node_t* user_func); /*!< in: user function name, or NULL */
323/*********************************************************************//**
324Parses an open or close cursor statement.
325@return fetch statement node */
326open_node_t*
327pars_open_statement(
328/*================*/
329 ulint type, /*!< in: ROW_SEL_OPEN_CURSOR
330 or ROW_SEL_CLOSE_CURSOR */
331 sym_node_t* cursor); /*!< in: cursor node */
332/*********************************************************************//**
333Parses a row_printf-statement.
334@return row_printf-statement node */
335row_printf_node_t*
336pars_row_printf_statement(
337/*======================*/
338 sel_node_t* sel_node); /*!< in: select node */
339/*********************************************************************//**
340Parses a commit statement.
341@return own: commit node struct */
342commit_node_t*
343pars_commit_statement(void);
344/*=======================*/
345/*********************************************************************//**
346Parses a rollback statement.
347@return own: rollback node struct */
348roll_node_t*
349pars_rollback_statement(void);
350/*=========================*/
351/*********************************************************************//**
352Parses a column definition at a table creation.
353@return column sym table node */
354sym_node_t*
355pars_column_def(
356/*============*/
357 sym_node_t* sym_node, /*!< in: column node in the
358 symbol table */
359 pars_res_word_t* type, /*!< in: data type */
360 sym_node_t* len, /*!< in: length of column, or
361 NULL */
362 void* is_unsigned, /*!< in: if not NULL, column
363 is of type UNSIGNED. */
364 void* is_not_null); /*!< in: if not NULL, column
365 is of type NOT NULL. */
366/*********************************************************************//**
367Parses a table creation operation.
368@return table create subgraph */
369tab_node_t*
370pars_create_table(
371/*==============*/
372 sym_node_t* table_sym, /*!< in: table name node in the symbol
373 table */
374 sym_node_t* column_defs, /*!< in: list of column names */
375 sym_node_t* compact, /* in: non-NULL if COMPACT table. */
376 sym_node_t* block_size); /* in: block size (can be NULL) */
377/*********************************************************************//**
378Parses an index creation operation.
379@return index create subgraph */
380ind_node_t*
381pars_create_index(
382/*==============*/
383 pars_res_word_t* unique_def, /*!< in: not NULL if a unique index */
384 pars_res_word_t* clustered_def, /*!< in: not NULL if a clustered index */
385 sym_node_t* index_sym, /*!< in: index name node in the symbol
386 table */
387 sym_node_t* table_sym, /*!< in: table name node in the symbol
388 table */
389 sym_node_t* column_list); /*!< in: list of column names */
390/*********************************************************************//**
391Parses a procedure definition.
392@return query fork node */
393que_fork_t*
394pars_procedure_definition(
395/*======================*/
396 sym_node_t* sym_node, /*!< in: procedure id node in the symbol
397 table */
398 sym_node_t* param_list, /*!< in: parameter declaration list */
399 que_node_t* stat_list); /*!< in: statement list */
400
401/*************************************************************//**
402Parses a stored procedure call, when this is not within another stored
403procedure, that is, the client issues a procedure call directly.
404In MySQL/InnoDB, stored InnoDB procedures are invoked via the
405parsed procedure tree, not via InnoDB SQL, so this function is not used.
406@return query graph */
407que_fork_t*
408pars_stored_procedure_call(
409/*=======================*/
410 sym_node_t* sym_node); /*!< in: stored procedure name */
411/** Completes a query graph by adding query thread and fork nodes
412above it and prepares the graph for running. The fork created is of
413type QUE_FORK_MYSQL_INTERFACE.
414@param[in] node root node for an incomplete query
415 graph, or NULL for dummy graph
416@param[in] trx transaction handle
417@param[in] heap memory heap from which allocated
418@param[in] prebuilt row prebuilt structure
419@return query thread node to run */
420que_thr_t*
421pars_complete_graph_for_exec(
422 que_node_t* node,
423 trx_t* trx,
424 mem_heap_t* heap,
425 row_prebuilt_t* prebuilt)
426 MY_ATTRIBUTE((nonnull(2,3), warn_unused_result));
427
428/****************************************************************//**
429Create parser info struct.
430@return own: info struct */
431pars_info_t*
432pars_info_create(void);
433/*==================*/
434
435/****************************************************************//**
436Free info struct and everything it contains. */
437void
438pars_info_free(
439/*===========*/
440 pars_info_t* info); /*!< in, own: info struct */
441
442/****************************************************************//**
443Add bound literal. */
444void
445pars_info_add_literal(
446/*==================*/
447 pars_info_t* info, /*!< in: info struct */
448 const char* name, /*!< in: name */
449 const void* address, /*!< in: address */
450 ulint length, /*!< in: length of data */
451 ulint type, /*!< in: type, e.g. DATA_FIXBINARY */
452 ulint prtype); /*!< in: precise type, e.g.
453 DATA_UNSIGNED */
454
455/****************************************************************//**
456Equivalent to pars_info_add_literal(info, name, str, strlen(str),
457DATA_VARCHAR, DATA_ENGLISH). */
458void
459pars_info_add_str_literal(
460/*======================*/
461 pars_info_t* info, /*!< in: info struct */
462 const char* name, /*!< in: name */
463 const char* str); /*!< in: string */
464/********************************************************************
465If the literal value already exists then it rebinds otherwise it
466creates a new entry.*/
467void
468pars_info_bind_literal(
469/*===================*/
470 pars_info_t* info, /* in: info struct */
471 const char* name, /* in: name */
472 const void* address, /* in: address */
473 ulint length, /* in: length of data */
474 ulint type, /* in: type, e.g. DATA_FIXBINARY */
475 ulint prtype); /* in: precise type, e.g. */
476/********************************************************************
477If the literal value already exists then it rebinds otherwise it
478creates a new entry.*/
479void
480pars_info_bind_varchar_literal(
481/*===========================*/
482 pars_info_t* info, /*!< in: info struct */
483 const char* name, /*!< in: name */
484 const byte* str, /*!< in: string */
485 ulint str_len); /*!< in: string length */
486/****************************************************************//**
487Equivalent to:
488
489char buf[4];
490mach_write_to_4(buf, val);
491pars_info_add_literal(info, name, buf, 4, DATA_INT, 0);
492
493except that the buffer is dynamically allocated from the info struct's
494heap. */
495void
496pars_info_bind_int4_literal(
497/*=======================*/
498 pars_info_t* info, /*!< in: info struct */
499 const char* name, /*!< in: name */
500 const ib_uint32_t* val); /*!< in: value */
501/********************************************************************
502If the literal value already exists then it rebinds otherwise it
503creates a new entry. */
504void
505pars_info_bind_int8_literal(
506/*=======================*/
507 pars_info_t* info, /*!< in: info struct */
508 const char* name, /*!< in: name */
509 const ib_uint64_t* val); /*!< in: value */
510/****************************************************************//**
511Add user function. */
512void
513pars_info_bind_function(
514/*===================*/
515 pars_info_t* info, /*!< in: info struct */
516 const char* name, /*!< in: function name */
517 pars_user_func_cb_t func, /*!< in: function address */
518 void* arg); /*!< in: user-supplied argument */
519/****************************************************************//**
520Add bound id. */
521void
522pars_info_bind_id(
523/*=============*/
524 pars_info_t* info, /*!< in: info struct */
525 ibool copy_name,/* in: make a copy of name if TRUE */
526 const char* name, /*!< in: name */
527 const char* id); /*!< in: id */
528/****************************************************************//**
529Equivalent to:
530
531char buf[4];
532mach_write_to_4(buf, val);
533pars_info_add_literal(info, name, buf, 4, DATA_INT, 0);
534
535except that the buffer is dynamically allocated from the info struct's
536heap. */
537void
538pars_info_add_int4_literal(
539/*=======================*/
540 pars_info_t* info, /*!< in: info struct */
541 const char* name, /*!< in: name */
542 ulint val); /*!< in: value */
543
544/****************************************************************//**
545Equivalent to:
546
547char buf[8];
548mach_write_to_8(buf, val);
549pars_info_add_literal(info, name, buf, 8, DATA_FIXBINARY, 0);
550
551except that the buffer is dynamically allocated from the info struct's
552heap. */
553void
554pars_info_add_ull_literal(
555/*======================*/
556 pars_info_t* info, /*!< in: info struct */
557 const char* name, /*!< in: name */
558 ib_uint64_t val); /*!< in: value */
559
560/****************************************************************//**
561If the literal value already exists then it rebinds otherwise it
562creates a new entry. */
563void
564pars_info_bind_ull_literal(
565/*=======================*/
566 pars_info_t* info, /*!< in: info struct */
567 const char* name, /*!< in: name */
568 const ib_uint64_t* val) /*!< in: value */
569 MY_ATTRIBUTE((nonnull));
570
571/****************************************************************//**
572Add bound id. */
573void
574pars_info_add_id(
575/*=============*/
576 pars_info_t* info, /*!< in: info struct */
577 const char* name, /*!< in: name */
578 const char* id); /*!< in: id */
579
580/****************************************************************//**
581Get bound literal with the given name.
582@return bound literal, or NULL if not found */
583pars_bound_lit_t*
584pars_info_get_bound_lit(
585/*====================*/
586 pars_info_t* info, /*!< in: info struct */
587 const char* name); /*!< in: bound literal name to find */
588
589/****************************************************************//**
590Get bound id with the given name.
591@return bound id, or NULL if not found */
592pars_bound_id_t*
593pars_info_get_bound_id(
594/*===================*/
595 pars_info_t* info, /*!< in: info struct */
596 const char* name); /*!< in: bound id name to find */
597
598/******************************************************************//**
599Release any resources used by the lexer. */
600void
601pars_lexer_close(void);
602/*==================*/
603
604/** Extra information supplied for pars_sql(). */
605struct pars_info_t {
606 mem_heap_t* heap; /*!< our own memory heap */
607
608 ib_vector_t* funcs; /*!< user functions, or NUll
609 (pars_user_func_t*) */
610 ib_vector_t* bound_lits; /*!< bound literals, or NULL
611 (pars_bound_lit_t*) */
612 ib_vector_t* bound_ids; /*!< bound ids, or NULL
613 (pars_bound_id_t*) */
614
615 ibool graph_owns_us; /*!< if TRUE (which is the default),
616 que_graph_free() will free us */
617};
618
619/** User-supplied function and argument. */
620struct pars_user_func_t {
621 const char* name; /*!< function name */
622 pars_user_func_cb_t func; /*!< function address */
623 void* arg; /*!< user-supplied argument */
624};
625
626/** Bound literal. */
627struct pars_bound_lit_t {
628 const char* name; /*!< name */
629 const void* address; /*!< address */
630 ulint length; /*!< length of data */
631 ulint type; /*!< type, e.g. DATA_FIXBINARY */
632 ulint prtype; /*!< precise type, e.g. DATA_UNSIGNED */
633 sym_node_t* node; /*!< symbol node */
634};
635
636/** Bound identifier. */
637struct pars_bound_id_t {
638 const char* name; /*!< name */
639 const char* id; /*!< identifier */
640};
641
642/** Struct used to denote a reserved word in a parsing tree */
643struct pars_res_word_t{
644 int code; /*!< the token code for the reserved word from
645 pars0grm.h */
646};
647
648/** A predefined function or operator node in a parsing tree; this construct
649is also used for some non-functions like the assignment ':=' */
650struct func_node_t{
651 que_common_t common; /*!< type: QUE_NODE_FUNC */
652 int func; /*!< token code of the function name */
653 ulint fclass; /*!< class of the function */
654 que_node_t* args; /*!< argument(s) of the function */
655 UT_LIST_NODE_T(func_node_t) cond_list;
656 /*!< list of comparison conditions; defined
657 only for comparison operator nodes except,
658 presently, for OPT_SCROLL_TYPE ones */
659 UT_LIST_NODE_T(func_node_t) func_node_list;
660 /*!< list of function nodes in a parsed
661 query graph */
662};
663
664/** An order-by node in a select */
665struct order_node_t{
666 que_common_t common; /*!< type: QUE_NODE_ORDER */
667 sym_node_t* column; /*!< order-by column */
668 ibool asc; /*!< TRUE if ascending, FALSE if descending */
669};
670
671/** Procedure definition node */
672struct proc_node_t{
673 que_common_t common; /*!< type: QUE_NODE_PROC */
674 sym_node_t* proc_id; /*!< procedure name symbol in the symbol
675 table of this same procedure */
676 sym_node_t* param_list; /*!< input and output parameters */
677 que_node_t* stat_list; /*!< statement list */
678 sym_tab_t* sym_tab; /*!< symbol table of this procedure */
679};
680
681/** elsif-element node */
682struct elsif_node_t{
683 que_common_t common; /*!< type: QUE_NODE_ELSIF */
684 que_node_t* cond; /*!< if condition */
685 que_node_t* stat_list; /*!< statement list */
686};
687
688/** if-statement node */
689struct if_node_t{
690 que_common_t common; /*!< type: QUE_NODE_IF */
691 que_node_t* cond; /*!< if condition */
692 que_node_t* stat_list; /*!< statement list */
693 que_node_t* else_part; /*!< else-part statement list */
694 elsif_node_t* elsif_list; /*!< elsif element list */
695};
696
697/** while-statement node */
698struct while_node_t{
699 que_common_t common; /*!< type: QUE_NODE_WHILE */
700 que_node_t* cond; /*!< while condition */
701 que_node_t* stat_list; /*!< statement list */
702};
703
704/** for-loop-statement node */
705struct for_node_t{
706 que_common_t common; /*!< type: QUE_NODE_FOR */
707 sym_node_t* loop_var; /*!< loop variable: this is the
708 dereferenced symbol from the
709 variable declarations, not the
710 symbol occurrence in the for loop
711 definition */
712 que_node_t* loop_start_limit;/*!< initial value of loop variable */
713 que_node_t* loop_end_limit; /*!< end value of loop variable */
714 lint loop_end_value; /*!< evaluated value for the end value:
715 it is calculated only when the loop
716 is entered, and will not change within
717 the loop */
718 que_node_t* stat_list; /*!< statement list */
719};
720
721/** exit statement node */
722struct exit_node_t{
723 que_common_t common; /*!< type: QUE_NODE_EXIT */
724};
725
726/** return-statement node */
727struct return_node_t{
728 que_common_t common; /*!< type: QUE_NODE_RETURN */
729};
730
731/** Assignment statement node */
732struct assign_node_t{
733 que_common_t common; /*!< type: QUE_NODE_ASSIGNMENT */
734 sym_node_t* var; /*!< variable to set */
735 que_node_t* val; /*!< value to assign */
736};
737
738/** Column assignment node */
739struct col_assign_node_t{
740 que_common_t common; /*!< type: QUE_NODE_COL_ASSIGN */
741 sym_node_t* col; /*!< column to set */
742 que_node_t* val; /*!< value to assign */
743};
744
745/** Classes of functions */
746/* @{ */
747#define PARS_FUNC_ARITH 1 /*!< +, -, *, / */
748#define PARS_FUNC_LOGICAL 2 /*!< AND, OR, NOT */
749#define PARS_FUNC_CMP 3 /*!< comparison operators */
750#define PARS_FUNC_PREDEFINED 4 /*!< TO_NUMBER, SUBSTR, ... */
751#define PARS_FUNC_AGGREGATE 5 /*!< COUNT, DISTINCT, SUM */
752#define PARS_FUNC_OTHER 6 /*!< these are not real functions,
753 e.g., := */
754/* @} */
755
756#endif
757