Default

halotukozak.alpaca.LexerCtx.Default
See theDefault companion object
final case class Default(position: Column = ..., line: Line = ...) extends LexerCtx

The default lexer context, composed of the Column and Line tracking fragments.

This is the most commonly used context and provides useful information for error reporting. The text field is inherited from LexerCtx.

position and line are immutable vals of a subtype of Int: Tracking.materialize finds each fragment's given Tracking and threads a fresh copy of this case class through the lexer rather than mutating a field in place. Read them as plain Ints (ctx.line, ctx.position).

Value parameters

line

the current line number (1-based)

position

the current column position within the line (1-based)

Attributes

Companion
object
Source
lexer.scala
Graph
Supertypes
trait Serializable
trait LexerCtx
trait Selectable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Inherited methods

def applyDynamic(name: String)(args: Any*): Any

Structural fallback for the getter/setter refinement that ctx (see below) types itself with, so that ctx.field += 1 type-checks even when field is an immutable val. The lexer macro rewrites away every such structural access inside a rule before it is compiled, so in practice this is only a safety net; it should never be hit at runtime.

Structural fallback for the getter/setter refinement that ctx (see below) types itself with, so that ctx.field += 1 type-checks even when field is an immutable val. The lexer macro rewrites away every such structural access inside a rule before it is compiled, so in practice this is only a safety net; it should never be hit at runtime.

Attributes

Inherited from:
LexerCtx
Source
lexer.scala
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
Source
Product.scala
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
Source
Product.scala
final def remainingText: CharSequence

A read-only view of the text still remaining to be tokenized.

A read-only view of the text still remaining to be tokenized.

Exposed so a custom alpaca.internal.lexer.ErrorHandling instance can inspect the character(s) that failed to match any token rule, e.g. to build a diagnostic message such as unexpected '${ctx.remainingText.charAt(0)}'.

Attributes

Inherited from:
LexerCtx
Source
lexer.scala

Inherited fields

var lastRawMatched: String

The raw string that was matched for the last token.

The raw string that was matched for the last token.

Attributes

Note

Internal API — the lexer macro reads this field at user-site, so it has to be source-visible outside the alpaca package.

Inherited from:
LexerCtx
Source
lexer.scala