diff options
-rw-r--r-- | server/main.lua | 2 | ||||
-rw-r--r-- | server/src/parser/ast.lua | 1 | ||||
-rw-r--r-- | server/src/parser/grammar.lua | 29 | ||||
-rw-r--r-- | server/src/service.lua | 3 |
4 files changed, 19 insertions, 16 deletions
diff --git a/server/main.lua b/server/main.lua index ac7860c5..685fce01 100644 --- a/server/main.lua +++ b/server/main.lua @@ -22,7 +22,7 @@ local function tryDebugger() log.info('Debugger startup, listen port: 11411') end ---pcall(tryDebugger) +pcall(tryDebugger) require 'utility' require 'global_protect' diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua index 83c877e4..19aabb9d 100644 --- a/server/src/parser/ast.lua +++ b/server/src/parser/ast.lua @@ -1538,4 +1538,3 @@ return function (self, lua, mode, version) end return res, Errs end - diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua index b5e083e6..00c3dbdb 100644 --- a/server/src/parser/grammar.lua +++ b/server/src/parser/grammar.lua @@ -184,18 +184,18 @@ UnaryList <- NOT / '~' !'=' POWER <- Sp {'^'} -BinaryOp <- {} {'or'} Cut - / {} {'and'} Cut - / {} {'<=' / '>=' / '<'!'<' / '>'!'>' / '~=' / '=='} - / {} {'|'} - / {} {'~'} - / {} {'&'} - / {} {'<<' / '>>'} - / {} {'..'} !'.' - / {} {'+' / '-'} - / {} {'*' / '//' / '/' / '%'} - / {} {'^'} -UnaryOp <- {} {'not' Cut / '#' / '~' / '-'} +BinaryOp <- Sp {} {'or'} Cut + / Sp {} {'and'} Cut + / Sp {} {'<=' / '>=' / '<'!'<' / '>'!'>' / '~=' / '=='} + / Sp {} {'|'} + / Sp {} {'~'} + / Sp {} {'&'} + / Sp {} {'<<' / '>>'} + / Sp {} {'..'} !'.' + / Sp {} {'+' / '-'} + / Sp {} {'*' / '//' / '/' / '%'} + / Sp {} {'^'} +UnaryOp <- Sp {} {'not' Cut / '#' / '~' !'=' / '-' !'-'} PL <- Sp '(' PR <- Sp ')' @@ -290,9 +290,10 @@ DirtyName <- {} -> DirtyName ]] grammar 'Exp' [[ -Exp <- ((Sp (UnaryOp / ExpUnit Sp BinaryOp))+ (Sp ExpUnit / {}->DirtyExp)) +Exp <- (UnUnit (BinaryOp (UnUnit / {} -> DirtyExp))*) -> Exp - / Sp ExpUnit +UnUnit <- ExpUnit + / UnaryOp+ (ExpUnit / {} -> DirtyExp) ExpUnit <- Nil / Boolean / String diff --git a/server/src/service.lua b/server/src/service.lua index ea3c4488..01d3424d 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -434,6 +434,9 @@ function mt:compileVM(uri) local ast = self:compileAst(obj) local version = obj.version obj.astCost = os.clock() - clock + if obj.astCost > 0.1 then + log.warn(('Compile[%s] takes [%.3f] sec, size [%.3f]kb'):format(uri, obj.astCost, #obj.text)) + end obj.oldText = nil self:_clearChainNode(obj, uri) |