Skip to main content

Crate maya_mel

Crate maya_mel 

Source
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

§Module Guide

  • parser exposes full and lightweight parse entry points.
  • sema exposes generic semantic analysis at the module root, with advanced command contracts under sema::command_schema and command normalization data under sema::command_norm.
  • maya exposes Maya-specific fact collection at the module root, with detailed fact model types under maya::model.
  • ast, syntax, and lexer expose 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.
DecodeDiagnostic
A diagnostic emitted while decoding non-UTF-8 source into display text.
Diagnostic
Semantic diagnostic with primary and secondary labels.
DiagnosticLabel
A labeled span attached to a Diagnostic.
MayaCommandRegistry
Builtin Maya command registry implementation. Builtin Maya command registry embedded in the crate.
MayaTopLevelFacts
Top-level Maya facts collected from a full parse.
Parse
Owned full-parse result for source text plus all parser-side diagnostics.
ParseBudgets
Resource budgets enforced by full and lightweight parse entry points.
ParseError
A parse error emitted after lexing succeeds.
ParseOptions
Options shared by the full parse entry points.

Enums§

DiagnosticFilter
Filter used by diagnostics-only semantic entry points.
DiagnosticSeverity
Diagnostic severity emitted by semantic analysis.
ParseMode
Parser behavior presets for MEL files, snippets, and Maya Expression Editor source.
SourceEncoding
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.