diff --git a/lib/parser/basic_types.rb b/lib/parser/basic_types.rb index ec774e85..b1199d07 100644 --- a/lib/parser/basic_types.rb +++ b/lib/parser/basic_types.rb @@ -6,13 +6,13 @@ module Parser # rule of thumb is that anything eats space behind it, but only space, no newlines rule(:space) { (str('\t') | str(' ')).repeat(1) } rule(:space?) { space.maybe } - rule(:newline){ str("\n") >> space? >> newline.repeat } + rule(:linebreak){ str("\n") >> space? >> linebreak.repeat } rule(:quote) { str('"') } rule(:nonquote) { str('"').absent? >> any } - rule(:comment){ match('#') >> (newline.absent? >> any).repeat.as(:comment) >> newline } - + rule(:comment){ match('#') >> (linebreak.absent? >> any).repeat >> linebreak } + rule(:newline) { linebreak | comment } rule(:eol) { newline | any.absent? } rule(:double_quote){ str('"') } diff --git a/lib/parser/call_site.rb b/lib/parser/call_site.rb index cd747eab..0c5c6403 100644 --- a/lib/parser/call_site.rb +++ b/lib/parser/call_site.rb @@ -9,7 +9,7 @@ module Parser space? >> right_parenthesis } - rule(:call_site) { name.as(:call_site) >> argument_list } + rule(:call_site) { name.as(:call_site) >> argument_list >> comment.maybe} end