module Prism
  class ParseResult < Result
    class Comments
      interface _Target
        def start_offset: () -> Integer
        def end_offset: () -> Integer
        def encloses?: (comment) -> bool
        def leading_comment: (comment) -> void
        def trailing_comment: (comment) -> void
      end

      class NodeTarget
        include _Target

        attr_reader node: node

        def initialize: (node) -> void
      end

      class LocationTarget
        include _Target

        attr_reader location: Location

        def initialize: (Location location) -> void
      end

      attr_reader parse_result: ParseResult

      def initialize: (ParseResult parse_result) -> void
      def attach!: () -> void

      private

      def nearest_targets: (node, comment) -> [_Target?, _Target, _Target?]
    end
  end
end
