ctb_formats_stagel/
stagel.rs

1// SPDX-License-Identifier: AGPL-3.0-or-later
2/*
3This file is part of Collective Toolbox, a database and document workspace and utilities.
4Copyright (C) 2026 Collective Toolbox Developers
5Contact: info@collectivetoolbox.com
6
7This program is free software: you can redistribute it and/or modify it under
8the terms of the GNU Affero General Public License as published by the Free
9Software Foundation, either version 3 of the License, or (at your option) any
10later version.
11
12This program is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
15
16You should have received a copy of the GNU Affero General Public License along
17with this program.  If not, see <https://www.gnu.org/licenses/>.
18*/
19
20//! StageL format compiler, tokenizer, and intermediate representation tools.
21//! Provides JS and Bash output to the degree that they were implemented. JS was the only target that saw significant use (I haven't confirmed if it works well). I wouldn't recommend using this transpiler for anything important; the generated JS is very slow. Eventually I hope to add conversion from StageL to DcText, and provide a more usable implementation in that way.
22
23#[allow(
24    unused_imports,
25    clippy::wildcard_imports,
26    reason = "Standard workspace crate prelude"
27)]
28pub(crate) use ctb_utilities::*;
29
30pub mod codegen;
31pub mod convert;
32pub mod parse;
33pub mod stagel2;
34pub mod stagel3;
35
36#[cfg(test)]
37pub(crate) fn get_stagel_data(key: &str) -> Option<Vec<u8>> {
38    ctb_utilities::load_manifest_fixture(env!("CARGO_MANIFEST_DIR"), key)
39}
40
41#[derive(Debug, Clone)]
42pub(crate) struct Token {
43    pub(crate) pos: String,
44    pub(crate) typ: String,
45    pub(crate) content: String,
46}