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),
interfaces (.mli) and types.
Typically, you will use LANGUAGE_OCAML 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();
let language = tree_sitter_ocaml::LANGUAGE_OCAML;
parser
.set_language(&language.into())
.expect("Error loading OCaml language");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());Use LANGUAGE_OCAML_INTERFACE to parse interface
files (with .mli extension) and LANGUAGE_OCAML_TYPE
to parse type signatures.
Constants
- The syntax highlighting query for OCaml.
- The content of the
node-types.jsonfile for OCaml interfaces. - The tree-sitter
LanguageFnfor OCaml. - The tree-sitter
LanguageFnfor OCaml interfaces. - The tree-sitter
LanguageFnfor OCaml types. - The local-variable syntax highlighting query for OCaml.
- The content of the
node-types.jsonfile for OCaml. - The symbol tagging query for OCaml.
- The content of the
node-types.jsonfile for OCaml types.