Class ModuleAnnotations
Reads RD-VBA-only '@AnnotationName comment annotations off a module's raw source: the
legacy-Rubberduck-style syntax the grammar already recognises (annotationList /
annotation / annotationName), read here as plain text rather than off the AST.
public static class ModuleAnnotations
- Inheritance
-
ModuleAnnotations
- Inherited Members
Remarks
The annotation is read from the source text: the parser builds no node for an annotation, which can be written at the end of nearly any statement. To MS-VBA and any other VBA host the annotation is a comment, so a workspace stays import- and export-compatible with the VBIDE.
The annotation vocabulary is open-ended: an extension can own annotations of its own, such as
@TestMethod for a unit-testing extension, without a change to the SDK. Option Strict
is owned by the core, and this type reads its annotation with a regular expression of its own.
Methods
HasOptionStrict(string?)
Whether source carries an '@OptionStrict annotation anywhere in the
module. false when there is no source to inspect.
public static bool HasOptionStrict(string? source)
Parameters
sourcestringThe raw module source, or
nullwhen it could not be read.
Returns
Remarks
Option Strict is not an MS-VBAL directive: it is RD-VBA's own dial for turning select
semantic flags that stay legal under plain Option Explicit into compile errors (see
VBCompileErrorId.ForbiddenWithOptionStrict), the same role a real Option Strict
statement line is reserved for (ModuleOptions.OptionStrict) once one ships.