Skip to main content
Module

x/leac/leac.ts>Rule

Lexer / tokenizer
Latest
interface Rule
import { type Rule } from "https://deno.land/x/leac@v0.6.0/leac.ts";

Lexing rule.

Base rule looks for exact match by it's name.

If the name and the lookup string have to be different then specify str property as defined in StringRule.

Properties

name: string

The name of the rule, also the name of tokens produced by this rule.

optional
discard: boolean

Matched token won't be added to the output array if this set to true.

(Think twice before using this.)

optional
push: Lexer

Switch to another lexer function after this match, concatenate it's results and continue from where it stopped.

optional
pop: boolean

Stop after this match and return.

If there is a parent parser - it will continue from this point.