* parse.y (parser_yylex): allow ';;' to be block terminator in

place of 'end'.  [highly experimental]

* misc/ruby-mode.el (ruby-block-end-re): allow ';;' for a negative
  indent trigger.  [highly experimental]

* parse.y (parser_yylex): "respond_to?:foo" should be interpreted
  as "respond_to? :foo" at the command level.  [ruby-talk:144303]

* sprintf.c (rb_f_sprintf): raise exception on debug mode (-d),
  not verbose mode (-w/-w).  [ruby-core:05123]

* sprintf.c (rb_f_sprintf): warn always on verbose mode.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2005-06-07 08:22:42 +00:00
Родитель 7eef190796
Коммит 549c345cef
4 изменённых файлов: 38 добавлений и 10 удалений

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

@ -1,3 +1,23 @@
Tue Jun 7 17:20:39 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (parser_yylex): allow ';;' to be block terminator in
place of 'end'. [highly experimental]
* misc/ruby-mode.el (ruby-block-end-re): allow ';;' for a negative
indent trigger. [highly experimental]
Tue Jun 7 16:45:49 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (parser_yylex): "respond_to?:foo" should be interpreted
as "respond_to? :foo" at the command level. [ruby-talk:144303]
Tue Jun 7 16:32:53 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* sprintf.c (rb_f_sprintf): raise exception on debug mode (-d),
not verbose mode (-w/-w). [ruby-core:05123]
* sprintf.c (rb_f_sprintf): warn always on verbose mode.
Tue Jun 7 10:30:49 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/multi-tk.rb: slave-ip fails to call procedures

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

@ -45,7 +45,7 @@
(concat ruby-modifier-beg-re "\\|" ruby-block-op-re)
)
(defconst ruby-block-end-re "end")
(defconst ruby-block-end-re "\\<end\\>\\|;;")
(defconst ruby-here-doc-beg-re
"<<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)")
@ -61,13 +61,13 @@
(defconst ruby-delimiter
(concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\<\\("
ruby-block-beg-re
"\\|" ruby-block-end-re
"\\)\\>\\|^=begin\\|" ruby-here-doc-beg-re)
"\\>\\|" ruby-block-end-re
"\\)\\|^=begin\\|" ruby-here-doc-beg-re)
)
(defconst ruby-negative
(concat "^[ \t]*\\(\\(" ruby-block-mid-re "\\)\\>\\|\\("
ruby-block-end-re "\\)\\>\\|}\\|\\]\\)")
ruby-block-end-re "\\)\\|}\\|\\]\\)")
)
(defconst ruby-operator-chars "-,.+*/%&|^~=<>:")
@ -453,7 +453,7 @@ The variable ruby-indent-level controls the amount of indentation.
(setq depth (1- depth)))
(setq nest (cdr nest))
(goto-char pnt))
((looking-at (concat "\\<\\(" ruby-block-end-re "\\)\\>"))
((looking-at ruby-block-end-re)
(if (or (and (not (bolp))
(progn
(forward-char -1)
@ -776,7 +776,8 @@ An end of a defun is found by moving forward from the beginning of one."
(defun ruby-move-to-block (n)
(let (start pos done down)
(setq start (ruby-calculate-indent))
(setq down (looking-at (concat "\\<\\(" (if (< n 0) ruby-block-end-re ruby-block-beg-re) "\\)\\>")))
(setq down (looking-at (if (< n 0) ruby-block-end-re
(concat "\\<\\(" ruby-block-beg-re "\\)\\>"))))
(while (and (not done) (not (if (< n 0) (bobp) (eobp))))
(forward-line n)
(cond
@ -887,7 +888,7 @@ An end of a defun is found by moving forward from the beginning of one."
(?:
(forward-char -1)
(eq (char-before) :)))))
(if (looking-at (concat "\\<\\(" ruby-block-end-re "\\)\\>"))
(if (looking-at ruby-block-end-re)
(ruby-beginning-of-block))
nil))
(setq i (1- i)))

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

@ -6304,6 +6304,11 @@ parser_yylex(parser)
return '^';
case ';':
if ((c = nextc()) == ';') {
lex_state = EXPR_END;
return kEND;
}
pushback(c);
command_start = Qtrue;
case ',':
lex_state = EXPR_BEG;
@ -6700,7 +6705,7 @@ parser_yylex(parser)
}
}
if (lex_state == EXPR_BEG ||
if ((lex_state == EXPR_BEG && !cmd_state) ||
lex_state == EXPR_ARG ||
lex_state == EXPR_CMDARG) {
if (peek(':') && !(lex_p + 1 < lex_pend && lex_p[1] == ':')) {

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

@ -770,8 +770,10 @@ rb_f_sprintf(argc, argv)
sprint_exit:
/* XXX - We cannot validiate the number of arguments if (digit)$ style used.
*/
if (RTEST(ruby_verbose) && posarg >= 0 && nextarg < argc) {
rb_raise(rb_eArgError, "too many arguments for format string");
if (posarg >= 0 && nextarg < argc) {
const char *mesg = "too many arguments for format string";
if (RTEST(ruby_debug)) rb_raise(rb_eArgError, mesg);
if (RTEST(ruby_verbose)) rb_warn(mesg);
}
rb_str_resize(result, blen);