~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/pars/pars0grm.y

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (C) 1997, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
12
12
 
13
13
You should have received a copy of the GNU General Public License along with
14
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
 
15
Place, Suite 330, Boston, MA 02110-1301 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
19
19
/******************************************************
20
20
SQL parser: input file for the GNU Bison parser generator
21
21
 
22
 
Look from pars0lex.l for instructions how to generate the C files for
23
 
the InnoDB parser.
24
 
 
25
22
Created 12/14/1997 Heikki Tuuri
26
23
*******************************************************/
27
24
 
38
35
#include "row0sel.h"
39
36
 
40
37
#define YYSTYPE que_node_t*
 
38
#define YYENABLE_NLS 0
 
39
#define YYLTYPE_IS_TRIVIAL 0
41
40
 
42
41
/* #define __STDC__ */
43
42
 
44
 
int
45
 
yylex(void);
 
43
extern "C" int yylex(void);
46
44
%}
47
45
 
 
46
%expect 27
 
47
 
48
48
%token PARS_INT_LIT
49
49
%token PARS_FLOAT_LIT
50
50
%token PARS_STR_LIT
238
238
 
239
239
stored_procedure_call:
240
240
        '{' PARS_ID_TOKEN '(' question_mark_list ')' '}'
241
 
                                { $$ = pars_stored_procedure_call($2); }
 
241
        { $$ = pars_stored_procedure_call(static_cast<sym_node_t *>($2)); }
242
242
;
243
243
 
244
244
predefined_procedure_call:
305
305
        '*'                     { $$ = pars_select_list(&pars_star_denoter,
306
306
                                                                NULL); }
307
307
        | select_item_list PARS_INTO_TOKEN variable_list
308
 
                                { $$ = pars_select_list($1, $3); }
 
308
        { $$ = pars_select_list(static_cast<sym_node_t *>($1), static_cast<sym_node_t *>($3)); }
309
309
        | select_item_list      { $$ = pars_select_list($1, NULL); }
310
310
;
311
311
 
335
335
order_by_clause:
336
336
        /* Nothing */           { $$ = NULL; }
337
337
        | PARS_ORDER_TOKEN PARS_BY_TOKEN PARS_ID_TOKEN order_direction
338
 
                                { $$ = pars_order_by($3, $4); }
 
338
        { $$ = pars_order_by(static_cast<sym_node_t *>($3), static_cast<pars_res_word_t *>($4)); }
339
339
;
340
340
 
341
341
select_statement:
344
344
        search_condition
345
345
        for_update_clause
346
346
        lock_shared_clause
347
 
        order_by_clause         { $$ = pars_select_statement($2, $4, $5,
348
 
                                                                $6, $7, $8); }
 
347
        order_by_clause         { $$ = pars_select_statement(static_cast<sel_node_t *>($2), static_cast<sym_node_t *>($4), $5,
 
348
                                                             static_cast<pars_res_word_t *>($6), static_cast<pars_res_word_t *>($7), static_cast<order_node_t *>($8)); }
349
349
;
350
350
 
351
351
insert_statement_start:
355
355
 
356
356
insert_statement:
357
357
        insert_statement_start PARS_VALUES_TOKEN '(' exp_list ')'
358
 
                                { $$ = pars_insert_statement($1, $4, NULL); }
 
358
        { $$ = pars_insert_statement(static_cast<sym_node_t *>($1), $4, NULL); }
359
359
        | insert_statement_start select_statement
360
 
                                { $$ = pars_insert_statement($1, NULL, $2); }
 
360
        { $$ = pars_insert_statement(static_cast<sym_node_t *>($1), NULL, static_cast<sel_node_t *>($2)); }
361
361
;
362
362
 
363
363
column_assignment:
364
 
        PARS_ID_TOKEN '=' exp   { $$ = pars_column_assignment($1, $3); }
 
364
PARS_ID_TOKEN '=' exp   { $$ = pars_column_assignment(static_cast<sym_node_t *>($1), $3); }
365
365
;
366
366
 
367
367
column_assignment_list:
380
380
        PARS_UPDATE_TOKEN PARS_ID_TOKEN
381
381
        PARS_SET_TOKEN
382
382
        column_assignment_list  { $$ = pars_update_statement_start(FALSE,
383
 
                                                                $2, $4); }
 
