mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (aref_args): "*arg" should always be expanded by REXPAND.
* variable.c (fc_i): removed vast string allocation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
dd90741112
commit
7c9c33e9ad
5 changed files with 81 additions and 54 deletions
|
@ -1,3 +1,11 @@
|
|||
Wed Jun 6 14:34:27 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* parse.y (aref_args): "*arg" should always be expanded by REXPAND.
|
||||
|
||||
Tue Jun 5 23:58:43 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* variable.c (fc_i): removed vast string allocation.
|
||||
|
||||
Tue Jun 5 16:45:48 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* error.c (Init_Exception): NameError went under StandardError,
|
||||
|
|
|
@ -660,24 +660,21 @@ An end of a defun is found by moving forward from the beginning of one."
|
|||
|
||||
(cond
|
||||
((featurep 'font-lock)
|
||||
(or (boundp 'font-lock-variable-name-face)
|
||||
(setq font-lock-variable-name-face font-lock-type-face))
|
||||
|
||||
|
||||
(add-hook 'ruby-mode-hook
|
||||
'(lambda ()
|
||||
(make-local-variable 'font-lock-syntactic-keywords)
|
||||
(setq font-lock-syntactic-keywords
|
||||
'(("\\$\\([#\"'`$\\]\\)" 1 (1 . nil))
|
||||
("\\(#\\)[{$@]" 1 (1 . nil))
|
||||
("\\(/\\)\\([^/\n]\\|\\/\\)*\\(/\\)"
|
||||
(1 (7 . ?'))
|
||||
(3 (7 . ?')))
|
||||
("^\\(=\\)begin\\(\\s \\|$\\)" 1 (7 . nil))
|
||||
("^\\(=\\)end\\(\\s \\|$\\)" 1 (7 . nil))))
|
||||
(make-local-variable 'font-lock-defaults)
|
||||
(setq font-lock-defaults '((ruby-font-lock-keywords) nil nil))
|
||||
(setq font-lock-keywords ruby-font-lock-keywords)))
|
||||
(setq ruby-font-lock-syntactic-keywords
|
||||
'(("\\$\\([#\"'`$\\]\\)" 1 (1 . nil))
|
||||
("\\(#\\)[{$@]" 1 (1 . nil))
|
||||
("\\(/\\)\\([^/\n]\\|\\/\\)*\\(/\\)"
|
||||
(1 (7 . ?'))
|
||||
(3 (7 . ?')))
|
||||
("^\\(=\\)begin\\(\\s \\|$\\)" 1 (7 . nil))
|
||||
("^\\(=\\)end\\(\\s \\|$\\)" 1 (7 . nil))))
|
||||
(put major-mode 'font-lock-defaults
|
||||
'((ruby-font-lock-keywords)
|
||||
nil nil nil
|
||||
beginning-of-line
|
||||
(font-lock-syntactic-keywords
|
||||
. ruby-font-lock-syntactic-keywords)))
|
||||
|
||||
(defun ruby-font-lock-docs (limit)
|
||||
(if (re-search-forward "^=begin\\(\\s \\|$\\)" limit t)
|
||||
|
|
2
parse.y
2
parse.y
|
@ -426,7 +426,7 @@ stmt : kALIAS fitem {lex_state = EXPR_FNAME;} fitem
|
|||
}
|
||||
| lhs '=' mrhs_basic
|
||||
{
|
||||
$$ = node_assign($1, ret_args($3));
|
||||
$$ = node_assign($1, $3);
|
||||
}
|
||||
| mlhs '=' mrhs
|
||||
{
|
||||
|
|
90
variable.c
90
variable.c
|
@ -36,6 +36,33 @@ struct fc_result {
|
|||
struct fc_result *prev;
|
||||
};
|
||||
|
||||
static VALUE
|
||||
fc_path(fc, name)
|
||||
struct fc_result *fc;
|
||||
ID name;
|
||||
{
|
||||
VALUE path, tmp;
|
||||
|
||||
path = rb_str_new2(rb_id2name(name));
|
||||
while (fc) {
|
||||
if (fc->track == rb_cObject) break;
|
||||
if (ROBJECT(fc->track)->iv_tbl &&
|
||||
st_lookup(ROBJECT(fc->track)->iv_tbl, rb_intern("__classpath__"), &tmp)) {
|
||||
tmp = rb_str_dup(tmp);
|
||||
rb_str_cat2(tmp, "::");
|
||||
rb_str_append(tmp, path);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
tmp = rb_str_new2(rb_id2name(fc->name));
|
||||
rb_str_cat2(tmp, "::");
|
||||
rb_str_append(tmp, path);
|
||||
path = tmp;
|
||||
fc = fc->prev;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
static int
|
||||
fc_i(key, value, res)
|
||||
ID key;
|
||||
|
@ -43,48 +70,43 @@ fc_i(key, value, res)
|
|||
struct fc_result *res;
|
||||
{
|
||||
VALUE path;
|
||||
char *name;
|
||||
|
||||
if (!rb_is_const_id(key)) return ST_CONTINUE;
|
||||
|
||||
name = rb_id2name(key);
|
||||
if (res->path) {
|
||||
path = rb_str_dup(res->path);
|
||||
rb_str_cat2(path, "::");
|
||||
rb_str_cat2(path, name);
|
||||
}
|
||||
else {
|
||||
path = rb_str_new2(name);
|
||||
}
|
||||
if (value == res->klass) {
|
||||
res->name = key;
|
||||
res->path = path;
|
||||
res->path = fc_path(res, key);
|
||||
return ST_STOP;
|
||||
}
|
||||
if (rb_obj_is_kind_of(value, rb_cModule)) {
|
||||
struct fc_result arg;
|
||||
struct fc_result *list;
|
||||
|
||||
|
||||
switch (TYPE(value)) {
|
||||
case T_MODULE:
|
||||
case T_CLASS:
|
||||
if (!RCLASS(value)->iv_tbl) return ST_CONTINUE;
|
||||
else {
|
||||
struct fc_result arg;
|
||||
struct fc_result *list;
|
||||
|
||||
list = res;
|
||||
while (list) {
|
||||
if (list->track == value) return ST_CONTINUE;
|
||||
list = list->prev;
|
||||
}
|
||||
list = res;
|
||||
while (list) {
|
||||
if (list->track == value) return ST_CONTINUE;
|
||||
list = list->prev;
|
||||
}
|
||||
|
||||
arg.name = 0;
|
||||
arg.path = path;
|
||||
arg.klass = res->klass;
|
||||
arg.track = value;
|
||||
arg.prev = res;
|
||||
st_foreach(RCLASS(value)->iv_tbl, fc_i, &arg);
|
||||
if (arg.name) {
|
||||
res->name = arg.name;
|
||||
res->path = arg.path;
|
||||
return ST_STOP;
|
||||
arg.name = key;
|
||||
arg.path = 0;
|
||||
arg.klass = res->klass;
|
||||
arg.track = value;
|
||||
arg.prev = res;
|
||||
st_foreach(RCLASS(value)->iv_tbl, fc_i, &arg);
|
||||
if (arg.path) {
|
||||
res->path = arg.path;
|
||||
return ST_STOP;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
@ -103,10 +125,10 @@ find_class_path(klass)
|
|||
if (RCLASS(rb_cObject)->iv_tbl) {
|
||||
st_foreach(RCLASS(rb_cObject)->iv_tbl, fc_i, &arg);
|
||||
}
|
||||
if (arg.name == 0) {
|
||||
if (arg.path == 0) {
|
||||
st_foreach(rb_class_tbl, fc_i, &arg);
|
||||
}
|
||||
if (arg.name) {
|
||||
if (arg.path) {
|
||||
st_insert(ROBJECT(klass)->iv_tbl,rb_intern("__classpath__"),arg.path);
|
||||
return arg.path;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.7.1"
|
||||
#define RUBY_RELEASE_DATE "2001-06-05"
|
||||
#define RUBY_RELEASE_DATE "2001-06-06"
|
||||
#define RUBY_VERSION_CODE 171
|
||||
#define RUBY_RELEASE_CODE 20010605
|
||||
#define RUBY_RELEASE_CODE 20010606
|
||||
|
|
Loading…
Reference in a new issue