A node in the Abstract Syntax Tree (AST).

interface AbstractElement {
    $container?: AstNode;
    $containerIndex?: number;
    $containerProperty?: string;
    $cstNode?: CstNode;
    $document?: LangiumDocument<AstNode>;
    $type:
        | "AbstractElement"
        | "Action"
        | "Alternatives"
        | "Assignment"
        | "CharacterRange"
        | "CrossReference"
        | "EndOfFile"
        | "Group"
        | "Keyword"
        | "NegatedToken"
        | "RegexToken"
        | "RuleCall"
        | "TerminalAlternatives"
        | "TerminalGroup"
        | "TerminalRuleCall"
        | "UnorderedGroup"
        | "UntilToken"
        | "Wildcard";
    cardinality?: "*" | "+" | "?";
    lookahead?:
        | "?!"
        | "?<!"
        | "?<="
        | "?=";
}

Hierarchy (view full)

Properties

$container?: AstNode

The container node in the AST; every node except the root node has a container.

$containerIndex?: number

In case $containerProperty is an array, the array index is stored here.

$containerProperty?: string

The property of the $container node that contains this node. This is either a direct reference or an array.

$cstNode?: CstNode

The Concrete Syntax Tree (CST) node of the text range from which this node was parsed.

The document containing the AST; only the root node has a direct reference to the document.

$type:
    | "AbstractElement"
    | "Action"
    | "Alternatives"
    | "Assignment"
    | "CharacterRange"
    | "CrossReference"
    | "EndOfFile"
    | "Group"
    | "Keyword"
    | "NegatedToken"
    | "RegexToken"
    | "RuleCall"
    | "TerminalAlternatives"
    | "TerminalGroup"
    | "TerminalRuleCall"
    | "UnorderedGroup"
    | "UntilToken"
    | "Wildcard"

Every AST node has a type corresponding to what was specified in the grammar declaration.

cardinality?: "*" | "+" | "?"
lookahead?:
    | "?!"
    | "?<!"
    | "?<="
    | "?="