зеркало из https://github.com/github/ruby.git
* parse.y (parser_initialize): explicitly call rb_ascii8bit_encoding().
* parse.y (parser_prepare): lex_input may not be have encoding (e.g. IO). * parse.y (rb_parser_compile_string): set encoding from input string. * encoding.c (rb_enc_find_index): use ASCII-8BIT if loading known encoding failed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
f7929ed206
Коммит
231ab57f6f
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Fri Jan 18 09:22:07 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* parse.y (parser_initialize): explicitly call rb_ascii8bit_encoding().
|
||||
|
||||
* parse.y (parser_prepare): lex_input may not be have encoding (e.g. IO).
|
||||
|
||||
* parse.y (rb_parser_compile_string): set encoding from input string.
|
||||
|
||||
* encoding.c (rb_enc_find_index): use ASCII-8BIT if loading known
|
||||
encoding failed.
|
||||
|
||||
Fri Jan 18 07:06:25 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* io.c (Init_IO): stdin/stdout may not be duplex.
|
||||
|
|
|
@ -498,6 +498,12 @@ rb_enc_find_index(const char *name)
|
|||
}
|
||||
else {
|
||||
i = load_encoding(name);
|
||||
enc = rb_enc_from_index(i);
|
||||
if (!enc->precise_mbc_enc_len) {
|
||||
rb_warn("failed to load encoding (%s); use ASCII-8BIT instead",
|
||||
name);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
|
|
4
parse.y
4
parse.y
|
@ -4764,6 +4764,7 @@ rb_parser_compile_string(volatile VALUE vparser, const char *f, VALUE s, int lin
|
|||
lex_gets = lex_get_str;
|
||||
lex_gets_ptr = 0;
|
||||
lex_input = s;
|
||||
parser->enc = rb_enc_get(s);
|
||||
lex_pbeg = lex_p = lex_pend = 0;
|
||||
compile_for_eval = rb_parse_in_eval();
|
||||
|
||||
|
@ -5956,7 +5957,6 @@ parser_prepare(struct parser_params *parser)
|
|||
return;
|
||||
}
|
||||
pushback(c);
|
||||
parser->enc = rb_enc_get(lex_input);
|
||||
}
|
||||
|
||||
#define IS_ARG() (lex_state == EXPR_ARG || lex_state == EXPR_CMDARG)
|
||||
|
@ -9192,7 +9192,7 @@ parser_initialize(struct parser_params *parser)
|
|||
#ifdef YYMALLOC
|
||||
parser->heap = NULL;
|
||||
#endif
|
||||
parser->enc = rb_enc_from_index(0);
|
||||
parser->enc = rb_ascii8bit_encoding();
|
||||
}
|
||||
|
||||
extern void rb_mark_source_filename(char *);
|
||||
|
|
Загрузка…
Ссылка в новой задаче