Commit e5368c00 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2081 from nobu/parenthesed_do-block_in_cmdarg

Allow parenthesed do-block in cmdarg
parents 426f80b1 b1669798
......@@ -2039,9 +2039,15 @@ primary : literal
p->cmdarg_stack = $<stack>1;
$$ = $3;
}
| tLPAREN_ARG expr {p->lstate = EXPR_ENDARG;} rparen
| tLPAREN_ARG
{
$$ = $2;
$<stack>1 = p->cmdarg_stack;
p->cmdarg_stack = 0;
}
expr {p->lstate = EXPR_ENDARG;} rparen
{
p->cmdarg_stack = $<stack>1;
$$ = $3;
}
| tLPAREN_ARG {p->lstate = EXPR_ENDARG;} rparen
{
......
......@@ -254,3 +254,14 @@ assert('External command execution.') do
end
true
end
assert('parenthesed do-block in cmdarg') do
class ParenDoBlockCmdArg
def test(block)
block.call
end
end
x = ParenDoBlockCmdArg.new
result = x.test (proc do :ok; end)
assert_equal :ok, result
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment