summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-25 17:06:29 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-10-25 17:06:29 +0000
commitbbe0af6be1f85ea93c3f5fe8ca1e100c784a01e9 (patch)
treedb59455f8c2b5ad54157e033b847df9da88b421a
parent012b58b121ff499a6c811a3e7498e9a50145109b (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--misc/ruby-mode.el16
-rw-r--r--parse.y19
3 files changed, 37 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 5878a6475a..39bf572e34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,14 @@ Fri Oct 26 01:48:28 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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@ruby-lang.org>
+
+ * 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@ruby-lang.org>
* io.c (rb_io_tell, rb_io_seek): check errno too. [ruby-dev:32093]
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index 25c6b3008d..6e9ac7ae45 100644
--- a/misc/ruby-mode.el
+++ b/misc/ruby-mode.el
@@ -727,15 +727,19 @@ The variable ruby-indent-level controls the amount of indentation.
(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")
diff --git a/parse.y b/parse.y
index 8803ddff87..65c1f6056b 100644
--- a/parse.y
+++ b/parse.y
@@ -5863,6 +5863,25 @@ parser_yylex(struct parser_params *parser)
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';