Token

halotukozak.alpaca.Token
See theToken companion class
object Token

Factory methods for creating token definitions in the lexer DSL.

Attributes

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

Members list

Value members

Concrete methods

def Ignored(using s: LexerScope): IgnoredToken[s.Ctx]

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.

Attributes

Returns

a token that will be ignored

Source
lexer.scala
def apply[Name <: ValidName](using s: LexerScope): Token[Name, s.Ctx, Unit]

Creates a token whose lexemes carry no value (()). To carry the matched text or anything computed from it, bind the match and pass it: case n @ "[0-9]+" => Token["NUM"](n.toInt).

Creates a token whose lexemes carry no value (()). To carry the matched text or anything computed from it, bind the match and pass it: case n @ "[0-9]+" => Token["NUM"](n.toInt).

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

Type parameters

Name

the token name

Attributes

Returns

a token definition

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

Creates a token whose lexemes carry value, typically computed from the bound match.

Creates a token whose lexemes carry value, typically computed from the bound match.

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

Type parameters

Name

the token name

Value parameters

value

the value its lexemes carry

Attributes

Returns

a token definition

Source
lexer.scala