Skip to main content
Module

x/moo/mod.ts>Token

Optimised tokenizer/lexer generator! 🐄 Uses /y for performance. Moo.
Latest
interface Token
import { type Token } from "https://deno.land/x/moo@0.5.1-deno.2/mod.ts";

Properties

optional
type: string

The name of the group, as passed to compile.

value: string

The match contents.

offset: number

The number of bytes from the start of the buffer where the match starts.

text: string

The complete match.

lineBreaks: number

The number of line breaks found in the match. (Always zero if this rule has lineBreaks: false.)

line: number

The line number of the beginning of the match, starting from 1.

col: number

The column where the match begins, starting from 1.

Methods

toString(): string

Returns value of the token, or its type if value isn't available.