ErrorHandling

alpaca.internal.lexer.ErrorHandling
See theErrorHandling companion object
trait ErrorHandling[-Ctx <: LexerCtx] extends Ctx => Strategy

Trait representing error handling strategies for a lexer context.

This trait allows the specification of error handling strategies for various lexer contexts by transforming a given lexer context to an instance of ErrorHandling.Strategy. The strategies determine how the lexer should proceed when it encounters an error, such as invalid tokens or characters during parsing.

Error handling is essential for customizing lexer behavior in response to specific scenarios, including ignoring or stopping on errors, or throwing specific exceptions.

Users must define an implicit instance of this trait to provide the error handling behavior for a custom lexer context.

Type parameters

Ctx

The lexer context that this error handling strategy applies to. Must be a subtype of LexerCtx.

Attributes

Companion
object
Experimental
true
Source
ErrorHandling.scala
Graph
Supertypes
trait Ctx => Strategy
class Object
trait Matchable
class Any

Members list

Value members

Inherited methods

def andThen[A](g: Strategy => A): Ctx => A

Composes two instances of Function1 in a new Function1, with this function applied first.

Composes two instances of Function1 in a new Function1, with this function applied first.

Type parameters

A

the result type of function g

Value parameters

g

a function R => A

Attributes

Returns

a new function f such that f(x) == g(apply(x))

Inherited from:
Function1
Source
Function1.scala
def compose[A](g: A => Ctx): A => Strategy

Composes two instances of Function1 in a new Function1, with this function applied last.

Composes two instances of Function1 in a new Function1, with this function applied last.

Type parameters

A

the type to which function g can be applied

Value parameters

g

a function A => T1

Attributes

Returns

a new function f such that f(x) == apply(g(x))

Inherited from:
Function1
Source
Function1.scala
override def toString(): String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Function1 -> Any
Inherited from:
Function1
Source
Function1.scala

Inherited and Abstract methods

def apply(v1: Ctx): Strategy

Applies the body of this function to the argument.

Applies the body of this function to the argument.

Attributes

Returns

the result of function application.

Inherited from:
Function1
Source
Function1.scala