math_spec.validation
The front door, and the rules a declaration is held to against the others before any expression is read.
:func:to_spec reads a model definition into a :class:~math_spec.model.Spec.
:func:reference_errors holds the rules one declaration is held to against
the others — a name declared once, a frame over declared dimensions, a bound
naming a numeric parameter, a set over one dim of one variable, a curve
through parameters carrying its breakpoints — which lowering runs before it
reads any expression, since resolution assumes every one of them.
:func:emitted_name_errors is read off the program instead: what a block's
expansion writes is decided by the block as lowered. The rules that need a
typed expression stay with the expressions in :func:~math_spec.lowering.lower:
a macro formal against a dimension, a curve's links, and every dim rule.
emitted_name_errors(schema, program)
#
Every name a set or curve of program would write out that schema already declares.
Read off the program rather than the file, since what a curve writes is decided by the curve as lowered — its links, its method, its mask.
Source code in src/math_spec/validation.py
reference_errors(schema)
#
Every cross-declaration rule schema breaks, collected rather than raised on the first.
Source code in src/math_spec/validation.py
to_spec(model)
#
Load and validate a model definition — the language's front door.
Everything decidable without data is decided here: schema shape, every rule one declaration is held to against the others, every expression and where string, and every macro template.
| PARAMETER | DESCRIPTION |
|---|---|
model
|
A YAML path — a :class: |
| RETURNS | DESCRIPTION |
|---|---|
Spec
|
The schema as the file declares it, |
| RAISES | DESCRIPTION |
|---|---|
LanguageError
|
Anything the language does not accept, a text that is not a mapping of sections included. |
FileNotFoundError
|
A |
Source code in src/math_spec/validation.py
undeclared_dimension(kind, name, dimension)
#
The one wording for a declaration naming a dimension the file does not declare.