mirror of
https://github.com/leafo/moonscript.git
synced 2025-01-09 00:04:22 +00:00
fixed with's dot chain from not parsing all types after first chain item
This commit is contained in:
parent
30ea723277
commit
c3fd7812ce
@ -365,14 +365,16 @@ local build_grammar = wrap(function()
|
||||
|
||||
FnArgs = symx"(" * Ct(ExpList^-1) * sym")" + sym"!" * -P"=" * Ct"",
|
||||
|
||||
ChainTail = (ChainItem^1 * ColonSuffix^-1 + ColonSuffix),
|
||||
|
||||
-- a list of funcalls and indexs on a callable
|
||||
Chain = Callable * (ChainItem^1 * ColonSuffix^-1 + ColonSuffix) / mark"chain",
|
||||
|
||||
-- shorthand dot call for use in with statement
|
||||
DotChain =
|
||||
(sym"." * Cc(-1) * (_Name / mark"dot") * ChainItem^0) / mark"chain" +
|
||||
(sym"." * Cc(-1) * (_Name / mark"dot") * ChainTail^-1) / mark"chain" +
|
||||
(sym"\\" * Cc(-1) * (
|
||||
(_Name * Invoke / mark"colon") * ChainItem^0 +
|
||||
(_Name * Invoke / mark"colon") * ChainTail^-1 +
|
||||
(_Name / mark"colon_stub")
|
||||
)) / mark"chain",
|
||||
|
||||
@ -448,15 +450,9 @@ local build_grammar = wrap(function()
|
||||
|
||||
local tree
|
||||
local args = {...}
|
||||
local pass, err = pcall(function()
|
||||
local pass, err = assert(pcall(function()
|
||||
tree = self._g:match(str, unpack(args))
|
||||
end)
|
||||
|
||||
if not pass then
|
||||
local line_no = pos_to_line(last_pos)
|
||||
print("stopped at", line_no)
|
||||
error(err)
|
||||
end
|
||||
end))
|
||||
|
||||
if not tree then
|
||||
local line_no = pos_to_line(last_pos)
|
||||
|
@ -31,3 +31,8 @@ x = {
|
||||
\okay!
|
||||
}
|
||||
|
||||
with foo
|
||||
\prop"something".hello
|
||||
.prop\send(one)
|
||||
.prop\send one
|
||||
|
||||
|
@ -39,4 +39,10 @@ x = {
|
||||
return _with_0
|
||||
end
|
||||
end)()
|
||||
}
|
||||
}
|
||||
do
|
||||
local _with_0 = foo
|
||||
local _ = _with_0:prop("something").hello
|
||||
_with_0.prop:send(one)
|
||||
_with_0.prop:send(one)
|
||||
end
|
Loading…
Reference in New Issue
Block a user