diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-17 21:23:52 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-17 21:23:52 +0800 |
commit | 085ad34e5ea996d2af23dcb574742dd6880cee65 (patch) | |
tree | feb512db226bbd1ac6124d6ba3ee95319ce3bfc8 /server/src/parser/ast.lua | |
parent | b62070c2e217bd90a7c00fefd0167c1b828128fa (diff) | |
download | lua-language-server-085ad34e5ea996d2af23dcb574742dd6880cee65.zip |
更新 LuaParser
Diffstat (limited to 'server/src/parser/ast.lua')
-rw-r--r-- | server/src/parser/ast.lua | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua index ba40a060..839f9b76 100644 --- a/server/src/parser/ast.lua +++ b/server/src/parser/ast.lua @@ -1090,6 +1090,118 @@ local Defs = { return {...} end, + -- EmmyLua 支持 + EmmyName = function (start, str) + return { + type = 'emmyName', + start = start, + finish = start + #str - 1, + [1] = str, + } + end, + DirtyEmmyName = function (pos) + pushError { + type = 'MISS_NAME', + start = pos, + finish = pos, + } + return { + type = 'emmyName', + start = pos, + finish = pos, + [1] = '' + } + end, + EmmyClass = function (class, extends) + return { + type = 'emmyClass', + [1] = class, + [2] = extends, + } + end, + EmmyType = function (typeDef, ...) + if ... then + typeDef.enum = {...} + end + return typeDef + end, + EmmyCommonType = function (...) + return { + type = 'emmyType', + ... + } + end, + EmmyArrayType = function (typeName) + typeName.type = 'emmyArrayType' + return typeName + end, + EmmyTableType = function (typeName, keyType, valueType) + typeName.type = 'emmyTableType' + typeName[2] = keyType + typeName[3] = valueType + return typeName + end, + EmmyFunctionType = function (...) + return { + type = 'emmyFunctionType', + ... + } + end, + EmmyAlias = function (name, emmyName) + return { + type = 'emmyAlias', + [1] = name, + [2] = emmyName, + } + end, + EmmyParam = function (argName, emmyName) + return { + type = 'emmyParam', + [1] = argName, + [2] = emmyName, + } + end, + EmmyReturn = function (...) + return { + type = 'emmyReturn', + ... + } + end, + EmmyField = function (access, fieldName, ...) + return { + type = 'emmyField', + access, fieldName, + ... + } + end, + EmmyGenericBlock = function (genericName, parentName) + return { genericName, parentName } + end, + EmmyGeneric = function (...) + return { + type = 'emmyGeneric', + ... + } + end, + EmmyVararg = function (typeName) + return { + type = 'emmyVararg', + typeName, + } + end, + EmmyLanguage = function (language) + return { + type = 'emmyLanguage', + language, + } + end, + EmmySee = function (className, methodName) + return { + type = 'emmySee', + className, methodName + } + end, + -- 捕获错误 UnknownSymbol = function (start, symbol) pushError { |