Skip to content

JSONPath Tools / @jsonpath-tools/jsonpath / SyntaxTreeToken

Class: SyntaxTreeToken ​

Terminal symbols of the grammar.

Extends ​

Constructors ​

Constructor ​

ts
new SyntaxTreeToken(
   type, 
   position, 
   text, 
   skippedTextBefore): SyntaxTreeToken;

Parameters ​

type ​

SyntaxTreeType

Inherit Doc

position ​

number

Inherit Doc

text ​

string

Inherit Doc

skippedTextBefore ​

string

Inherit Doc

Returns ​

SyntaxTreeToken

Overrides ​

SyntaxTree.constructor

Properties ​

_parent ​

ts
_parent: SyntaxTreeNode | null = null;

Internal

Inherited from ​

SyntaxTree._parent


length ​

ts
readonly length: number;

Length in the text.

Inherited from ​

SyntaxTree.length


position ​

ts
readonly position: number;

Position in the text.

Inherited from ​

SyntaxTree.position


skippedTextBefore ​

ts
readonly skippedTextBefore: string;

Text that was skipped during parsing.

Inherited from ​

SyntaxTree.skippedTextBefore


text ​

ts
readonly text: string;

Inherit Doc ​


type ​

ts
readonly type: SyntaxTreeType;

Type.

Inherited from ​

SyntaxTree.type

Accessors ​

parent ​

Get Signature ​

ts
get parent(): SyntaxTreeNode | null;

Parent or null when no parent is assigned.

Returns ​

SyntaxTreeNode | null

Inherited from ​

SyntaxTree.parent


textRange ​

Get Signature ​

ts
get textRange(): TextRange;

Range in the text.

Returns ​

TextRange

Inherited from ​

SyntaxTree.textRange


textRangeWithoutSkipped ​

Get Signature ​

ts
get textRangeWithoutSkipped(): TextRange;

Range in the text excluding skipped text before.

Returns ​

TextRange

Inherited from ​

SyntaxTree.textRangeWithoutSkipped

Methods ​

forEach() ​

ts
forEach(action): void;

Executes the given action for this and all descendant trees in a pre-order tree traversal.

Parameters ​

action ​

(tree) => boolean | void

Action.

Returns ​

void

Overrides ​

SyntaxTree.forEach


getAtPosition() ​

ts
getAtPosition(characterPosition): SyntaxTree | null;

Returns the innermost subtree that spans the given character position or null when the position is outside of a range of the current tree.

Parameters ​

characterPosition ​

number

Position (character index).

Returns ​

SyntaxTree | null

Inherited from ​

SyntaxTree.getAtPosition


getContainingAtPosition() ​

ts
getContainingAtPosition(caretPosition): SyntaxTree | null;

Returns the innermost subtree that fully contains the given caret position (not just touches) or null when the position is not contained in a range of the current tree.

Parameters ​

caretPosition ​

number

Position (caret position index).

Returns ​

SyntaxTree | null

Inherited from ​

SyntaxTree.getContainingAtPosition


getTouchingAtPosition() ​

ts
getTouchingAtPosition(caretPosition): SyntaxTree[];

Returns all innermost subtrees that touch the given caret position.

Parameters ​

caretPosition ​

number

Position (caret position index).

Returns ​

SyntaxTree[]

Inherited from ​

SyntaxTree.getTouchingAtPosition