@@ -1795,67 +1795,64 @@ def parse_statements(container, single = NORMAL, current_method = nil,
1795
1795
non_comment_seen = true unless ( :on_comment == tk [ :kind ] or :on_embdoc == tk [ :kind ] )
1796
1796
1797
1797
case tk [ :kind ]
1798
- when :on_nl , :on_ignored_nl , :on_comment , :on_embdoc then
1799
- if :on_nl == tk [ :kind ] or :on_ignored_nl == tk [ :kind ]
1800
- skip_tkspace
1801
- tk = get_tk
1802
- else
1803
- past_tokens = @read . size > 1 ? @read [ 0 ..-2 ] : [ ]
1804
- nl_position = 0
1805
- past_tokens . reverse . each_with_index do |read_tk , i |
1806
- if read_tk =~ /^\n $/ then
1807
- nl_position = ( past_tokens . size - 1 ) - i
1808
- break
1809
- elsif read_tk =~ /^#.*\n $/ then
1810
- nl_position = ( ( past_tokens . size - 1 ) - i ) + 1
1811
- break
1812
- end
1813
- end
1814
- comment_only_line = past_tokens [ nl_position ..-1 ] . all? { |c | c =~ /^\s +$/ }
1815
- unless comment_only_line then
1816
- tk = get_tk
1798
+ when :on_nl , :on_ignored_nl then
1799
+ skip_tkspace
1800
+
1801
+ keep_comment = true
1802
+ container . current_line_visibility = nil
1803
+
1804
+ when :on_comment , :on_embdoc then
1805
+ past_tokens = @read . size > 1 ? @read [ 0 ..-2 ] : [ ]
1806
+ nl_position = 0
1807
+ past_tokens . reverse . each_with_index do |read_tk , i |
1808
+ if read_tk =~ /^\n $/ then
1809
+ nl_position = ( past_tokens . size - 1 ) - i
1810
+ break
1811
+ elsif read_tk =~ /^#.*\n $/ then
1812
+ nl_position = ( ( past_tokens . size - 1 ) - i ) + 1
1813
+ break
1817
1814
end
1818
1815
end
1816
+ comment_only_line = past_tokens [ nl_position ..-1 ] . all? { |c | c =~ /^\s +$/ }
1817
+ unless comment_only_line then
1818
+ tk = get_tk
1819
+ end
1819
1820
1820
- if tk and ( :on_comment == tk [ :kind ] or :on_embdoc == tk [ :kind ] ) then
1821
- if non_comment_seen then
1822
- # Look for RDoc in a comment about to be thrown away
1823
- non_comment_seen = parse_comment container , tk , comment unless
1824
- comment . empty?
1821
+ if non_comment_seen then
1822
+ # Look for RDoc in a comment about to be thrown away
1823
+ non_comment_seen = parse_comment container , tk , comment unless
1824
+ comment . empty?
1825
1825
1826
- comment = ''
1827
- comment = RDoc ::Encoding . change_encoding comment , @encoding if @encoding
1828
- end
1826
+ comment = ''
1827
+ comment = RDoc ::Encoding . change_encoding comment , @encoding if @encoding
1828
+ end
1829
+
1830
+ line_no = nil
1831
+ while tk and ( :on_comment == tk [ :kind ] or :on_embdoc == tk [ :kind ] ) do
1832
+ comment_body = retrieve_comment_body ( tk )
1833
+ line_no = tk [ :line_no ] if comment . empty?
1834
+ comment += comment_body
1835
+ comment << "\n " unless comment_body =~ /\n \z /
1829
1836
1830
- line_no = nil
1831
- while tk and ( :on_comment == tk [ :kind ] or :on_embdoc == tk [ :kind ] ) do
1832
- comment_body = retrieve_comment_body ( tk )
1833
- line_no = tk [ :line_no ] if comment . empty?
1834
- comment += comment_body
1835
- comment << "\n " unless comment_body =~ /\n \z /
1836
-
1837
- if comment_body . size > 1 && comment_body =~ /\n \z / then
1838
- skip_tkspace_without_nl # leading spaces
1839
- end
1840
- tk = get_tk
1837
+ if comment_body . size > 1 && comment_body =~ /\n \z / then
1838
+ skip_tkspace_without_nl # leading spaces
1841
1839
end
1840
+ tk = get_tk
1841
+ end
1842
1842
1843
- comment = new_comment comment , line_no
1843
+ comment = new_comment comment , line_no
1844
1844
1845
- unless comment . empty? then
1846
- look_for_directives_in container , comment
1845
+ unless comment . empty? then
1846
+ look_for_directives_in container , comment
1847
1847
1848
- if container . done_documenting then
1849
- throw :eof if RDoc ::TopLevel === container
1850
- container . ongoing_visibility = save_visibility
1851
- end
1848
+ if container . done_documenting then
1849
+ throw :eof if RDoc ::TopLevel === container
1850
+ container . ongoing_visibility = save_visibility
1852
1851
end
1853
-
1854
- keep_comment = true
1855
- else
1856
- non_comment_seen = true
1857
1852
end
1858
1853
1854
+ keep_comment = true
1855
+
1859
1856
unget_tk tk
1860
1857
keep_comment = true
1861
1858
container . current_line_visibility = nil
0 commit comments