diff --git a/runtime/queries/minizinc/highlights.scm b/runtime/queries/minizinc/highlights.scm new file mode 100644 index 000000000..5e85fa148 --- /dev/null +++ b/runtime/queries/minizinc/highlights.scm @@ -0,0 +1,125 @@ +; Function calls +(call + function: (identifier) @function) + +; Function definitions +(function_item + name: (identifier) @function) + +(predicate + name: (identifier) @function) + +; Types +(primitive_type) @type.builtin + +[ + "array" + "of" + "par" + "set" + "var" +] @type.builtin + +; Identifiers +(identifier) @variable + +; Keywords +[ + "annotation" + "constraint" + "else" + "elseif" + "endif" + "enum" + "function" + "if" + "include" + "let" + "maximize" + "minimize" + "output" + "predicate" + "satisfy" + "solve" + "test" + "then" + "where" +] @keyword + +; Operators +[ + "<->" + "->" + "<-" + "\\/" + "xor" + "/\\" + "=" + "==" + "!=" + "<" + "<=" + ">" + ">=" + "in" + "subset" + "superset" + "union" + "diff" + "symdiff" + "intersect" + ".." + "+" + "-" + "++" + "*" + "/" + "div" + "mod" + "^" + "::" +] @operator + +; Punctuation +[ + "," + ":" + ";" + "|" +] @punctuation.delimiter + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +; Literals +[ + (integer_literal) + (float_literal) +] @number + +[ + (string_literal) + (string_interpolation) +] @string + +[ + (escape_sequence) + (escape_interpolation) +] @string.escape + +[ + (absent) + (boolean_literal) +] @constant.builtin + +; Comments +[ + (block_comment) + (line_comment) +] @comment diff --git a/tests/query/highlights/minizinc/test.mzn b/tests/query/highlights/minizinc/test.mzn new file mode 100644 index 000000000..d8e4318cf --- /dev/null +++ b/tests/query/highlights/minizinc/test.mzn @@ -0,0 +1,13 @@ +% include "data.dzn"; +% ^^^^^^^ @keyword.directive +% ^^^^^^^^^^ @string +% ^ @punctuation.delimiter + +var 1..10: x; +% ^^^ @keyword +% ^ @number +% ^^ @operator +% ^^ @number +% ^ @punctuation.delimiter +% ^ @variable +% ^ @punctuation.delimiter