method
collect_first_comment
v1_9_1_378 -
Show latest stable
- Class:
RDoc::Parser::Ruby
collect_first_comment()public
Look for the first comment in a file that isn’t a shebang line.
# File lib/rdoc/parser/ruby.rb, line 1488
def collect_first_comment
skip_tkspace
res = ''
first_line = true
tk = get_tk
while TkCOMMENT === tk
if first_line and tk.text =~ /\A#!/ then
skip_tkspace
tk = get_tk
elsif first_line and tk.text =~ /\A#\s*-\*-/ then
first_line = false
skip_tkspace
tk = get_tk
else
first_line = false
res << tk.text << "\n"
tk = get_tk
if TkNL === tk then
skip_tkspace false
tk = get_tk
end
end
end
unget_tk tk
res
end Related methods
- Instance methods
- add_token_listener
- collect_first_comment
- error
- extract_call_seq
- get_bool
- get_class_or_module
- get_class_specification
- get_constant
- get_constant_with_optional_parens
- get_symbol_or_name
- get_tk
- get_tkread
- look_for_directives_in
- make_message
- parse_alias
- parse_attr
- parse_attr_accessor
- parse_call_parameters
- parse_class
- parse_comment
- parse_constant
- parse_include
- parse_meta_method
- parse_method
- parse_method_or_yield_parameters
- parse_method_parameters
- parse_module
- parse_require
- parse_statements
- parse_symbol_arg
- parse_symbol_in_arg
- parse_toplevel_statements
- parse_visibility
- parse_yield
- parse_yield_parameters
- peek_read
- peek_tk
- read_directive
- read_documentation_modifiers
- remove_private_comments
- remove_token_listener
- reset
- scan
- skip_for_variable
- skip_method
- skip_optional_do_after_expression
- skip_tkspace
- skip_tkspace_comment
- unget_tk
- warn
- Class methods
- new