LexerCtx

halotukozak.alpaca.LexerCtx
See theLexerCtx companion object
trait LexerCtx extends Product, Selectable

Trait for the global context used during tokenization.

The global context maintains state during lexing, including the current position in the input, the last matched token, and the remaining text to process. Users can extend this trait to add custom state tracking.

Attributes

Companion
object
Experimental
true
Source
lexer.scala
Graph
Supertypes
trait Selectable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class Default
class Empty

Members list

Value members

Concrete 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

Source
lexer.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

Source
lexer.scala

Inherited methods

def productElementName(n: Int): String

The name of the n^th^ element of this product, 0-based. In the default implementation, an empty string.

The name of the n^th^ element of this product, 0-based. In the default implementation, an empty string.

Value parameters

n

the index of the element name to return

Attributes

Returns

the name of the specified element

Throws
IndexOutOfBoundsException

if the n is out of range(n < 0 || n >= productArity).

Inherited from:
Product
Source
Product.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
def productPrefix: String

A string used in the toString methods of derived classes. Implementations may override this method to prepend a string prefix to the result of toString methods.

A string used in the toString methods of derived classes. Implementations may override this method to prepend a string prefix to the result of toString methods.

Attributes

Returns

in the default implementation, the empty string

Inherited from:
Product
Source
Product.scala

Inherited and Abstract methods

def canEqual(that: Any): Boolean

Checks whether this instance can possibly equal that.

Checks whether this instance can possibly equal that.

A method that should be called from every well-designed equals method that is open to be overridden in a subclass. See Programming in Scala, Chapter 28 for discussion and design.

Value parameters

that

the value being probed for possible equality

Attributes

Returns

true if this instance can possibly equal that, otherwise false

Inherited from:
Equals
Source
Equals.scala
def productArity: Int

The size of this product.

The size of this product.

Attributes

Returns

for a product A(x,,1,,, ..., x,,k,,), returns k

Inherited from:
Product
Source
Product.scala
def productElement(n: Int): Any

The n^th^ element of this product, 0-based. In other words, for a product A(x,,1,,, ..., x,,k,,), returns x,,(n+1),, where `0 = productArity).

The n^th^ element of this product, 0-based. In other words, for a product A(x,,1,,, ..., x,,k,,), returns x,,(n+1),, where `0 = productArity).

Attributes

Returns

the element n elements after the first element

Inherited from:
Product
Source
Product.scala

Concrete 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.

Source
lexer.scala