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_constant(container, tk, comment, ignore_constants = false)public
Parses a constant in context with comment. If ignore_constants is true, no found constants will be added to RDoc.
# File lib/rdoc/parser/ruby.rb, line 848
def parse_constant container, tk, comment, ignore_constants = false
offset = tk.seek
line_no = tk.line_no
name = tk.name
skip_tkspace false
return unless name =~ /^\w+$/
eq_tk = get_tk
if TkCOLON2 === eq_tk then
unget_tk eq_tk
unget_tk tk
container, name_t, = get_class_or_module container, ignore_constants
name = name_t.name
eq_tk = get_tk
end
unless TkASSIGN === eq_tk then
unget_tk eq_tk
return false
end
if TkGT === peek_tk then
unget_tk eq_tk
return
end
value = ''
con = RDoc::Constant.new name, value, comment
body = parse_constant_body container, con
return unless body
value.replace body
record_location con
con.offset = offset
con.line = line_no
read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS
@stats.add_constant con
container.add_constant con
true
end Related methods
- Instance methods
- collect_first_comment
- consume_trailing_spaces
- create_attr
- create_module_alias
- error
- get_bool
- get_class_or_module
- get_class_specification
- get_constant
- get_constant_with_optional_parens
- get_end_token
- get_method_container
- get_symbol_or_name
- get_tkread_clean
- get_visibility_information
- look_for_directives_in
- make_message
- new_comment
- parse_alias
- parse_attr
- parse_attr_accessor
- parse_call_parameters
- parse_class
- parse_class_regular
- parse_class_singleton
- parse_comment
- parse_comment_attr
- parse_comment_ghost
- parse_comment_tomdoc
- parse_constant
- parse_constant_body
- parse_extend_or_include
- parse_identifier
- parse_meta_attr
- parse_meta_method
- parse_meta_method_name
- parse_meta_method_params
- parse_method
- parse_method_dummy
- parse_method_name
- parse_method_name_regular
- parse_method_name_singleton
- parse_method_or_yield_parameters
- parse_method_parameters
- parse_method_params_and_body
- parse_module
- parse_require
- parse_rescue
- parse_statements
- parse_symbol_arg
- parse_symbol_arg_paren
- parse_symbol_arg_space
- parse_symbol_in_arg
- parse_top_level_statements
- parse_visibility
- parse_yield
- read_directive
- read_documentation_modifiers
- record_location
- remove_private_comments
- scan
- skip_for_variable
- skip_method
- skip_optional_do_after_expression
- skip_tkspace_comment
- stop_at_EXPR_END
- suppress_parents
- update_visibility
- warn
- Class methods
- new