openscad_rs/lib.rs
1//! # openscad-rs
2//!
3//! A high-performance `OpenSCAD` parser library for Rust.
4//!
5//! Parses `.scad` source files into a well-typed AST suitable for
6//! building compilers, formatters, linters, and language servers.
7//!
8//! ## Quick Start
9//!
10//! ```rust
11//! use openscad_rs::parse;
12//!
13//! let source = r#"
14//! module box(size = 10) {
15//! cube(size);
16//! }
17//! box(size = 20);
18//! "#;
19//!
20//! let ast = parse(source).expect("parse error");
21//! println!("Parsed {} statements", ast.statements.len());
22//! ```
23
24// Suppress false positive from thiserror/miette derive macros
25#![allow(unused_assignments)]
26
27pub mod ast;
28pub mod error;
29pub mod lexer;
30pub mod parser;
31pub mod span;
32pub mod token;
33pub mod visit;
34
35// Re-exports for convenience
36pub use ast::{
37 Argument, BinaryOp, Expr, ExprKind, Modifiers, Parameter, SourceFile, Statement, UnaryOp,
38};
39pub use error::{ParseError, ParseResult};
40pub use parser::parse;
41pub use span::Span;
42pub use visit::Visitor;