* misc/ruby-style.el (ruby-style-{case,label}-indent): adjust for

labels inside switch block.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-10-26 06:00:52 +00:00
Родитель 27b35eddd6
Коммит 32865ef821
3 изменённых файлов: 27 добавлений и 18 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Fri Oct 26 15:00:52 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* misc/ruby-style.el (ruby-style-{case,label}-indent): adjust for
labels inside switch block.
Fri Oct 26 05:48:57 UTC 2007 David Flanagan <davidflanagan@ruby-lang.org>
* array.c: raise IndexError for negative length in rb_ary_fill

Просмотреть файл

@ -20,18 +20,22 @@
(defun ruby-style-case-indent (x)
(save-excursion
(goto-char (cdr x))
(if (looking-at "\\<case\\|default\\>") '*)))
(unless (progn (backward-up-list) (back-to-indentation)
(> (point) (cdr x)))
(goto-char (cdr x))
(if (looking-at "\\<case\\|default\\>") '*))))
(defun ruby-style-label-indent (x)
(save-excursion
(goto-char (cdr x))
(condition-case ()
(progn
(backward-up-list)
(backward-sexp 2)
(if (looking-at "\\<switch\\>") '/))
(error))))
(unless (progn (backward-up-list) (back-to-indentation)
(> (point) (cdr x)))
(goto-char (cdr x))
(condition-case ()
(progn
(backward-up-list)
(backward-sexp 2)
(if (looking-at "\\<switch\\>") '/))
(error)))))
(require 'cc-styles)
(c-add-style

18
parse.y
Просмотреть файл

@ -5870,11 +5870,11 @@ parser_yylex(struct parser_params *parser)
space_seen++;
break;
case '.': {
if ((c = nextc()) != '.') {
pushback(c);
pushback('.');
goto retry;
}
if ((c = nextc()) != '.') {
pushback(c);
pushback('.');
goto retry;
}
}
default:
pushback(c);
@ -5903,7 +5903,7 @@ parser_yylex(struct parser_params *parser)
return tOP_ASGN;
}
pushback(c);
if (IS_ARG() && space_seen && !ISSPACE(c)){
if (IS_ARG() && space_seen && !ISSPACE(c)) {
rb_warning0("`*' interpreted as argument prefix");
c = tSTAR;
}
@ -6084,8 +6084,8 @@ parser_yylex(struct parser_params *parser)
compile_error(PARSER_ARG "incomplete character syntax");
return 0;
}
if (rb_enc_isspace(c, parser->enc)){
if (!IS_ARG()){
if (rb_enc_isspace(c, parser->enc)) {
if (!IS_ARG()) {
int c2 = 0;
switch (c) {
case ' ':
@ -6156,7 +6156,7 @@ parser_yylex(struct parser_params *parser)
return tOP_ASGN;
}
pushback(c);
if (IS_ARG() && space_seen && !ISSPACE(c)){
if (IS_ARG() && space_seen && !ISSPACE(c)) {
rb_warning0("`&' interpreted as argument prefix");
c = tAMPER;
}