# File lib/rdoc/parser/ruby.rb, line 1255def parse_statements(container,single=NORMAL,current_method=nil,comment='')comment.force_encoding@encodingif@encodingnest=1save_visibility=container.visibilitynon_comment_seen=truewhiletk=get_tkdokeep_comment=falsetry_parse_comment=falsenon_comment_seen=trueunlessTkCOMMENT===tkcasetkwhenTkNLthenskip_tkspacetk=get_tkifTkCOMMENT===tkthenifnon_comment_seenthen# Look for RDoc in a comment about to be thrown awaynon_comment_seen=parse_commentcontainer,tk,commentunlesscomment.empty?comment=''comment.force_encoding@encodingif@encodingendwhileTkCOMMENT===tkdocomment<<tk.text<<"\n"tk=get_tkifTkNL===tkthenskip_tkspacefalse# leading spacestk=get_tkendendunlesscomment.empty?thenlook_for_directives_incontainer,commentifcontainer.done_documentingthencontainer.ongoing_visibility=save_visibilityendendkeep_comment=trueelsenon_comment_seen=trueendunget_tktk# TODO peek instead of get then ungetkeep_comment=truewhenTkCLASSthenparse_classcontainer,single,tk,commentwhenTkMODULEthenifcontainer.document_childrenthenparse_modulecontainer,single,tk,commentelsenest+=1endwhenTkDEFthenparse_methodcontainer,single,tk,commentwhenTkCONSTANTthenunlessparse_constantcontainer,tk,commentthentry_parse_comment=trueendwhenTkALIASthenparse_aliascontainer,single,tk,commentunlesscurrent_methodwhenTkYIELDthenifcurrent_method.nil?thenwarn"Warning: yield outside of method"ifcontainer.document_selfelseparse_yieldcontainer,single,tk,current_methodend# Until and While can have a 'do', which shouldn't increase the nesting.# We can't solve the general case, but we can handle most occurrences by# ignoring a do at the end of a line.whenTkUNTIL,TkWHILEthennest+=1skip_optional_do_after_expression# 'for' is trickierwhenTkFORthennest+=1skip_for_variableskip_optional_do_after_expressionwhenTkCASE,TkDO,TkIF,TkUNLESS,TkBEGINthennest+=1whenTkIDENTIFIERthenifnest==1andcurrent_method.nil?thencasetk.namewhen'private','protected','public','private_class_method','public_class_method','module_function'thenparse_visibilitycontainer,single,tkkeep_comment=truewhen'attr'thenparse_attrcontainer,single,tk,commentwhen/^attr_(reader|writer|accessor)$/thenparse_attr_accessorcontainer,single,tk,commentwhen'alias_method'thenparse_aliascontainer,single,tk,commentwhen'require','include'then# ignoreelseifcomment=~/\A#\#$/thencasecommentwhen/^# +:?attr(_reader|_writer|_accessor)?:/thenparse_meta_attrcontainer,single,tk,commentelseparse_meta_methodcontainer,single,tk,commentendendendendcasetk.namewhen"require"thenparse_requirecontainer,commentwhen"include"thenparse_includecontainer,commentendwhenTkENDthennest-=1ifnest==0thenread_documentation_modifierscontainer,RDoc::CLASS_MODIFIERScontainer.ongoing_visibility=save_visibilityparse_commentcontainer,tk,commentunlesscomment.empty?returnendelsetry_parse_comment=nest==1endiftry_parse_commentthennon_comment_seen=parse_commentcontainer,tk,commentunlesscomment.empty?keep_comment=falseendunlesskeep_commentthencomment=''comment.force_encoding@encodingif@encodingendbeginget_tkreadskip_tkspacefalseendwhilepeek_tk==TkNLendend