Treat ocaml tags as atoms too

pull/101/head
Wilfred Hughes 2022-01-15 11:00:41 +07:00
parent f7626ba249
commit 2d4ab5e494
4 changed files with 13 additions and 2 deletions

@ -8,7 +8,7 @@ trimming rules.
Fixed parsing of heredocs in shell scripts. They are now treated as Fixed parsing of heredocs in shell scripts. They are now treated as
string literals. string literals.
Fixed parsing of type variables in OCaml. Fixed parsing of type variables and tags in OCaml.
Improved language detection for files with bash/sh syntax. Improved language detection for files with bash/sh syntax.

@ -1,3 +1,8 @@
type foo = type foo =
| Bar | Bar
| Biz of ('ex, 'en) list | Biz of ('ex, 'en) list
let do_stuff x =
match x with
| `Foo -> 1
| _ -> 3

@ -2,3 +2,9 @@ type foo =
| Bar | Bar
| Baz of int * ('ex, 'en) list | Baz of int * ('ex, 'en) list
| Biz of ('ex, 'en) list | Biz of ('ex, 'en) list
let do_stuff x =
match x with
| `Foo -> 1
| `Bar -> 2
| _ -> 3

@ -207,7 +207,7 @@ pub fn from_language(language: guess::Language) -> TreeSitterConfig {
OCaml => TreeSitterConfig { OCaml => TreeSitterConfig {
name: "OCaml", name: "OCaml",
language: unsafe { tree_sitter_ocaml() }, language: unsafe { tree_sitter_ocaml() },
atom_nodes: (vec!["character", "string", "type_variable"]) atom_nodes: (vec!["character", "string", "tag", "type_variable"])
.into_iter() .into_iter()
.collect(), .collect(),
// TODO: begin/end and object/end. // TODO: begin/end and object/end.