diff --git a/moonscript/parse.lua b/moonscript/parse.lua index d3d8c22..026734d 100644 --- a/moonscript/parse.lua +++ b/moonscript/parse.lua @@ -171,7 +171,7 @@ local build_grammar = wrap_env(debug_grammar, function(root) Slice = symx("[") * (SliceValue + Cc(1)) * sym(",") * (SliceValue + Cc("")) * (sym(",") * SliceValue) ^ -1 * sym("]") / mark("slice"), ColonCall = symx("\\") * (_Name * Invoke) / mark("colon"), ColonSuffix = symx("\\") * _Name / mark("colon_stub"), - Invoke = FnArgs / mark("call") + SingleString / wrap_func_arg + DoubleString / wrap_func_arg + LuaString / wrap_func_arg, + Invoke = FnArgs / mark("call") + SingleString / wrap_func_arg + DoubleString / wrap_func_arg + #P("[") * LuaString / wrap_func_arg, TableValue = KeyValue + Ct(Exp), TableLit = sym("{") * Ct(TableValueList ^ -1 * sym(",") ^ -1 * (SpaceBreak * TableLitLine * (sym(",") ^ -1 * SpaceBreak * TableLitLine) ^ 0 * sym(",") ^ -1) ^ -1) * White * sym("}") / mark("table"), TableValueList = TableValue * (sym(",") * TableValue) ^ 0, diff --git a/moonscript/parse.moon b/moonscript/parse.moon index 7b81bb3..a224580 100644 --- a/moonscript/parse.moon +++ b/moonscript/parse.moon @@ -261,7 +261,7 @@ build_grammar = wrap_env debug_grammar, (root) -> Invoke: FnArgs/mark"call" + SingleString / wrap_func_arg + DoubleString / wrap_func_arg + - LuaString / wrap_func_arg + #P"[" * LuaString / wrap_func_arg TableValue: KeyValue + Ct(Exp) diff --git a/moonscript/parse/util.moon b/moonscript/parse/util.moon index fc680d7..e12e1f8 100644 --- a/moonscript/parse/util.moon +++ b/moonscript/parse/util.moon @@ -109,7 +109,7 @@ format_single_assign = (lhs, assign) -> -- a symbol sym = (chars) -> Space * chars --- a symbole that doesn't accept whitespace before it +-- a symbol that doesn't accept whitespace before it symx = (chars) -> chars -- a constructor for quote delimited strings diff --git a/spec/inputs/syntax.moon b/spec/inputs/syntax.moon index a1829a5..05ce067 100644 --- a/spec/inputs/syntax.moon +++ b/spec/inputs/syntax.moon @@ -69,6 +69,15 @@ something"else" something[[hey]] * 2 something[======[hey]======] * 2 + +something'else', 2 +something"else", 2 +something[[else]], 2 + +something 'else', 2 +something "else", 2 +something [[else]], 2 + here(we)"go"[12123] -- this runs diff --git a/spec/outputs/syntax.lua b/spec/outputs/syntax.lua index 3d2b625..f19a3e6 100644 --- a/spec/outputs/syntax.lua +++ b/spec/outputs/syntax.lua @@ -55,6 +55,12 @@ something('else') something("else") _ = something([[hey]]) * 2 _ = something([======[hey]======]) * 2 +_ = something('else'), 2 +_ = something("else"), 2 +_ = something([[else]]), 2 +something('else', 2) +something("else", 2) +something([[else]], 2) _ = here(we)("go")[12123] local something = { test = 12323,