LexerCtx

alpaca.LexerCtx
See theLexerCtx companion trait
object LexerCtx

Attributes

Companion
trait
Experimental
true
Source
lexer.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
LexerCtx.type

Members list

Type members

Classlikes

final case class Default(var position: Int = ..., var line: Int = ...) extends LexerCtx, PositionTracking, LineTracking

The default lexer context with position and line tracking.

The default lexer context with position and line tracking.

This context tracks:

  • The current column position within the line (1-based, resets on newlines)
  • The current line number (1-based)

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

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
Supertypes
trait Serializable
trait LineTracking
trait LexerCtx
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Default

Attributes

Companion
class
Source
lexer.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Default.type
final case class Empty() extends LexerCtx

An empty lexer context with no extra state tracking.

An empty lexer context with no extra state tracking.

This is the simplest context that only tracks the remaining text. Use this when you don't need line or position tracking.

Attributes

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

Givens

Givens

given given_Copyable_Ctx[Ctx <: LexerCtx & Product : ProductOf]: Copyable[Ctx]

Automatic Copyable instance for any GlobalCtx that is a Product (case class).

Automatic Copyable instance for any GlobalCtx that is a Product (case class).

Type parameters

Ctx

the context type

Attributes

Source
lexer.scala

Default error handler for any LexerCtx that throws on the first unrecognised character.

Default error handler for any LexerCtx that throws on the first unrecognised character.

Attributes

Source
lexer.scala

Default OnTokenMatch implementation that updates the context after each match.

Default OnTokenMatch implementation that updates the context after each match.

This implementation:

  • Updates lastRawMatched with the matched text
  • Creates a new Lexeme for defined tokens
  • Advances the text position
  • Applies any context modifications

Attributes

Source
lexer.scala