Table of Contents

VBC00001 — Syntax error

Severity: Error  ·  Family: VBC (parser / concrete syntax tree)  ·  Source metadata: VBSyntaxErrorInfo

A token was reached that the RD-VBA grammar cannot place in the current context. This is the parser's general fallback: when the input cannot be parsed and no more specific code applies, it reports VBC00001. Recurring shapes of syntax error are promoted from VBC00001 to their own code in the VBC00042–VBC00999 range.

The diagnostic's verbose detail carries the parser's account of the failure: the token it found and what it expected in its place. A client marks the reported range and reads the verbose detail for the specifics.

How it is raised

Situation What the verbose detail says Resolution
A keyword, operator, or delimiter appears where the grammar expects something else, e.g. a misplaced Then, a doubled operator, an unbalanced bracket. expecting <token>, found <token> Put the tokens in a legal order.
A construct RD-VBA does not accept in this position, e.g. a declaration inside a procedure body, an expression used as a statement, or a ByVal before an argument of a RaiseEvent (MS-VBAL §5.4.2.20 gives the statement no ByVal, and §5.6.13.1 allows one only in the invocation of an external procedure; for any other call, see VBC09327). the offending token and the rule that rejected it Move or remove the construct.
A conditional-compilation directive (#If / #Else / #End If) splits a single statement across branches, e.g. a procedure header whose return type differs per branch. RD-VBA, like the legacy Rubberduck parser, does not parse this. the token after the directive that could not be joined to the statement Rewrite so each branch holds whole statements: duplicate the header in each branch, or move the #If inside the body.
A stray or unterminated token, e.g. an unclosed string, an unexpected line continuation, a character outside any token. the unexpected character or the unterminated token Remove or complete the token.

Notes

The RD-VBA grammar is permissive at the token level by design, and defers meaning to the semantic layers. A VBC00001 is therefore always a structural problem: the text could not be assembled into a syntax tree at all.

Conditions that need symbol information (an undefined name, a duplicate declaration) are not syntax errors. They are reported later, as semantic compilation errors.

See also


⏮️ Diagnostics | ⏭️ VBC00042 Numeric literal overflow


ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca