Skip to content

Commit 0851701

Browse files
committedMar 28, 2019
Handle whitespace after semicolon
1 parent 2a929d8 commit 0851701

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
 

‎sql.ne

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
const valid_function_identifiers=['LEFT','RIGHT','REPLACE','MOD']
1414
%}
1515

16-
main -> sql (_ ";" | _) {% d => d[0] %}
16+
main -> sql (_ ";" _| _) {% d => d[0] %}
1717

1818
sql ->
1919
manipulative_statement {% d => d[0] %}

‎test/test1.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ const tests = [
182182
{
183183
sql: "select cast(x as decimal) as y#comment",
184184
toSql: "(select cast(`x` as decimal) as `y`)"
185+
},
186+
{
187+
sql: "select cast(x as decimal); ",
188+
toSql: "(select cast(`x` as decimal))"
185189
},
186190
{
187191
sql: 'select x.y>DATE_SUB(CURDATE(),INTERVAL 7 day) -- comments',

0 commit comments

Comments
 (0)