* parse.y (tokadd_escape): refactored. [ruby-core:15657]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
eccb4ca2e7
commit
fbee9ba6ea
@ -1,3 +1,7 @@
|
|||||||
|
Tue Feb 26 15:43:42 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* parse.y (tokadd_escape): refactored. [ruby-core:15657]
|
||||||
|
|
||||||
Tue Feb 26 15:30:36 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Feb 26 15:30:36 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* array.c (rb_ary_eql, rb_ary_cmp): get rid of stack overflow with
|
* array.c (rb_ary_eql, rb_ary_cmp): get rid of stack overflow with
|
||||||
|
10
parse.y
10
parse.y
@ -4520,7 +4520,7 @@ static int parser_here_document(struct parser_params*,NODE*);
|
|||||||
# define tokadd(c) parser_tokadd(parser, c)
|
# define tokadd(c) parser_tokadd(parser, c)
|
||||||
# define tok_hex(numlen) parser_tok_hex(parser, numlen)
|
# define tok_hex(numlen) parser_tok_hex(parser, numlen)
|
||||||
# define read_escape(flags,e) parser_read_escape(parser, flags, e)
|
# define read_escape(flags,e) parser_read_escape(parser, flags, e)
|
||||||
# define tokadd_escape(t,e) parser_tokadd_escape(parser, t, e)
|
# define tokadd_escape(e) parser_tokadd_escape(parser, e)
|
||||||
# define regx_options() parser_regx_options(parser)
|
# define regx_options() parser_regx_options(parser)
|
||||||
# define tokadd_string(f,t,p,n,e) parser_tokadd_string(parser,f,t,p,n,e)
|
# define tokadd_string(f,t,p,n,e) parser_tokadd_string(parser,f,t,p,n,e)
|
||||||
# define parse_string(n) parser_parse_string(parser,n)
|
# define parse_string(n) parser_parse_string(parser,n)
|
||||||
@ -5203,8 +5203,7 @@ parser_tokaddmbc(struct parser_params *parser, int c, rb_encoding *enc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parser_tokadd_escape(struct parser_params *parser, int term,
|
parser_tokadd_escape(struct parser_params *parser, rb_encoding **encp)
|
||||||
rb_encoding **encp)
|
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
@ -5277,8 +5276,7 @@ parser_tokadd_escape(struct parser_params *parser, int term,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (c != '\\' || c != term)
|
tokadd('\\');
|
||||||
tokadd('\\');
|
|
||||||
tokadd(c);
|
tokadd(c);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -5416,7 +5414,7 @@ parser_tokadd_string(struct parser_params *parser,
|
|||||||
default:
|
default:
|
||||||
if (func & STR_FUNC_REGEXP) {
|
if (func & STR_FUNC_REGEXP) {
|
||||||
pushback(c);
|
pushback(c);
|
||||||
if ((c = tokadd_escape(term, &enc)) < 0)
|
if ((c = tokadd_escape(&enc)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (has_nonascii && enc != *encp) {
|
if (has_nonascii && enc != *encp) {
|
||||||
mixed_escape(beg, enc, *encp);
|
mixed_escape(beg, enc, *encp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user