Added highlights.scm and tests.mzn

This commit is contained in:
Kelvin Davis 2026-02-06 10:22:35 +11:00
parent 30d2648f94
commit ee8c109cbd
2 changed files with 138 additions and 0 deletions

View file

@ -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

View file

@ -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