Skip to content

Commit 420197c

Browse files
committed
new tracer
1 parent 3c45587 commit 420197c

File tree

7 files changed

+21
-428
lines changed

7 files changed

+21
-428
lines changed

script/parser/compile.lua

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3136,22 +3136,6 @@ local function parseGoTo()
31363136
return action
31373137
end
31383138

3139-
local function parseFilter()
3140-
local exp = parseExp()
3141-
if exp then
3142-
local filter = {
3143-
type = 'filter',
3144-
start = exp.start,
3145-
finish = exp.finish,
3146-
exp = exp,
3147-
}
3148-
exp.parent = filter
3149-
return filter
3150-
else
3151-
missExp()
3152-
end
3153-
end
3154-
31553139
local function parseIfBlock(parent)
31563140
local ifLeft = getPosition(Tokens[Index], 'left')
31573141
local ifRight = getPosition(Tokens[Index] + 1, 'right')
@@ -3167,11 +3151,13 @@ local function parseIfBlock(parent)
31673151
}
31683152
}
31693153
skipSpace()
3170-
local filter = parseFilter()
3154+
local filter = parseExp()
31713155
if filter then
31723156
ifblock.filter = filter
31733157
ifblock.finish = filter.finish
31743158
filter.parent = ifblock
3159+
else
3160+
missExp()
31753161
end
31763162
skipSpace()
31773163
local thenToken = Tokens[Index + 1]
@@ -3224,11 +3210,13 @@ local function parseElseIfBlock(parent)
32243210
}
32253211
Index = Index + 2
32263212
skipSpace()
3227-
local filter = parseFilter()
3213+
local filter = parseExp()
32283214
if filter then
32293215
elseifblock.filter = filter
32303216
elseifblock.finish = filter.finish
32313217
filter.parent = elseifblock
3218+
else
3219+
missExp()
32323220
end
32333221
skipSpace()
32343222
local thenToken = Tokens[Index + 1]
@@ -3536,16 +3524,15 @@ local function parseWhile()
35363524

35373525
skipSpace()
35383526
local nextToken = Tokens[Index + 1]
3539-
if nextToken == 'do'
3540-
or nextToken == 'then' then
3541-
missExp()
3527+
local filter = nextToken ~= 'do'
3528+
and nextToken ~= 'then'
3529+
and parseExp()
3530+
if filter then
3531+
action.filter = filter
3532+
action.finish = filter.finish
3533+
filter.parent = action
35423534
else
3543-
local filter = parseFilter()
3544-
if filter then
3545-
action.filter = filter
3546-
action.finish = filter.finish
3547-
filter.parent = action
3548-
end
3535+
missExp()
35493536
end
35503537

35513538
skipSpace()
@@ -3624,10 +3611,12 @@ local function parseRepeat()
36243611
Index = Index + 2
36253612

36263613
skipSpace()
3627-
local filter = parseFilter()
3614+
local filter = parseExp()
36283615
if filter then
36293616
action.filter = filter
36303617
filter.parent = action
3618+
else
3619+
missExp()
36313620
end
36323621

36333622
else

script/parser/guide.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ local childMap = {
139139
['getfield'] = {'node', 'field'},
140140
['list'] = {'#'},
141141
['binary'] = {1, 2},
142-
['unary'] = { 1 },
143-
['filter'] = {'exp'},
142+
['unary'] = {1},
144143

145144
['doc'] = {'#'},
146145
['doc.class'] = {'class', '#extends', '#signs', 'comment'},

script/vm/compiler.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,7 @@ local function compileLocal(source)
972972
vm.setNode(source, vm.compileNode(source.value))
973973
end
974974
end
975-
if not hasMarkValue
975+
if not hasMarkDoc
976976
and not hasMarkValue
977977
and source.ref then
978978
local firstSet

0 commit comments

Comments
 (0)