383
                                                                   static_cast<sym_node_t *>($2), static_cast<col_assign_node_t *>($4)); }
384
384
;
385
385
 
386
386
update_statement_searched:
387
387
        update_statement_start
388
 
        search_condition        { $$ = pars_update_statement($1, NULL, $2); }
 
388
        search_condition        { $$ = pars_update_statement(static_cast<upd_node_t *>($1), NULL, $2); }
389
389
;
390
390
 
391
391
update_statement_positioned:
392
392
        update_statement_start
393
 
        cursor_positioned       { $$ = pars_update_statement($1, $2, NULL); }
 
393
        cursor_positioned       { $$ = pars_update_statement(static_cast<upd_node_t *>($1), static_cast<sym_node_t *>($2), NULL); }
394
394
;
395
395
 
396
396
delete_statement_start:
397
397
        PARS_DELETE_TOKEN PARS_FROM_TOKEN
398
398
        PARS_ID_TOKEN           { $$ = pars_update_statement_start(TRUE,
399
 
                                                                $3, NULL); }
 
399
                                                                   static_cast<sym_node_t *>($3), NULL); }
400
400
;
401
401
 
402
402
delete_statement_searched:
403
403
        delete_statement_start
404
 
        search_condition        { $$ = pars_update_statement($1, NULL, $2); }
 
404
        search_condition        { $$ = pars_update_statement(static_cast<upd_node_t *>($1), NULL, $2); }
405
405
;
406
406
 
407
407
delete_statement_positioned:
408
408
        delete_statement_start
409
 
        cursor_positioned       { $$ = pars_update_statement($1, $2, NULL); }
 
409
        cursor_positioned       { $$ = pars_update_statement(static_cast<upd_node_t *>($1), static_cast<sym_node_t *>($2), NULL); }
410
410
;
411
411
 
412
412
row_printf_statement:
413
413
        PARS_ROW_PRINTF_TOKEN select_statement
414
 
                                { $$ = pars_row_printf_statement($2); }
 
414
        { $$ = pars_row_printf_statement(static_cast<sel_node_t *>($2)); }
415
415
;
416
416
 
417
417
assignment_statement:
418
418
        PARS_ID_TOKEN PARS_ASSIGN_TOKEN exp
419
 
                                { $$ = pars_assignment_statement($1, $3); }
 
419
        { $$ = pars_assignment_statement(static_cast<sym_node_t *>($1), $3); }
420
420
;
421
421
 
422
422
elsif_element:
456
456
        exp PARS_DDOT_TOKEN exp
457
457
        PARS_LOOP_TOKEN statement_list
458
458
        PARS_END_TOKEN PARS_LOOP_TOKEN
459
 
                                { $$ = pars_for_statement($2, $4, $6, $8); }
 
459
        { $$ = pars_for_statement(static_cast<sym_node_t *>($2), $4, $6, $8); }
460
460
;
461
461
 
462
462
exit_statement:
469
469
 
470
470
open_cursor_statement:
471
471
        PARS_OPEN_TOKEN PARS_ID_TOKEN
472
 
                                { $$ = pars_open_statement(
473
 
                                                ROW_SEL_OPEN_CURSOR, $2); }
 
472
        { $$ = pars_open_statement(ROW_SEL_OPEN_CURSOR,
 
473
                                   static_cast<sym_node_t *>($2)); }
474
474
;
475
475
 
476
476
close_cursor_statement:
477
477
        PARS_CLOSE_TOKEN PARS_ID_TOKEN
478
 
                                { $$ = pars_open_statement(
479
 
                                                ROW_SEL_CLOSE_CURSOR, $2); }
 
478
        { $$ = pars_open_statement(ROW_SEL_CLOSE_CURSOR,
 
479
                                   static_cast<sym_node_t *>($2)); }
480
480
;
481
481
 
482
482
fetch_statement:
483
483
        PARS_FETCH_TOKEN PARS_ID_TOKEN PARS_INTO_TOKEN variable_list
484
 
                                { $$ = pars_fetch_statement($2, $4, NULL); }
 
484
        { $$ = pars_fetch_statement(static_cast<sym_node_t *>($2), static_cast<sym_node_t *>($4), NULL); }
485
485
        | PARS_FETCH_TOKEN PARS_ID_TOKEN PARS_INTO_TOKEN user_function_call
486
 
                                { $$ = pars_fetch_statement($2, NULL, $4); }
 
