package tree-sitter
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9
doc/tree-sitter.ocaml/Tree_sitter_ocaml/index.html
Module Tree_sitter_ocamlSource
Tree-sitter OCaml grammars with built-in highlighting.
This module provides grammars for three OCaml dialects — implementation files (.ml), interface files (.mli), and standalone type expressions — together with convenience highlighting functions.
let ranges = Tree_sitter_ocaml.highlight_ocaml "let x = 1"
(* ranges : (int * int * string) list *)Languages
ocaml () is the grammar for OCaml implementation files (.ml).
interface () is the grammar for OCaml interface files (.mli).
type_ () is the grammar for standalone OCaml type expressions.
Highlighting
ocaml_highlights_query is the highlight query source for OCaml implementation files. Targets comments, strings, types, keywords, variables, and numbers.
interface_highlights_query is the highlight query source for OCaml interface files. Currently identical to ocaml_highlights_query.
highlight_ocaml content parses content as OCaml and returns (start_byte, end_byte, capture_group) triples. Equivalent to parsing with ocaml and running Tree_sitter.highlight with ocaml_highlights_query.
highlight_interface content parses content as an OCaml interface and returns (start_byte, end_byte, capture_group) triples. Equivalent to parsing with interface and running Tree_sitter.highlight with interface_highlights_query.