Grammar.VM.Token (IchorRuntime v0.1.0)

Copy Markdown View Source

One lexed token from Grammar.VM.Tokenizer -- the target grammar's own tokens (e.g. a calculator's NUMBER, "+"), not to be confused with Aether.Token (Ichor's front-end lexing .aether source itself).

capture is nil for an ordinary token (its capture, when some rule references it, is built as {:token, name, text} from text alone). A Grammar.IR.CustomLexeme-matched token (Ichor.CustomLexeme.scan/3 returning an explicit capture override, not nil) carries its own structure here instead -- a string-interpolation token's embedded expressions, say -- which the rule level uses verbatim in place of the usual flat-text capture.

Summary

Types

t()

@type t() :: %Grammar.VM.Token{
  capture: Ichor.Capture.node_t() | nil,
  column: pos_integer(),
  line: pos_integer(),
  name: atom(),
  text: String.t()
}