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 "(?