Token

alpaca.Token
object Token

Factory methods for creating token definitions in the lexer DSL.

Attributes

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

Members list

Value members

Concrete methods

def Ignored(using ctx: LexerCtx): IgnoredToken[ctx.type]

Creates an ignored token that will be matched but not included in the output.

Creates an ignored token that will be matched but not included in the output.

This is compile-time only and should only be used inside lexer definitions.

Value parameters

ctx

the lexer context

Attributes

Returns

a token that will be ignored

Source
lexer.scala
def apply[Name <: ValidName](using ctx: LexerCtx): Token[Name, ctx.type, String]

Creates a token that captures the matched string.

Creates a token that captures the matched string.

This is compile-time only and should only be used inside lexer definitions.

Type parameters

Name

the token name

Value parameters

ctx

the lexer context

Attributes

Returns

a token definition

Source
lexer.scala
def apply[Name <: ValidName](value: Any)(using ctx: LexerCtx): Token[Name, ctx.type, value.type]

Creates a token with a custom value extractor.

Creates a token with a custom value extractor.

This is compile-time only and should only be used inside lexer definitions.

Type parameters

Name

the token name

Value parameters

ctx

the lexer context

value

the value to extract from the match

Attributes

Returns

a token definition

Source
lexer.scala