summaryrefslogtreecommitdiff
path: root/server/src/parser/ast.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/parser/ast.lua')
-rw-r--r--server/src/parser/ast.lua40
1 files changed, 26 insertions, 14 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index c419e50a..341a5519 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -4,6 +4,7 @@ local utf8_char = utf8.char
local Errs
local function pushError(err)
+ err.level = 'error'
Errs[#Errs+1] = err
end
@@ -74,20 +75,6 @@ local defs = {
[1] = str,
}
end,
- DirtyName = function (pos)
- pushError {
- type = 'MISS_NAME',
- start = pos,
- finish = pos,
- level = 'error',
- }
- return {
- type = 'name',
- start = pos,
- finish = pos,
- [1] = ''
- }
- end,
Simple = function (first, ...)
if ... then
local obj = {
@@ -423,6 +410,31 @@ local defs = {
end
return {...}
end,
+
+ -- 捕获错误
+ UnknownSymbol = function (start, symbol, finish)
+ pushError {
+ type = 'UNKNOWN_SYMBOL',
+ start = start,
+ finish = finish - 1,
+ info = {
+ symbol = symbol,
+ }
+ }
+ end,
+ DirtyName = function (pos)
+ pushError {
+ type = 'MISS_NAME',
+ start = pos,
+ finish = pos,
+ }
+ return {
+ type = 'name',
+ start = pos,
+ finish = pos,
+ [1] = ''
+ }
+ end,
}
return function (self, lua, mode)