Class Parser::Source::Comment
In: lib/parser/source/comment.rb
Parent: Object

A comment in the source code.

@!attribute [r] text

 @return [String]

@!attribute [r] location

 @return [Parser::Source::Map]

@api public

Methods

==   associate   associate_locations   document?   inline?   inspect   new   type  

Classes and Modules

Class Parser::Source::Comment::Associator

External Aliases

location -> loc

Attributes

location  [R] 
text  [R] 

Public Class methods

Associate `comments` with `ast` nodes by their corresponding node.

@param [Parser::AST::Node] ast @param [Array(Comment)] comments @return [Hash(Parser::AST::Node, Array(Comment))] @see Parser::Source::Comment::Associator#associate @deprecated Use {associate_locations}.

Associate `comments` with `ast` nodes by their location in the source.

@param [Parser::AST::Node] ast @param [Array(Comment)] comments @return [Hash(Parser::Source::Map, Array(Comment))] @see Parser::Source::Comment::Associator#associate_locations

Public Instance methods

Compares comments. Two comments are equal if they correspond to the same source range.

@param [Object] other @return [Boolean]

@see type @return [Boolean] true if this is a block comment.

@see type @return [Boolean] true if this is an inline comment.

@return [String] a human-readable representation of this comment

Type of this comment.

  * Inline comments correspond to `:inline`:

        # whatever

  * Block comments correspond to `:document`:

        =begin
        hi i am a document
        =end

@return [Symbol]

[Validate]