Table of Contents

Class SupportedLanguage

Namespace
RDCore.SDK.Workspace
Assembly
RDCore.SDK.Protocols.dll

A language the platform serves: what it is called to a client, which files are written in it, and what the environment it runs in is like - which is what tells one dialect of the family from another.

public class SupportedLanguage
Inheritance
SupportedLanguage
Inherited Members

Remarks

The platform is one implementation of the MS-VBAL semantics for several members of the BASIC family (SupportedLanguages), and a language is the dialect table behind it: the pieces a dialect decides stay behind this type rather than being re-decided wherever they matter.

Constructors

SupportedLanguage(string, string, params string[])

Creates the definition of a language.

public SupportedLanguage(string id, string name, params string[] fileTypes)

Parameters

id string

The language identifier a client names the language by (languageId).

name string

What the language is called.

fileTypes string[]

The patterns of the files written in it.

Properties

FileTypes

The patterns of the files written in the language.

public string[] FileTypes { get; }

Property Value

string[]

FilterString

The patterns of the files written in the language, as a document filter pattern.

public string FilterString { get; }

Property Value

string

HasBarePrint

Whether a Print statement with no file number - Print "x" - is a statement of the language.

public bool HasBarePrint { get; init; }

Property Value

bool

Remarks

In VB6 it is the Print member of the form or report it is written in, so it exists only where there is one. A BASIC has it as its own: it writes to the output of the program.

In VBA Print is a reserved identifier: it is illegal as the name of anything, it has no semantics, and it is not a recognized statement inside a procedure. Only the Immediate window accepts a bare Print, where it writes what Debug.Print does - and the Immediate window is not procedure scope.

HasFileLevelStatements

Whether a file of the language may have statements outside its procedures (file-level statements), which run in the order they are written: the script's own code, which is the program's entry point (ProgramEntryPoint.ScriptName).

public bool HasFileLevelStatements { get; init; }

Property Value

bool

Remarks

A script has them: VBScript runs a file from its first line to its last, and calls its procedures only where the file does. VBA and VB6 do not: a statement outside a procedure is a syntax error (MS-VBAL §5.1), unless the workspace allows it (SdkWorkspaceOptions.FileLevelStatements).

HasOptionExplicit

Whether the language has the Option Explicit directive (MS-VBAL §5.2.1.3), with which a module requires that every name it uses is declared.

public bool HasOptionExplicit { get; init; }

Property Value

bool

Remarks

VBA and VB6 do. A BASIC does not: a variable is whatever a line first assigns, which is what makes it a language to type in a line at a time, and a module of it cannot state a directive that it has no way to write. Whether a module states it is not something to have an opinion about, then.

Id

The language identifier a client names the language by (languageId).

public string Id { get; }

Property Value

string

ImplicitDeclarationScope

Where the variable that a reference to an undeclared name declares lives (MS-VBAL §5.6.10).

public ImplicitDeclarationScope ImplicitDeclarationScope { get; init; }

Property Value

ImplicitDeclarationScope

Remarks

Procedure - a local of the procedure - is VBA's and VB6's. Module is a BASIC's: a variable of the module, so that what one line assigns the next one reads.

ImplicitReferences

The libraries every project of the language references without its project file listing them, by name, in their order of reference precedence: after the standard library, and before the references the project file lists (RD-VBAL §2.3.1.3).

public IReadOnlyList<string> ImplicitReferences { get; init; }

Property Value

IReadOnlyList<string>

Remarks

The standard library (VBA) is every language's, and is none of them. A VB6 project also has the Visual Basic runtime objects and procedures (VBRUN, the third type library of MSVBVM60.DLL): the constants of its forms and controls (vbFixedSingle, vbTwips, vbHourglass, vbChecked) and its PropertyBag; and the Visual Basic objects and procedures (VB, VB6.OLB): its forms, controls and App, Screen and Printer. A .vbp lists neither, and the VB6 IDE does not let a project remove them. A name both the standard library and VBRUN declare is the standard library's: vbCancel is 2, where VBRUN's is 0.

