Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7c8362c7f6cc
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 35402eecb296
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Jun 19, 2015

  1. Copy the full SHA
    85cfa72 View commit details
  2. Merge pull request #951 from seaneshbaugh/master

    Fixed regex for matching identifiers
    meh committed Jun 19, 2015
    Copy the full SHA
    35402ee View commit details
Showing with 9 additions and 1 deletion.
  1. +1 −1 lib/opal/parser/lexer.rb
  2. +8 −0 spec/lib/parser/not_spec.rb
2 changes: 1 addition & 1 deletion lib/opal/parser/lexer.rb
Original file line number Diff line number Diff line change
@@ -1238,7 +1238,7 @@ def yylex
elsif check(/[0-9]/)
return process_numeric

elsif scan(/(\w)+[\?\!]?/)
elsif scan(/(\w)+(\?|(\!(?!=)))?/)
return process_identifier scanner.matched, cmd_start
end

8 changes: 8 additions & 0 deletions spec/lib/parser/not_spec.rb
Original file line number Diff line number Diff line change
@@ -18,6 +18,14 @@
it "rewrites as !(lhs == rhs)" do
parsed("1 != 2").should == [:call, [:call, [:int, 1], :==, [:arglist, [:int, 2]]], '!'.to_sym, [:arglist]]
end

it "rewrites as !(lhs == rhs) without space before when lhs is not a number" do
parsed("x!= 2").should == [:call, [:call, [:call, nil, :x, [:arglist]], :==, [:arglist, [:int, 2]]], '!'.to_sym, [:arglist]]
end

it "rewrites as !(lhs == rhs) without space after when lhs is not a number" do
parsed("x !=2").should == [:call, [:call, [:call, nil, :x, [:arglist]], :==, [:arglist, [:int, 2]]], '!'.to_sym, [:arglist]]
end
end

describe "The '!~' expression" do