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>
|
||||
|
||||
* 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.
|
||||
|
||||
* 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.
|
||||
|
||||
|
|
7
ToDo
7
ToDo
|
@ -4,9 +4,9 @@ Language Spec.
|
|||
- compile time string concatenation, "hello" "world" => "helloworld"
|
||||
- rescue modifier; a rescue b => begin a rescue; b end
|
||||
- %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. ???
|
||||
* objectify symbols
|
||||
* objectify characters
|
||||
* ../... outside condition invokes operator method too.
|
||||
* ... inside condition turns off just before right condition.???
|
||||
|
@ -58,6 +58,8 @@ Standard Libraries
|
|||
- regexp: (?>..), \G
|
||||
- Struct::new([name,]member,...)
|
||||
- IO#reopen accepts path as well
|
||||
- Kernel#scan
|
||||
- call initialize for builtin class too (not yet: Regexp, IO, etc)
|
||||
* String#scanf(?)
|
||||
* Object#fmt(?)
|
||||
* Integer#{bin,oct,hex,heX}
|
||||
|
@ -69,7 +71,6 @@ Standard Libraries
|
|||
* optional stepsize argument for succ()
|
||||
* performance tune for String's non-bang methods.
|
||||
* Ruby module -- Ruby::Version, Ruby::Interpreter
|
||||
* call initialize for builtin class too
|
||||
|
||||
Extension Libraries
|
||||
|
||||
|
|
4
eval.c
4
eval.c
|
@ -340,7 +340,7 @@ rb_disable_super(klass, name)
|
|||
}
|
||||
else {
|
||||
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;
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
10
object.c
10
object.c
|
@ -497,7 +497,13 @@ static VALUE
|
|||
sym_to_s(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
|
||||
|
@ -1100,7 +1106,7 @@ Init_Object()
|
|||
rb_define_global_const("NIL", Qnil);
|
||||
|
||||
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, "to_i", sym_to_i, 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 */
|
||||
{
|
||||
char buf[2];
|
||||
int i;
|
||||
int numlen;
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
int cc = nextc();
|
||||
|
||||
if (cc == -1) goto eof;
|
||||
buf[i] = cc;
|
||||
if (!ISXDIGIT(buf[i])) {
|
||||
pushback(buf[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
c = scan_hex(buf, i, &i);
|
||||
c = scan_hex(lex_p, 2, &numlen);
|
||||
lex_p += numlen;
|
||||
}
|
||||
return c;
|
||||
|
||||
|
@ -3595,9 +3585,16 @@ str_extend(list, term)
|
|||
tokadd(c);
|
||||
goto loop_again;
|
||||
case '\\':
|
||||
c = read_escape();
|
||||
tokadd(c);
|
||||
goto loop_again;
|
||||
c = nextc();
|
||||
if (c == -1) return (NODE*)-1;
|
||||
if (c == term) {
|
||||
tokadd(c);
|
||||
}
|
||||
else {
|
||||
tokadd('\\');
|
||||
tokadd(c);
|
||||
}
|
||||
break;
|
||||
case '{':
|
||||
if (brace != -1) nest++;
|
||||
case '\"':
|
||||
|
|
66
regex.c
66
regex.c
|
@ -1067,7 +1067,7 @@ calculate_must_string(start, end)
|
|||
return must;
|
||||
}
|
||||
|
||||
static int
|
||||
static unsigned int
|
||||
read_backslash(c)
|
||||
int c;
|
||||
{
|
||||
|
@ -1099,6 +1099,47 @@ read_backslash(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
|
||||
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;
|
||||
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:
|
||||
c = read_backslash(c);
|
||||
if (ismbchar(c)) {
|
||||
|
@ -2173,6 +2224,16 @@ re_compile_pattern(pattern, size, bufp)
|
|||
BUFPUSH(c1);
|
||||
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:
|
||||
c = read_backslash(c);
|
||||
goto normal_char;
|
||||
|
@ -2335,6 +2396,9 @@ re_compile_pattern(pattern, size, bufp)
|
|||
|
||||
nested_meta:
|
||||
FREE_AND_RETURN(stackb, "nested *?+ in regexp");
|
||||
|
||||
invalid_escape:
|
||||
FREE_AND_RETURN(stackb, "Invalid escape character syntax");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
8
string.c
8
string.c
|
@ -2483,6 +2483,13 @@ rb_str_scan(str, pat)
|
|||
return str;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_f_scan(self, pat)
|
||||
VALUE self, pat;
|
||||
{
|
||||
return rb_str_scan(uscore_get(), pat);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_str_hex(str)
|
||||
VALUE str;
|
||||
|
@ -2755,6 +2762,7 @@ Init_String()
|
|||
rb_define_global_function("chomp!", rb_f_chomp_bang, -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_slice_bang, -1);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#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_RELEASE_CODE 20000307
|
||||
#define RUBY_RELEASE_CODE 20000308
|
||||
|
|
Loading…
Reference in a new issue