summaryrefslogtreecommitdiff
path: root/server/src/parser
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/parser')
-rw-r--r--server/src/parser/ast.lua17
-rw-r--r--server/src/parser/grammar.lua6
2 files changed, 13 insertions, 10 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index f361021b..5a3630cd 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -738,8 +738,8 @@ local Defs = {
local last = args[max]
pushError {
type = 'MISS_NAME',
- start = last,
- finish = last,
+ start = last+1,
+ finish = last+1,
}
end
if #list == 0 then
@@ -1119,8 +1119,8 @@ local Defs = {
pushError {
type = 'MISS_NAME',
level = 'warning',
- start = pos-1,
- finish = pos-1,
+ start = pos,
+ finish = pos,
}
return {
type = 'emmyName',
@@ -1177,11 +1177,14 @@ local Defs = {
[2] = valueType,
}
end,
- EmmyFunctionType = function (...)
+ EmmyFunctionType = function (start, ...)
local result = {
+ start = start,
type = 'emmyFunctionType',
...
}
+ result.finish = result[#result] - 1
+ result[#result] = nil
return result
end,
EmmyAlias = function (name, emmyName, ...)
@@ -1276,8 +1279,8 @@ local Defs = {
DirtyName = function (pos)
pushError {
type = 'MISS_NAME',
- start = pos-1,
- finish = pos-1,
+ start = pos,
+ finish = pos,
}
return {
type = 'name',
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index 28e3eb28..25ac30f2 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -541,15 +541,15 @@ EmmyClass <- (MustEmmyName EmmyParentClass?)
EmmyParentClass <- %s* {} ':' %s* MustEmmyName
EmmyType <- EmmyFunctionType
- / EmmyArrayType
/ EmmyTableType
+ / EmmyArrayType
/ EmmyCommonType
EmmyCommonType <- EmmyTypeNames
-> EmmyCommonType
EmmyTypeNames <- EmmyTypeName (%s* {} '|' %s* !String EmmyTypeName)*
EmmyTypeName <- EmmyFunctionType
- / EmmyArrayType
/ EmmyTableType
+ / EmmyArrayType
/ MustEmmyName
EmmyTypeEnums <- %s* '|' %s* String
@@ -580,7 +580,7 @@ EmmyArrayType <- (MustEmmyName '[]')
EmmyTableType <- ({} 'table' Cut '<' %s* EmmyType %s* ',' %s* EmmyType %s* '>' {})
-> EmmyTableType
-EmmyFunctionType<- ('fun' Cut %s* EmmyFunctionArgs? %s* EmmyFunctionRtn?)
+EmmyFunctionType<- ({} 'fun' Cut %s* EmmyFunctionArgs? %s* EmmyFunctionRtn? {})
-> EmmyFunctionType
EmmyFunctionArgs<- '(' %s* EmmyFunctionArg %s* (',' %s* EmmyFunctionArg %s*)* ')'
EmmyFunctionRtn <- ':' %s* EmmyType