KbSourceLocation

class KbSourceLocation(val line: Int, val column: Int, val sourceText: String, val templateStack: List<KbTemplateOrigin> = listOf(KbTemplateOrigin.Root))(source)

The position of a failing expression within the template source.

Constructors

Link copied to clipboard
constructor(line: Int, column: Int, sourceText: String, templateStack: List<KbTemplateOrigin> = listOf(KbTemplateOrigin.Root))

Properties

Link copied to clipboard
val column: Int

the 0-based position within line of the start of the expression, counted in Unicode code points rather than UTF-16 code units (Kotlin's native String/Char indexing). A character outside the Basic Multilingual Plane (for example, an emoji) is one code point — and therefore one unit of column — even though it occupies two UTF-16 Chars in the underlying Kotlin String. This follows from the ANTLR Kotlin runtime's StringCharStream, which indexes by decoded code point, not by raw Char.

Link copied to clipboard
val line: Int

the 1-based line number of the start of the expression.

Link copied to clipboard

the verbatim slice of template source for the expression (for example, "price | divided_by: qty").

Link copied to clipboard

the chain of templates that led to this location, outermost first. The first element is always KbTemplateOrigin.Root; each subsequent element is a KbTemplateOrigin.Partial whose key identifies the partial entered next. A location captured entirely within the root template has a single-element stack [Root]. The stack is stamped at render time when a failure is reported; parse-time construction always starts with [Root].