method
parse_constant
v1_9_1_378 -
Show latest stable
- Class:
RDoc::Parser::Ruby
parse_constant(container, single, tk, comment)public
No documentation available.
# File lib/rdoc/parser/ruby.rb, line 1923
def parse_constant(container, single, tk, comment)
name = tk.name
skip_tkspace(false)
eq_tk = get_tk
unless TkASSIGN === eq_tk then
unget_tk(eq_tk)
return
end
nest = 0
get_tkread
tk = get_tk
if TkGT === tk then
unget_tk(tk)
unget_tk(eq_tk)
return
end
loop do
case tk
when TkSEMICOLON
break
when TkLPAREN, TkfLPAREN, TkLBRACE, TkLBRACK, TkDO
nest += 1
when TkRPAREN, TkRBRACE, TkRBRACK, TkEND
nest -= 1
when TkCOMMENT
if nest <= 0 && @scanner.lex_state == EXPR_END
unget_tk(tk)
break
end
when TkNL
if (nest <= 0) && ((@scanner.lex_state == EXPR_END) || ([email protected]))
unget_tk(tk)
break
end
end
tk = get_tk
end
res = get_tkread.tr("\n", " ").strip
res = "" if res == ";"
con = RDoc::Constant.new name, res, comment
read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS
if con.document_self
container.add_constant(con)
end
end