Skip to content

Commit

Permalink
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/opal/lexer.rb
Original file line number Diff line number Diff line change
@@ -289,6 +289,13 @@ def next_token

next if [:expr_beg, :expr_dot].include? @lex_state

if scanner.scan(/([\ \t\r\f\v]*)\./)
space_seen = true unless scanner[1].empty?
scanner.pos = scanner.pos - 1

next unless scanner.check(/\.\./)
end

cmd_start = true
@lex_state = :expr_beg
return '\\n', '\\n'
5 changes: 5 additions & 0 deletions spec/parser/call_spec.rb
Original file line number Diff line number Diff line change
@@ -18,6 +18,11 @@
opal_parse("foo 1, 2").should == [:call, nil, :foo, [:arglist, [:lit, 1], [:lit, 2]]]
opal_parse("foo 1, *2").should == [:call, nil, :foo, [:arglist, [:lit, 1], [:splat, [:lit, 2]]]]
end

it "supports leading dots on newline" do
opal_parse("foo\n.bar").should == [:call, [:call, nil, :foo, [:arglist]], :bar, [:arglist]]
lambda { opal_parse("foo\n..bar") }.should raise_error(Exception)
end
end

describe "Operator calls" do

0 comments on commit cc8e942

Please sign in to comment.