The base of every lexer context: the state a lexer carries from one token to the next, read and assigned as ctx in rule bodies, and snapshotted into every lexeme and LexerError.
A context must be a case class whose fields all have default values, since the lexer macro builds the initial context from those defaults:
case class BrainLexContext(squareBrackets: Int = 0, line: Line = Line.Start) extends LexerCtx
A field whose type has a given Tracking, like Line or Column, is updated after every match.
Attributes
- Companion
- object
- Source
- lexer.scala
- Graph
-
- Supertypes
-
trait Selectabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Members list
Value members
Concrete methods
Not meant to be called: assigning a context field outside a lexer rule or handler is a compile error.
Not meant to be called: assigning a context field outside a lexer rule or handler is a compile error.
Attributes
- Source
- lexer.scala
A copy of at most the next n characters of the input still to be tokenized, fewer at its end.
A copy of at most the next n characters of the input still to be tokenized, fewer at its end.
Meant for a custom ErrorHandling instance to look at what failed to match any token rule, e.g. to pick a recovery strategy based on what comes next. Only the requested characters are read and copied, and the result is safe to keep after the callback returns.
Value parameters
- n
-
the maximum number of characters to return
Attributes
- Throws
-
IllegalArgumentException
if
nis negative - 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
