mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
parens can take spacebreaks on the insides of either side
This commit is contained in:
parent
e61c2ba29f
commit
7109da7e1d
@ -216,6 +216,7 @@ local function sym(chars)
|
||||
return Space * chars
|
||||
end
|
||||
|
||||
-- Like sym but doesn't accept whitespace in front
|
||||
local function symx(chars)
|
||||
return chars
|
||||
end
|
||||
@ -482,9 +483,9 @@ local build_grammar = wrap_env(function()
|
||||
LuaStringClose = "]" * P"="^0 * "]",
|
||||
|
||||
Callable = pos(Name / mark"ref") + SelfName + VarArg + Parens / mark"parens",
|
||||
Parens = sym"(" * Exp * sym")",
|
||||
Parens = sym"(" * SpaceBreak^0 * Exp * SpaceBreak^0 * sym")",
|
||||
|
||||
FnArgs = symx"(" * Ct(ExpList^-1) * sym")" + sym"!" * -P"=" * Ct"",
|
||||
FnArgs = symx"(" * SpaceBreak^0 * Ct(ExpList^-1) * SpaceBreak^0 * sym")" + sym"!" * -P"=" * Ct"",
|
||||
|
||||
ChainTail = ChainItem^1 * ColonSuffix^-1 + ColonSuffix,
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
--
|
||||
-- binary ops
|
||||
x = 1 + 3
|
||||
|
||||
y = 1 +
|
||||
@ -46,5 +46,27 @@ v = {
|
||||
->
|
||||
"yeah"
|
||||
"great"
|
||||
oksy: 3 ^
|
||||
2
|
||||
}
|
||||
|
||||
-- parens
|
||||
|
||||
nno = (
|
||||
yeah + 2 )
|
||||
|
||||
nn = (
|
||||
yeah + 2
|
||||
)
|
||||
|
||||
n = hello(
|
||||
b
|
||||
) ->
|
||||
|
||||
hello a,
|
||||
(
|
||||
yeah +
|
||||
2
|
||||
) -
|
||||
okay
|
||||
|
||||
|
@ -20,5 +20,10 @@ local v = {
|
||||
color = 1 and function()
|
||||
return "yeah"
|
||||
end,
|
||||
"great"
|
||||
}
|
||||
"great",
|
||||
oksy = 3 ^ 2
|
||||
}
|
||||
local nno = (yeah + 2)
|
||||
local nn = (yeah + 2)
|
||||
local n = hello(b)(function() end)
|
||||
return hello(a, (yeah + 2) - okay)
|
Loading…
Reference in New Issue
Block a user