@@ -0,0 +1,91 @@
1+; Highlights queries from Matthew Fluet (https://github.com/MatthewFluet/tree-sitter-sml)
2+;
3+; MIT License
4+;
5+; Copyright (c) 2022 Matthew Fluet
6+;
7+; Permission is hereby granted, free of charge, to any person obtaining a copy
8+; of this software and associated documentation files (the "Software"), to deal
9+; in the Software without restriction, including without limitation the rights
10+; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+; copies of the Software, and to permit persons to whom the Software is
12+; furnished to do so, subject to the following conditions:
13+;
14+; The above copyright notice and this permission notice shall be included in all
15+; copies or substantial portions of the Software.
16+;
17+; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+; SOFTWARE.
24+
25+;; *******************************************************************
26+;; Comments
27+;; *******************************************************************
28+
29+[(block_comment) (line_comment)] @comment
30+
31+;; *******************************************************************
32+;; Keywords
33+;; *******************************************************************
34+
35+[
36+ ;; Reserved Words Core
37+ "abstype" "and" "andalso" "as" "case" "datatype" "do" "else" "end"
38+ "exception" "fn" "fun" "handle" "if" "in" "infix" "infixr" "let"
39+ "local" "nonfix" "of" "op" "open" "orelse" "raise" "rec" "then"
40+ "type" "val" "with" "withtype" "while"
41+ ;; Reserved Words Modules
42+ "eqtype" "functor" "include" "sharing" "sig" "signature" "struct"
43+ "structure" "where"
44+] @keyword
45+
46+;; *******************************************************************
47+;; Constants
48+;; *******************************************************************
49+
50+(integer_scon) @constant.numeric.integer
51+(real_scon) @constant.numeric.float
52+(word_scon) @constant.numeric
53+(string_scon) @string
54+(char_scon) @constant.character
55+
56+;; *******************************************************************
57+;; Types
58+;; *******************************************************************
59+
60+(fn_ty "->" @type)
61+(tuple_ty "*" @type)
62+(paren_ty ["(" ")"] @type)
63+(tyvar_ty (tyvar) @type)
64+(record_ty
65+ ["{" "," "}"] @type
66+ (tyrow [(lab) ":"] @type)?
67+ (ellipsis_tyrow ["..." ":"] @type)?)
68+(tycon_ty
69+ (tyseq ["(" "," ")"] @type)?
70+ (longtycon) @type)
71+
72+;; *******************************************************************
73+;; Constructors
74+;; *******************************************************************
75+
76+;; Assume value identifiers starting with capital letter are constructors
77+((vid) @constructor
78+ (#match? @constructor "^[A-Z].*"))
79+
80+((vid) @constant.builtin (#eq? @constant.builtin "nil"))
81+((vid) @constant.builtin.boolean
82+ (#match? @constant.builtin.boolean "^(true|false)$"))
83+((vid) @operator (#eq? @operator "::"))
84+((vid) @keyword.storage.modifier (#eq? @keyword.storage.modifier "ref"))
85+
86+;; *******************************************************************
87+;; Punctuation
88+;; *******************************************************************
89+
90+["(" ")" "[" "]" "{" "}"] @punctuation.bracket
91+["." "," ":" ";" "|" "=>" ":>"] @punctuation.delimiter