486
        { $$ = pars_fetch_statement(static_cast<sym_node_t *>($2), NULL, static_cast<sym_node_t *>($4)); }
487
487
;
488
488
 
489
489
column_def:
490
490
        PARS_ID_TOKEN type_name opt_column_len opt_unsigned opt_not_null
491
 
                                { $$ = pars_column_def($1, $2, $3, $4, $5); }
 
491
        { $$ = pars_column_def(static_cast<sym_node_t *>($1), static_cast<pars_res_word_t *>($2), static_cast<sym_node_t *>($3), $4, $5); }
492
492
;
493
493
 
494
494
column_def_list:
527
527
create_table:
528
528
        PARS_CREATE_TOKEN PARS_TABLE_TOKEN
529
529
        PARS_ID_TOKEN '(' column_def_list ')'
530
 
        not_fit_in_memory       { $$ = pars_create_table($3, $5, $7); }
 
530
        not_fit_in_memory       { $$ = pars_create_table(static_cast<sym_node_t *>($3), static_cast<sym_node_t *>($5), $7); }
531
531
;
532
532
 
533
533
column_list:
551
551
        clustered_def
552
552
        PARS_INDEX_TOKEN
553
553
        PARS_ID_TOKEN PARS_ON_TOKEN PARS_ID_TOKEN
554
 
        '(' column_list ')'     { $$ = pars_create_index($2, $3, $5, $7, $9); }
 
554
        '(' column_list ')'     { $$ = pars_create_index(static_cast<pars_res_word_t *>($2), static_cast<pars_res_word_t *>($3), static_cast<sym_node_t *>($5), static_cast<sym_node_t *>($7), static_cast<sym_node_t *>($9)); }
555
555
;
556
556
 
557
557
commit_statement:
574
574
 
575
575
parameter_declaration:
576
576
        PARS_ID_TOKEN PARS_IN_TOKEN type_name
577
 
                                { $$ = pars_parameter_declaration($1,
578
 
                                                        PARS_INPUT, $3); }
 
577
        { $$ = pars_parameter_declaration(static_cast<sym_node_t *>($1),
 
578
                                                                  PARS_INPUT, static_cast<pars_res_word_t *>($3)); }
579
579
        | PARS_ID_TOKEN PARS_OUT_TOKEN type_name
580
 
                                { $$ = pars_parameter_declaration($1,
581
 
                                                        PARS_OUTPUT, $3); }
 
580
        { $$ = pars_parameter_declaration(static_cast<sym_node_t *>($1),
 
581
                                                                  PARS_OUTPUT, static_cast<pars_res_word_t *>($3)); }
582
582
;
583
583
 
584
584
parameter_declaration_list:
590
590
 
591
591
variable_declaration:
592
592
        PARS_ID_TOKEN type_name ';'
593
 
                                { $$ = pars_variable_declaration($1, $2); }
 
593
        { $$ = pars_variable_declaration(static_cast<sym_node_t *>($1), static_cast<pars_res_word_t *>($2)); }
594
594
;
595
595
 
596
596
variable_declaration_list:
602
602
cursor_declaration:
603
603
        PARS_DECLARE_TOKEN PARS_CURSOR_TOKEN PARS_ID_TOKEN
604
604
        PARS_IS_TOKEN select_statement ';'
605
 
                                { $$ = pars_cursor_declaration($3, $5); }
 
605
        { $$ = pars_cursor_declaration(static_cast<sym_node_t *>($3), static_cast<sel_node_t *>($5)); }
606
606
;
607
607
 
608
608
function_declaration:
609
609
        PARS_DECLARE_TOKEN PARS_FUNCTION_TOKEN PARS_ID_TOKEN ';'
610
 
                                { $$ = pars_function_declaration($3); }
 
610
        { $$ = pars_function_declaration(static_cast<sym_node_t *>($3)); }
611
611
;
612
612
 
613
613
declaration:
628
628
        declaration_list
629
629
        PARS_BEGIN_TOKEN
630
630
        statement_list
631
 
        PARS_END_TOKEN          { $$ = pars_procedure_definition($2, $4,
 
631
        PARS_END_TOKEN          { $$ = pars_procedure_definition(static_cast<sym_node_t *>($2), static_cast<sym_node_t *>($4),
632
632
                                                                $10); }
633
633
;
634
634