From 492c9eed2e10a320e2115c65a051daf4b4066d95 Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Sun, 20 Aug 2023 19:13:32 +0200 Subject: [PATCH] Exclude infix operators from the keywords list --- ocaml-ts-mode.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ocaml-ts-mode.el b/ocaml-ts-mode.el index 21b8b60..d85468c 100644 --- a/ocaml-ts-mode.el +++ b/ocaml-ts-mode.el @@ -238,7 +238,10 @@ (catch-all ,dangle-parent (,default-ofs)))))) -(defvar ocaml-ts-mode--keywords (string-split " +(defvar ocaml-ts-mode--keywords + (let ((infix-operators '("asr" "land" "lor" "lsl" "lsr" "lxor" "or" "mod"))) + (seq-remove (lambda (k) (seq-position infix-operators k)) + (string-split " and as assert asr begin class constraint do done downto else end exception external false for fun function @@ -248,9 +251,10 @@ new nonrec object of open or private rec sig struct then to true try type val virtual when - while with") + while with"))) "OCaml keywords for tree-sitter font-locking. -List taken directly from https://v2.ocaml.org/manual/lex.html.") +List taken directly from https://v2.ocaml.org/manual/lex.html. +Infix operators are parsed and fontified separately.") (defvar ocaml-ts-mode--constants '((unit) "true" "false")