Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected _text

_text: string

Protected _tokenStartIndex

_tokenStartIndex: number

Protected _tokenStopIndex

_tokenStopIndex: number

Protected _type

_type: number

charPositionInLine

charPositionInLine: number

childIndex

childIndex: number = -1

What index is this node in the child list? Range: 0..n-1

children

children: List<ITree>

Get the children internal List; note that if you directly mess with the list, do so at your own risk.

hasTextArg

hasTextArg: boolean

label

label: string

line

line: number

parent

parent: CommonTree

Who is the parent node of this node; if null, implies node is root

Protected startIndex

startIndex: number = -1

What token indexes bracket all tokens associated with this node and below?

Protected stopIndex

stopIndex: number = -1

token

token: IToken

Accessors

childCount

  • get childCount(): number

isNil

  • get isNil(): boolean

text

  • get text(): string

tokenStartIndex

  • get tokenStartIndex(): number
  • set tokenStartIndex(value: number): void

tokenStopIndex

  • get tokenStopIndex(): number
  • set tokenStopIndex(value: number): void

type

  • get type(): number

Methods

addChild

  • addChild(t: ITree): void
  • Add t as child of this node.

    Warning: if t has no children, but child does and child isNil then this routine moves children to t via t.children = child.children; i.e., without copying the array.

    Parameters

    Returns void

addChildren

createChildrenList

deleteChild

  • deleteChild(i: number): any

dupNode

freshenParentAndChildIndexes

  • freshenParentAndChildIndexes(offset?: number): void

freshenParentAndChildIndexesDeeply

  • freshenParentAndChildIndexesDeeply(offset?: number): void

getAncestor

  • getAncestor(ttype: number): ITree

getAncestors

getChild

  • getChild(i: number): ITree

getFirstChildWithType

  • getFirstChildWithType(type: number): ITree

hasAncestor

  • hasAncestor(ttype: number): boolean

implements

  • implements(): any[]

insertChild

  • insertChild(i: number, t: ITree): void
  • Insert child t at child position i (0..n-1) by shifting children i+1..n-1 to the right one position. Set parent / indexes properly but does NOT collapse nil-rooted t's that come in here like addChild.

    Parameters

    Returns void

replaceChildren

  • replaceChildren(startChildIndex: number, stopChildIndex: number, t: any): void
  • 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 void

sanityCheckParentAndChildIndexes

  • sanityCheckParentAndChildIndexes(parent?: ITree, i?: number): void

setChild

  • setChild(i: number, t: ITree): void

setUnknownTokenBoundaries

  • setUnknownTokenBoundaries(): void
  • For every node in this subtree, make sure it's start/stop token's are set. Walk depth first, visit bottom up. Only updates nodes with at least one token index < 0.

    Returns void

toString

  • toString(): string

toStringTree

  • toStringTree(): string

Generated using TypeDoc