Interface GrammarToken

The expansion of a simple RegExp literal to support additional properties.

Hierarchy

  • GrammarToken

Properties

alias?: TokenName

An optional alias. Multiple aliases are separated by spaces.

exec?: undefined

A property to make the types GrammarToken and RegExp non-overlapping.

Since GrammarToken requires exec to be undefined and RegExp requires it to be a function, there can be no object that is both a GrammarToken and a RegExp.

greedy?: boolean

Whether the token is greedy.

Default

false
inside?: null | string | Grammar

The nested grammar of this token.

The inside grammar will be used to tokenize the text value of each token of this kind.

This can be used to make nested and even recursive language definitions.

Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into each another.

lookbehind?: boolean

If true, then the first capturing group of pattern will (effectively) behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.

Default

false
pattern: RegExp

The regular expression of the token.

Generated using TypeDoc