method
parse_constant_body
v2_2_9 -
Show latest stable
- Class:
RDoc::Parser::Ruby
parse_constant_body(container, constant)public
No documentation available.
# File lib/rdoc/parser/ruby.rb, line 899
def parse_constant_body container, constant # :nodoc:
nest = 0
rhs_name = ''
get_tkread
tk = get_tk
loop do
case tk
when TkSEMICOLON then
break if nest <= 0
when TkLPAREN, TkfLPAREN, TkLBRACE, TkfLBRACE, TkLBRACK, TkfLBRACK,
TkDO, TkIF, TkUNLESS, TkCASE, TkDEF, TkBEGIN then
nest += 1
when TkRPAREN, TkRBRACE, TkRBRACK, TkEND then
nest -= 1
when TkCOMMENT then
if nest <= 0 and stop_at_EXPR_END then
unget_tk tk
break
else
unget_tk tk
read_documentation_modifiers constant, RDoc::CONSTANT_MODIFIERS
end
when TkCONSTANT then
rhs_name << tk.name
if nest <= 0 and TkNL === peek_tk then
create_module_alias container, constant, rhs_name
break
end
when TkNL then
if nest <= 0 and stop_at_EXPR_END then
unget_tk tk
break
end
when TkCOLON2, TkCOLON3 then
rhs_name << '::'
when nil then
break
end
tk = get_tk
end
get_tkread_clean(/^[ \t]+/, '')
end