halotukozak.alpaca.internal.lexer
Members list
Type members
Experimental classlikes
Attributes
- Experimental
- true
- Source
- Column.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Column.type
Provides mechanisms for defining error-handling strategies when processing input. This object contains a sealed enumeration Strategy that specifies the different ways errors can be addressed during tokenization or parsing workflows.
Provides mechanisms for defining error-handling strategies when processing input. This object contains a sealed enumeration Strategy that specifies the different ways errors can be addressed during tokenization or parsing workflows.
Attributes
- Companion
- trait
- Experimental
- true
- Source
- ErrorHandling.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ErrorHandling.type
Trait representing error handling strategies for a lexer context.
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
- Supertypes
A lazy character sequence that reads from a Reader on demand.
A lazy character sequence that reads from a Reader on demand.
This class is useful for tokenizing large files without loading them entirely into memory. It buffers characters as they are accessed and can efficiently skip over processed characters.
Value parameters
- reader
-
the underlying Reader to read from
- size
-
the total size of the input (if known)
Attributes
- Companion
- object
- Experimental
- true
- Source
- LazyReader.scala
- Supertypes
-
trait Closeabletrait AutoCloseabletrait CharSequenceclass Objecttrait Matchableclass AnyShow all
Factory methods for creating LazyReader instances.
Factory methods for creating LazyReader instances.
Attributes
- Companion
- class
- Experimental
- true
- Source
- LazyReader.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
LazyReader.type
Attributes
- Experimental
- true
- Source
- Line.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Line.type
Base trait for all token types.
Base trait for all token types.
A token represents a lexical unit matched by the lexer. It contains information about the token's name, pattern, and how to manipulate the lexer context when matched.
Type parameters
- Ctx
-
the global context type
- Name
-
the token name type
- Value
-
the value type extracted from the matched text
Attributes
- Experimental
- true
- Source
- Token.scala
- Supertypes
-
class Objecttrait Matchableclass Any
The result of compiling a lexer definition.
The result of compiling a lexer definition.
This abstract class represents a compiled lexer that can tokenize input. It is generated by the lexer macro and provides methods to access tokens and perform tokenization.
Type parameters
- Ctx
-
the global context type
Attributes
- Experimental
- true
- Source
- Tokenization.scala
- Supertypes
-
trait Selectableclass Objecttrait Matchableclass Any
A per-token update for a single lexer-context field (a "fragment" such as Line or Column).
Tracking.materialize applies one Tracking instance to each case field of the context whose type provides a given, threading the result through a functional copy; fields whose type has no Tracking given are left untouched by the hook (they only change in rule bodies).
This is how tracking composes without inheritance: define a distinct field type and a given Tracking[YourType] in its companion, then use it as a context field.
Type parameters
- F
-
the fragment field type
Attributes
- Companion
- object
- Experimental
- true
- Source
- Tracking.scala
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- trait
- Experimental
- true
- Source
- Tracking.scala
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Tracking.type
Types
A context fragment that tracks the current 1-based column position within the line, resetting to 1 on a newline.
A context fragment that tracks the current 1-based column position within the line, resetting to 1 on a newline.
Use it as a field of a lexer context:
case class MyCtx(position: Column = Column.Start) extends LexerCtx
Tracking.materialize finds the given Tracking[Column] below and applies it to that field after every match, threading a functional copy -- so position stays an immutable val. Column <: Int, so ctx.position reads as a plain Int everywhere; assigning it inside a rule body (ctx.position = Column(...)) is rewritten to a copy too.
(Named Column, not Position, to avoid shadowing the unrelated source Position type used throughout this library's own error reporting.)
Attributes
- Source
- Column.scala
A context fragment that tracks the current 1-based line number.
A context fragment that tracks the current 1-based line number.
Use it as a field of a lexer context:
case class MyCtx(line: Line = Line.Start) extends LexerCtx
Tracking.materialize finds the given Tracking[Line] below and applies it to that field after every match, threading a functional copy -- so line stays an immutable val. Line <: Int, so ctx.line reads as a plain Int everywhere; assigning it inside a rule body (ctx.line = Line(...)) is rewritten to a copy too.
Attributes
- Source
- Line.scala
Value members
Experimental methods
Attributes
- Experimental
- true
- Source
- Lexer.scala
