summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/core/noder.lua32
-rw-r--r--script/core/searcher.lua8
-rw-r--r--script/parser/guide.lua2
-rw-r--r--script/parser/luadoc.lua14
4 files changed, 36 insertions, 20 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua
index 120bf1ad..bb64bb7e 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -464,26 +464,18 @@ function m.compileNode(noders, source)
pushForward(noders, id, getID(src))
end
end
- do
- local start
- for _, doc in ipairs(source.bindGroup) do
- if doc.type == 'doc.class' then
- start = doc == source
- end
- if start and doc.type == 'doc.field' then
- local key = doc.field[1]
- if key then
- local keyID = ('%s%s%q'):format(
- id,
- SPLIT_CHAR,
- key
- )
- pushForward(noders, keyID, getID(doc.field))
- pushBackward(noders, getID(doc.field), keyID)
- pushForward(noders, keyID, getID(doc.extends))
- pushBackward(noders, getID(doc.extends), keyID)
- end
- end
+ for _, field in ipairs(source.fields) do
+ local key = field.field[1]
+ if key then
+ local keyID = ('%s%s%q'):format(
+ id,
+ SPLIT_CHAR,
+ key
+ )
+ pushForward(noders, keyID, getID(field.field))
+ pushBackward(noders, getID(field.field), keyID)
+ pushForward(noders, keyID, getID(field.extends))
+ pushBackward(noders, getID(field.extends), keyID)
end
end
end
diff --git a/script/core/searcher.lua b/script/core/searcher.lua
index 7eb11a97..90c92c7b 100644
--- a/script/core/searcher.lua
+++ b/script/core/searcher.lua
@@ -514,6 +514,14 @@ local function getField(status, source, mode)
for _, field in ipairs(source) do
m.pushResult(status, mode, field)
end
+ return
+ end
+ if source.type == 'doc.class.name' then
+ local class = source.parent
+ for _, field in ipairs(class.fields) do
+ m.pushResult(status, mode, field.field)
+ end
+ return
end
local field = source.next
if field then
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index 35c53120..be9f3742 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -812,6 +812,8 @@ function m.getKeyName(obj)
return obj.alias[1]
elseif tp == 'doc.field' then
return obj.field[1]
+ elseif tp == 'doc.field.name' then
+ return obj[1]
elseif tp == 'dummy' then
return obj[1]
end
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index 2d21c9ac..054ea3f1 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -194,6 +194,7 @@ local function parseClass(parent)
local result = {
type = 'doc.class',
parent = parent,
+ fields = {},
}
result.class = parseName('doc.class.name', result)
if not result.class then
@@ -1170,6 +1171,18 @@ local function bindParamAndReturnIndex(binded)
end
end
+local function bindClassAndFields(binded)
+ local class
+ for _, doc in ipairs(binded) do
+ if doc.type == 'doc.class' then
+ class = doc
+ elseif doc.type == 'doc.field' then
+ class.fields[#class.fields+1] = doc
+ doc.class = class
+ end
+ end
+end
+
local function bindDoc(sources, lns, binded)
if not binded then
return
@@ -1192,6 +1205,7 @@ local function bindDoc(sources, lns, binded)
bindDocsBetween(sources, binded, bindSources, nstart, nfinish)
end
bindParamAndReturnIndex(binded)
+ bindClassAndFields(binded)
end
local function bindDocs(state)