diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-04-19 13:35:47 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-04-19 13:35:47 +0000 |
commit | c5539579bcb9ae080e5ff0c2898bcc4d70c50bda (patch) | |
tree | aacbd6be1a38e51c4f8c7c1af1b23c069f65dbe8 /lib | |
parent | 9d73a4268c2c08941a6b4967cdd2d878abbd590b (diff) |
merges r23129 from trunk into ruby_1_9_1.
--
* lib/irb/completion.rb (IRB::InputCompletor::Operators): Add
overloadable negative operators.
* lib/irb/ruby-lex.rb (RubyLex#lex_init): Support overloadable
negative operators.
* lib/irb/ruby-lex.rb (RubyLex#identify_identifier): Minus signs
need to be escaped in regexp character class.
* misc/ruby-mode.el (ruby-font-lock-keywords, ruby-parse-partial):
Support overloadable negative operators.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@23233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/irb/completion.rb | 2 | ||||
-rw-r--r-- | lib/irb/ruby-lex.rb | 15 |
2 files changed, 6 insertions, 11 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb index 26339f217d..8278d8ff87 100644 --- a/lib/irb/completion.rb +++ b/lib/irb/completion.rb @@ -184,7 +184,7 @@ module IRB Operators = ["%", "&", "*", "**", "+", "-", "/", "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>", - "[]", "[]=", "^",] + "[]", "[]=", "^", "!", "!=", "!~"] def self.select_message(receiver, message, candidates) candidates.grep(/^#{message}/).collect do |e| diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index b21f0d34f8..93dc229f31 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -389,7 +389,8 @@ class RubyLex "=", "==", "===", "=~", "<=>", "<", "<=", - ">", ">=", ">>") do + ">", ">=", ">>", + "!", "!=", "!~") do |op, io| case @lex_state when EXPR_FNAME, EXPR_DOT @@ -400,12 +401,6 @@ class RubyLex Token(op) end - @OP.def_rules("!", "!=", "!~") do - |op, io| - @lex_state = EXPR_BEG - Token(op) - end - @OP.def_rules("<<") do |op, io| tk = nil @@ -822,11 +817,11 @@ class RubyLex when "class" valid = false unless peek_match?(/^\s*(<<|\w|::)/) when "def" - valid = false if peek_match?(/^\s*(([+-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/) + valid = false if peek_match?(/^\s*(([+\-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/) when "do" - valid = false if peek_match?(/^\s*([+-\/*]?=|\*|<|>|\&)/) + valid = false if peek_match?(/^\s*([+\-\/*]?=|\*|<|>|\&)/) when *ENINDENT_CLAUSE - valid = false if peek_match?(/^\s*([+-\/*]?=|\*|<|>|\&|\|)/) + valid = false if peek_match?(/^\s*([+\-\/*]?=|\*|<|>|\&|\|)/) else # no nothing end |