MiniZinc language support for Zed

update tree-sitter grammar configuration

Add support for FlatZinc and DataZinc as separate languages.

dekker.one 0ea5a042 5d3ddc44

verified
+300
+2
.gitignore
··· 1 + # zed install dev extension 2 + grammars/
+5
extension.toml
··· 10 10 repository = "https://github.com/shackle-rs/shackle.git" 11 11 commit = "a1090067ad19e24fabc0afb751a057a1926a4b85" 12 12 path = "parsers/tree-sitter-minizinc" 13 + 14 + [grammars.datazinc] 15 + repository = "https://github.com/shackle-rs/shackle.git" 16 + commit = "a1090067ad19e24fabc0afb751a057a1926a4b85" 17 + path = "parsers/tree-sitter-datazinc"
+4
languages/datazinc/brackets.scm
··· 1 + ("[" @open "]" @close) 2 + ("{" @open "}" @close) 3 + (("\"" @open "\"" @close) (#set! rainbow.exclude)) 4 + ("(" @open ")" @close)
+4
languages/datazinc/config.toml
··· 1 + name = "DataZinc" 2 + grammar = "datazinc" 3 + path_suffixes = ["dzn"] 4 + line_comments = ["% "]
+45
languages/datazinc/highlights.scm
··· 1 + ; Identifiers 2 + (identifier) @variable 3 + 4 + ; Operators 5 + [ 6 + "=" 7 + ] @operator 8 + 9 + ; Punctuation 10 + [ 11 + "," 12 + ":" 13 + ";" 14 + "|" 15 + ] @punctuation.delimiter 16 + [ 17 + "(" 18 + ")" 19 + "[" 20 + "]" 21 + "{" 22 + "}" 23 + ] @punctuation.bracket 24 + 25 + ; Literals 26 + [ 27 + (integer_literal) 28 + (float_literal) 29 + ] @number 30 + 31 + [ 32 + (string_literal) 33 + ] @string 34 + (escape_sequence) @escape 35 + 36 + [ 37 + (absent) 38 + (boolean_literal) 39 + ] @constant.builtin 40 + 41 + ; Comments 42 + [ 43 + (block_comment) 44 + (line_comment) 45 + ] @comment
+4
languages/flatzinc/config.toml
··· 1 + name = "FlatZinc" 2 + grammar = "minizinc" 3 + path_suffixes = ["fzn"] 4 + line_comments = ["% "]
+114
languages/flatzinc/highlights.scm
··· 1 + ; Function calls 2 + (call function: (identifier) @function) 3 + ; Function definitions 4 + (function_item name: (identifier) @function) 5 + (predicate name: (identifier) @function) 6 + 7 + ; Types 8 + (primitive_type) @type.builtin 9 + [ 10 + "array" 11 + "of" 12 + "par" 13 + "set" 14 + "var" 15 + ] @type.builtin 16 + 17 + ; Identifiers 18 + (identifier) @variable 19 + 20 + ; Keywords 21 + [ 22 + "annotation" 23 + "constraint" 24 + "else" 25 + "elseif" 26 + "endif" 27 + "enum" 28 + "function" 29 + "if" 30 + "include" 31 + "let" 32 + "maximize" 33 + "minimize" 34 + "output" 35 + "predicate" 36 + "satisfy" 37 + "solve" 38 + "test" 39 + "then" 40 + "where" 41 + ] @keyword 42 + 43 + ; Operators 44 + [ 45 + "<->" 46 + "->" 47 + "<-" 48 + "\\/" 49 + "xor" 50 + "/\\" 51 + "=" 52 + "==" 53 + "!=" 54 + "<" 55 + "<=" 56 + ">" 57 + ">=" 58 + "in" 59 + "subset" 60 + "superset" 61 + "union" 62 + "diff" 63 + "symdiff" 64 + "intersect" 65 + ".." 66 + "+" 67 + "-" 68 + "++" 69 + "*" 70 + "/" 71 + "div" 72 + "mod" 73 + "^" 74 + "::" 75 + ] @operator 76 + 77 + ; Punctuation 78 + [ 79 + "," 80 + ":" 81 + ";" 82 + "|" 83 + ] @punctuation.delimiter 84 + [ 85 + "(" 86 + ")" 87 + "[" 88 + "]" 89 + "{" 90 + "}" 91 + ] @punctuation.bracket 92 + 93 + ; Literals 94 + [ 95 + (integer_literal) 96 + (float_literal) 97 + ] @number 98 + 99 + [ 100 + (string_literal) 101 + (string_interpolation) 102 + ] @string 103 + (escape_sequence) @escape 104 + 105 + [ 106 + (absent) 107 + (boolean_literal) 108 + ] @constant.builtin 109 + 110 + ; Comments 111 + [ 112 + (block_comment) 113 + (line_comment) 114 + ] @comment
+4
languages/minizinc/brackets.scm
··· 1 + ("[" @open "]" @close) 2 + ("{" @open "}" @close) 3 + (("\"" @open "\"" @close) (#set! rainbow.exclude)) 4 + ("(" @open ")" @close)
+4
languages/minizinc/config.toml
··· 1 + name = "MiniZinc" 2 + grammar = "minizinc" 3 + path_suffixes = ["mzn"] 4 + line_comments = ["% "]
+114
languages/minizinc/highlights.scm
··· 1 + ; Function calls 2 + (call function: (identifier) @function) 3 + ; Function definitions 4 + (function_item name: (identifier) @function) 5 + (predicate name: (identifier) @function) 6 + 7 + ; Types 8 + (primitive_type) @type.builtin 9 + [ 10 + "array" 11 + "of" 12 + "par" 13 + "set" 14 + "var" 15 + ] @type.builtin 16 + 17 + ; Identifiers 18 + (identifier) @variable 19 + 20 + ; Keywords 21 + [ 22 + "annotation" 23 + "constraint" 24 + "else" 25 + "elseif" 26 + "endif" 27 + "enum" 28 + "function" 29 + "if" 30 + "include" 31 + "let" 32 + "maximize" 33 + "minimize" 34 + "output" 35 + "predicate" 36 + "satisfy" 37 + "solve" 38 + "test" 39 + "then" 40 + "where" 41 + ] @keyword 42 + 43 + ; Operators 44 + [ 45 + "<->" 46 + "->" 47 + "<-" 48 + "\\/" 49 + "xor" 50 + "/\\" 51 + "=" 52 + "==" 53 + "!=" 54 + "<" 55 + "<=" 56 + ">" 57 + ">=" 58 + "in" 59 + "subset" 60 + "superset" 61 + "union" 62 + "diff" 63 + "symdiff" 64 + "intersect" 65 + ".." 66 + "+" 67 + "-" 68 + "++" 69 + "*" 70 + "/" 71 + "div" 72 + "mod" 73 + "^" 74 + "::" 75 + ] @operator 76 + 77 + ; Punctuation 78 + [ 79 + "," 80 + ":" 81 + ";" 82 + "|" 83 + ] @punctuation.delimiter 84 + [ 85 + "(" 86 + ")" 87 + "[" 88 + "]" 89 + "{" 90 + "}" 91 + ] @punctuation.bracket 92 + 93 + ; Literals 94 + [ 95 + (integer_literal) 96 + (float_literal) 97 + ] @number 98 + 99 + [ 100 + (string_literal) 101 + (string_interpolation) 102 + ] @string 103 + (escape_sequence) @escape 104 + 105 + [ 106 + (absent) 107 + (boolean_literal) 108 + ] @constant.builtin 109 + 110 + ; Comments 111 + [ 112 + (block_comment) 113 + (line_comment) 114 + ] @comment