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
//! The FLM language: the language type techy's parser runs with, the parse
//! entry points, and everything a parse needs.
//!
//! techy, the parser toolkit FLM is built on, supplies the tokenizer, the parser
//! and the node tree. It is generic over a *language*: a set of types that says
//! which kinds of groups and callables exist, which data is attached to parsing
//! states and nodes, and which behavior runs during a parse. This module defines
//! FLM's language, builds it from what the [features](crate::core::registry::FlmFeature)
//! declare, and parses sources with it.
//!
//! The intended entry points are two functions. [`build_language`] turns the
//! features' declarations ([`LangInputs`]) into a [`BuiltLang`]; the registry
//! calls it once when it is built, and a caller usually takes the result from
//! [`FlmRegistry::lang`](crate::core::registry::FlmRegistry::lang).
//! [`parse_fragment`] parses one source under a [`BuiltLang`] and returns a
//! [`Fragment`](crate::model::doc::Fragment): the tree, its source and the
//! diagnostics of the parse. A document of several files is parsed through
//! [`crate::model::assemble`], which uses the same machinery.
//!
//! This module depends only on the lower layers of the crate ([`crate::model`]:
//! names, elements, aspects, the document); the registry, the pipeline and the
//! standard features are built on top of it.
//!
//! # The submodules and what each holds
//!
//! - [`flm`] — the language type [`Flm`], the group classes
//! ([`FlmGroupType`]), the callable forms ([`FlmCallableType`]) and the
//! state events ([`FlmEvent`]); [`Flm`] gives every node its element.
//! - [`origin`] — [`FlmOrigin`], where a source comes from, and the aliases
//! [`FlmSource`], [`FlmSpan`], [`FlmDiagnostic`] and [`FlmDiagnostics`].
//! - [`ext`] — the data FLM attaches to parsing states ([`FlmStateExt`]) and to
//! nodes ([`FlmNodeExt`]), and the typed payload of a node ([`PresPayload`]).
//! - [`structural`] — the structural elements ([`StructuralElements`]): the
//! elements of the node shapes that no feature declares.
//! - [`rules`] — [`FlmParsing`], the parsing settings a document may set, and
//! their translation into techy's tokenizer rules.
//! - [`driver`] — [`FlmDriver`], the object holding the behavior and the
//! settings of a running parse.
//! - [`mint`] — the element declarations a feature contributes, and minting:
//! building from them the techy packages and specifications a parse resolves
//! names against.
//! - [`chars_group`] and [`verbatim`] — the parsers of the two restricted
//! argument shapes: arguments read as plain characters (`\label{…}`) and raw
//! text (`\verbcode{…}`, verbatim environments).
//! - [`build`] — [`build_language`], which assembles all of the above into a
//! [`BuiltLang`].
//! - [`owned`] — [`LangOwned`], the cell through which an element reads a
//! value built against its own language, such as a compiled template.
//! - [`parse`] — [`parse_fragment`] and the ways a parse can fail
//! ([`FragmentError`]).
//! - [`input`] — the command `\input`: what the library asks of the embedding
//! program to read another file ([`InputResolver`]), and the parser of the
//! command.
//! - [`guard`] — the recursion guard and the worker threads every recursive
//! operation runs on.
//! - [`copy`] — building a [synthesized
//! value](crate::guide::concepts_overview#synthesized-values), a small tree
//! held outside the document, from nodes of an existing tree.
//! - [`text`] — reading the characters of content: its plain text, or the
//! characters of an argument that holds nothing else.
//! - [`rewrites`] — the three rewrite passes: splicing included files,
//! expanding user definitions, and laying content out in paragraphs and
//! blocks.
//! - [`serialize`] — storing an FLM parse in techy's serialized form and reading
//! it back.
//!
//! # Guarantees that hold across the module
//!
//! - **Every node has an element, and finding it needs no name lookup.** A
//! callable node's specification is always one of the wrapper types that
//! [`mint`] builds, each carrying its element, and every other node shape
//! takes its element from the [`StructuralElements`] the parsing state
//! carries. See [structural
//! elements](crate::guide::concepts_overview#structural-elements).
//! - **Every recursive operation is guarded and runs on a worker thread.**
//! Deeply nested input is refused with a diagnostic instead of overflowing the
//! stack; see [the recursion guard and worker
//! threads](crate::guide::concepts_overview#the-recursion-guard-and-worker-threads).
//! - **Raw text is always wrapped.** Every run of verbatim content is a child
//! of a group node of the verbatim class, so whether content is verbatim is
//! one question about a node anywhere in the library. See [verbatim
//! regions](crate::guide::concepts_overview#verbatim-regions).
//! - **A parse is tolerant.** A problem in the source becomes a
//! [diagnostic](crate::guide::concepts_overview#diagnostics) attached to the
//! fragment, and the tree still covers the whole input; [`FragmentError`]
//! lists the only cases with no tree.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use LangOwned;
pub use ;
pub use FlmParsing;
pub use StructuralElements;
// Not part of the public interface: the span a condition with no position in
// any document is reported at, spelled once for the whole crate.
pub use nowhere;