summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-11-10 14:58:09 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-11-10 14:58:09 +0800
commitf33db0b3dc76197d20464ca4a95b6472e1bcb634 (patch)
treef344505784d522603f6702ec53a43f9e604a97b5 /script/parser
parent970a8fa3bc196e3ffc37f7c7301627d1206e78b5 (diff)
downloadlua-language-server-f33db0b3dc76197d20464ca4a95b6472e1bcb634.zip
resolve #785
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/newparser.lua21
1 files changed, 15 insertions, 6 deletions
diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua
index cee6d499..0132350b 100644
--- a/script/parser/newparser.lua
+++ b/script/parser/newparser.lua
@@ -487,7 +487,13 @@ end
local function skipComment(isAction)
local token = Tokens[Index + 1]
if token == '--'
- or (token == '//' and isAction) then
+ or (
+ token == '//'
+ and (
+ isAction
+ or State.options.nonstandardSymbol['//']
+ )
+ ) then
local start = Tokens[Index]
local left = getPosition(start, 'left')
local chead = false
@@ -1527,7 +1533,7 @@ local function parseTable()
local index = 0
local wantSep = false
while true do
- skipSpace()
+ skipSpace(true)
local token = Tokens[Index + 1]
if token == '}' then
Index = Index + 2
@@ -2162,7 +2168,7 @@ local function parseFunction(isLocal, isAction)
Index = Index + 2
local LastLocalCount = LocalCount
LocalCount = 0
- skipSpace()
+ skipSpace(true)
local hasLeftParen = Tokens[Index + 1] == '('
if not hasLeftParen then
local name = parseName()
@@ -2192,7 +2198,7 @@ local function parseFunction(isLocal, isAction)
finish = simple.finish,
}
end
- skipSpace()
+ skipSpace(true)
hasLeftParen = Tokens[Index + 1] == '('
end
end
@@ -2223,7 +2229,7 @@ local function parseFunction(isLocal, isAction)
params.parent = func
func.args = params
end
- skipSpace()
+ skipSpace(true)
if Tokens[Index + 1] == ')' then
local parenRight = getPosition(Tokens[Index], 'right')
func.finish = parenRight
@@ -2231,7 +2237,7 @@ local function parseFunction(isLocal, isAction)
params.finish = parenRight
end
Index = Index + 2
- skipSpace()
+ skipSpace(true)
else
func.finish = lastRightPosition()
if params then
@@ -2340,6 +2346,9 @@ local function parseBinaryOP(asAction, level)
if not symbol then
return nil
end
+ if symbol == '//' and State.options.nonstandardSymbol['//'] then
+ return nil
+ end
local myLevel = BinarySymbol[symbol]
if level and myLevel < level then
return nil