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§

Functions§