diff --git a/lib/parser/composed.rb b/lib/parser/composed.rb index 6eba0000..73aa5da9 100644 --- a/lib/parser/composed.rb +++ b/lib/parser/composed.rb @@ -46,7 +46,7 @@ module Parser rule(:expressions_end) { delimited_expressions(keyword_end) } rule(:function_definition) { - keyword_def >> name.as(:function_definition) >> parmeter_list >> expressions_end + keyword_def >> name.as(:function_definition) >> parmeter_list >> newline >> expressions_end } rule(:parmeter_list) { diff --git a/test/parser/test_basic.rb b/test/parser/test_basic.rb index aae32e71..783c6c40 100644 --- a/test/parser/test_basic.rb +++ b/test/parser/test_basic.rb @@ -19,8 +19,10 @@ class TestBasic < MiniTest::Test end def test_comment - @string_input = '# i am a comment\n' #NEEDS the return, which is what delimits the comment - @parse_output = {:comment => ' i am a comment'} + out = "# i am a comment \n" + @string_input = out.dup #NEEDS the return, which is what delimits the comment + out = out[1..-2] + @parse_output = {:comment => out} @transform_output = @parse_output #dont transform @parser = @parser.comment end