mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y: fix segfault with \x escapes in regexps
delete unused #if 0 code regions from previous patch git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
219d2315af
commit
453889cf0c
2 changed files with 4 additions and 58 deletions
|
@ -1,3 +1,7 @@
|
|||
Thu Nov 8 15:13:56 UTC 2007 David Flanagan <davidflanagan@ruby-lang.org>
|
||||
* parse.y: fix segfault with \x escapes in regexps
|
||||
delete unused #if 0 code regions from previous patch
|
||||
|
||||
Thu Nov 8 12:12:10 2007 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* parse.y (parser_read_escape): remove C99/gcc-ism.
|
||||
|
|
58
parse.y
58
parse.y
|
@ -4973,48 +4973,6 @@ parser_tok_hex(struct parser_params *parser, int *numlen)
|
|||
return c;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
parser_tok_utf8(struct parser_params *parser, int *numlen, rb_encoding **encp)
|
||||
{
|
||||
int codepoint;
|
||||
|
||||
if (peek('{')) { /* handle \u{...} form */
|
||||
nextc();
|
||||
codepoint = scan_hex(lex_p, 6, numlen);
|
||||
if (*numlen == 0) {
|
||||
yyerror("invalid Unicode escape");
|
||||
return 0;
|
||||
}
|
||||
if (codepoint > 0x10ffff) {
|
||||
yyerror("illegal Unicode codepoint (too large)");
|
||||
return 0;
|
||||
}
|
||||
lex_p += *numlen;
|
||||
if (!peek('}')) {
|
||||
yyerror("unterminated Unicode escape");
|
||||
return 0;
|
||||
}
|
||||
nextc();
|
||||
}
|
||||
else { /* handle \uxxxx form */
|
||||
codepoint = scan_hex(lex_p, 4, numlen);
|
||||
if (*numlen < 4) {
|
||||
yyerror("invalid Unicode escape");
|
||||
return 0;
|
||||
}
|
||||
lex_p += 4;
|
||||
}
|
||||
if (codepoint >= 0x80) {
|
||||
*encp = UTF8_ENC();
|
||||
}
|
||||
|
||||
return codepoint;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static int
|
||||
parser_tokadd_utf8(struct parser_params *parser, int *hasmb,
|
||||
rb_encoding **encp, int string_literal, int symbol_literal)
|
||||
|
@ -5242,27 +5200,11 @@ parser_tokadd_escape(struct parser_params *parser, int term,
|
|||
|
||||
hex = tok_hex(&numlen);
|
||||
if (numlen == 0) goto eof;
|
||||
lex_p += numlen;
|
||||
tokcopy(numlen + 2);
|
||||
if (hex >= 0x80) *has8bit = ENC_CODERANGE_UNKNOWN;
|
||||
}
|
||||
return 0;
|
||||
|
||||
#if 0
|
||||
case 'u': /* Unicode constant */
|
||||
if (flags & (ESCAPE_CONTROL|ESCAPE_META)) goto eof;
|
||||
{
|
||||
int numlen;
|
||||
int uc;
|
||||
|
||||
uc = tok_utf8(&numlen, encp);
|
||||
if (numlen == 0) goto eof;
|
||||
tokaddmbc(uc, *encp);
|
||||
if (uc >= 0x80) *hasmb = 1;
|
||||
}
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
case 'M':
|
||||
if (flags & ESCAPE_META) goto eof;
|
||||
if ((c = nextc()) != '-') {
|
||||
|
|
Loading…
Reference in a new issue