summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/guide.lua24
-rw-r--r--script/parser/luadoc.lua20
2 files changed, 23 insertions, 21 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index 7ca3ddd0..bc82ec57 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -84,18 +84,18 @@ m.childMap = {
['unary'] = {1},
['doc'] = {'#'},
- ['doc.class'] = {'class', 'extends'},
- ['doc.type'] = {'#types', '#enums', 'name'},
- ['doc.alias'] = {'alias', 'extends'},
- ['doc.param'] = {'param', 'extends'},
- ['doc.return'] = {'#returns'},
- ['doc.field'] = {'field', 'extends'},
- ['doc.generic'] = {'#generics'},
- ['doc.generic.object'] = {'generic', 'extends'},
- ['doc.vararg'] = {'vararg'},
- ['doc.type.table'] = {'key', 'value'},
- ['doc.type.function'] = {'#args', '#returns'},
- ['doc.overload'] = {'overload'},
+ ['doc.class'] = {'class', 'extends', 'comment'},
+ ['doc.type'] = {'#types', '#enums', 'name', 'comment'},
+ ['doc.alias'] = {'alias', 'extends', 'comment'},
+ ['doc.param'] = {'param', 'extends', 'comment'},
+ ['doc.return'] = {'#returns', 'comment'},
+ ['doc.field'] = {'field', 'extends', 'comment'},
+ ['doc.generic'] = {'#generics', 'comment'},
+ ['doc.generic.object'] = {'generic', 'extends', 'comment'},
+ ['doc.vararg'] = {'vararg', 'comment'},
+ ['doc.type.table'] = {'key', 'value', 'comment'},
+ ['doc.type.function'] = {'#args', '#returns', 'comment'},
+ ['doc.overload'] = {'overload', 'comment'},
}
m.actionMap = {
diff --git a/script/parser/luadoc.lua b/script/parser/luadoc.lua
index 2b2396ec..53f0097d 100644
--- a/script/parser/luadoc.lua
+++ b/script/parser/luadoc.lua
@@ -856,19 +856,21 @@ local function buildLuaDoc(comment)
comment = comment,
}
end
- local finishPos = text:find('@', startPos + 1)
- local doc, lastComment
- if finishPos then
- doc = text:sub(startPos + 1, finishPos - 1)
- lastComment = text:sub(finishPos)
- else
- doc = text:sub(startPos + 1)
- end
+
+ local doc = text:sub(startPos + 1)
parseTokens(doc, comment.start + startPos - 1)
local result = convertTokens()
if result then
- result.comment = lastComment
+ local cstart = text:find('%S', result.finish - comment.start + 2)
+ if cstart and cstart < comment.finish then
+ result.comment = {
+ type = 'doc.tailcomment',
+ start = cstart + comment.start - 1,
+ finish = comment.finish,
+ text = text:sub(cstart),
+ }
+ end
end
return result