Skip to content

Commit

Permalink
Fix parsing of <=> and setting of subsequent lex_state
Browse files Browse the repository at this point in the history
Also fixes some bugs in parsing Kernel#<=> specs, so moved those back to
rubyspec to use proper parsing.
  • Loading branch information
adambeynon committed Sep 22, 2013
1 parent 7716ac7 commit e976e16
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
9 changes: 7 additions & 2 deletions lib/opal/lexer.rb
Expand Up @@ -721,11 +721,16 @@ def next_token
@lex_state = :expr_beg
return '<<', '<<'
elsif scanner.scan(/\<\=\>/)
if @lex_state == :expr_fname
@lex_state = :expr_end
if after_operator?
@lex_state = :expr_arg
else
if @lex_state == :expr_class
cmd_start = true
end

@lex_state = :expr_beg
end

return '<=>', '<=>'
elsif scanner.scan(/\<\=/)
if @lex_state == :expr_fname
Expand Down
4 changes: 4 additions & 0 deletions spec/filters/bugs/kernel.rb
Expand Up @@ -3,4 +3,8 @@

fails "Kernel.rand returns a float if no argument is passed"
fails "Kernel.rand returns an integer for an integer argument"

fails "Kernel#<=> returns 0 if self is == to the argument"
fails "Kernel#<=> returns nil if self is eql? but not == to the argument"
fails "Kernel#<=> returns nil if self.==(arg) returns nil"
end
15 changes: 0 additions & 15 deletions spec/rubyspec/core/kernel/comparison_spec.rb

This file was deleted.

3 changes: 2 additions & 1 deletion spec/rubyspecs
Expand Up @@ -213,4 +213,5 @@ library/set/length_spec
library/set/member_spec
library/set/merge_spec
library/set/size_spec
library/set/to_a_spec
library/set/to_a_spec
core/kernel/comparison_spec

0 comments on commit e976e16

Please sign in to comment.