diff options
Diffstat (limited to 'script/parser')
-rw-r--r-- | script/parser/compile.lua | 23 | ||||
-rw-r--r-- | script/parser/guide.lua | 6 | ||||
-rw-r--r-- | script/parser/luadoc.lua | 2 |
3 files changed, 15 insertions, 16 deletions
diff --git a/script/parser/compile.lua b/script/parser/compile.lua index 9db46241..ac599030 100644 --- a/script/parser/compile.lua +++ b/script/parser/compile.lua @@ -269,14 +269,13 @@ end ---@return string word ---@return parser.position startPosition ---@return parser.position finishPosition ----@return integer newOffset local function peekWord() local word = Tokens[Index + 1] if not word then - return nil + return nil, nil, nil end if not CharMapWord[ssub(word, 1, 1)] then - return nil + return nil, nil, nil end local startPos = getPosition(Tokens[Index] , 'left') local finishPos = getPosition(Tokens[Index] + #word - 1, 'right') @@ -2598,29 +2597,29 @@ local function parseSetValues() skipSpace() local first = parseExp() if not first then - return nil + return nil, nil, nil end skipSpace() if Tokens[Index + 1] ~= ',' then - return first + return first, nil, nil end Index = Index + 2 skipSeps() local second = parseExp() if not second then missExp() - return first + return first, nil, nil end skipSpace() if Tokens[Index + 1] ~= ',' then - return first, second + return first, second, nil end Index = Index + 2 skipSeps() local third = parseExp() if not third then missExp() - return first, second + return first, second, nil end local rest = { third } @@ -2652,14 +2651,14 @@ end ---@return parser.object[] rest local function parseVarTails(parser, isLocal) if Tokens[Index + 1] ~= ',' then - return + return nil, nil end Index = Index + 2 skipSpace() local second = parser(true) if not second then missName() - return + return nil, nil end if isLocal then createLocal(second, parseLocalAttrs()) @@ -2667,14 +2666,14 @@ local function parseVarTails(parser, isLocal) end skipSpace() if Tokens[Index + 1] ~= ',' then - return second + return second, nil end Index = Index + 2 skipSeps() local third = parser(true) if not third then missName() - return second + return second, nil end if isLocal then createLocal(third, parseLocalAttrs()) diff --git a/script/parser/guide.lua b/script/parser/guide.lua index 439f5889..1ba28d4d 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -1089,13 +1089,13 @@ end --- 返回的2个 `list` 分别为基准block到达 a 与 b 的路径。 ---@param a table ---@param b table ----@return string|boolean mode +---@return string|false mode ---@return table pathA? ---@return table pathB? function m.getPath(a, b, sameFunction) --- 首先测试双方在同一个函数内 if sameFunction and m.getParentFunction(a) ~= m.getParentFunction(b) then - return false + return false, nil, nil end local mode local objA @@ -1139,7 +1139,7 @@ function m.getPath(a, b, sameFunction) end end if not start then - return nil + return false, nil, nil end -- pathA: { 1, 2, 3} -- pathB: {5, 6, 2, 3} diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua index 392b476f..e71c6f18 100644 --- a/script/parser/luadoc.lua +++ b/script/parser/luadoc.lua @@ -165,7 +165,7 @@ local function nextToken() Ci = Ci + 1 if not TokenTypes[Ci] then Ci = Ci - 1 - return nil + return nil, nil end return TokenTypes[Ci], TokenContents[Ci] end |