Skip to main content

register_with_grammar

Function register_with_grammar 

Source
pub fn register_with_grammar(
    name: &str,
    extensions: &[&str],
    grammar: &GrammarSpec,
    provenance: u64,
) -> Result<LanguageName, LanguageRegistrationError>
Expand description

Register a language with its grammar and queries (LG.3a).

The complete form: identity, selection, and everything crate::LangRegistry needs to parse, highlight, fold and indent the language. register is the identity-only subset, kept for callers that have no grammar to offer.

Atomic across both registries. The queries are compiled first, the name is claimed second, and the compiled config is installed only once both have succeeded. So a malformed folds.scm leaves the language absent rather than resolvable-but-dead, and a name collision leaves the winner’s grammar untouched.