SourceRange
public struct SourceRange : Hashable, Sendable
extension SourceRange: Codable
extension SourceRange: CustomStringConvertible
A half-open range of textual positions in a source file.
-
The file containing the source text.
Declaration
Swift
public let file: SourceFile -
The region of text in
file‘s contents.Declaration
Swift
public let regionOfFile: Range<SourceFile.Index> -
The start of the region of text.
Declaration
Swift
public var startIndex: SourceFile.Index { get } -
The end index of the range.
Declaration
Swift
public var endIndex: SourceFile.Index { get } -
Creates an instance with the given properties.
Declaration
Swift
public init(_ regionOfFile: Range<SourceFile.Index>, in file: SourceFile) -
Returns whether
selfcontains the given location.Declaration
Swift
public func contains(_ l: SourcePosition) -> Bool -
The start.
Declaration
Swift
public var start: SourcePosition { get } -
The end.
Declaration
Swift
public var end: SourcePosition { get } -
Returns a copy of
selfwith the end increased (if necessary) tonewEnd.Declaration
Swift
public func extended(upTo newEnd: SourceFile.Index) -> SourceRange -
Returns a copy of
selfextended to coverother.Declaration
Swift
public func extended(toCover other: SourceRange) -> SourceRange -
Increases (if necessary) the end of
selfso that it equalsnewEnd.Declaration
Swift
public mutating func extend(upTo newEnd: SourceFile.Index) -
Returns a copy of
selfextended to coverother.Declaration
Swift
public mutating func extend(toCover other: SourceRange) -
The source text contained in this range.
Declaration
Swift
public var text: Substring { get } -
Creates an empty range that starts and end at
p.Declaration
Swift
public static func empty(at p: SourcePosition) -> SourceRange -
Undocumented
See moreDeclaration
Swift
fileprivate enum CodingKeys : String, CodingKey -
Declaration
Swift
public init(from decoder: Decoder) throws -
Declaration
Swift
public func encode(to encoder: Encoder) throws -
A textual representation per the Gnu-standard.
Declaration
Swift
public var gnuStandardText: String { get } -
Declaration
Swift
public var description: String { get }
View on GitHub