1 unstable release

0.3.0 Jun 27, 2024

#2852 in Parser implementations

MIT license

43KB
1.5K SLoC

C 1.5K SLoC JavaScript 70 SLoC // 0.1% comments Rust 29 SLoC Scheme 9 SLoC

tree-sitter-xcompose

CI discord matrix

A tree-sitter parser for XCompose files.

References

Editors

  • Neovim
  • Helix
  • Emacs
  • Zed

lib.rs:

This crate provides XCompose language support for the tree-sitter parsing library.

Typically, you will use the language function to add this language to a tree-sitter Parser, and then use the parser to parse some code:

let code = r#"
include "%L"

<Multi_key> <g> <a> : "α"
<Multi_key> <g> <b> : "β"
<Multi_key> <g> <g> : "γ"
"#;
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_xcompose::language();
parser.set_language(&language).expect("Error loading xcompose grammar");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

Dependencies

~2.8–4MB
~78K SLoC