ruby-changes:5989
From: nobu <ko1@a...>
Date: Sat, 21 Jun 2008 15:57:46 +0900 (JST)
Subject: [ruby-changes:5989] Ruby:r17497 (ruby_1_8, trunk): * lib/rdoc/parsers/parse_rb.rb (RDoc#collect_first_comment): skip
nobu 2008-06-21 15:57:28 +0900 (Sat, 21 Jun 2008) New Revision: 17497 Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/lib/rdoc/parsers/parse_rb.rb trunk/ChangeLog trunk/lib/rdoc/parsers/parse_rb.rb Log: * lib/rdoc/parsers/parse_rb.rb (RDoc#collect_first_comment): skip magic comment. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/lib/rdoc/parsers/parse_rb.rb?r1=17497&r2=17496&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=17497&r2=17496&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rdoc/parsers/parse_rb.rb?r1=17497&r2=17496&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17497&r2=17496&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 17496) +++ ChangeLog (revision 17497) @@ -1,3 +1,8 @@ +Sat Jun 21 15:57:15 2008 Nobuyoshi Nakada <nobu@r...> + + * lib/rdoc/parsers/parse_rb.rb (RDoc#collect_first_comment): skip + magic comment. + Sat Jun 21 15:54:55 2008 Nobuyoshi Nakada <nobu@r...> * configure.in: check if fork works with pthread. Index: lib/rdoc/parsers/parse_rb.rb =================================================================== --- lib/rdoc/parsers/parse_rb.rb (revision 17496) +++ lib/rdoc/parsers/parse_rb.rb (revision 17497) @@ -1536,10 +1536,15 @@ tk = get_tk while tk.kind_of?(TkCOMMENT) - if first_line && tk.text[0,2] == "#!" + if first_line && /\A#!/ =~ tk.text skip_tkspace tk = get_tk + elsif first_line && /\A#\s*-\*-/ =~ tk.text + first_line = false + skip_tkspace + tk = get_tk else + first_line = false res << tk.text << "\n" tk = get_tk if tk.kind_of? TkNL @@ -1547,7 +1552,6 @@ tk = get_tk end end - first_line = false end unget_tk(tk) res Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 17496) +++ ruby_1_8/ChangeLog (revision 17497) @@ -1,3 +1,8 @@ +Sat Jun 21 15:57:15 2008 Nobuyoshi Nakada <nobu@r...> + + * lib/rdoc/parsers/parse_rb.rb (RDoc#collect_first_comment): skip + magic comment. + Fri Jun 20 18:16:01 2008 Nobuyoshi Nakada <nobu@r...> * string.c (rb_str_buf_append): should infect. Index: ruby_1_8/lib/rdoc/parsers/parse_rb.rb =================================================================== --- ruby_1_8/lib/rdoc/parsers/parse_rb.rb (revision 17496) +++ ruby_1_8/lib/rdoc/parsers/parse_rb.rb (revision 17497) @@ -1546,10 +1546,15 @@ tk = get_tk while tk.kind_of?(TkCOMMENT) - if first_line && tk.text[0,2] == "#!" + if first_line && /\A#!/ =~ tk.text skip_tkspace tk = get_tk + elsif first_line && /\A#\s*-\*-/ =~ tk.text + first_line = false + skip_tkspace + tk = get_tk else + first_line = false res << tk.text << "\n" tk = get_tk if tk.kind_of? TkNL @@ -1557,7 +1562,6 @@ tk = get_tk end end - first_line = false end unget_tk(tk) res -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/