Table of Contents

Class UnbuiltExpressionTriviaNode

Namespace
RDCore.SDK.Model.AST.Abstract
Assembly
RDCore.SDK.dll

Preserves the raw source text of an expression that the tree does not model: an alternative the grammar recognizes but that has no dedicated AST node yet (e.g. New <class>, TypeOf <expr> Is <type>), or an expression nested too deeply to be analyzed (VBC00060, RD-VBAL §2.6.1).

public sealed record UnbuiltExpressionTriviaNode : ExpressionNode, IEquatable<SyntaxNode>, IExecutableNode, IEquatable<ExpressionNode>, IEquatable<UnbuiltExpressionTriviaNode>
Inheritance
UnbuiltExpressionTriviaNode
Implements
Inherited Members
Extension Methods

Remarks

The AST must stay a faithful, lossless representation of the source even where no semantic node stands for it: silently building a different, wrong-meaning node in its place (or building nothing at all) would misrepresent the source rather than merely under-represent it. Source is the exact original text, which lets a consumer that needs to reconstruct the source (e.g. a formatter) do so verbatim, while a consumer that only cares about semantics can tell at a glance that this position wasn't modeled.

For an alternative that has no node, Inputs keeps whatever the grammar's own sub-expression already built, so that nothing the walk already parsed is thrown away. An expression nested in more than 2,500 others (VBC00060) is the other way around: what it holds is thrown away on purpose and Inputs is empty, so that no stage after the parser is handed a tree deeper than the limit. A name written in its text is not analyzed (it is neither bound nor counted as a use), and a rename of what it could refer to is refused (RenameRefusalKind.Unresolved). Where each such name is written is in Names.

Constructors

UnbuiltExpressionTriviaNode(SyntaxNodeId, SourceLocation, string, ImmutableArray<SyntaxNode>)

Preserves the raw source text of an expression that the tree does not model: an alternative the grammar recognizes but that has no dedicated AST node yet (e.g. New <class>, TypeOf <expr> Is <type>), or an expression nested too deeply to be analyzed (VBC00060, RD-VBAL §2.6.1).

public UnbuiltExpressionTriviaNode(SyntaxNodeId Identity, SourceLocation Location, string Source, ImmutableArray<SyntaxNode> Inputs)

Parameters

Identity SyntaxNodeId

A unique identifier for this specific syntax node.

Location SourceLocation

The document location (Uri+Range) of the unbuilt expression.

Source string

The exact original source text of the unbuilt expression.

Inputs ImmutableArray<SyntaxNode>

Whatever sub-expression(s) the grammar's own walk already built underneath it; none for an expression nested too deeply to be analyzed.

Remarks

The AST must stay a faithful, lossless representation of the source even where no semantic node stands for it: silently building a different, wrong-meaning node in its place (or building nothing at all) would misrepresent the source rather than merely under-represent it. Source is the exact original text, which lets a consumer that needs to reconstruct the source (e.g. a formatter) do so verbatim, while a consumer that only cares about semantics can tell at a glance that this position wasn't modeled.

For an alternative that has no node, Inputs keeps whatever the grammar's own sub-expression already built, so that nothing the walk already parsed is thrown away. An expression nested in more than 2,500 others (VBC00060) is the other way around: what it holds is thrown away on purpose and Inputs is empty, so that no stage after the parser is handed a tree deeper than the limit. A name written in its text is not analyzed (it is neither bound nor counted as a use), and a rename of what it could refer to is refused (RenameRefusalKind.Unresolved). Where each such name is written is in Names.

Properties

Names

The names written in Source that no node of Inputs stands for, in the order they are written, as the VBA lexer reads them.

public ImmutableArray<UnbuiltName> Names { get; init; }

Property Value

ImmutableArray<UnbuiltName>

Remarks

A name is a token of its own: never a part of a string, date or numeric literal (1# is the number 1, &HFF a number too), nor of a comment. The key of a dictionary access (b in a!b) is the text of a string, and is no name. Empty for an expression whose every name is in what the walk built of it.

Source

The exact original source text of the unbuilt expression.

public string Source { get; init; }

Property Value

string