aboutsummaryrefslogtreecommitdiffstats
path: root/lib/irb/ruby-lex.rb
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-03 05:04:02 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-04-03 05:04:02 +0000
commitae846f9fb810ecd241a20579495a94a15212ca56 (patch)
treecf18c37e6b8fce92d71291c3914de99150a43fb9 /lib/irb/ruby-lex.rb
parent2b7279ba5fce23a653323423309cfa4fc1173e06 (diff)
downloadruby-ae846f9fb810ecd241a20579495a94a15212ca56.tar.gz
* 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/trunk@23129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb/ruby-lex.rb')
-rw-r--r--lib/irb/ruby-lex.rb15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index 13b101ffc8..1def148885 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