Skip to main content

teksilo_parse/
lib.rs

1// SPDX-License-Identifier: MPL-2.0
2// SPDX-FileCopyrightText: 2026 FernTech
3
4//! Parser and IR for the `teksu!` DSL.
5//!
6//! Extracted from `teksilo-macros` so non-proc-macro consumers (notably
7//! `cargo teksilo-fmt`) can build on the same grammar without depending on
8//! a `proc-macro = true` crate. The proc-macro crate `teksilo-macros`
9//! depends on this crate and only owns the lowering step.
10//!
11//! Surface:
12//!
13//! - [`parse_root`] — entry point. Takes a `proc_macro2::TokenStream`
14//!   and returns a [`TeksiRoot`].
15//! - [`ir`] module — IR types ([`TeksiRoot`], [`TeksiElement`],
16//!   [`BodyItem`], …). All fields are `pub` so consumers can walk and
17//!   reformat the tree.
18//! - [`diag`] module — shared diagnostic helpers and the
19//!   `is_widget_builder_method` / `is_category_b_widget` predicates
20//!   used by both lowering and pretty-printing.
21//!
22//! See `engineering/docs/teksu-language-spec-v3.md` for the surface language.
23
24pub mod diag;
25pub mod ir;
26mod parse;
27
28pub use ir::{
29    BodyItem, PropArg, RustShape, TeksiElement, TeksiElse, TeksiFor, TeksiIf, TeksiMatch,
30    TeksiMatchArm, TeksiProperty, TeksiRoot,
31};
32pub use parse::parse_root;