parens can take spacebreaks on the insides of either side

This commit is contained in:
leaf corcoran 2015-02-28 13:52:09 -08:00
parent e61c2ba29f
commit 7109da7e1d
3 changed files with 33 additions and 5 deletions

View File

@ -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,

View File

@ -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

View File

@ -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)