-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
70 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,84 @@ | ||
(comment) @comment @spell | ||
(annot_atom doc: (static_string) @spell) | ||
|
||
[ | ||
"forall" | ||
"in" | ||
"let" | ||
"default" | ||
"doc" | ||
"rec" | ||
"optional" | ||
"priority" | ||
"force" | ||
"not_exported" | ||
] @keyword | ||
|
||
"fun" @keyword.function | ||
|
||
"import" @include | ||
|
||
[ "if" "then" "else" ] @conditional | ||
"match" @conditional | ||
|
||
(types) @type | ||
(type_builtin) @type.builtin | ||
"Array" @type.builtin | ||
|
||
(enum_tag) @constructor | ||
|
||
; BUILTIN Constants | ||
(bool) @boolean | ||
"null" @constant.builtin | ||
(bool) @constant.builtin.boolean | ||
(str_esc_char) @constant.character.escape | ||
(num_literal) @constant.numeric | ||
|
||
(str_chunks) @string | ||
|
||
; NOTE: Nickel has no block comments | ||
(comment) @comment.line | ||
; Nickel doesn't use comments for documentation, ideally this would be | ||
; `@documentation` or something similar | ||
(annot_atom | ||
doc: (static_string) @comment.block.documentation | ||
) | ||
(enum_tag) @constant | ||
|
||
(record_operand (atom (ident) @variable)) | ||
(let_expr | ||
"let" @keyword | ||
"rec"? @keyword | ||
pat: (pattern | ||
(ident) @variable | ||
) | ||
"in" @keyword | ||
) | ||
(fun_expr | ||
"fun" @keyword.function | ||
pats: | ||
(pattern | ||
id: (ident) @variable.parameter | ||
)+ | ||
"=>" @operator | ||
) | ||
(record_field) @variable.other.member | ||
(num_literal) @number | ||
|
||
(infix_op) @operator | ||
|
||
(type_atom) @type | ||
|
||
(chunk_literal_single) @string | ||
(chunk_literal_multi) @string | ||
|
||
(str_esc_char) @string.escape | ||
|
||
[ | ||
"." | ||
] @punctuation.delimiter | ||
[ | ||
"{" "}" | ||
"(" ")" | ||
"[|" "|]" | ||
"[" "]" | ||
"{" "}" | ||
"(" ")" | ||
"[|" "|]" | ||
] @punctuation.bracket | ||
|
||
[ | ||
"," | ||
"." | ||
":" | ||
"=" | ||
"|" | ||
"->" | ||
"+" | ||
"-" | ||
"*" | ||
] @punctuation.delimiter | ||
|
||
(multstr_start) @punctuation.bracket | ||
(multstr_end) @punctuation.bracket | ||
(interpolation_start) @punctuation.bracket | ||
(interpolation_end) @punctuation.bracket | ||
|
||
["forall" "default" "doc"] @keyword | ||
["if" "then" "else" "switch"] @keyword.control.conditional | ||
"import" @keyword.control.import | ||
(record_field) @field | ||
|
||
(infix_expr | ||
op: (_) @operator | ||
) | ||
(builtin) @function.builtin | ||
|
||
(applicative | ||
t1: (applicative | ||
(record_operand) @function | ||
(fun_expr pats: | ||
(pattern id: | ||
(ident) @parameter | ||
) | ||
) | ||
(builtin) @function.builtin | ||
|
||
; application where the head terms is an identifier: function arg1 arg2 arg3 | ||
(applicative t1: | ||
(applicative (record_operand (atom (ident))) @function) | ||
) | ||
|
||
; application where the head terms is a record field path: foo.bar.function arg1 arg2 arg3 | ||
(applicative t1: | ||
(applicative (record_operand (record_operation_chain)) @function) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(annot_atom doc: (static_string) | ||
@injection.content | ||
(#set! injection.language "markdown")) |