summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server-beta/src/parser/ast.lua10
-rw-r--r--server-beta/src/parser/grammar.lua4
2 files changed, 13 insertions, 1 deletions
diff --git a/server-beta/src/parser/ast.lua b/server-beta/src/parser/ast.lua
index ff5a6ae1..c5303796 100644
--- a/server-beta/src/parser/ast.lua
+++ b/server-beta/src/parser/ast.lua
@@ -661,6 +661,16 @@ local Defs = {
end
return e
end,
+ SubBinary = function (op, symb)
+ if symb then
+ return op, symb
+ end
+ PushError {
+ type = 'MISS_EXP',
+ start = op.start,
+ finish = op.finish,
+ }
+ end,
Binary = function (first, op, second, ...)
if not first then
return second
diff --git a/server-beta/src/parser/grammar.lua b/server-beta/src/parser/grammar.lua
index b64f6277..48e2f86e 100644
--- a/server-beta/src/parser/grammar.lua
+++ b/server-beta/src/parser/grammar.lua
@@ -297,8 +297,10 @@ DirtyName <- {} -> DirtyName
]]
grammar 'Exp' [[
-Exp <- (UnUnit (BinaryOp UnUnit / BinaryOp->None MissExp)*)
+Exp <- (UnUnit BinUnit*)
-> Binary
+BinUnit <- (BinaryOp UnUnit?)
+ -> SubBinary
UnUnit <- ExpUnit
/ (UnaryOp+ (ExpUnit / MissExp))
-> Unary