Skip to content

Commit 9699af6

Browse files
committed
fix LuaLS#698
1 parent 6d4f656 commit 9699af6

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 2.4.1
44
* `FIX` broken with single file
5+
* `FIX` #698
56

67
## 2.4.0
78
`2021-10-1`

script/parser/newparser.lua

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ local CharMapSign = stringToCharMap '+-'
5454
local CharMapSB = stringToCharMap 'ao|~&=<>.*/%^+-'
5555
local CharMapSU = stringToCharMap 'n#~!-'
5656
local CharMapSimple = stringToCharMap '.:([\'"{'
57-
local CharMapStrSH = stringToCharMap '\'"'
57+
local CharMapStrSH = stringToCharMap '\'"`'
5858
local CharMapStrLH = stringToCharMap '['
5959
local CharMapTSep = stringToCharMap ',;'
6060
local CharMapWord = stringToCharMap '_a-zA-Z\x80-\xff'
@@ -882,18 +882,6 @@ local function parseShortString()
882882
local startOffset = Tokens[Index]
883883
local startPos = getPosition(startOffset, 'left')
884884
Index = Index + 2
885-
-- empty string
886-
if Tokens[Index+1] == mark then
887-
local finishPos = getPosition(Tokens[Index], 'right')
888-
Index = Index + 2
889-
return {
890-
type = 'string',
891-
start = startPos,
892-
finish = finishPos,
893-
[1] = '',
894-
[2] = mark,
895-
}
896-
end
897885
local stringIndex = 0
898886
local currentOffset = startOffset + 1
899887
while true do
@@ -1024,13 +1012,41 @@ local function parseShortString()
10241012
::CONTINUE::
10251013
end
10261014
local stringResult = tconcat(stringPool, '', 1, stringIndex)
1027-
return {
1015+
local str = {
10281016
type = 'string',
10291017
start = startPos,
10301018
finish = lastRightPosition(),
10311019
[1] = stringResult,
10321020
[2] = mark,
10331021
}
1022+
if mark == '`' then
1023+
if State.options.nonstandardSymbol and State.options.nonstandardSymbol[mark] then
1024+
else
1025+
pushError {
1026+
type = 'ERR_NONSTANDARD_SYMBOL',
1027+
start = startPos,
1028+
finish = str.finish,
1029+
info = {
1030+
symbol = '"',
1031+
},
1032+
fix = {
1033+
title = 'FIX_NONSTANDARD_SYMBOL',
1034+
symbol = '"',
1035+
{
1036+
start = startPos,
1037+
finish = startPos + 1,
1038+
text = '"',
1039+
},
1040+
{
1041+
start = str.finish - 1,
1042+
finish = str.finish,
1043+
text = '"',
1044+
},
1045+
}
1046+
}
1047+
end
1048+
end
1049+
return str
10341050
end
10351051

10361052
local function parseString()

0 commit comments

Comments
 (0)