Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/frugal/docs/dep/prism.ts>Token

A frugal web framework
Go to Latest
class Token
import { Token } from "https://deno.land/x/frugal@0.5.0/docs/dep/prism.ts";

Constructors

new
Token(
type: string,
content: TokenStream,
alias?: string | string[],
matchedStr?: string,
greedy?: boolean,
)

Creates a new token.

Properties

alias: string | string[]

The alias(es) of the token.

content: TokenStream

The strings or tokens contained by this token.

This will be a token stream if the pattern matched also defined an inside grammar.

greedy: boolean

Whether the pattern that created this token is greedy or not.

length: number

The length of the matched string or 0.

type: string

The type of the token.

This is usually the key of a pattern in a Grammar.

Static Methods

stringify(
token: TokenStream,
language: string,
parent?: Array<string | Token>,
): string

Converts the given token or token stream to an HTML representation.

The following hooks will be run:

  1. wrap: On each Prism.Token.