Language support for moss.
This crate provides the Language trait and implementations for
various programming languages. Each language struct IS its support implementation.
Grammars are loaded dynamically from shared libraries via GrammarLoader.
Build grammars with cargo xtask build-grammars.
Feature Flags
Languages are gated behind feature flags for customizability:
langs-all(default): All languageslangs-core: Common languages (Python, JS, TS, Rust, Go, Java, etc.)langs-functional: Haskell, OCaml, Elixir, etc.langs-config: JSON, YAML, TOML, HCL, etc.lang-*: Individual language flags
Example
use normalize_languages::{Python, Language, support_for_path, GrammarLoader};
use std::path::Path;
// Load grammars
let loader = GrammarLoader::new();
let python_grammar = loader.get("python").expect("grammar not found");
// Static usage (compile-time known language):
println!("Python function kinds: {:?}", Python.function_kinds());
// Dynamic lookup (from file path):
if let Some(support) = support_for_path(Path::new("foo.py")) {
println!("Language: {}", support.name());
}