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 | c6a6e54f8f6240a6ed10610dff3f20181603c6b8 (patch) | |
| tree | d7ddf0f388f75f38c741a64e0313f33a04833708 /parse.y | |
| parent | 18950f4523271de3e2576252bb013cb1c835142f (diff) | |
| download | ruby-c6a6e54f8f6240a6ed10610dff3f20181603c6b8.tar.gz ruby-c6a6e54f8f6240a6ed10610dff3f20181603c6b8.tar.xz ruby-c6a6e54f8f6240a6ed10610dff3f20181603c6b8.zip | |
* 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: http://svn.ruby-lang.org/repos/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; |
