Hierarchy

  • ITree

Implemented by

Index

Properties

charPositionInLine

charPositionInLine: number

childCount

childCount: number

childIndex

childIndex: number

This node is what child index? 0..n-1

isNil

isNil: boolean

Indicates the node is a nil node but may still have children, meaning the tree is a flat list.

line

line: number

In case we don't have a token payload, what is the line for errors?

parent

parent: ITree

text

text: string

tokenStartIndex

tokenStartIndex: number

What is the smallest token index (indexing from 0) for this node and its children?

tokenStopIndex

tokenStopIndex: number

What is the largest token index (indexing from 0) for this node and its children?

type

type: number

Return a token type; needed for tree parsing

Methods

addChild

  • addChild(t: ITree): any
  • Add t as a child to this node. If t is null, do nothing. If t is nil, add all children of t to this' children.

    Parameters

    Returns any

deleteChild

  • deleteChild(i: number): any
  • Parameters

    • i: number

    Returns any

dupNode

freshenParentAndChildIndexes

  • freshenParentAndChildIndexes(): any
  • Set the parent and child index values for all children

    Returns any

getAncestor

  • getAncestor(ttype: number): ITree
  • Walk upwards and get first ancestor with this token type.

    Parameters

    • ttype: number

    Returns ITree

getAncestors

  • Return a list of all ancestors of this node. The first node of list is the root and the last is the parent of this node.

    Returns List<ITree>

getChild

  • getChild(i: number): ITree
  • Parameters

    • i: number

    Returns ITree

hasAncestor

  • hasAncestor(ttype: number): boolean
  • Is there is a node above with token type ttype?

    Parameters

    • ttype: number

    Returns boolean

replaceChildren

  • replaceChildren(startChildIndex: number, stopChildIndex: number, t: any): any
  • Delete children from start to stop and replace with t even if t is a list (nil-root tree). num of children can increase or decrease. For huge child lists, inserting children can force walking rest of children to set their childindex; could be slow.

    Parameters

    • startChildIndex: number
    • stopChildIndex: number
    • t: any

    Returns any

setChild

  • setChild(i: number, t: ITree): any
  • Set ith child (0..n-1) to t; t must be non-null and non-nil node

    Parameters

    Returns any

toString

  • toString(): string
  • Returns string

toStringTree

  • toStringTree(): string
  • Returns string

Generated using TypeDoc