diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-01 09:38:50 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-01 09:38:50 +0000 |
commit | 20486a7f64e0e35797c77ee19b3b05ad14d3d6cf (patch) | |
tree | d7ddf0f388f75f38c741a64e0313f33a04833708 /parse.y | |
parent | c6fb433c3f34172e438d17885cb688ca57ce3518 (diff) |
* parse.y (parser_yylex): removed an useless conditional, and magic
comment are ignored unless at the first of line.
* test/ruby/test_m17n.rb (test_magic_comment_vim): added.
* test/ruby/test_m17n.rb (test_magic_comment_at_variaous_positions):
added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -6076,12 +6076,11 @@ parser_yylex(struct parser_params *parser) goto retry; case '#': /* it's a comment */ - if (!parser->has_shebang || parser->line_count != 1) { - /* no magic_comment in shebang line */ + /* no magic_comment in shebang line */ + if (parser->line_count == (parser->has_shebang ? 2 : 1) + && (lex_p - lex_pbeg) == 1) { if (!parser_magic_comment(parser, lex_p, lex_pend - lex_p)) { - if (parser->line_count == (parser->has_shebang ? 2 : 1)) { - set_file_encoding(parser, lex_p, lex_pend); - } + set_file_encoding(parser, lex_p, lex_pend); } } lex_p = lex_pend; |