Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Rule<Type, Stage, Context>

Defines how the token is read from the input string and how Tokenizer transitions between stages.

Type parameters

  • Type = unknown

    The type of the token emitted by this rule.

  • Stage = void

    The tokenizer stage type.

  • Context = void

    The context passed by tokenizer.

Hierarchy

  • Rule

Index

Properties

on?: Stage[]

The list of stages at which the rule can be used. If undefined then the rule is used on all stages. If an empty array then the rule is never used.

default

undefined

reader: Reader<Context>

The reader that reads chars from the string.

silent?: boolean

If set to true then tokens read by this reader are not emitted.

default

false

to?: Stage | StageProvider<Stage, Context>

Provides the stage to which tokenizer transitions if this rule successfully reads a token.

If undefined then the stage is left unchanged.

default

undefined

type?: Type

The type of the token that is passed to TokenHandler when the rule successfully reads chars from the input string. Type isn't required to be unique, so multiple rules may share the same type if needed.

default

undefined

Generated using TypeDoc