Spec-Zone.ru › Homebrew

Class: Parser::Source::Comment

Inherits:
Object
  • Object
  • Parser::Source::Comment
show all
Defined in:
sorbet/rbi/parser@3.3.8.0.rbi

Overview

A comment in the source code.

source://parser//lib/parser/source/comment.rb#17

Defined Under Namespace

Classes: Associator

Class Method Summary collapse

  • .associate(ast, comments) ⇒ Hash<Parser::AST::Node, Array<Comment>> deprecated Deprecated.

    Use Comment.associate_locations.

  • .associate_by_identity(ast, comments) ⇒ Hash<Parser::Source::Node, Array<Comment>>

    Associate comments with ast nodes using identity.

  • .associate_locations(ast, comments) ⇒ Hash<Parser::Source::Map, Array<Comment>>

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

Instance Method Summary collapse

  • #document? ⇒ Boolean

    source://parser//lib/parser/source/comment.rb#109.

  • #initialize(range) ⇒ Comment constructor

    source://parser//lib/parser/source/comment.rb#67.

  • #inline? ⇒ Boolean

    source://parser//lib/parser/source/comment.rb#101.

  • #loc ⇒ Parser::Source::Range

    source://parser//lib/parser/source/comment.rb#20.

  • #location ⇒ Parser::Source::Range

    source://parser//lib/parser/source/comment.rb#20.

  • #text ⇒ String

    source://parser//lib/parser/source/comment.rb#18.

  • #type ⇒ Symbol

    Type of this comment.

Constructor Details

#initialize(range) ⇒ Comment

source://parser//lib/parser/source/comment.rb#67

Parameters:

  • range (Parser::Source::Range)


5365
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 5365

def initialize(range); end

Class Method Details

.associate(ast, comments) ⇒ Hash<Parser::AST::Node, Array<Comment>>

Deprecated.

Use associate_locations.

Associate comments with ast nodes by their corresponding node.

source://parser//lib/parser/source/comment.rb#32

Parameters:

  • ast (Parser::AST::Node)
  • comments (Array<Comment>)

Returns:

  • (Hash<Parser::AST::Node, Array<Comment>>)

See Also:

  • Parser::Source::Comment::Associator#associate


5444
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 5444

def associate(ast, comments); end

.associate_by_identity(ast, comments) ⇒ Hash<Parser::Source::Node, Array<Comment>>

Associate comments with ast nodes using identity.

source://parser//lib/parser/source/comment.rb#59

Parameters:

  • ast (Parser::AST::Node)
  • comments (Array<Comment>)

Returns:

  • (Hash<Parser::Source::Node, Array<Comment>>)

See Also:

  • Parser::Source::Comment::Associator#associate_by_identity


5455
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 5455

def associate_by_identity(ast, comments); end

.associate_locations(ast, comments) ⇒ Hash<Parser::Source::Map, Array<Comment>>

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

source://parser//lib/parser/source/comment.rb#46

Parameters:

  • ast (Parser::AST::Node)
  • comments (Array<Comment>)

Returns:

  • (Hash<Parser::Source::Map, Array<Comment>>)

See Also:

  • Parser::Source::Comment::Associator#associate_locations


5467
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 5467

def associate_locations(ast, comments); end

Instance Method Details

#document? ⇒ Boolean

source://parser//lib/parser/source/comment.rb#109

Returns:

  • (Boolean) —

    true if this is a block comment.

See Also:

  • #type


5382
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 5382

def document?; end

#inline? ⇒ Boolean

source://parser//lib/parser/source/comment.rb#101

Returns:

  • (Boolean) —

    true if this is an inline comment.

See Also:

  • #type


5389
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 5389

def inline?; end

#loc ⇒ Parser::Source::Range

source://parser//lib/parser/source/comment.rb#20

Returns:

  • (Parser::Source::Range)


5401
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 5401

def loc; end

#location ⇒ Parser::Source::Range

source://parser//lib/parser/source/comment.rb#20

Returns:

  • (Parser::Source::Range)


5407
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 5407

def location; end

#text ⇒ String

source://parser//lib/parser/source/comment.rb#18

Returns:

  • (String)


5413
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 5413

def text; end

#type ⇒ Symbol

Type of this comment.

* Inline comments correspond to `:inline`:

    # whatever

* Block comments correspond to `:document`:

    =begin
    hi i am a document
    =end

source://parser//lib/parser/source/comment.rb#89

Returns:

  • (Symbol)


5431
# File 'sorbet/rbi/parser@3.3.8.0.rbi', line 5431

def type; end

© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/Parser/Source/Comment.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API