1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
//! Minting: building, from the features' element declarations, the techy
//! packages and specifications that a parse resolves commands against.
//!
//! FLM parses documents with techy, the parser toolkit it is built on. When
//! techy's parser reads a command such as `\section` or `\begin{itemize}`, it
//! looks the name up and follows a **specification** (a value implementing
//! techy's `CallableSpec`): the arguments the command takes and how to parse
//! them. Specifications are held in **techy packages**, named tables of
//! specifications, and a parse consults a stack of them, the **scope stack**,
//! innermost first. This module builds all of these from what the features
//! declare; that work is called *minting*. [`mint_packages`] does it; the
//! language build ([`build_language`](crate::lang::build_language)) calls it
//! once per registry and installs the result.
//!
//! # What a feature declares
//!
//! A feature gives **declarations**, plain data that say what exists, to its
//! feature builder ([`FeatureBuilder`](crate::core::registry::FeatureBuilder));
//! the registry passes them here when it builds the language, and minting
//! builds every specification from them:
//!
//! - an element declaration ([`ElementDef`]): an element together with the
//! syntax it is written in (macro, environment or special character sequence),
//! its arguments, its body, and the parsing modes it is available in (text
//! mode unless it lists its modes, [`ElementDef::modes`]);
//! - a fallback ([`FallbackDef`]): what a macro or an environment that no
//! declaration defines means, in the parsing modes the fallback lists;
//! - a scoped package ([`ScopedPackageDef`]): a set of element declarations
//! that is on no scope stack until something adds it: the declaration of an
//! environment body or an argument that refers to the package by name, or a
//! program
//! ([`BuiltLang::scoped_package`](crate::lang::BuiltLang::scoped_package));
//! - an override ([`OverrideDef`]): a feature's statement that its definition
//! of a name replaces another feature's.
//!
//! An argument or a body whose syntax no standard argument kind
//! ([`ArgStdKind`]) can express is still declared this way: the argument
//! declaration holds a parser object of the feature's own
//! ([`FlmArgumentParser`], in [`ArgDef::kind`]), or the body declaration does
//! ([`FlmBodyParser`], in [`BodyDef::parser`]). The name, layout, parsing mode,
//! scoped packages, state events and documentation are declared beside the
//! parser, and this module builds the specification around it: the mode, the
//! scoped packages and the state events ([`ArgDef::events`],
//! [`BodyDef::events`]) become the parsing state the parser reads under, the
//! specification
//! carries the layout for the [block-structure
//! pass](crate::lang::rewrites::blocks), and an argument or a body declared
//! with an opaque wrapper ([`ArgDef::opaque_wrapper`],
//! [`BodyDef::opaque_wrapper`]) has what the parser read placed under a group
//! of the class [`FlmGroupType::OpaqueWrapper`](crate::lang::FlmGroupType::OpaqueWrapper),
//! whose content the pass carries over as written. The library reads a parser object
//! only through the methods of these traits and never tests which parser
//! type it is. The methods return, for instance, the bytes that identify the
//! parser in the [registry digest](crate::model::digest), the hash of
//! everything about a registry that can change what processing produces, and
//! a short description of the syntax the parser reads.
//!
//! # Every specification carries its element
//!
//! Every specification a parse can resolve is one of a **closed list** of
//! FLM-owned types ([`specs`]), and each of them carries the element its nodes
//! receive. [`resolve_element`] therefore gives a node its element by testing
//! the type of its specification, with no name to look up. A specification
//! registered by a feature directly would produce a node with no element
//! ([`UnmintedSpec`]), which is why features declare and this module builds
//! the specifications.
//!
//! # Declaration errors and where they are reported
//!
//! Minting never stops on a faulty declaration: it builds everything that is
//! sound and returns the problems as [`MintError`] values, such as two features
//! defining one name in the same parsing mode, or a reference to a scoped
//! package no feature declares. The language build reports each one as a
//! [`LangBuildError::Mint`](crate::lang::LangBuildError::Mint), and the
//! registry build refuses a language with any such error
//! ([`BuildPhase::Language`](crate::core::registry::BuildPhase::Language)).
//!
//! # Submodules
//!
//! - [`decl`] — the declaration types a feature fills in.
//! - [`parsers`] — the parser objects an argument or a body declaration holds:
//! the traits [`FlmArgumentParser`] and [`FlmBodyParser`], and the standard
//! argument kinds [`ArgStdKind`].
//! - [`codes`] — the syntax of an argument in settings given as data, and its
//! only reader: the structured syntax, a standard argument kind written as a
//! map (`{syntax: delimited-group, delimiters: ["(", ")"]}`), and the
//! argument codes, the short texts that stand for the kinds (`{`, `[`,
//! `r()`, ...).
//! - [`field`] — reading a field node by its name, and the element of a field
//! that a scoped package declares; a field is a macro that a construct
//! absorbs as data, such as the `\label` written after a heading.
//! - [`specs`] — the FLM specification types, the language's own specifications
//! for unknown macros and environments, and [`resolve_element`].
//! - [`packages`] — [`mint_packages`] and its result [`MintedProviders`]: the
//! features' techy packages, the scoped packages, the detection of two
//! features defining one name, and the fallback provider
//! ([`FlmFallbackProvider`]), which resolves a command that no declaration
//! defines.
//!
//! See [features and packages](crate::guide::concepts_overview#features-and-packages)
//! for how features reach a registry, and the guide section [declaring
//! elements](crate::guide::extending#declaring-elements) for a walk through the
//! declaration types.
pub
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;