Skip to main content

Crate cratestack_parser

Crate cratestack_parser 

Source

Structs§

FileDirectives
Every multi-file directive one file declares.
FsSources
The default: std::fs::read_to_string.
LoadDiagnostics
Everything a load found. files lists every file a read was tried for, including when loading stopped early.
LoadOptions
How to load.
LoadedSchema
A schema and the files it was loaded from, in load order (root first).
OverlaySources
In-memory texts keyed by canonical_schema_path, optionally falling back to the disk for a path that has none.
PathDirective
One part "…", part of "…" or import "…" line.
RelatedSpan
A second location an error points at, in its own file: for example the earlier declaration of a name that two files both declare (docs/design/multi-file-schemas.md section 9).
SchemaError
A schema error, identified by which file it came from (cratestack#916).
SchemaFile
One file of a loaded schema.

Enums§

DirectiveKind
Which directive a target was written in.
FieldHost
A declaration kind whose fields carry attributes.
FileRole
What a loaded file is to the schema.

Constants§

ANONYMOUS_SCHEMA
File identity used when a caller parses a schema with no path to give. Prefer parse_schema_named whenever a path is known: it is what makes a rendered diagnostic name the file.

Traits§

SchemaSources
Where file text comes from.

Functions§

builtin_type_names
Canonical scalar type names built into the .cstack language (e.g. String, Int, Decimal, …), including Page (which is valid only as a procedure return type — see validate::type_names::validate_type_ref — not as a plain field type).
canonical_schema_path
The identity of a schema file, so two spellings of one file are one file (docs/design/multi-file-schemas.md section 5, Q3): std::fs::canonicalize, or, for a file that does not exist, the absolute path with . and .. folded away lexically.
directive_targets
Every well-formed part, part of and import target in source, in order, paths as written. Malformed directive lines are skipped, and nothing else in the file is looked at, so this never fails.
field_attribute_names
The field attributes host accepts, sigil included (@readonly), in the order its list is written. The validator and the editor completions read the same list, so they cannot disagree.
load_schema
Loads and validates, returning the first error. Same checks, in the same order, as load_schema_diagnostics.
load_schema_diagnostics
Loads path and reports every independent problem, from several files in one run (docs/design/multi-file-schemas.md section 9).
parse_schema
parse_schema_diagnostics
Parse and validate, reporting every independent problem rather than only the first.
parse_schema_file
Loads the schema at path, including the parts it lists and the files it imports (see crate::load_schema).
parse_schema_named
parse_schema_unvalidated
Parse a .cstack source into a [cratestack_core::Schema] WITHOUT running [validate::validate_schema].
reserved_multi_file_keywords
Words reserved for the multi-file schema grammar. Consumers that accept prospective identifiers, such as the LSP rename flow, must reject this canonical list before producing source the parser cannot read.