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 Selectabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Members list
Value members
Concrete methods
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
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
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
nis out of range(n < 0 || n >= productArity). - Inherited from:
- Product
- Source
- Product.scala
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
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
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
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
The size of this product.
The size of this product.
Attributes
- Returns
-
for a product
A(x,,1,,, ..., x,,k,,), returnsk - Inherited from:
- Product
- Source
- Product.scala
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
nelements after the first element - Inherited from:
- Product
- Source
- Product.scala
Concrete fields
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
alpacapackage. - Source
- lexer.scala
