Skip to main content

Module declarations

Module declarations 

Source
Expand description

Project declarations for constructs the parser cannot infer from source.

Declarations supplement the aliases found by crate::semantic::define. They can describe environments defined in another file or through constructs the definition scanner does not recognize.

A declaration names a spelling, not a pairing. Shape gates still decide whether the source supports a construct, so invalid declarations degrade to generic syntax rather than forcing a tree shape.

The schema follows three rules:

  1. Each syntactic category has its own name map.
  2. like copies a built-in entry from the same category. Cross-category relationships use explicit fields such as EnvironmentDecl::begin.
  3. Declarations::resolve performs validation after deserialization so errors can identify the original configuration key.

These types are shared by all parser front ends. Their serialized field names are public API.

Structs§

CommandName
A control-word name as written in a declaration, stored without the leading backslash — the spelling every signature and ParseCtx map is keyed by.
DeclarationError
A rule Declarations::resolve rejected, with the dotted key of the entry that broke it (environments.myenv.like) so the CLI can point at the line the user wrote.
Declarations
Every declaration a project makes, as authored — unresolved and unvalidated.
EnvironmentDecl
One [environments.<name>] entry: what the environment named by the key behaves like, and which command spellings stand in for its delimiters.
ResolvedDeclarations
A project’s declarations, checked and projected into signature data by Declarations::resolve.

Enums§

DeclarationErrorKind
Why a declaration was rejected. Each variant is a rule from AGENTS.md decision #12 or its architecture section.

Type Aliases§

EnvironmentDecls
The name-keyed [environments] map. A type alias so the CLI’s Config can name the field’s type without restating the key type.