diff options
author | davidflanagan <davidflanagan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-08 06:14:45 +0000 |
---|---|---|
committer | davidflanagan <davidflanagan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-08 06:14:45 +0000 |
commit | 453889cf0ccc2d5676f49893e670fc611e4ae08c (patch) | |
tree | 5434ee1686f217879a506a8b4a9420c2d3b22632 | |
parent | 219d2315afc0fbb393ed759fd48005c92d32b32d (diff) | |
download | ruby-453889cf0ccc2d5676f49893e670fc611e4ae08c.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | parse.y | 58 |
2 files changed, 4 insertions, 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. @@ -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()) != '-') { |