yog_script_analyze/system.rs
1//! The System library's declarations (`system/**/*.ys`: one type a file,
2//! its folders its namespace), read once and seen by every source as its
3//! own types are. Its names are `yog_script_ids::system`'s.
4
5use yog_sync::LazyLock;
6
7use crate::ast::Decl;
8
9// `SOURCES`: every `.ys` under `src/system/`, listed by `build.rs`.
10include!(concat!(env!("OUT_DIR"), "/system_sources.rs"));
11
12/// The library's sources: each one's path under `src/system/` and its text.
13pub fn sources() -> &'static [(&'static str, &'static str)] {
14 SOURCES
15}
16
17/// Every declaration of the library, parsed once.
18pub static DECLS: LazyLock<Vec<Decl>> = LazyLock::new(|| {
19 SOURCES
20 .iter()
21 .flat_map(|(name, src)| crate::parse(name, src).file.decls)
22 .collect()
23});