mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (parse_regx): handle backslash escaping of delimiter here.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ad56376d19
commit
c7e9e1f8f9
3 changed files with 11 additions and 5 deletions
|
@ -2,6 +2,10 @@ Wed Aug 17 13:55:33 2001 Usaku Nakamura <usa@ruby-lang.org>
|
|||
|
||||
* win32/Makefile.sub: merge from 1.7: use del instead of rm.
|
||||
|
||||
Fri Aug 17 00:49:51 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* parse.y (parse_regx): handle backslash escaping of delimiter here.
|
||||
|
||||
Thu Aug 16 19:53:19 2001 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* lib/resolv.rb, lib/resolv-replace.rb: Copy from 1.7.
|
||||
|
|
10
parse.y
10
parse.y
|
@ -2241,7 +2241,8 @@ read_escape()
|
|||
}
|
||||
|
||||
static int
|
||||
tokadd_escape()
|
||||
tokadd_escape(term)
|
||||
int term;
|
||||
{
|
||||
int c;
|
||||
|
||||
|
@ -2302,7 +2303,7 @@ tokadd_escape()
|
|||
tokadd('\\'); tokadd('c');
|
||||
escaped:
|
||||
if ((c = nextc()) == '\\') {
|
||||
return tokadd_escape();
|
||||
return tokadd_escape(term);
|
||||
}
|
||||
else if (c == -1) goto eof;
|
||||
tokadd(c);
|
||||
|
@ -2314,7 +2315,8 @@ tokadd_escape()
|
|||
return -1;
|
||||
|
||||
default:
|
||||
tokadd('\\');
|
||||
if (c != term)
|
||||
tokadd('\\');
|
||||
tokadd(c);
|
||||
}
|
||||
return 0;
|
||||
|
@ -2345,7 +2347,7 @@ parse_regx(term, paren)
|
|||
continue;
|
||||
|
||||
case '\\':
|
||||
if (tokadd_escape() < 0)
|
||||
if (tokadd_escape(term) < 0)
|
||||
return 0;
|
||||
continue;
|
||||
|
||||
|
|
2
re.c
2
re.c
|
@ -214,7 +214,7 @@ rb_reg_expr_str(str, s, len)
|
|||
const char *p, *pend;
|
||||
int need_escape = 0;
|
||||
|
||||
p = s; pend = p + len;
|
||||
p = s; pend = p + len;
|
||||
while (p<pend) {
|
||||
if (*p == '/' || (!ISPRINT(*p) && !ismbchar(*p))) {
|
||||
need_escape = 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue