aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/dhall/highlights.scm
blob: 0663bbd9d27068455a8a0a92b4309431190ad39d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
;; Literals
(integer_literal) @constant.numeric.integer
(natural_literal) @constant.numeric.integer
(double_literal) @constant.numeric.float
(boolean_literal) @constant.builtin.boolean
(builtin "None") @constant.builtin

;; Text
(text_literal) @string
(interpolation "}" @string)
(double_quote_escaped) @constant.character.escape
(single_quote_escaped) @constant.character.escape

;; Imports
(local_import) @string.special.path
(http_import) @string.special.url
(env_import) @keyword
(env_variable) @string.special
(import_hash) @string.special
(missing_import) @keyword.control.import
[ (import_as_location) (import_as_text) ] @type

;; Comments
(block_comment) @comment.block
(line_comment) @comment.line

;; Types
([
  (let_binding (label) @type)
  (union_type_entry (label) @type)
] (#match? @type "^[A-Z]"))
((primitive_expression
  (identifier (label) @type)
  (selector (label) @type)?) @whole_identifier
  (#match? @whole_identifier "(?:^|\\.)[A-Z][^.]*$"))

;; Variables
(identifier [
  (label) @variable
  (de_bruijn_index) @operator
])
(let_binding label: (label) @variable)
(lambda_expression label: (label) @variable.parameter)
(record_literal_entry (label) @variable.other.member)
(record_type_entry (label) @variable.other.member)
(selector) @variable.other.member

;; Keywords
[
  "let"
  "in"
  "assert"
] @keyword
[
  "using"
  "as"
  "with"
] @keyword.operator

;; Operators
[
  (type_operator)
  (assign_operator)
  (lambda_operator)
  (arrow_operator)
  (infix_operator)
  (completion_operator)
  (assert_operator)
  (forall_operator)
  (empty_record_literal)
] @operator

;; Builtins
(builtin_function) @function.builtin
(builtin [
  "Bool"
  "Optional"
  "Natural"
  "Integer"
  "Double"
  "Text"
  "Date"
  "Time"
  "TimeZone"
  "List"
  "Type"
  "Kind"
  "Sort"
] @type.builtin)

;; Punctuation
[ "," "|" ] @punctuation.delimiter
(selector_dot) @punctuation.delimiter
[
  "("
  ")"
  "{"
  "}"
  "["
  "]"
  "<"
  ">"
] @punctuation.bracket

;; Conditionals
[
  "if"
  "then"
  "else"
] @keyword.control.conditional