Range

data class Range(val start: Point, val end: Point, var source: Source? = null) : Comparable<Range> , Serializable

An area in a source file, from start to end. The start point is the point right before the starting character. The end point is the point right after the last character. An empty range will have coinciding points.

Consider a file with one line, containing text "HELLO". The Range of such text will be Range(Point(1, 0), Point(1, 5)).

Constructors

Link copied to clipboard
constructor(start: Point, end: Point, source: Source? = null, validate: Boolean = true)
constructor(start: Point, end: Point, source: Source? = null)

Functions

Link copied to clipboard
open operator override fun compareTo(other: Range): Int
Link copied to clipboard
fun contains(node: Node): Boolean

Tests whether the given node is contained in the interval represented by this object.

fun contains(point: Point): Boolean

Tests whether the given point is contained in the interval represented by this object.

fun contains(range: Range?): Boolean

Tests whether the given range is contained in the interval represented by this object.

Link copied to clipboard
Link copied to clipboard
fun length(code: String): Int

The length in characters of the text under this range in the provided source.

Link copied to clipboard
fun overlaps(range: Range?): Boolean

Tests whether the given range overlaps the interval represented by this object.

Link copied to clipboard
fun text(wholeText: String): String

Given the whole code extract the portion of text corresponding to this range

Link copied to clipboard
fun Range.toJson(): JsonElement
Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
val end: Point
Link copied to clipboard
Link copied to clipboard