summaryrefslogtreecommitdiff
path: root/src/parser/grammar.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/grammar.lua')
-rw-r--r--src/parser/grammar.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/parser/grammar.lua b/src/parser/grammar.lua
index 1e3a37c1..cb14fe6d 100644
--- a/src/parser/grammar.lua
+++ b/src/parser/grammar.lua
@@ -147,7 +147,8 @@ TL <- Sp '{'
TR <- Sp '}'
COMMA <- Sp ','
SEMICOLON <- Sp ';'
-DOTS <- Sp '...'
+DOTS <- Sp {} -> DOTSPos
+ '...' -> DOTS
DOT <- Sp '.'
COLON <- Sp ':'
LABEL <- Sp '::'
@@ -185,7 +186,8 @@ Float16 <- ('.' X16*)? ([pP] [+-]? [1-9]? [0-9]*)?
]]
grammar 'Name' [[
-Name <- Sp {} -> NamePos {[a-zA-Z_] [a-zA-Z0-9_]*} -> Name
+Name <- Sp {} -> NamePos
+ {[a-zA-Z_] [a-zA-Z0-9_]*} -> Name
]]
grammar 'Exp' [[
@@ -222,7 +224,7 @@ Suffix <- DOT Name
/ BL Exp BR
/ PL ArgList? PR
-ArgList <- Arg (COMMA Arg)*
+ArgList <- (Arg (COMMA Arg)*)
Arg <- DOTS
/ Exp
@@ -233,7 +235,7 @@ TableField <- NewIndex / NewField / Exp
NewIndex <- BL Exp BR ASSIGN Exp
NewField <- Name ASSIGN Exp
-Function <- (FUNCTION {| FuncName? |} PL ArgList? PR) -> FunctionDef
+Function <- (FUNCTION {| FuncName? |} PL {| ArgList? |} PR) -> FunctionDef
(!END Action)* -> Function
END
FuncName <- Name (FuncSuffix)*