lib/code/parser/call.rb in code-ruby-0.2.4 vs lib/code/parser/call.rb in code-ruby-0.3.0
- old
+ new
@@ -1,10 +1,10 @@
class Code
class Parser
class Call < Parslet::Parser
rule(:dictionnary) { ::Code::Parser::Dictionnary.new }
- rule(:code) { ::Code::Parser::Code.new }
+ rule(:code) { ::Code::Parser::Code.new.present }
rule(:name) { ::Code::Parser::Name.new }
rule(:function_arguments) { ::Code::Parser::Function.new.arguments }
rule(:dot) { str(".") }
rule(:opening_parenthesis) { str("(") }
@@ -70,15 +70,15 @@
end
rule(:block) do
(
whitespace >> do_keyword >> whitespace >>
- block_arguments.as(:arguments).maybe >> code.as(:body) >>
+ block_arguments.as(:arguments).maybe >> code.as(:body).maybe >>
end_keyword
) |
(
whitespace? >> opening_curly_bracket >> whitespace >>
- block_arguments.as(:arguments).maybe >> code.as(:body) >>
+ block_arguments.as(:arguments).maybe >> code.as(:body).maybe >>
closing_curly_bracket
)
end
rule(:call) { (single_call | chained_call).as(:call) | dictionnary }