luau_parser/types/
mod.rs

1//! # Types module
2//!
3//! This just reexports the struct and traits for easier importing.
4//!
5//! ## Note
6//!
7//! This file only contains the definitions for items, for actual implementations,
8//! check the files under `src/impl`. Each type will have it's implementation in
9//! the same place, ex. types in `types/value/function.rs` will have
10//! their implementations in `impl/value/function.rs`. The only `impl`
11//! here is for `Statement`, and it isn't exposed directly to consumers of this
12//! crate, but rather through other functions.
13
14use std::rc::Rc;
15
16/// A helper macro to reexport modules.
17macro_rules! reexport {
18    ($($name: ident),* $(,)?) => {
19        $( mod $name; )*
20        $( pub use $name::*; )*
21    };
22}
23
24reexport!(block, bracketed, cst, expression, list, literals, name, range, traits, value);
25
26/// The main pointer used in the [`Cst`]. It's just [`Rc`]. The only reason
27/// this type exists is to allow easily switching to others, like [`Box`] or
28/// [`Arc`](std::sync::Arc) by only editing one line instead of mass refactoring.
29pub type Pointer<T> = Rc<T>;
30
31/// An enum representing printing errors that stopped [`Cst::try_print`] from working.
32#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
33#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
34pub enum PrintingError {
35    /// The [`CST`](Cst) has syntax errors.
36    ErroneousCst,
37}