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

ruby-changes:2286

From: ko1@a...
Date: 26 Oct 2007 02:06:46 +0900
Subject: [ruby-changes:2286] matz - Ruby:r13777 (trunk): * parse.y (parser_yylex): dot at the head of the line denote line

matz	2007-10-26 02:06:29 +0900 (Fri, 26 Oct 2007)

  New Revision: 13777

  Modified files:
    trunk/ChangeLog
    trunk/misc/ruby-mode.el
    trunk/parse.y

  Log:
    * parse.y (parser_yylex): dot at the head of the line denote line
      continuation from previous one to support fluent interface.
      [experimental]
    
    * misc/ruby-mode.el (ruby-calculate-indent): support fluent dot.

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/misc/ruby-mode.el?r1=13777&r2=13776
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/parse.y?r1=13777&r2=13776
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13777&r2=13776

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 13776)
+++ ChangeLog	(revision 13777)
@@ -9,6 +9,14 @@
 	* hash.c (rb_hash_s_create): Hash#[] now takes assocs as source of
 	  hash conversion.
 
+Thu Oct 25 16:46:05 2007  Yukihiro Matsumoto  <matz@r...>
+
+	* parse.y (parser_yylex): dot at the head of the line denote line
+	  continuation from previous one to support fluent interface.
+	  [experimental]
+
+	* misc/ruby-mode.el (ruby-calculate-indent): support fluent dot.
+
 Thu Oct 25 14:19:33 2007  Nobuyoshi Nakada  <nobu@r...>
 
 	* io.c (rb_io_tell, rb_io_seek): check errno too.  [ruby-dev:32093]
Index: misc/ruby-mode.el
===================================================================
--- misc/ruby-mode.el	(revision 13776)
+++ misc/ruby-mode.el	(revision 13777)
@@ -727,15 +727,19 @@
 		    (not (looking-at (concat "\\<\\(" ruby-block-hanging-re "\\)\\>")))
 		    (eq (ruby-deep-indent-paren-p t) 'space)
 		    (not (bobp)))
-		   (save-excursion
-		     (widen)
-		     (goto-char (or begin parse-start))
-		     (skip-syntax-forward " ")
-		     (current-column)))
+		   (widen)
+		   (goto-char (or begin parse-start))
+		   (skip-syntax-forward " ")
+		   (current-column))
 		  ((car (nth 1 state)) indent)
 		  (t
 		   (+ indent ruby-indent-level))))))))
-      indent)))
+      (goto-char indent-point)
+      (beginning-of-line)
+      (skip-syntax-forward " ")
+      (if (looking-at "\\.[^.]")
+	  (+ indent ruby-indent-level)
+	indent))))
 
 (defun ruby-electric-brace (arg)
   (interactive "P")
Index: parse.y
===================================================================
--- parse.y	(revision 13776)
+++ parse.y	(revision 13777)
@@ -5863,6 +5863,25 @@
 	  default:
 	    break;
 	}
+	while ((c = nextc())) {
+	    switch (c) {
+	      case ' ': case '\t': case '\f': case '\r':
+	      case '\13': /* '\v' */
+		space_seen++;
+		break;
+	      case '.': {
+		  if ((c = nextc()) != '.') {
+		      pushback(c);
+		      pushback('.');
+		      goto retry;
+		  }
+	      }
+	      default:
+		pushback(c);
+		goto normal_newline;
+	    }
+	}
+      normal_newline:
 	command_start = Qtrue;
 	lex_state = EXPR_BEG;
 	return '\n';

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

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