ruby-changes:2347
From: ko1@a...
Date: 8 Nov 2007 15:15:12 +0900
Subject: [ruby-changes:2347] davidflanagan - Ruby:r13838 (trunk): * parse.y: fix segfault with \x escapes in regexps
davidflanagan 2007-11-08 15:14:45 +0900 (Thu, 08 Nov 2007) New Revision: 13838 Modified files: trunk/ChangeLog trunk/parse.y Log: * parse.y: fix segfault with \x escapes in regexps delete unused #if 0 code regions from previous patch http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/parse.y?r1=13838&r2=13837 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13838&r2=13837 Index: ChangeLog =================================================================== --- ChangeLog (revision 13837) +++ ChangeLog (revision 13838) @@ -1,3 +1,7 @@ +Thu Nov 8 15:13:56 UTC 2007 David Flanagan <davidflanagan@r...> + * 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@r...> * parse.y (parser_read_escape): remove C99/gcc-ism. Index: parse.y =================================================================== --- parse.y (revision 13837) +++ parse.y (revision 13838) @@ -4973,49 +4973,7 @@ 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 @@ 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()) != '-') { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml