3.4.2 Simple Statements
Each simple statement is cross-referenced below to its section of MS-VBAL §5.4.2 Control Statements, MS-VBAL §5.4.3 Data Manipulation Statements or MS-VBAL §5.4.4 Error Handling Statements, and to the RD-VBAL page that describes its implementation.
Name...As is not an MS-VBAL-numbered statement: MS-VBAL has no section for it.
Assignment Statements
Let, Set, LSet and RSet share one node type, AssignmentStatementNode, distinguished by its AssignmentKind Kind. LSet and RSet have the same node shape as Let and Set.
The Target of an AssignmentStatementNode is always an lExpression. It draws from the shared expression family described in RD-VBAL §3.0.2 Node Types: a member access, an index, a dictionary access, or a bare name.
The runtime semantics of LSet and RSet are described in RD-VBAL §5.4.3.6 LSet Statement and RD-VBAL §5.4.3.7 RSet Statement.
Mid Statement
MidStatementNode records the statement's spelling in two independent flags. IsByteMode distinguishes MidB/MidB$ from Mid/Mid$; IsStringInput records the $ suffix.
| Spelling | IsByteMode |
IsStringInput |
|---|---|---|
Mid |
false |
false |
Mid$ |
false |
true |
MidB |
true |
false |
MidB$ |
true |
true |
The replacement-span mechanics of MS-VBAL §5.4.3.5 split only on byte mode (MidB/MidB$ versus Mid/Mid$), never on the $ suffix. IsStringInput is preserved because it mirrors the VBVariant/VBString split of the Mid/Mid$ function overloads, which matters for static semantics.
ReDim Statement
ReDim and ReDim Preserve are represented by RedimDeclarationNode. ReDim is modelled as a declaration node, not a statement node, because it declares or resizes storage.
Branching Statements
Statement labels and line numbers are captured as separate nodes, LineLabelNode and LineNumberNode; see RD-VBAL §5.4.1.1 Statement Labels.
A GoTo or GoSub statement's target is an expression naming or numbering a label or line. There is no static link between the GoToStatementNode or GoSubStatementNode and the LineLabelNode or LineNumberNode it targets.
OnGoToStatementNode and OnGoSubStatementNode hold their targets in a Labels list. They follow the same convention as GoTo and GoSub: each target is an expression naming or numbering a label or line, with no static link to the label node.
OnGoToStatementNode and OnGoSubStatementNode are separate node types rather than one shared node with a Kind. This mirrors the separate GoToStatementNode and GoSubStatementNode, because GoTo and GoSub are distinct branch mechanisms. By contrast, Let, Set, LSet and RSet share one node type, AssignmentStatementNode, distinguished by Kind.
Error-Handling Statements
On Error Resume Next and On Error GoTo are parsed by the same grammar rule, disambiguated by the keyword that follows On Error.
The SDK documentation of OnErrorGoToStatementNode also covers the On Error GoTo -1 form, which MS-VBAL does not document; see RD-VBAL §5.4.4.1 On Error Statement.
ResumeStatementNode.LabelExpression is nullable: a bare Resume has no label.
Resume Next has its own node type, ResumeNextStatementNode. It is not a ResumeStatementNode with a "Next" label.
⏮️ RD-VBAL §3.4.1 Block Statements | ⏭️ RD-VBAL §3.4.3 File Statements