ModuleFileTypes

The patterns of the files that are the modules of a workspace of the language: those a folder with no project file is made a project of (IProjectFileLoader.LoadOrSynthesizeAsync). They are the language's own files (FileTypes), unless the language says otherwise.

public string[] ModuleFileTypes { get; init; }

Property Value

string[]

Remarks

A BASIC's are RD-VBA's, except the code of an RDForms form (BASIC): its own file, a .rdc, is a program of the shell, as the lines typed at its prompt are, and is not a module of a project.

Name

What the language is called.

public string Name { get; }

Property Value

string

UsesClassicBasicSyntax

Whether the language is written in the syntax of classic BASIC: a Rem comment and the Error statement are how it writes a comment and raises an error, and not relics of the language it descends from.

public bool UsesClassicBasicSyntax { get; init; }

Property Value

bool

Remarks

A BASIC does, since that is what it is. VBA and VB6 keep both for backward compatibility only: ' is the comment, and Err.Raise raises an error (MS-VBAL §5.4.4.3).

Methods

ImplicitReferencesOf(IEnumerable<string?>)

The libraries a project of the language with these modules references without its project file listing them, by name, in their order of reference precedence: the language's (ImplicitReferences), then RDForms (RDFormsLibraryName) when a module is the code of an RDForms form (IsRDFormsModule(string?)).

public IReadOnlyList<string> ImplicitReferencesOf(IEnumerable<string?> modulePaths)

Parameters

modulePaths IEnumerable<string>

The paths or relative URIs of the project's modules (RelativeUri).

Returns

IReadOnlyList<string>

The names; ImplicitReferences when no module is the code of an RDForms form, or when the language already has RDForms.

Remarks

A project sees the forms and controls of its forms the way a VB6 project sees VB's: a project that has an RDForms form references RDForms, and its project file does not list it. RDForms comes after the language's own, so in a VB6 project a name both VB and RDForms declare is VB's.

IsModuleFile(string)

Whether a file is a module of a workspace of the language: whether its extension is the extension of one of its ModuleFileTypes.

public bool IsModuleFile(string path)

Parameters

path string

The file's path, or its name; or the path of a block's module.

Returns

bool

true when the extension is one of the language's module files, compared without regard to case.

Remarks

A module that a block of a file declares (BlockUri(Uri, string)) is a module of the workspaces its file is a module of.

IsSourceFile(string)

Whether a file is written in the language: whether its extension is the extension of one of its FileTypes.

public bool IsSourceFile(string path)

Parameters

path string

The file's path, or its name; or the path of a block's module.

Returns

bool

true when the extension is one of the language's, compared without regard to case.

Remarks

A module that a block of a file declares (BlockUri(Uri, string)) is written in the language of its file.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

TrailingImplicitReferencesOf(IEnumerable<string?>)

The libraries, by name, that a project of the language with these modules references after the ones its project file lists, without the project file listing them (RD-VBAL §2.3.1.3): Windows Script Host's, the implicit references of VBScript (IHost, then IWshRuntimeLibrary), when a module is a script (.vbs).

public IReadOnlyList<string> TrailingImplicitReferencesOf(IEnumerable<string?> modulePaths)

Parameters

modulePaths IEnumerable<string>

The paths or relative URIs of the project's modules (RelativeUri).

Returns

IReadOnlyList<string>

The names; none when no module is a script, or when the language has the libraries among its own.

Remarks

A script names WScript in a project of another language as it does in a VBScript project. The libraries come after the ones the project file lists, so a name they declare does not shadow a listed library's: both carry the Scripting runtime's FileSystemObject, File, Folder, Drive and TextStream, and a project that lists Scripting keeps its classes. A library that is among the language's own (ImplicitReferences) is not repeated.