Crate tree_sitter_ocaml
source ·Expand description
This crate provides OCaml language support for the tree-sitter parsing
library. There are separate languages for implementation (.ml
) and
interface (.mli
) files.
Typically, you will use the language_ocaml function to add this language to a tree-sitter Parser, and then use the parser to parse some code:
let code = r#"
module M = struct
let x = 0
end
"#;
let mut parser = tree_sitter::Parser::new();
parser
.set_language(&tree_sitter_ocaml::language_ocaml())
.expect("Error loading OCaml grammar");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());
Constants§
- The syntax highlighting query for OCaml.
- The content of the
node-types.json
file for OCaml interfaces. - The local-variable syntax highlighting query for OCaml.
- The content of the
node-types.json
file for OCaml. - The symbol tagging query for OCaml.