method
parse_statements

Ruby latest stable (v2_5_5)
-
0 notes -
Class: Ruby
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (38)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
Related methods
- Class methods (1)
-
new (<= v2_2_9)
- Instance methods (82)
-
add_token_listener (<= v1_9_1_378)
-
collect_first_comment (<= v2_2_9)
-
consume_trailing_spaces (<= v2_2_9)
-
create_attr (<= v2_2_9)
-
create_module_alias (<= v2_2_9)
-
error (<= v2_2_9)
-
extract_call_seq (<= v1_9_3_392)
-
get_bool (<= v2_2_9)
-
get_class_or_module (<= v2_2_9)
-
get_class_specification (<= v2_2_9)
-
get_constant (<= v2_2_9)
-
get_constant_with_optional_... (<= v2_2_9)
-
get_end_token (<= v2_2_9)
-
get_method_container (<= v2_2_9)
-
get_symbol_or_name (<= v2_2_9)
-
get_tk (<= v1_9_1_378)
-
get_tkread (<= v1_9_1_378)
-
get_tkread_clean (<= v2_2_9)
-
get_visibility_information (<= v2_2_9)
-
look_for_directives_in (<= v2_2_9)
-
make_message (<= v2_2_9)
-
new_comment (<= v2_2_9)
-
parse_alias (<= v2_2_9)
-
parse_attr (<= v2_2_9)
-
parse_attr_accessor (<= v2_2_9)
-
parse_call_parameters (<= v2_2_9)
-
parse_class (<= v2_2_9)
-
parse_class_regular (<= v2_2_9)
-
parse_class_singleton (<= v2_2_9)
-
parse_comment (<= v2_2_9)
-
parse_comment_attr (<= v2_2_9)
-
parse_comment_ghost (<= v2_2_9)
-
parse_comment_tomdoc (<= v2_2_9)
-
parse_constant (<= v2_2_9)
-
parse_constant_body (<= v2_2_9)
-
parse_extend_or_include (<= v2_2_9)
-
parse_identifier (<= v2_2_9)
-
parse_include (<= v1_9_3_392)
-
parse_meta_attr (<= v2_2_9)
-
parse_meta_method (<= v2_2_9)
-
parse_meta_method_name (<= v2_2_9)
-
parse_meta_method_params (<= v2_2_9)
-
parse_method (<= v2_2_9)
-
parse_method_dummy (<= v2_2_9)
-
parse_method_name (<= v2_2_9)
-
parse_method_name_regular (<= v2_2_9)
-
parse_method_name_singleton (<= v2_2_9)
-
parse_method_or_yield_param... (<= v2_2_9)
-
parse_method_parameters (<= v2_2_9)
-
parse_method_params_and_body (<= v2_2_9)
-
parse_module (<= v2_2_9)
-
parse_require (<= v2_2_9)
-
parse_rescue (<= v2_2_9)
-
parse_statements (<= v2_2_9)
-
parse_symbol_arg (<= v2_2_9)
-
parse_symbol_arg_paren (<= v2_2_9)
-
parse_symbol_arg_space (<= v2_2_9)
-
parse_symbol_in_arg (<= v2_2_9)
-
parse_top_level_statements (<= v2_2_9)
-
parse_toplevel_statements (<= v1_9_1_378)
-
parse_visibility (<= v2_2_9)
-
parse_yield (<= v2_2_9)
-
parse_yield_parameters (<= v1_9_1_378)
-
peek_read (<= v1_9_1_378)
-
peek_tk (<= v1_9_1_378)
-
read_directive (<= v2_2_9)
-
read_documentation_modifiers (<= v2_2_9)
-
record_location (<= v2_2_9)
-
remove_private_comments (<= v2_2_9)
-
remove_token_listener (<= v1_9_1_378)
-
reset (<= v1_9_1_378)
-
scan (<= v2_2_9)
-
skip_for_variable (<= v2_2_9)
-
skip_method (<= v2_2_9)
-
skip_optional_do_after_expr... (<= v2_2_9)
-
skip_tkspace (<= v1_9_1_378)
-
skip_tkspace_comment (<= v2_2_9)
-
stop_at_EXPR_END (<= v2_2_9)
-
suppress_parents (<= v2_2_9)
-
unget_tk (<= v1_9_1_378)
-
update_visibility (<= v2_2_9)
-
warn (<= v2_2_9)
= private
= protected
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v2_2_9) is shown here.
parse_statements(container, single = NORMAL, current_method = nil, comment = new_comment(''))
public
The core of the Ruby parser.
Show source
# File lib/rdoc/parser/ruby.rb, line 1610 def parse_statements(container, single = NORMAL, current_method = nil, comment = new_comment('')) raise 'no' unless RDoc::Comment === comment comment.force_encoding @encoding if @encoding nest = 1 save_visibility = container.visibility non_comment_seen = true while tk = get_tk do keep_comment = false try_parse_comment = false non_comment_seen = true unless TkCOMMENT === tk case tk when TkNL then skip_tkspace tk = get_tk if TkCOMMENT === tk then if non_comment_seen then # Look for RDoc in a comment about to be thrown away non_comment_seen = parse_comment container, tk, comment unless comment.empty? comment = '' comment.force_encoding @encoding if @encoding end while TkCOMMENT === tk do comment << tk.text << "\n" tk = get_tk if TkNL === tk then skip_tkspace false # leading spaces tk = get_tk end end comment = new_comment comment unless comment.empty? then look_for_directives_in container, comment if container.done_documenting then throw :eof if RDoc::TopLevel === container container.ongoing_visibility = save_visibility end end keep_comment = true else non_comment_seen = true end unget_tk tk keep_comment = true when TkCLASS then parse_class container, single, tk, comment when TkMODULE then parse_module container, single, tk, comment when TkDEF then parse_method container, single, tk, comment when TkCONSTANT then unless parse_constant container, tk, comment, current_method then try_parse_comment = true end when TkALIAS then parse_alias container, single, tk, comment unless current_method when TkYIELD then if current_method.nil? then warn "Warning: yield outside of method" if container.document_self else parse_yield container, single, tk, current_method end # 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. when TkUNTIL, TkWHILE then nest += 1 skip_optional_do_after_expression # 'for' is trickier when TkFOR then nest += 1 skip_for_variable skip_optional_do_after_expression when TkCASE, TkDO, TkIF, TkUNLESS, TkBEGIN then nest += 1 when TkSUPER then current_method.calls_super = true if current_method when TkRESCUE then parse_rescue when TkIDENTIFIER then if nest == 1 and current_method.nil? then keep_comment = parse_identifier container, single, tk, comment end case tk.name when "require" then parse_require container, comment when "include" then parse_extend_or_include RDoc::Include, container, comment when "extend" then parse_extend_or_include RDoc::Extend, container, comment end when TkEND then nest -= 1 if nest == 0 then read_documentation_modifiers container, RDoc::CLASS_MODIFIERS container.ongoing_visibility = save_visibility parse_comment container, tk, comment unless comment.empty? return end else try_parse_comment = nest == 1 end if try_parse_comment then non_comment_seen = parse_comment container, tk, comment unless comment.empty? keep_comment = false end unless keep_comment then comment = new_comment '' comment.force_encoding @encoding if @encoding container.params = nil container.block_params = nil end consume_trailing_spaces end container.params = nil container.block_params = nil end