Crate tree_sitter_ocaml[−][src]
This crate provides OCaml and OCaml Interface grammars for the tree-sitter parsing library.
Typically, you will use the language_ocaml function to add this grammar to a tree-sitter Parser, and then use the parser to parse some code:
use tree_sitter::Parser; let code = r#" module M = struct let x = x end "#; let mut parser = Parser::new(); parser .set_language(tree_sitter_ocaml::language_ocaml()) .expect("Error loading ocaml grammar"); let parsed = parser.parse(code, None).unwrap(); let root = parsed.root_node(); assert!(!root.has_error());
Constants
HIGHLIGHT_QUERY | The syntax highlighting query for this language. |
INTERFACE_NODE_TYPES | |
LOCALS_QUERY | The local-variable syntax highlighting query for this language. |
OCAML_NODE_TYPES | The content of the |
TAGGING_QUERY | The symbol tagging query for this language. |
Functions
language_ocaml | Returns the tree-sitter Language for this OCaml. |
language_ocaml_interface | Returns the tree-sitter Language for TSX. |