[前][次][番号順一覧][スレッド一覧]

ruby-changes:11503

From: knu <ko1@a...>
Date: Fri, 3 Apr 2009 14:04:14 +0900 (JST)
Subject: [ruby-changes:11503] Ruby:r23129 (trunk): * lib/irb/completion.rb (IRB::InputCompletor::Operators): Add

knu	2009-04-03 14:04:02 +0900 (Fri, 03 Apr 2009)

  New Revision: 23129

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23129

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/lib/irb/completion.rb
    trunk/lib/irb/ruby-lex.rb
    trunk/misc/ruby-mode.el

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23128)
+++ ChangeLog	(revision 23129)
@@ -1,3 +1,17 @@
+Fri Apr  3 14:02:42 2009  Akinori MUSHA  <knu@i...>
+
+	* 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.
+
 Fri Apr  3 12:45:55 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/extmk.rb: quotes arguments with spaces always.
Index: misc/ruby-mode.el
===================================================================
--- misc/ruby-mode.el	(revision 23128)
+++ misc/ruby-mode.el	(revision 23129)
@@ -646,7 +646,7 @@
        ((looking-at ":\\(['\"]\\)")
         (goto-char (match-beginning 1))
         (ruby-forward-string (buffer-substring (match-beginning 1) (match-end 1)) end))
-       ((looking-at ":\\([-,.+*/%&|^~<>]=?\\|===?\\|<=>\\)")
+       ((looking-at ":\\([-,.+*/%&|^~<>]=?\\|===?\\|<=>\\|![~=]?\\)")
         (goto-char (match-end 0)))
        ((looking-at ":\\([a-zA-Z_][a-zA-Z_0-9]*[!?=]?\\)?")
         (goto-char (match-end 0)))
@@ -1386,7 +1386,7 @@
      '("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
        2 font-lock-type-face)
      ;; symbols
-     '("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|\\[\\]=?\\|\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
+     '("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
        2 font-lock-reference-face)
      ;; expression expansion
      '("#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)"
Index: lib/irb/ruby-lex.rb
===================================================================
--- lib/irb/ruby-lex.rb	(revision 23128)
+++ lib/irb/ruby-lex.rb	(revision 23129)
@@ -389,7 +389,8 @@
 		  "=", "==", "===",
 		  "=~", "<=>",
 		  "<", "<=",
-		  ">", ">=", ">>") do
+		  ">", ">=", ">>",
+		  "!", "!=", "!~") do
       |op, io|
       case @lex_state
       when EXPR_FNAME, EXPR_DOT
@@ -400,12 +401,6 @@
       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 @@
 	      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
Index: lib/irb/completion.rb
===================================================================
--- lib/irb/completion.rb	(revision 23128)
+++ lib/irb/completion.rb	(revision 23129)
@@ -184,7 +184,7 @@
 
     Operators = ["%", "&", "*", "**", "+",  "-",  "/",
       "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>",
-      "[]", "[]=", "^",]
+      "[]", "[]=", "^", "!", "!=", "!~"]
 
     def self.select_message(receiver, message, candidates)
       candidates.grep(/^#{message}/).collect do |e|

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]