From 22a94b9d35df01b75390eb1b5f92d0e4bae5ec2b Mon Sep 17 00:00:00 2001 From: Murray Calavera Date: Tue, 23 Jun 2020 12:46:59 +0100 Subject: [PATCH] Add highlighters for Standard ML --- rc/filetype/mlb.kak | 50 ++++++++++++++++++++++++++ rc/filetype/sml.kak | 86 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 rc/filetype/mlb.kak create mode 100644 rc/filetype/sml.kak diff --git a/rc/filetype/mlb.kak b/rc/filetype/mlb.kak new file mode 100644 index 00000000..aa174234 --- /dev/null +++ b/rc/filetype/mlb.kak @@ -0,0 +1,50 @@ +# http://mlton.org/MLBasis +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +# Detection +# ‾‾‾‾‾‾‾‾‾ + +hook global BufCreate .*\.mlb %{ + set-option buffer filetype mlb +} + +# Initialization +# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ + +hook global WinSetOption filetype=mlb %{ + require-module mlb + set-option buffer extra_word_chars '_' '-' '.' + set-option window static_words %opt{mlb_static_words} +} + +hook -group mlb-highlight global WinSetOption filetype=mlb %{ + add-highlighter window/mlb ref mlb + hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/mlb } +} + +provide-module mlb %[ + +# Highlighters +# ‾‾‾‾‾‾‾‾‾‾‾‾ + +add-highlighter shared/mlb regions +add-highlighter shared/mlb/code default-region group +add-highlighter shared/mlb/string region '"' '(?%%&$?`\\#:|]+" 0:operator + +# Record projection functions +add-highlighter shared/sml/code/ regex "(?%%&$?`\\#:|])#([\w']+)?(?![!*/+\-~\^@=<>%%&$?`\\#:|])" 0:function + +# Symbolic keywords +add-highlighter shared/sml/code/ regex "(?%%&$?`\\#:|])(=>|=|\*|->|:>|:|;|\.\.\.|\b_\b|\|)(?![!*/+\-~\^@=<>%%&$?`\\#:|])" 0:keyword + +# Type variables +add-highlighter shared/sml/code/ regex "(?