fixed with's dot chain from not parsing all types after first chain item

This commit is contained in:
leaf corcoran 2011-11-01 19:54:13 -07:00
parent 30ea723277
commit c3fd7812ce
3 changed files with 18 additions and 11 deletions

View File

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

View File

@ -31,3 +31,8 @@ x = {
\okay!
}
with foo
\prop"something".hello
.prop\send(one)
.prop\send one

View File

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