mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
9d73a4268c
commit
c5539579bc
4 changed files with 22 additions and 13 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
Fri Apr 3 14:02:42 2009 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
Wed Apr 1 20:37:49 2009 Tanaka Akira <akr@fsij.org>
|
Wed Apr 1 20:37:49 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* configure.in (rb_cv_fork_with_pthread): fail if the child process
|
* configure.in (rb_cv_fork_with_pthread): fail if the child process
|
||||||
|
|
|
@ -184,7 +184,7 @@ module IRB
|
||||||
|
|
||||||
Operators = ["%", "&", "*", "**", "+", "-", "/",
|
Operators = ["%", "&", "*", "**", "+", "-", "/",
|
||||||
"<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>",
|
"<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>",
|
||||||
"[]", "[]=", "^",]
|
"[]", "[]=", "^", "!", "!=", "!~"]
|
||||||
|
|
||||||
def self.select_message(receiver, message, candidates)
|
def self.select_message(receiver, message, candidates)
|
||||||
candidates.grep(/^#{message}/).collect do |e|
|
candidates.grep(/^#{message}/).collect do |e|
|
||||||
|
|
|
@ -389,7 +389,8 @@ class RubyLex
|
||||||
"=", "==", "===",
|
"=", "==", "===",
|
||||||
"=~", "<=>",
|
"=~", "<=>",
|
||||||
"<", "<=",
|
"<", "<=",
|
||||||
">", ">=", ">>") do
|
">", ">=", ">>",
|
||||||
|
"!", "!=", "!~") do
|
||||||
|op, io|
|
|op, io|
|
||||||
case @lex_state
|
case @lex_state
|
||||||
when EXPR_FNAME, EXPR_DOT
|
when EXPR_FNAME, EXPR_DOT
|
||||||
|
@ -400,12 +401,6 @@ class RubyLex
|
||||||
Token(op)
|
Token(op)
|
||||||
end
|
end
|
||||||
|
|
||||||
@OP.def_rules("!", "!=", "!~") do
|
|
||||||
|op, io|
|
|
||||||
@lex_state = EXPR_BEG
|
|
||||||
Token(op)
|
|
||||||
end
|
|
||||||
|
|
||||||
@OP.def_rules("<<") do
|
@OP.def_rules("<<") do
|
||||||
|op, io|
|
|op, io|
|
||||||
tk = nil
|
tk = nil
|
||||||
|
@ -822,11 +817,11 @@ class RubyLex
|
||||||
when "class"
|
when "class"
|
||||||
valid = false unless peek_match?(/^\s*(<<|\w|::)/)
|
valid = false unless peek_match?(/^\s*(<<|\w|::)/)
|
||||||
when "def"
|
when "def"
|
||||||
valid = false if peek_match?(/^\s*(([+-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/)
|
valid = false if peek_match?(/^\s*(([+\-\/*&\|^]|<<|>>|\|\||\&\&)=|\&\&|\|\|)/)
|
||||||
when "do"
|
when "do"
|
||||||
valid = false if peek_match?(/^\s*([+-\/*]?=|\*|<|>|\&)/)
|
valid = false if peek_match?(/^\s*([+\-\/*]?=|\*|<|>|\&)/)
|
||||||
when *ENINDENT_CLAUSE
|
when *ENINDENT_CLAUSE
|
||||||
valid = false if peek_match?(/^\s*([+-\/*]?=|\*|<|>|\&|\|)/)
|
valid = false if peek_match?(/^\s*([+\-\/*]?=|\*|<|>|\&|\|)/)
|
||||||
else
|
else
|
||||||
# no nothing
|
# no nothing
|
||||||
end
|
end
|
||||||
|
|
|
@ -646,7 +646,7 @@ The variable ruby-indent-level controls the amount of indentation.
|
||||||
((looking-at ":\\(['\"]\\)")
|
((looking-at ":\\(['\"]\\)")
|
||||||
(goto-char (match-beginning 1))
|
(goto-char (match-beginning 1))
|
||||||
(ruby-forward-string (buffer-substring (match-beginning 1) (match-end 1)) end))
|
(ruby-forward-string (buffer-substring (match-beginning 1) (match-end 1)) end))
|
||||||
((looking-at ":\\([-,.+*/%&|^~<>]=?\\|===?\\|<=>\\)")
|
((looking-at ":\\([-,.+*/%&|^~<>]=?\\|===?\\|<=>\\|![~=]?\\)")
|
||||||
(goto-char (match-end 0)))
|
(goto-char (match-end 0)))
|
||||||
((looking-at ":\\([a-zA-Z_][a-zA-Z_0-9]*[!?=]?\\)?")
|
((looking-at ":\\([a-zA-Z_][a-zA-Z_0-9]*[!?=]?\\)?")
|
||||||
(goto-char (match-end 0)))
|
(goto-char (match-end 0)))
|
||||||
|
@ -1386,7 +1386,7 @@ buffer position `limit' or the end of the buffer."
|
||||||
'("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
|
'("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
|
||||||
2 font-lock-type-face)
|
2 font-lock-type-face)
|
||||||
;; symbols
|
;; symbols
|
||||||
'("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|\\[\\]=?\\|\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
|
'("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
|
||||||
2 font-lock-reference-face)
|
2 font-lock-reference-face)
|
||||||
;; expression expansion
|
;; expression expansion
|
||||||
'("#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)"
|
'("#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue