diff --git a/package.json b/package.json index e75a63e..130815f 100644 --- a/package.json +++ b/package.json @@ -27,5 +27,15 @@ "devDependencies": { "prettier": "2.2.1", "tree-sitter-cli": "^0.16.9" - } + }, + "tree-sitter": [ + { + "scope": "source.minizinc", + "file-types": [ + "mzn", + "fzn", + "dzn" + ] + } + ] } diff --git a/queries/highlights.scm b/queries/highlights.scm new file mode 100644 index 0000000..c68f904 --- /dev/null +++ b/queries/highlights.scm @@ -0,0 +1,114 @@ +; Function calls +(call name: (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" + "function" + "if" + "in" + "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 + +[ + (absent) + (boolean_literal) +] @constant.builtin + +; Comments +[ + (block_comment) + (line_comment) +] @comment