mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
2000-03-08
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4d215cd9d3
commit
035226e1fe
8 changed files with 111 additions and 27 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,11 @@
|
||||||
|
Wed Mar 8 02:08:43 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* parse.y: escape expansion too early.
|
||||||
|
|
||||||
|
* string.c (rb_f_scan): Kernel#scan added.
|
||||||
|
|
||||||
|
* regex.c (re_compile_pattern): support \cX et al.
|
||||||
|
|
||||||
Tue Mar 7 01:44:27 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Tue Mar 7 01:44:27 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
* io.c (set_stdin): simplified procedure, allows $stdin = DATA;
|
* io.c (set_stdin): simplified procedure, allows $stdin = DATA;
|
||||||
|
@ -6,7 +14,7 @@ Tue Mar 7 01:44:27 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
* io.c (set_outfile): ditto.
|
* io.c (set_outfile): ditto.
|
||||||
|
|
||||||
* re.c (Init_Regexp): new method Regexp#last_match added; it's a
|
* re.c (Init_Regexp): new method Regexp#last_match added; it's a
|
||||||
replacement for $~.
|
alternative for $~.
|
||||||
|
|
||||||
* configure.in (DEFAULT_KCODE): KCODE_NONE should be the default.
|
* configure.in (DEFAULT_KCODE): KCODE_NONE should be the default.
|
||||||
|
|
||||||
|
|
7
ToDo
7
ToDo
|
@ -4,9 +4,9 @@ Language Spec.
|
||||||
- compile time string concatenation, "hello" "world" => "helloworld"
|
- compile time string concatenation, "hello" "world" => "helloworld"
|
||||||
- rescue modifier; a rescue b => begin a rescue; b end
|
- rescue modifier; a rescue b => begin a rescue; b end
|
||||||
- %w(a\ b\ c abc) => ["a b c", "abc"]
|
- %w(a\ b\ c abc) => ["a b c", "abc"]
|
||||||
* class variable (prefix @@?) ??
|
- objectify symbols
|
||||||
|
- class variable (prefix @@) - still need work for singletons
|
||||||
* operator !! for rescue. ???
|
* operator !! for rescue. ???
|
||||||
* objectify symbols
|
|
||||||
* objectify characters
|
* objectify characters
|
||||||
* ../... outside condition invokes operator method too.
|
* ../... outside condition invokes operator method too.
|
||||||
* ... inside condition turns off just before right condition.???
|
* ... inside condition turns off just before right condition.???
|
||||||
|
@ -58,6 +58,8 @@ Standard Libraries
|
||||||
- regexp: (?>..), \G
|
- regexp: (?>..), \G
|
||||||
- Struct::new([name,]member,...)
|
- Struct::new([name,]member,...)
|
||||||
- IO#reopen accepts path as well
|
- IO#reopen accepts path as well
|
||||||
|
- Kernel#scan
|
||||||
|
- call initialize for builtin class too (not yet: Regexp, IO, etc)
|
||||||
* String#scanf(?)
|
* String#scanf(?)
|
||||||
* Object#fmt(?)
|
* Object#fmt(?)
|
||||||
* Integer#{bin,oct,hex,heX}
|
* Integer#{bin,oct,hex,heX}
|
||||||
|
@ -69,7 +71,6 @@ Standard Libraries
|
||||||
* optional stepsize argument for succ()
|
* optional stepsize argument for succ()
|
||||||
* performance tune for String's non-bang methods.
|
* performance tune for String's non-bang methods.
|
||||||
* Ruby module -- Ruby::Version, Ruby::Interpreter
|
* Ruby module -- Ruby::Version, Ruby::Interpreter
|
||||||
* call initialize for builtin class too
|
|
||||||
|
|
||||||
Extension Libraries
|
Extension Libraries
|
||||||
|
|
||||||
|
|
4
eval.c
4
eval.c
|
@ -340,7 +340,7 @@ rb_disable_super(klass, name)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_clear_cache_by_id(mid);
|
rb_clear_cache_by_id(mid);
|
||||||
rb_add_method(ruby_class, mid, 0, NOEX_UNDEF);
|
rb_add_method(klass, mid, 0, NOEX_UNDEF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4302,7 +4302,7 @@ rb_call_super(argc, argv)
|
||||||
VALUE result;
|
VALUE result;
|
||||||
|
|
||||||
if (ruby_frame->last_class == 0) {
|
if (ruby_frame->last_class == 0) {
|
||||||
rb_raise(rb_eNameError, "superclass method `%s' disabled",
|
rb_raise(rb_eNameError, "superclass method `%s' must be enabled by rb_enable_super()",
|
||||||
rb_id2name(ruby_frame->last_func));
|
rb_id2name(ruby_frame->last_func));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
object.c
10
object.c
|
@ -497,7 +497,13 @@ static VALUE
|
||||||
sym_to_s(sym)
|
sym_to_s(sym)
|
||||||
VALUE sym;
|
VALUE sym;
|
||||||
{
|
{
|
||||||
return rb_str_new2(rb_id2name(SYM2ID(sym)));
|
char *name, *buf;
|
||||||
|
|
||||||
|
name = rb_id2name(SYM2ID(sym));
|
||||||
|
buf = ALLOCA_N(char, strlen(name)+2);
|
||||||
|
sprintf(buf, ":%s", name);
|
||||||
|
|
||||||
|
return rb_str_new2(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1100,7 +1106,7 @@ Init_Object()
|
||||||
rb_define_global_const("NIL", Qnil);
|
rb_define_global_const("NIL", Qnil);
|
||||||
|
|
||||||
rb_cSymbol = rb_define_class("Symbol", rb_cObject);
|
rb_cSymbol = rb_define_class("Symbol", rb_cObject);
|
||||||
rb_undef_method(CLASS_OF(rb_cNilClass), "new");
|
rb_undef_method(CLASS_OF(rb_cSymbol), "new");
|
||||||
rb_define_method(rb_cSymbol, "type", sym_type, 0);
|
rb_define_method(rb_cSymbol, "type", sym_type, 0);
|
||||||
rb_define_method(rb_cSymbol, "to_i", sym_to_i, 0);
|
rb_define_method(rb_cSymbol, "to_i", sym_to_i, 0);
|
||||||
rb_define_method(rb_cSymbol, "to_s", sym_to_s, 0);
|
rb_define_method(rb_cSymbol, "to_s", sym_to_s, 0);
|
||||||
|
|
29
parse.y
29
parse.y
|
@ -2067,20 +2067,10 @@ read_escape()
|
||||||
|
|
||||||
case 'x': /* hex constant */
|
case 'x': /* hex constant */
|
||||||
{
|
{
|
||||||
char buf[2];
|
int numlen;
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i=0; i<2; i++) {
|
c = scan_hex(lex_p, 2, &numlen);
|
||||||
int cc = nextc();
|
lex_p += numlen;
|
||||||
|
|
||||||
if (cc == -1) goto eof;
|
|
||||||
buf[i] = cc;
|
|
||||||
if (!ISXDIGIT(buf[i])) {
|
|
||||||
pushback(buf[i]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c = scan_hex(buf, i, &i);
|
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
|
|
||||||
|
@ -3595,9 +3585,16 @@ str_extend(list, term)
|
||||||
tokadd(c);
|
tokadd(c);
|
||||||
goto loop_again;
|
goto loop_again;
|
||||||
case '\\':
|
case '\\':
|
||||||
c = read_escape();
|
c = nextc();
|
||||||
tokadd(c);
|
if (c == -1) return (NODE*)-1;
|
||||||
goto loop_again;
|
if (c == term) {
|
||||||
|
tokadd(c);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tokadd('\\');
|
||||||
|
tokadd(c);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case '{':
|
case '{':
|
||||||
if (brace != -1) nest++;
|
if (brace != -1) nest++;
|
||||||
case '\"':
|
case '\"':
|
||||||
|
|
66
regex.c
66
regex.c
|
@ -1067,7 +1067,7 @@ calculate_must_string(start, end)
|
||||||
return must;
|
return must;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static unsigned int
|
||||||
read_backslash(c)
|
read_backslash(c)
|
||||||
int c;
|
int c;
|
||||||
{
|
{
|
||||||
|
@ -1099,6 +1099,47 @@ read_backslash(c)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned int
|
||||||
|
read_special(p, pend, pp)
|
||||||
|
const char *p, *pend, **pp;
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
|
||||||
|
PATFETCH_RAW(c);
|
||||||
|
switch (c) {
|
||||||
|
case 'M':
|
||||||
|
PATFETCH_RAW(c);
|
||||||
|
if (c != '-') return -1;
|
||||||
|
PATFETCH_RAW(c);
|
||||||
|
*pp = p;
|
||||||
|
if (c == '\\') {
|
||||||
|
return read_special(p, pend, pp) | 0x80;
|
||||||
|
}
|
||||||
|
else if (c == -1) return ~0;
|
||||||
|
else {
|
||||||
|
return ((c & 0xff) | 0x80);
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'C':
|
||||||
|
PATFETCH_RAW(c);
|
||||||
|
if (c != '-') return ~0;
|
||||||
|
case 'c':
|
||||||
|
PATFETCH_RAW(c);
|
||||||
|
*pp = p;
|
||||||
|
if (c == '\\') {
|
||||||
|
c = read_special(p, pend, pp);
|
||||||
|
}
|
||||||
|
else if (c == '?') return 0177;
|
||||||
|
else if (c == -1) return ~0;
|
||||||
|
return c & 0x9f;
|
||||||
|
default:
|
||||||
|
return read_backslash(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
end_of_pattern:
|
||||||
|
return ~0;
|
||||||
|
}
|
||||||
|
|
||||||
/* re_compile_pattern takes a regular-expression string
|
/* re_compile_pattern takes a regular-expression string
|
||||||
and converts it into a buffer full of byte commands for matching.
|
and converts it into a buffer full of byte commands for matching.
|
||||||
|
|
||||||
|
@ -1470,6 +1511,16 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
had_num_literal = 1;
|
had_num_literal = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'M':
|
||||||
|
case 'C':
|
||||||
|
case 'c':
|
||||||
|
p0 = --p;
|
||||||
|
c = read_special(p, pend, &p0);
|
||||||
|
if (c > 255) goto invalid_escape;
|
||||||
|
p = p0;
|
||||||
|
had_num_literal = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
c = read_backslash(c);
|
c = read_backslash(c);
|
||||||
if (ismbchar(c)) {
|
if (ismbchar(c)) {
|
||||||
|
@ -2173,6 +2224,16 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
BUFPUSH(c1);
|
BUFPUSH(c1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'M':
|
||||||
|
case 'C':
|
||||||
|
case 'c':
|
||||||
|
p0 = --p;
|
||||||
|
c = read_special(p, pend, &p0);
|
||||||
|
if (c > 255) goto invalid_escape;
|
||||||
|
p = p0;
|
||||||
|
had_num_literal = 1;
|
||||||
|
goto numeric_char;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
c = read_backslash(c);
|
c = read_backslash(c);
|
||||||
goto normal_char;
|
goto normal_char;
|
||||||
|
@ -2335,6 +2396,9 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
|
|
||||||
nested_meta:
|
nested_meta:
|
||||||
FREE_AND_RETURN(stackb, "nested *?+ in regexp");
|
FREE_AND_RETURN(stackb, "nested *?+ in regexp");
|
||||||
|
|
||||||
|
invalid_escape:
|
||||||
|
FREE_AND_RETURN(stackb, "Invalid escape character syntax");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
8
string.c
8
string.c
|
@ -2483,6 +2483,13 @@ rb_str_scan(str, pat)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static VALUE
|
||||||
|
rb_f_scan(self, pat)
|
||||||
|
VALUE self, pat;
|
||||||
|
{
|
||||||
|
return rb_str_scan(uscore_get(), pat);
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_str_hex(str)
|
rb_str_hex(str)
|
||||||
VALUE str;
|
VALUE str;
|
||||||
|
@ -2755,6 +2762,7 @@ Init_String()
|
||||||
rb_define_global_function("chomp!", rb_f_chomp_bang, -1);
|
rb_define_global_function("chomp!", rb_f_chomp_bang, -1);
|
||||||
|
|
||||||
rb_define_global_function("split", rb_f_split, -1);
|
rb_define_global_function("split", rb_f_split, -1);
|
||||||
|
rb_define_global_function("scan", rb_f_scan, 1);
|
||||||
|
|
||||||
rb_define_method(rb_cString, "slice", rb_str_aref_m, -1);
|
rb_define_method(rb_cString, "slice", rb_str_aref_m, -1);
|
||||||
rb_define_method(rb_cString, "slice!", rb_str_slice_bang, -1);
|
rb_define_method(rb_cString, "slice!", rb_str_slice_bang, -1);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#define RUBY_VERSION "1.5.3"
|
#define RUBY_VERSION "1.5.3"
|
||||||
#define RUBY_RELEASE_DATE "2000-03-07"
|
#define RUBY_RELEASE_DATE "2000-03-08"
|
||||||
#define RUBY_VERSION_CODE 153
|
#define RUBY_VERSION_CODE 153
|
||||||
#define RUBY_RELEASE_CODE 20000307
|
#define RUBY_RELEASE_CODE 20000308
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue