Skip to content

Commit 5310260

Browse files
committed
hotfix: keyword limit missing.
1 parent 436f780 commit 5310260

File tree

6 files changed

+15
-1695
lines changed

6 files changed

+15
-1695
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
node_modules
33
*.log
44
*.swp
5+
dist/parser/sqlParser.js
6+

.npmignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Makefile
2+
*.log
3+
node_modules
4+
src
5+
test

dist/parser/.gitkeep

Whitespace-only changes.

dist/parser/sqlParser.js

-1,692
This file was deleted.

src/sqlParser.jison

+4-3
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ LOCK return 'LOCK'
8888
SHARE return 'SHARE'
8989
MODE return 'MODE'
9090
OJ return 'OJ'
91+
LIMIT return 'LIMIT'
9192

9293
"," return ','
9394
"=" return '='
@@ -442,9 +443,9 @@ having_opt
442443
| HAVING expr { $$ = $2 }
443444
;
444445
limit
445-
: NUMERIC { $$ = { type: 'Limit', value: [ $1 ] } }
446-
| NUMERIC ',' NUMERIC { $$ = { type: 'Limit', value: [ $1, $3 ] } }
447-
| NUMERIC OFFSET NUMERIC { $$ = { type: 'Limit', value: [ $3, $1 ], offsetMode: true } }
446+
: LIMIT NUMERIC { $$ = { type: 'Limit', value: [ $2 ] } }
447+
| LIMIT NUMERIC ',' NUMERIC { $$ = { type: 'Limit', value: [ $2, $4 ] } }
448+
| LIMIT NUMERIC OFFSET NUMERIC { $$ = { type: 'Limit', value: [ $4, $2 ], offsetMode: true } }
448449
;
449450
limit_opt
450451
: { $$ = null }

test/main.test.js

+4
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,9 @@ AND (rd.rd_numberofrooms <= (select sum(rn.reservation_numberofrooms) as count_r
130130
it ('test11 SELECT `LEFT`(a, 3) FROM b support.', function () {
131131
testParser('SELECT `LEFT`(a, 3) FROM b');
132132
});
133+
134+
it ('limit support.', function () {
135+
testParser('select a from b limit 2, 3');
136+
});
133137
});
134138

0 commit comments

Comments
 (0)