pub fn new_parser(language: SupportedLanguage) -> Result<Parser>Expand description
Creates a new Parser configured for the given language.
§Errors
Returns an error if Tree-sitter fails to set the language (should not happen with compiled-in grammars).
§Examples
use sephera_compression::{SupportedLanguage, new_parser};
let mut parser = new_parser(SupportedLanguage::Rust).unwrap();
let tree = parser.parse("fn main() {}", None).unwrap();
assert!(!tree.root_node().has_error());