diff options
Diffstat (limited to 'script')
-rw-r--r-- | script/core/semantic-tokens.lua | 62 | ||||
-rw-r--r-- | script/parser/newparser.lua | 2 |
2 files changed, 48 insertions, 16 deletions
diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua index 806615fe..f4050acd 100644 --- a/script/core/semantic-tokens.lua +++ b/script/core/semantic-tokens.lua @@ -278,6 +278,36 @@ local Care = util.switch() type = define.TokenTypes.keyword, } end) + : case 'break' + : call(function (source, options, results) + results[#results+1] = { + start = source.start, + finish = source.start + #'break', + type = define.TokenTypes.keyword, + } + end) + : case 'goto' + : call(function (source, options, results) + results[#results+1] = { + start = source.keyStart, + finish = source.keyStart + #'goto', + type = define.TokenTypes.keyword, + } + results[#results+1] = { + start = source.start, + finish = source.finish, + type = define.TokenTypes.struct, + } + end) + : case 'label' + : call(function (source, options, results) + results[#results+1] = { + start = source.start, + finish = source.finish, + type = define.TokenTypes.struct, + modifieres = define.TokenModifiers.declaration, + } + end) : case 'binary' : case 'unary' : call(function (source, options, results) @@ -475,22 +505,22 @@ local function solveMultilineAndOverlapping(state, results) local finishRow, finishCol = guide.rowColOf(token.finish) if finishRow > startRow then token.finish = guide.positionOf(startRow, guide.getLineRange(state, startRow)) - end - for i = startRow + 1, finishRow - 1 do - new[#new+1] = { - start = guide.positionOf(i, 0), - finish = guide.positionOf(i, guide.getLineRange(state, i)), - type = token.type, - modifieres = token.modifieres, - } - end - if finishCol > 0 then - new[#new+1] = { - start = guide.positionOf(finishRow, 0), - finish = guide.positionOf(finishRow, finishCol), - type = token.type, - modifieres = token.modifieres, - } + for i = startRow + 1, finishRow - 1 do + new[#new+1] = { + start = guide.positionOf(i, 0), + finish = guide.positionOf(i, guide.getLineRange(state, i)), + type = token.type, + modifieres = token.modifieres, + } + end + if finishCol > 0 then + new[#new+1] = { + start = guide.positionOf(finishRow, 0), + finish = guide.positionOf(finishRow, finishCol), + type = token.type, + modifieres = token.modifieres, + } + end end end diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua index 36e7b6cd..37f79d4b 100644 --- a/script/parser/newparser.lua +++ b/script/parser/newparser.lua @@ -3011,6 +3011,7 @@ local function parseLabel() end local function parseGoTo() + local start = getPosition(Tokens[Index], 'left') Index = Index + 2 skipSpace() @@ -3021,6 +3022,7 @@ local function parseGoTo() end action.type = 'goto' + action.keyStart = start for i = #Chunk, 1, -1 do local chunk = Chunk[i] |