Expand description
Parse and analyze Autodesk Maya MEL from a single crate.
maya-mel is the public library entry point for this workspace. It keeps
the common MEL workflow available from one dependency while leaving
lower-level syntax, parsing, and Maya-specific layers available as public
modules when you need tighter control.
§Quick Start
use maya_mel::{analyze, collect_top_level_facts, parse_source};
let parsed = parse_source("global proc hello() {}");
let analysis = analyze(&parsed.syntax, parsed.source_view());
let facts = collect_top_level_facts(&parsed);
assert!(analysis.diagnostics.is_empty());
assert!(!facts.items.is_empty());use maya_mel::{MayaCommandRegistry, collect_top_level_facts_with_registry, parse_source};
let parsed = parse_source("createNode transform -n \"root\";");
let facts = collect_top_level_facts_with_registry(&parsed, &MayaCommandRegistry::new());
assert_eq!(facts.items.len(), 1);§Common Workflows
- Use
parse_sourceorparse_fileto build a typed MEL syntax tree. - Use
analyzeto resolve generic MEL semantics and collect diagnostics. - Use
collect_top_level_factsto gather Maya-specific command facts. - Use
MayaCommandRegistrywithanalyze_with_registryorcollect_top_level_facts_with_registrywhen builtin Maya command metadata matters. - Use
parser,sema, ormayadirectly for advanced workflows.
§Module Guide
parserexposes full and lightweight parse entry points.semaexposes generic semantic analysis at the module root, with advanced command contracts undersema::command_schemaand command normalization data undersema::command_norm.mayaexposes Maya-specific fact collection at the module root, with detailed fact model types undermaya::model.ast,syntax, andlexerexpose lower-level structures.
There is intentionally no crate prelude. The crate root stays small and covers the common parse/analyze/fact-collection workflow, while explicit module paths carry the advanced surfaces.
§Stability
This crate is published as experimental 0.x. Root-level APIs are intended
to cover the common workflow, while advanced surfaces may continue to move
between releases.
Modules§
- ast
- Typed MEL syntax tree structures returned by the parser. Typed AST shapes used by the parser and semantic layers.
- lexer
- MEL tokenization utilities and lexer entry points. MEL lexer entry points.
- maya
- Maya-specific metadata, registries, and top-level fact collection. Maya-specific command registries and top-level fact collection.
- parser
- Full and lightweight MEL parsing entry points. Full and lightweight MEL parsing entry points.
- sema
- Generic semantic analysis and command normalization. Generic semantic analysis for MEL syntax trees.
- syntax
- Shared spans, tokens, and source mapping primitives. Shared spans, tokens, and source mapping primitives.
Structs§
- Analysis
- Full semantic analysis result.
- Decode
Diagnostic - A diagnostic emitted while decoding non-UTF-8 source into display text.
- Diagnostic
- Semantic diagnostic with primary and secondary labels.
- Diagnostic
Label - A labeled span attached to a
Diagnostic. - Maya
Command Registry - Builtin Maya command registry implementation. Builtin Maya command registry embedded in the crate.
- Maya
TopLevel Facts - Top-level Maya facts collected from a full parse.
- Parse
- Owned full-parse result for source text plus all parser-side diagnostics.
- Parse
Budgets - Resource budgets enforced by full and lightweight parse entry points.
- Parse
Error - A parse error emitted after lexing succeeds.
- Parse
Options - Options shared by the full parse entry points.
Enums§
- Diagnostic
Filter - Filter used by diagnostics-only semantic entry points.
- Diagnostic
Severity - Diagnostic severity emitted by semantic analysis.
- Parse
Mode - Parser behavior presets for MEL files, snippets, and Maya Expression Editor source.
- Source
Encoding - Supported source encodings for byte-oriented parse entry points.
Functions§
- analyze
- Run semantic analysis without a command registry.
- analyze_
diagnostics_ with_ registry - Collect only diagnostics while still using a command registry.
- analyze_
diagnostics_ with_ registry_ filtered - Collect only diagnostics with an explicit
DiagnosticFilter. - analyze_
with_ registry - Run semantic analysis with a caller-provided command registry.
- collect_
top_ level_ facts - Full-parse top-level fact collection. Collect Maya-oriented top-level facts from a full parse.
- collect_
top_ level_ facts_ shared - Full-parse top-level fact collection. Collect Maya-oriented top-level facts from a shared full parse.
- collect_
top_ level_ facts_ shared_ with_ registry - Full-parse top-level fact collection. Collect Maya-oriented top-level facts from a shared parse with an additional registry.
- collect_
top_ level_ facts_ with_ registry - Full-parse top-level fact collection. Collect Maya-oriented top-level facts using an additional command registry.
- parse_
bytes - Decode and parse bytes using automatic encoding detection.
- parse_
bytes_ with_ encoding - Decode and parse bytes with an explicit source encoding.
- parse_
file - Read, decode, and parse a file using automatic encoding detection.
- parse_
file_ with_ encoding - Read, decode, and parse a file with an explicit encoding.
- parse_
file_ with_ encoding_ and_ options - Read, decode, and parse a file with an explicit encoding and
ParseOptions. - parse_
file_ with_ options - Read, decode, and parse a file using explicit
ParseOptions. - parse_
source - Parse a UTF-8 source string into a full AST.
- parse_
source_ with_ options - Parse a UTF-8 source string with explicit
ParseOptions.