Skip to content

Commit 2361c57

Browse files
committed
fix: #40
1 parent 7f3b853 commit 2361c57

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/sqlParser.jison

+3-2
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ UNION return 'UNION'
126126

127127
[a-zA-Z_\u4e00-\u9fa5][a-zA-Z0-9_\u4e00-\u9fa5]* return 'IDENTIFIER'
128128
\. return 'DOT'
129-
['"][a-zA-Z_\u4e00-\u9fa5][a-zA-Z0-9_\u4e00-\u9fa5]*["'] return 'IDENTIFIER'
130-
([`])(?:(?=(\\?))\2.)*?\1 return 'IDENTIFIER'
129+
["][a-zA-Z_\u4e00-\u9fa5][a-zA-Z0-9_\u4e00-\u9fa5]*["] return 'STRING'
130+
['][a-zA-Z_\u4e00-\u9fa5][a-zA-Z0-9_\u4e00-\u9fa5]*['] return 'STRING'
131+
[`].+[`] return 'IDENTIFIER'
131132

132133
<<EOF>> return 'EOF'
133134
. return 'INVALID'

test/main.test.js

+9
Original file line numberDiff line numberDiff line change
@@ -422,4 +422,13 @@ describe('select grammar support', function () {
422422
testParser('select a as "A A" from z');
423423
testParser('select a as "A A" from z order by "A A" desc');
424424
});
425+
426+
it('support quoted alias', function () {
427+
testParser('select a as \'A A\' from z');
428+
testParser('select a as \'"A#A\' from z order by \'"A#A\' desc');
429+
});
430+
431+
it.only('test IDENTIFIER', function () {
432+
testParser('select `aa#sfs`(a) as \'A A\' from z');
433+
});
425434
});

0 commit comments

Comments
 (0)