Skip to content

Commit 5addb42

Browse files
committed
update
1 parent e112035 commit 5addb42

File tree

2 files changed

+48
-16
lines changed

2 files changed

+48
-16
lines changed

script/core/semantic-tokens.lua

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,36 @@ local Care = util.switch()
278278
type = define.TokenTypes.keyword,
279279
}
280280
end)
281+
: case 'break'
282+
: call(function (source, options, results)
283+
results[#results+1] = {
284+
start = source.start,
285+
finish = source.start + #'break',
286+
type = define.TokenTypes.keyword,
287+
}
288+
end)
289+
: case 'goto'
290+
: call(function (source, options, results)
291+
results[#results+1] = {
292+
start = source.keyStart,
293+
finish = source.keyStart + #'goto',
294+
type = define.TokenTypes.keyword,
295+
}
296+
results[#results+1] = {
297+
start = source.start,
298+
finish = source.finish,
299+
type = define.TokenTypes.struct,
300+
}
301+
end)
302+
: case 'label'
303+
: call(function (source, options, results)
304+
results[#results+1] = {
305+
start = source.start,
306+
finish = source.finish,
307+
type = define.TokenTypes.struct,
308+
modifieres = define.TokenModifiers.declaration,
309+
}
310+
end)
281311
: case 'binary'
282312
: case 'unary'
283313
: call(function (source, options, results)
@@ -475,22 +505,22 @@ local function solveMultilineAndOverlapping(state, results)
475505
local finishRow, finishCol = guide.rowColOf(token.finish)
476506
if finishRow > startRow then
477507
token.finish = guide.positionOf(startRow, guide.getLineRange(state, startRow))
478-
end
479-
for i = startRow + 1, finishRow - 1 do
480-
new[#new+1] = {
481-
start = guide.positionOf(i, 0),
482-
finish = guide.positionOf(i, guide.getLineRange(state, i)),
483-
type = token.type,
484-
modifieres = token.modifieres,
485-
}
486-
end
487-
if finishCol > 0 then
488-
new[#new+1] = {
489-
start = guide.positionOf(finishRow, 0),
490-
finish = guide.positionOf(finishRow, finishCol),
491-
type = token.type,
492-
modifieres = token.modifieres,
493-
}
508+
for i = startRow + 1, finishRow - 1 do
509+
new[#new+1] = {
510+
start = guide.positionOf(i, 0),
511+
finish = guide.positionOf(i, guide.getLineRange(state, i)),
512+
type = token.type,
513+
modifieres = token.modifieres,
514+
}
515+
end
516+
if finishCol > 0 then
517+
new[#new+1] = {
518+
start = guide.positionOf(finishRow, 0),
519+
finish = guide.positionOf(finishRow, finishCol),
520+
type = token.type,
521+
modifieres = token.modifieres,
522+
}
523+
end
494524
end
495525
end
496526

script/parser/newparser.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3011,6 +3011,7 @@ local function parseLabel()
30113011
end
30123012

30133013
local function parseGoTo()
3014+
local start = getPosition(Tokens[Index], 'left')
30143015
Index = Index + 2
30153016
skipSpace()
30163017

@@ -3021,6 +3022,7 @@ local function parseGoTo()
30213022
end
30223023

30233024
action.type = 'goto'
3025+
action.keyStart = start
30243026

30253027
for i = #Chunk, 1, -1 do
30263028
local chunk = Chunk[i]

0 commit comments

Comments
 (0)