Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Node<TType, TValid>

The base AST node class all node types extend from. Can be used to check if an object is an ast node.

if (token instanceof Node) {
//...
}

Type parameters

Hierarchy

Index

Constructors

Properties

Accessors

Methods

Constructors

  • new Node<TType, TValid>(type: TType, start: number, end: number): Node<TType, TValid>

Properties

end: number
start: number
type: TType
valid: TValid

Accessors

Methods

  • stringify(..._any: any[]): string
  • Returns the canonical version string version of the node.

    The main purpose is to provide some definitive string versions of nodes so that we can check the equality of two shortcuts. This should ideally be done at the ChainNode level since e.g. key parses to Chain(Combo(Key(key))) but all it's node's string versions equal each other (i.e. Chain(Combo(Key(key))) === Key(key)).

    The string returned should also parse back to exactly the same nodes (again, at the @ChainNode level).

    See Token.stringify for how this works at the token level.

    Parameters

    • Rest ..._any: any[]

    Returns string

Generated using TypeDoc