* re.c (rb_reg_expr_str): need to escape if the coderage is invalid.

* error.c, include/ruby/intern.h (rb_compile_error_with_enc): new
	  function to raise syntax error, with source encoding'ed message.

	* parse.y (compile_error): use above function.
	  [ruby-core:33951] (#4217)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2010-12-28 09:43:49 +00:00
parent 8af7ed6036
commit 90d5bcf910
4 changed files with 33 additions and 7 deletions

View file

@ -308,6 +308,7 @@ static int parser_yyerror(struct parser_params*, const char*);
#define ruby__end__seen (parser->parser_ruby__end__seen)
#define ruby_sourceline (parser->parser_ruby_sourceline)
#define ruby_sourcefile (parser->parser_ruby_sourcefile)
#define current_enc (parser->enc)
#define yydebug (parser->parser_yydebug)
#ifdef RIPPER
#else
@ -586,8 +587,9 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...);
# define compile_error ripper_compile_error
# define PARSER_ARG parser,
#else
# define compile_error parser->nerr++,rb_compile_error
# define PARSER_ARG ruby_sourcefile, ruby_sourceline,
# define rb_compile_error rb_compile_error_with_enc
# define compile_error parser->nerr++,rb_compile_error_with_enc
# define PARSER_ARG ruby_sourcefile, ruby_sourceline, current_enc,
#endif
/* Older versions of Yacc set YYMAXDEPTH to a very low value by default (150,