forked from xwb1989/sqlparser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sql.go
2453 lines (2384 loc) · 55.1 KB
/
sql.go
1
2
3
4
5
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
863
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//line sql.y:6
package sqlparser
import __yyfmt__ "fmt"
//line sql.y:6
import "bytes"
func SetParseTree(yylex interface{}, stmt Statement) {
yylex.(*Tokenizer).ParseTree = stmt
}
func SetAllowComments(yylex interface{}, allow bool) {
yylex.(*Tokenizer).AllowComments = allow
}
func ForceEOF(yylex interface{}) {
yylex.(*Tokenizer).ForceEOF = true
}
var (
SHARE = []byte("share")
MODE = []byte("mode")
IF_BYTES = []byte("if")
VALUES_BYTES = []byte("values")
)
//line sql.y:31
type yySymType struct {
yys int
empty struct{}
statement Statement
selStmt SelectStatement
byt byte
bytes []byte
bytes2 [][]byte
str string
selectExprs SelectExprs
selectExpr SelectExpr
columns Columns
colName *ColName
tableExprs TableExprs
tableExpr TableExpr
smTableExpr SimpleTableExpr
tableName *TableName
indexHints *IndexHints
expr Expr
boolExpr BoolExpr
valExpr ValExpr
colTuple ColTuple
valExprs ValExprs
values Values
rowTuple RowTuple
subquery *Subquery
caseExpr *CaseExpr
whens []*When
when *When
orderBy OrderBy
order *Order
limit *Limit
insRows InsertRows
updateExprs UpdateExprs
updateExpr *UpdateExpr
/*
for CreateTable
*/
createTableStmt CreateTable
columnDefinition *ColumnDefinition
columnDefinitions ColumnDefinitions
columnAtts ColumnAtts
}
const LEX_ERROR = 57346
const SELECT = 57347
const INSERT = 57348
const UPDATE = 57349
const DELETE = 57350
const FROM = 57351
const WHERE = 57352
const GROUP = 57353
const HAVING = 57354
const ORDER = 57355
const BY = 57356
const LIMIT = 57357
const FOR = 57358
const ALL = 57359
const DISTINCT = 57360
const AS = 57361
const EXISTS = 57362
const IN = 57363
const IS = 57364
const LIKE = 57365
const BETWEEN = 57366
const NULL = 57367
const ASC = 57368
const DESC = 57369
const VALUES = 57370
const INTO = 57371
const DUPLICATE = 57372
const KEY = 57373
const DEFAULT = 57374
const SET = 57375
const LOCK = 57376
const ID = 57377
const STRING = 57378
const NUMBER = 57379
const VALUE_ARG = 57380
const LIST_ARG = 57381
const COMMENT = 57382
const LE = 57383
const GE = 57384
const NE = 57385
const NULL_SAFE_EQUAL = 57386
const PRIMARY = 57387
const UNIQUE = 57388
const UNION = 57389
const MINUS = 57390
const EXCEPT = 57391
const INTERSECT = 57392
const JOIN = 57393
const STRAIGHT_JOIN = 57394
const LEFT = 57395
const RIGHT = 57396
const INNER = 57397
const OUTER = 57398
const CROSS = 57399
const NATURAL = 57400
const USE = 57401
const FORCE = 57402
const ON = 57403
const OR = 57404
const AND = 57405
const NOT = 57406
const UNARY = 57407
const CASE = 57408
const WHEN = 57409
const THEN = 57410
const ELSE = 57411
const END = 57412
const CREATE = 57413
const ALTER = 57414
const DROP = 57415
const RENAME = 57416
const ANALYZE = 57417
const TABLE = 57418
const INDEX = 57419
const VIEW = 57420
const TO = 57421
const IGNORE = 57422
const IF = 57423
const USING = 57424
const SHOW = 57425
const DESCRIBE = 57426
const EXPLAIN = 57427
const BIT = 57428
const TINYINT = 57429
const SMALLINT = 57430
const MEDIUMINT = 57431
const INT = 57432
const INTEGER = 57433
const BIGINT = 57434
const REAL = 57435
const DOUBLE = 57436
const FLOAT = 57437
const UNSIGNED = 57438
const ZEROFILL = 57439
const DECIMAL = 57440
const NUMERIC = 57441
const DATE = 57442
const TIME = 57443
const TIMESTAMP = 57444
const DATETIME = 57445
const YEAR = 57446
const TEXT = 57447
const CHAR = 57448
const VARCHAR = 57449
const NULLX = 57450
const AUTO_INCREMENT = 57451
const BOOL = 57452
const APPROXNUM = 57453
const INTNUM = 57454
var yyToknames = [...]string{
"$end",
"error",
"$unk",
"LEX_ERROR",
"SELECT",
"INSERT",
"UPDATE",
"DELETE",
"FROM",
"WHERE",
"GROUP",
"HAVING",
"ORDER",
"BY",
"LIMIT",
"FOR",
"ALL",
"DISTINCT",
"AS",
"EXISTS",
"IN",
"IS",
"LIKE",
"BETWEEN",
"NULL",
"ASC",
"DESC",
"VALUES",
"INTO",
"DUPLICATE",
"KEY",
"DEFAULT",
"SET",
"LOCK",
"ID",
"STRING",
"NUMBER",
"VALUE_ARG",
"LIST_ARG",
"COMMENT",
"LE",
"GE",
"NE",
"NULL_SAFE_EQUAL",
"'('",
"'='",
"'<'",
"'>'",
"'~'",
"PRIMARY",
"UNIQUE",
"UNION",
"MINUS",
"EXCEPT",
"INTERSECT",
"','",
"JOIN",
"STRAIGHT_JOIN",
"LEFT",
"RIGHT",
"INNER",
"OUTER",
"CROSS",
"NATURAL",
"USE",
"FORCE",
"ON",
"OR",
"AND",
"NOT",
"'&'",
"'|'",
"'^'",
"' '",
"'-'",
"'*'",
"'/'",
"'%'",
"'.'",
"UNARY",
"CASE",
"WHEN",
"THEN",
"ELSE",
"END",
"CREATE",
"ALTER",
"DROP",
"RENAME",
"ANALYZE",
"TABLE",
"INDEX",
"VIEW",
"TO",
"IGNORE",
"IF",
"USING",
"SHOW",
"DESCRIBE",
"EXPLAIN",
"BIT",
"TINYINT",
"SMALLINT",
"MEDIUMINT",
"INT",
"INTEGER",
"BIGINT",
"REAL",
"DOUBLE",
"FLOAT",
"UNSIGNED",
"ZEROFILL",
"DECIMAL",
"NUMERIC",
"DATE",
"TIME",
"TIMESTAMP",
"DATETIME",
"YEAR",
"TEXT",
"CHAR",
"VARCHAR",
"NULLX",
"AUTO_INCREMENT",
"BOOL",
"APPROXNUM",
"INTNUM",
"')'",
}
var yyStatenames = [...]string{}
const yyEofCode = 1
const yyErrCode = 2
const yyMaxDepth = 200
//line yacctab:1
var yyExca = [...]int{
-1, 1,
1, -1,
-2, 0,
}
const yyNprod = 254
const yyPrivate = 57344
var yyTokenNames []string
var yyStates []string
const yyLast = 689
var yyAct = [...]int{
95, 294, 159, 429, 92, 358, 246, 93, 63, 162,
368, 250, 364, 197, 286, 103, 237, 208, 439, 86,
81, 177, 161, 3, 260, 261, 262, 263, 264, 82,
265, 266, 439, 51, 439, 29, 30, 31, 32, 66,
136, 135, 71, 65, 442, 74, 426, 64, 407, 78,
427, 54, 130, 229, 297, 292, 130, 130, 397, 87,
52, 53, 363, 185, 404, 398, 229, 77, 339, 341,
69, 120, 44, 386, 45, 47, 48, 49, 385, 256,
128, 124, 384, 403, 405, 132, 271, 70, 238, 349,
441, 134, 117, 163, 113, 343, 73, 164, 340, 42,
227, 72, 50, 396, 440, 121, 438, 46, 123, 158,
160, 228, 171, 66, 168, 119, 66, 65, 181, 180,
65, 175, 426, 381, 348, 345, 298, 291, 281, 279,
148, 149, 150, 87, 203, 181, 217, 135, 230, 39,
207, 41, 204, 215, 216, 201, 219, 220, 221, 222,
223, 224, 225, 226, 210, 205, 206, 399, 136, 135,
202, 115, 195, 179, 238, 287, 284, 252, 231, 87,
87, 191, 287, 351, 66, 66, 136, 135, 65, 244,
127, 218, 242, 383, 333, 382, 253, 233, 235, 334,
189, 60, 337, 192, 336, 241, 335, 245, 248, 146,
147, 148, 149, 150, 234, 331, 98, 115, 229, 427,
332, 102, 231, 270, 108, 201, 274, 275, 257, 272,
254, 85, 99, 100, 101, 178, 392, 353, 210, 116,
273, 90, 278, 200, 178, 106, 129, 87, 76, 29,
30, 31, 32, 199, 211, 188, 190, 187, 289, 417,
209, 111, 293, 283, 114, 280, 89, 290, 285, 416,
104, 105, 83, 14, 15, 16, 17, 109, 415, 173,
165, 258, 329, 330, 201, 201, 394, 395, 374, 347,
115, 174, 107, 130, 369, 391, 365, 350, 79, 182,
14, 18, 169, 66, 167, 355, 166, 354, 356, 359,
143, 144, 145, 146, 147, 148, 149, 150, 110, 360,
422, 423, 434, 410, 232, 409, 408, 72, 366, 367,
200, 143, 144, 145, 146, 147, 148, 149, 150, 67,
199, 251, 370, 371, 372, 375, 373, 376, 344, 269,
342, 326, 325, 194, 20, 21, 23, 22, 24, 387,
193, 176, 125, 122, 388, 268, 25, 26, 27, 377,
346, 390, 143, 144, 145, 146, 147, 148, 149, 150,
276, 133, 143, 144, 145, 146, 147, 148, 149, 150,
118, 61, 436, 231, 80, 411, 75, 72, 112, 425,
413, 424, 389, 352, 419, 359, 59, 421, 420, 412,
437, 414, 143, 144, 145, 146, 147, 148, 149, 150,
14, 277, 212, 428, 213, 214, 430, 430, 430, 66,
431, 432, 444, 65, 183, 33, 126, 433, 260, 261,
262, 263, 264, 240, 265, 266, 57, 55, 295, 380,
445, 35, 36, 37, 38, 446, 296, 447, 313, 314,
315, 316, 317, 318, 319, 320, 321, 322, 247, 379,
323, 324, 308, 309, 310, 311, 312, 307, 305, 306,
98, 328, 178, 62, 14, 102, 14, 443, 108, 418,
34, 402, 401, 361, 302, 85, 99, 100, 101, 98,
304, 303, 400, 406, 102, 90, 362, 108, 300, 106,
301, 19, 249, 299, 67, 99, 100, 101, 184, 40,
255, 186, 43, 68, 90, 243, 172, 435, 106, 393,
89, 357, 378, 327, 104, 105, 83, 282, 170, 236,
97, 109, 94, 96, 288, 91, 239, 98, 14, 89,
137, 88, 102, 104, 105, 108, 107, 338, 198, 259,
109, 196, 67, 99, 100, 101, 84, 267, 102, 131,
56, 108, 90, 28, 58, 107, 106, 13, 67, 99,
100, 101, 12, 11, 10, 9, 8, 7, 165, 6,
5, 4, 106, 2, 1, 0, 0, 89, 0, 0,
0, 104, 105, 0, 0, 0, 0, 0, 109, 102,
0, 0, 108, 0, 0, 0, 0, 104, 105, 67,
99, 100, 101, 107, 109, 0, 0, 0, 0, 165,
0, 0, 0, 106, 0, 0, 0, 0, 0, 107,
0, 138, 142, 140, 141, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 104, 105,
0, 154, 155, 156, 157, 109, 151, 152, 153, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
107, 0, 0, 0, 0, 0, 0, 0, 0, 0,
139, 143, 144, 145, 146, 147, 148, 149, 150,
}
var yyPact = [...]int{
258, -1000, -1000, 187, -1000, -1000, -1000, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
48, -21, 16, -16, 11, -1000, -1000, -1000, 471, 420,
-1000, -1000, -1000, 418, -1000, 367, 346, 464, 294, -26,
-5, 282, -1000, 5, 282, -1000, 351, -29, 282, -29,
349, -1000, -1000, -1000, -1000, -1000, 450, -1000, 268, 346,
355, 15, 346, 151, -1000, 183, -1000, 13, 345, 45,
282, -1000, -1000, 318, -1000, -13, 317, 406, 113, 282,
-1000, 227, -1000, -1000, 352, 12, 108, 610, -1000, 517,
469, -1000, -1000, -1000, 574, 251, 249, -1000, 247, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 574,
-1000, 236, 294, 316, 462, 294, 574, 282, 244, 404,
-34, -1000, 158, -1000, 315, -1000, -1000, 308, -1000, 198,
450, -1000, -1000, 282, 66, 517, 517, 574, 205, 391,
574, 574, 111, 574, 574, 574, 574, 574, 574, 574,
574, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 610,
-28, -17, 10, 610, -1000, 533, 186, 450, -1000, 471,
6, 331, 405, 294, 294, 224, -1000, 445, 517, -1000,
331, -1000, 296, -1000, 100, 282, -1000, -15, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, 215, 371, 320, 285,
7, -1000, -1000, -1000, -1000, -1000, 68, 331, -1000, 533,
-1000, -1000, 205, 574, 574, 331, 301, -1000, 386, 125,
125, 125, 54, 54, -1000, -1000, -1000, -1000, -1000, 574,
-1000, 331, -1000, 1, 450, 0, 82, -1000, 517, 98,
225, 187, 105, -1, -1000, 445, 423, 432, 108, -2,
-1000, 347, 307, -1000, -1000, 306, -1000, 460, 198, 198,
-1000, -1000, 148, 127, 139, 137, 135, 3, -1000, 305,
-33, 303, -3, -1000, 331, 291, 574, -1000, 331, -1000,
-4, -1000, 4, -1000, 574, 90, -1000, 363, 171, -1000,
-1000, -1000, 294, 423, -1000, 574, 574, 296, -1000, -1000,
-49, -1000, -1000, 241, -1000, 241, 241, -1000, -1000, -1000,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
239, 239, 239, 233, 233, -1000, -1000, 447, 425, 371,
56, -1000, 128, -1000, 126, -1000, -1000, -1000, -1000, -10,
-14, -19, -1000, -1000, -1000, -1000, 574, 331, -1000, -1000,
331, 574, 361, 225, -1000, -1000, 229, 170, -1000, 250,
-1000, 33, -64, -1000, -1000, 279, -1000, -1000, -1000, 278,
-1000, -1000, -1000, -1000, 276, -1000, -1000, -1000, 445, 517,
574, 517, -1000, -1000, 223, 214, 204, 331, 331, 472,
-1000, 574, 574, -1000, -1000, -1000, 372, -1000, 274, -1000,
-1000, -1000, -1000, 360, -1000, 358, -1000, -1000, -82, 153,
-6, 423, 108, 152, 108, 282, 282, 282, 294, 331,
-1000, -1000, -1000, -1000, -1000, -1000, -1000, 275, 366, -22,
-1000, -24, -38, 151, -84, -1000, 470, 401, -1000, 282,
-1000, -1000, -1000, -1000, 282, -1000, 282, -1000,
}
var yyPgo = [...]int{
0, 584, 583, 22, 581, 580, 579, 577, 576, 575,
574, 573, 572, 567, 425, 564, 563, 560, 20, 29,
559, 557, 556, 551, 13, 549, 548, 191, 547, 3,
21, 19, 541, 540, 536, 535, 2, 17, 9, 534,
7, 533, 15, 532, 4, 530, 529, 16, 528, 527,
523, 522, 6, 521, 5, 519, 1, 517, 516, 515,
14, 8, 47, 238, 513, 512, 511, 510, 509, 508,
0, 33, 503, 11, 502, 501, 12, 500, 498, 496,
493, 492, 491, 490, 10, 484, 483, 482, 481, 480,
}
var yyR1 = [...]int{
0, 1, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 3, 3, 4, 4, 5, 6, 7,
80, 80, 72, 72, 72, 85, 85, 85, 85, 85,
77, 77, 77, 78, 78, 82, 82, 82, 82, 82,
82, 82, 83, 83, 83, 83, 83, 83, 83, 84,
84, 76, 76, 79, 79, 86, 86, 86, 86, 86,
86, 86, 81, 81, 87, 87, 88, 88, 73, 74,
74, 75, 8, 8, 8, 9, 9, 9, 10, 11,
11, 11, 12, 13, 13, 13, 89, 14, 15, 15,
16, 16, 16, 16, 16, 17, 17, 18, 18, 19,
19, 19, 22, 22, 20, 20, 20, 23, 23, 24,
24, 24, 24, 21, 21, 21, 25, 25, 25, 25,
25, 25, 25, 25, 25, 26, 26, 26, 27, 27,
28, 28, 28, 28, 29, 29, 30, 30, 31, 31,
31, 31, 31, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 33, 33, 33, 33, 33, 33, 33,
37, 37, 37, 42, 38, 38, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 41, 41, 43, 43, 43, 45, 48,
48, 46, 46, 47, 49, 49, 44, 44, 35, 35,
35, 35, 50, 50, 51, 51, 52, 52, 53, 53,
54, 55, 55, 55, 56, 56, 56, 57, 57, 57,
58, 58, 59, 59, 60, 60, 34, 34, 39, 39,
40, 40, 61, 61, 62, 63, 63, 64, 64, 65,
65, 66, 66, 66, 66, 66, 67, 67, 68, 68,
69, 69, 70, 71,
}
var yyR2 = [...]int{
0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 12, 3, 7, 7, 8, 7, 3,
0, 1, 3, 1, 1, 1, 1, 1, 1, 1,
2, 2, 1, 2, 1, 1, 1, 1, 1, 1,
1, 1, 2, 2, 2, 2, 2, 2, 2, 0,
5, 0, 3, 0, 1, 0, 3, 2, 3, 3,
2, 2, 1, 1, 2, 1, 1, 2, 3, 1,
3, 7, 1, 8, 4, 6, 7, 4, 5, 4,
5, 5, 3, 2, 2, 2, 0, 2, 0, 2,
1, 2, 1, 1, 1, 0, 1, 1, 3, 1,
2, 3, 1, 1, 0, 1, 2, 1, 3, 3,
3, 3, 5, 0, 1, 2, 1, 1, 2, 3,
2, 3, 2, 2, 2, 1, 3, 1, 1, 3,
0, 5, 5, 5, 1, 3, 0, 2, 1, 3,
3, 2, 3, 3, 3, 4, 3, 4, 5, 6,
3, 4, 2, 1, 1, 1, 1, 1, 1, 1,
3, 1, 1, 3, 1, 3, 1, 1, 1, 3,
3, 3, 3, 3, 3, 3, 3, 2, 3, 4,
5, 4, 1, 1, 1, 1, 1, 1, 5, 0,
1, 1, 2, 4, 0, 2, 1, 3, 1, 1,
1, 1, 0, 3, 0, 2, 0, 3, 1, 3,
2, 0, 1, 1, 0, 2, 4, 0, 2, 4,
0, 3, 1, 3, 0, 5, 2, 1, 1, 3,
3, 1, 1, 3, 3, 0, 2, 0, 3, 0,
1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
0, 2, 1, 0,
}
var yyChk = [...]int{
-1000, -1, -2, -3, -4, -5, -6, -7, -8, -9,
-10, -11, -12, -13, 5, 6, 7, 8, 33, -75,
86, 87, 89, 88, 90, 98, 99, 100, -16, 52,
53, 54, 55, -14, -89, -14, -14, -14, -14, 91,
-68, 93, 51, -65, 93, 95, 91, 91, 92, 93,
91, -71, -71, -71, -3, 17, -17, 18, -15, 29,
-27, 35, 9, -61, -62, -44, -70, 35, -64, 96,
92, -70, 35, 91, -70, 35, -63, 96, -70, -63,
35, -18, -19, 76, -22, 35, -31, -36, -32, 70,
45, -35, -44, -40, -43, -70, -41, -45, 20, 36,
37, 38, 25, -42, 74, 75, 49, 96, 28, 81,
40, -27, 33, 79, -27, 56, 46, 79, 35, 70,
-70, -71, 35, -71, 94, 35, 20, 67, -70, 9,
56, -20, -70, 19, 79, 69, 68, -33, 21, 70,
23, 24, 22, 71, 72, 73, 74, 75, 76, 77,
78, 46, 47, 48, 41, 42, 43, 44, -31, -36,
-31, -3, -38, -36, -36, 45, 45, 45, -42, 45,
-48, -36, -58, 33, 45, -61, 35, -30, 10, -62,
-36, -70, 45, 20, -69, 97, -66, 89, 87, 32,
88, 13, 35, 35, 35, -71, -23, -24, -26, 45,
35, -42, -19, -70, 76, -31, -31, -36, -37, 45,
-42, 39, 21, 23, 24, -36, -36, 25, 70, -36,
-36, -36, -36, -36, -36, -36, -36, 128, 128, 56,
128, -36, 128, -18, 18, -18, -46, -47, 82, -34,
28, -3, -61, -59, -44, -30, -52, 13, -31, -74,
-73, 35, 67, -70, -71, -67, 94, -30, 56, -25,
57, 58, 59, 60, 61, 63, 64, -21, 35, 19,
-24, 79, -38, -37, -36, -36, 69, 25, -36, 128,
-18, 128, -49, -47, 84, -31, -60, 67, -39, -40,
-60, 128, 56, -52, -56, 15, 14, 56, 128, -72,
-78, -77, -85, -82, -83, 121, 122, 120, 115, 116,
117, 118, 119, 101, 102, 103, 104, 105, 106, 107,
108, 109, 110, 113, 114, 35, 35, -50, 11, -24,
-24, 57, 62, 57, 62, 57, 57, 57, -28, 65,
95, 66, 35, 128, 35, 128, 69, -36, 128, 85,
-36, 83, 30, 56, -44, -56, -36, -53, -54, -36,
-73, -86, -79, 111, -76, 45, -76, -76, -84, 45,
-84, -84, -84, -76, 45, -84, -76, -71, -51, 12,
14, 67, 57, 57, 92, 92, 92, -36, -36, 31,
-40, 56, 56, -55, 26, 27, 70, 25, 32, 124,
-81, -87, -88, 50, 31, 51, -80, 112, 37, 37,
37, -52, -31, -38, -31, 45, 45, 45, 7, -36,
-54, 25, 36, 37, 31, 31, 128, 56, -56, -29,
-70, -29, -29, -61, 37, -57, 16, 34, 128, 56,
128, 128, 128, 7, 21, -70, -70, -70,
}
var yyDef = [...]int{
0, -2, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 86, 86, 86, 86, 86, 72,
248, 239, 0, 0, 0, 253, 253, 253, 0, 90,
92, 93, 94, 95, 88, 0, 0, 0, 0, 237,
0, 0, 249, 0, 0, 240, 0, 235, 0, 235,
0, 83, 84, 85, 14, 91, 0, 96, 87, 0,
0, 128, 0, 19, 232, 0, 196, 252, 0, 0,
0, 253, 252, 0, 253, 0, 0, 0, 0, 0,
82, 0, 97, 99, 104, 252, 102, 103, 138, 0,
0, 166, 167, 168, 0, 196, 0, 182, 0, 198,
199, 200, 201, 231, 185, 186, 187, 183, 184, 189,
89, 220, 0, 0, 136, 0, 0, 0, 0, 0,
250, 74, 0, 77, 0, 79, 236, 0, 253, 0,
0, 100, 105, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 153, 154, 155, 156, 157, 158, 159, 141, 0,
0, 0, 0, 164, 177, 0, 0, 0, 152, 0,
0, 190, 0, 0, 0, 136, 129, 206, 0, 233,
234, 197, 0, 238, 0, 0, 253, 246, 241, 242,
243, 244, 245, 78, 80, 81, 136, 107, 113, 0,
125, 127, 98, 106, 101, 139, 140, 143, 144, 0,
161, 162, 0, 0, 0, 146, 0, 150, 0, 169,
170, 171, 172, 173, 174, 175, 176, 142, 163, 0,
230, 164, 178, 0, 0, 0, 194, 191, 0, 224,
0, 227, 224, 0, 222, 206, 214, 0, 137, 0,
69, 0, 0, 251, 75, 0, 247, 202, 0, 0,
116, 117, 0, 0, 0, 0, 0, 130, 114, 0,
0, 0, 0, 145, 147, 0, 0, 151, 165, 179,
0, 181, 0, 192, 0, 0, 15, 0, 226, 228,
16, 221, 0, 214, 18, 0, 0, 0, 71, 55,
53, 23, 24, 51, 34, 51, 51, 32, 25, 26,
27, 28, 29, 35, 36, 37, 38, 39, 40, 41,
49, 49, 49, 49, 49, 253, 76, 204, 0, 108,
111, 118, 0, 120, 0, 122, 123, 124, 109, 0,
0, 0, 115, 110, 126, 160, 0, 148, 180, 188,
195, 0, 0, 0, 223, 17, 215, 207, 208, 211,
70, 68, 20, 54, 33, 0, 30, 31, 42, 0,
43, 44, 45, 46, 0, 47, 48, 73, 206, 0,
0, 0, 119, 121, 0, 0, 0, 149, 193, 0,
229, 0, 0, 210, 212, 213, 0, 57, 0, 60,
61, 62, 63, 0, 65, 66, 22, 21, 0, 0,
0, 214, 205, 203, 112, 0, 0, 0, 0, 216,
209, 56, 58, 59, 64, 67, 52, 0, 217, 0,
134, 0, 0, 225, 0, 13, 0, 0, 131, 0,
132, 133, 50, 218, 0, 135, 0, 219,
}
var yyTok1 = [...]int{
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, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 78, 71, 3,
45, 128, 76, 74, 56, 75, 79, 77, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
47, 46, 48, 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, 3,
3, 3, 3, 3, 73, 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, 3, 3, 3, 72, 3, 49,
}
var yyTok2 = [...]int{
2, 3, 4, 5, 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, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 50, 51, 52, 53, 54, 55, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, 69, 70, 80, 81, 82, 83, 84, 85, 86,
87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
127,
}
var yyTok3 = [...]int{
0,
}
var yyErrorMessages = [...]struct {
state int
token int
msg string
}{}
//line yaccpar:1
/* parser for yacc output */
var (
yyDebug = 0
yyErrorVerbose = false
)
type yyLexer interface {
Lex(lval *yySymType) int
Error(s string)
}
type yyParser interface {
Parse(yyLexer) int
Lookahead() int
}
type yyParserImpl struct {
lookahead func() int
}
func (p *yyParserImpl) Lookahead() int {
return p.lookahead()
}
func yyNewParser() yyParser {
p := &yyParserImpl{
lookahead: func() int { return -1 },
}
return p
}
const yyFlag = -1000
func yyTokname(c int) string {
if c >= 1 && c-1 < len(yyToknames) {
if yyToknames[c-1] != "" {
return yyToknames[c-1]
}
}
return __yyfmt__.Sprintf("tok-%v", c)
}
func yyStatname(s int) string {
if s >= 0 && s < len(yyStatenames) {
if yyStatenames[s] != "" {
return yyStatenames[s]
}
}
return __yyfmt__.Sprintf("state-%v", s)
}
func yyErrorMessage(state, lookAhead int) string {
const TOKSTART = 4
if !yyErrorVerbose {
return "syntax error"
}
for _, e := range yyErrorMessages {
if e.state == state && e.token == lookAhead {
return "syntax error: " e.msg
}
}
res := "syntax error: unexpected " yyTokname(lookAhead)
// To match Bison, suggest at most four expected tokens.
expected := make([]int, 0, 4)
// Look for shiftable tokens.
base := yyPact[state]
for tok := TOKSTART; tok-1 < len(yyToknames); tok {
if n := base tok; n >= 0 && n < yyLast && yyChk[yyAct[n]] == tok {
if len(expected) == cap(expected) {
return res
}
expected = append(expected, tok)
}
}
if yyDef[state] == -2 {
i := 0
for yyExca[i] != -1 || yyExca[i 1] != state {
i = 2
}
// Look for tokens that we accept or reduce.
for i = 2; yyExca[i] >= 0; i = 2 {
tok := yyExca[i]
if tok < TOKSTART || yyExca[i 1] == 0 {
continue
}
if len(expected) == cap(expected) {
return res
}
expected = append(expected, tok)
}
// If the default action is to accept or reduce, give up.
if yyExca[i 1] != 0 {
return res
}
}
for i, tok := range expected {
if i == 0 {
res = ", expecting "
} else {
res = " or "
}
res = yyTokname(tok)
}
return res
}
func yylex1(lex yyLexer, lval *yySymType) (char, token int) {
token = 0
char = lex.Lex(lval)
if char <= 0 {
token = yyTok1[0]
goto out
}
if char < len(yyTok1) {
token = yyTok1[char]
goto out
}
if char >= yyPrivate {
if char < yyPrivate len(yyTok2) {
token = yyTok2[char-yyPrivate]
goto out
}
}
for i := 0; i < len(yyTok3); i = 2 {
token = yyTok3[i 0]
if token == char {
token = yyTok3[i 1]
goto out
}
}
out:
if token == 0 {
token = yyTok2[1] /* unknown char */
}
if yyDebug >= 3 {
__yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char))
}
return char, token
}
func yyParse(yylex yyLexer) int {
return yyNewParser().Parse(yylex)
}
func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int {
var yyn int
var yylval yySymType
var yyVAL yySymType
var yyDollar []yySymType
_ = yyDollar // silence set and not used
yyS := make([]yySymType, yyMaxDepth)
Nerrs := 0 /* number of errors */
Errflag := 0 /* error recovery flag */
yystate := 0
yychar := -1
yytoken := -1 // yychar translated into internal numbering
yyrcvr.lookahead = func() int { return yychar }
defer func() {
// Make sure we report no lookahead when not parsing.
yystate = -1
yychar = -1
yytoken = -1
}()
yyp := -1
goto yystack
ret0:
return 0
ret1:
return 1
yystack:
/* put a state and value onto the stack */
if yyDebug >= 4 {
__yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate))
}
yyp
if yyp >= len(yyS) {
nyys := make([]yySymType, len(yyS)*2)
copy(nyys, yyS)
yyS = nyys
}
yyS[yyp] = yyVAL
yyS[yyp].yys = yystate
yynewstate:
yyn = yyPact[yystate]
if yyn <= yyFlag {
goto yydefault /* simple state */
}
if yychar < 0 {
yychar, yytoken = yylex1(yylex, &yylval)
}
yyn = yytoken
if yyn < 0 || yyn >= yyLast {
goto yydefault
}
yyn = yyAct[yyn]
if yyChk[yyn] == yytoken { /* valid shift */
yychar = -1
yytoken = -1
yyVAL = yylval
yystate = yyn
if Errflag > 0 {
Errflag--
}
goto yystack
}
yydefault:
/* default state action */
yyn = yyDef[yystate]
if yyn == -2 {
if yychar < 0 {
yychar, yytoken = yylex1(yylex, &yylval)
}
/* look through exception table */
xi := 0
for {
if yyExca[xi 0] == -1 && yyExca[xi 1] == yystate {
break
}
xi = 2
}
for xi = 2; ; xi = 2 {
yyn = yyExca[xi 0]
if yyn < 0 || yyn == yytoken {
break
}
}
yyn = yyExca[xi 1]
if yyn < 0 {
goto ret0
}
}
if yyn == 0 {
/* error ... attempt to resume parsing */
switch Errflag {
case 0: /* brand new error */
yylex.Error(yyErrorMessage(yystate, yytoken))
Nerrs
if yyDebug >= 1 {
__yyfmt__.Printf("%s", yyStatname(yystate))
__yyfmt__.Printf(" saw %s\n", yyTokname(yytoken))
}
fallthrough
case 1, 2: /* incompletely recovered error ... try again */
Errflag = 3
/* find a state where "error" is a legal shift action */
for yyp >= 0 {
yyn = yyPact[yyS[yyp].yys] yyErrCode
if yyn >= 0 && yyn < yyLast {
yystate = yyAct[yyn] /* simulate a shift of "error" */
if yyChk[yystate] == yyErrCode {
goto yystack
}
}
/* the current p has no shift on "error", pop stack */
if yyDebug >= 2 {
__yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys)
}
yyp--
}
/* there is no state on the stack with an error shift ... abort */
goto ret1
case 3: /* no shift yet; clobber input char */
if yyDebug >= 2 {
__yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken))
}
if yytoken == yyEofCode {
goto ret1
}
yychar = -1
yytoken = -1
goto yynewstate /* try again in the same state */
}
}
/* reduction by production yyn */
if yyDebug >= 2 {
__yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate))
}
yynt := yyn
yypt := yyp
_ = yypt // guard against "declared and not used"
yyp -= yyR2[yyn]
// yyp is now the index of $0. Perform the default action. Iff the
// reduced production is ε, $1 is possibly out of range.
if yyp 1 >= len(yyS) {
nyys := make([]yySymType, len(yyS)*2)
copy(nyys, yyS)
yyS = nyys
}
yyVAL = yyS[yyp 1]
/* consult goto table to find next state */
yyn = yyR1[yyn]
yyg := yyPgo[yyn]
yyj := yyg yyS[yyp].yys 1
if yyj >= yyLast {
yystate = yyAct[yyg]
} else {
yystate = yyAct[yyj]
if yyChk[yystate] != -yyn {
yystate = yyAct[yyg]
}
}
// dummy call; replaced with literal code
switch yynt {
case 1:
yyDollar = yyS[yypt-1 : yypt 1]
//line sql.y:181
{
SetParseTree(yylex, yyDollar[1].statement)