maya_mel/lib.rs
1#![forbid(unsafe_code)]
2#![deny(rustdoc::bare_urls, rustdoc::broken_intra_doc_links)]
3//! Parse and analyze Autodesk Maya MEL from a single crate.
4//!
5//! `maya-mel` is the public library entry point for this workspace. It keeps
6//! the common MEL workflow available from one dependency while leaving
7//! lower-level syntax, parsing, and Maya-specific layers available as public
8//! modules when you need tighter control.
9//!
10//! # Quick Start
11//!
12//! ```rust
13//! use maya_mel::{analyze, collect_top_level_facts, parse_source};
14//!
15//! let parsed = parse_source("global proc hello() {}");
16//! let analysis = analyze(&parsed.syntax, parsed.source_view());
17//! let facts = collect_top_level_facts(&parsed);
18//!
19//! assert!(analysis.diagnostics.is_empty());
20//! assert!(!facts.items.is_empty());
21//! ```
22//!
23//! ```rust
24//! use maya_mel::{MayaCommandRegistry, collect_top_level_facts_with_registry, parse_source};
25//!
26//! let parsed = parse_source("createNode transform -n \"root\";");
27//! let facts = collect_top_level_facts_with_registry(&parsed, &MayaCommandRegistry::new());
28//!
29//! assert_eq!(facts.items.len(), 1);
30//! ```
31//!
32//! # Common Workflows
33//!
34//! - Use [`parse_source`] or [`parse_file`] to build a typed MEL syntax tree.
35//! - Use [`analyze`] to resolve generic MEL semantics and collect diagnostics.
36//! - Use [`collect_top_level_facts`] to gather Maya-specific command facts.
37//! - Use [`MayaCommandRegistry`] with [`analyze_with_registry`] or
38//! [`collect_top_level_facts_with_registry`] when builtin Maya command metadata matters.
39//! - Use [`parser`], [`sema`], or [`maya`] directly for advanced workflows.
40//!
41//! # Module Guide
42//!
43//! - [`parser`] exposes full and lightweight parse entry points.
44//! - [`sema`] exposes generic semantic analysis at the module root, with
45//! advanced command contracts under [`sema::command_schema`] and command
46//! normalization data under [`sema::command_norm`].
47//! - [`maya`] exposes Maya-specific fact collection at the module root, with
48//! detailed fact model types under [`maya::model`].
49//! - [`ast`], [`syntax`], and [`mod@lexer`] expose lower-level structures.
50//!
51//! There is intentionally no crate prelude. The crate root stays small and
52//! covers the common parse/analyze/fact-collection workflow, while explicit
53//! module paths carry the advanced surfaces.
54//!
55//! # Stability
56//!
57//! This crate is published as experimental `0.x`. Root-level APIs are intended
58//! to cover the common workflow, while advanced surfaces may continue to move
59//! between releases.
60
61extern crate self as mel_ast;
62extern crate self as mel_lexer;
63extern crate self as mel_maya;
64extern crate self as mel_parser;
65extern crate self as mel_sema;
66extern crate self as mel_syntax;
67
68/// Typed MEL syntax tree structures returned by the parser.
69pub mod ast;
70/// MEL tokenization utilities and lexer entry points.
71pub mod lexer;
72/// Maya-specific metadata, registries, and top-level fact collection.
73pub mod maya;
74/// Full and lightweight MEL parsing entry points.
75pub mod parser;
76/// Generic semantic analysis and command normalization.
77pub mod sema;
78/// Shared spans, tokens, and source mapping primitives.
79pub mod syntax;
80
81pub(crate) use maya::{model, normalize, registry, specialize, validate};
82pub(crate) use parser::decode;
83pub(crate) use sema::{command_norm, command_schema, scope};
84
85pub(crate) use ast::*;
86pub(crate) use lexer::*;
87pub(crate) use parser::*;
88pub(crate) use sema::{command_norm::*, command_schema::*, *};
89pub(crate) use syntax::*;
90
91#[doc(inline)]
92pub use maya::model::MayaTopLevelFacts;
93#[doc(inline)]
94pub use maya::{
95 MayaCommandRegistry, collect_top_level_facts, collect_top_level_facts_shared,
96 collect_top_level_facts_shared_with_registry, collect_top_level_facts_with_registry,
97};
98#[doc(inline)]
99pub use parser::{
100 DecodeDiagnostic, Parse, ParseBudgets, ParseError, ParseMode, ParseOptions, SourceEncoding,
101 parse_bytes, parse_bytes_with_encoding, parse_file, parse_file_with_encoding,
102 parse_file_with_encoding_and_options, parse_file_with_options, parse_source,
103 parse_source_with_options,
104};
105#[doc(inline)]
106pub use sema::{
107 Analysis, Diagnostic, DiagnosticFilter, DiagnosticLabel, DiagnosticSeverity, analyze,
108 analyze_diagnostics_with_registry, analyze_diagnostics_with_registry_filtered,
109 analyze_with_registry,
110};