module Steep class Source extend NodeHelper attr_reader buffer: RBS::Buffer attr_reader path: Pathname attr_reader node: Parser::AST::Node? attr_reader mapping: Hash[Parser::AST::Node, Array[AST::Annotation::t]] attr_reader comments: Array[Parser::Source::Comment] attr_reader ignores: Array[AST::Ignore::t] def initialize: ( buffer: RBS::Buffer, path: Pathname, node: Parser::AST::Node?, mapping: Hash[Parser::AST::Node, Array[AST::Annotation::t]], comments: Array[Parser::Source::Comment], ignores: Array[AST::Ignore::t] ) -> void class Builder < ::Parser::Builders::Default def string_value: (untyped token) -> untyped end def self.new_parser: () -> Parser::Ruby33 def self.parse: (String source_code, path: Pathname, factory: AST::Types::Factory) -> Source def self.construct_mapping: ( node: Parser::AST::Node, annotations: Array[AST::Annotation::t], mapping: Hash[Parser::AST::Node, Array[AST::Annotation::t]], ?line_range: Range[Integer]? ) -> void def self.map_child_node: (Parser::AST::Node node, ?Symbol? type, ?skip: Set[Parser::AST::Node]?) { (Parser::AST::Node) -> Parser::AST::Node } -> Parser::AST::Node def annotations: (block: Parser::AST::Node, factory: AST::Types::Factory, context: RBS::Resolver::context) -> AST::Annotation::Collection def each_annotation: () { ([Parser::AST::Node, Array[AST::Annotation::t]]) -> void } -> void | () -> Enumerator[[Parser::AST::Node, Array[AST::Annotation::t]], void] # Yields all heredoc node and its parents under `node` (or `self.node`) # # Yields arrays, inner node first, outer node last -- `[heredoc_node, *outer_node, node]`. # def each_heredoc_node: (?Parser::AST::Node? node, ?Array[Parser::AST::Node] parents) { ([Array[Parser::AST::Node], Parser::Source::Map & Parser::AST::_Heredoc]) -> void } -> void | (?Parser::AST::Node? node, ?Array[Parser::AST::Node] parents) -> Enumerator[[Array[Parser::AST::Node], Parser::Source::Map & Parser::AST::_Heredoc], void] # Returns array of nodes that is located inside heredoc # # ```ruby # content = < Array[Parser::AST::Node]? # Returns a node and it's outer nodes # def find_nodes_loc: (Parser::AST::Node node, Integer position, Array[Parser::AST::Node] parents) -> Array[Parser::AST::Node]? # Returns a node and it's outer nodes def find_nodes: (line: Integer, column: Integer) -> ::Array[Parser::AST::Node]? # Returns comment at the given position # # Note that a cursor position that is at the beginning of a comment returns `nil`. # # ```ruby # .#. .H.e.l.l.o. # ^ => Returns nil # ^ => Returns the comment # ^ => Returns the comment # ``` # def find_comment: (line: Integer, column: Integer) -> Parser::Source::Comment? def self.delete_defs: (Parser::AST::Node node, Set[Parser::AST::Node] allow_list) -> Parser::AST::Node def without_unrelated_defs: (line: Integer, column: Integer) -> Source type type_comment = AST::Node::TypeAssertion | AST::Node::TypeApplication def self.insert_type_node: (Parser::AST::Node node, Hash[Integer, type_comment]) -> Parser::AST::Node def self.adjust_location: (Parser::AST::Node) -> Parser::AST::Node def self.assertion_node: (Parser::AST::Node, AST::Node::TypeAssertion) -> Parser::AST::Node def self.type_application_node: (Parser::AST::Node, AST::Node::TypeApplication) -> Parser::AST::Node # Returns a line of `selector` of `send` node, that can be used to look up a TypeApplication comment # def self.sendish_node?: (Parser::AST::Node) -> Integer? end end