Skip to content

Commit 8496da8

Browse files
committed
Tweak highlighting; bump to 0.0.2
Signed-off-by: egibs <[email protected]>
1 parent 9d3cf40 commit 8496da8

File tree

4 files changed

+90
-54
lines changed

4 files changed

+90
-54
lines changed

example.png

26.9 KB
Loading

example.yara

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ private rule test2: tag2 tag3 tag4 tag5 {
1717
filesize > 1MB and all of them
1818
}
1919

20-
private rule test3: tag4 tag5 {
20+
rule test3: tag4 tag5 {
2121
strings:
2222
$hello = "hello world"
2323
$test = "test"
2424
$ = "test2"
2525
$ = "test3"
2626
condition:
27-
filesize > 2MB and any of them
27+
filesize > 2MB and any of them and none of ($h*) and none of ($t*)
2828
}

extension.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
id = "yara"
22
name = "Yara"
3-
version = "0.0.1"
3+
version = "0.0.2"
44
schema_version = 1
55
authors = ["egibs <[email protected]>"]
66
description = "Yara syntax highlighting for Zed."
77
repository = "https://github.com/egibs/yara-zed"
88

99
[grammars.yara]
1010
repository = "https://github.com/egibs/tree-sitter-yara.git"
11-
commit = "a8058d3fcffa5d61aa66185c976e9f6efbea2a8d"
11+
commit = "eb3ede203275c38000177f72ec0f9965312806ef"

languages/yara/highlights.scm

+86-50
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1+
; Comments
2+
(comment) @comment
3+
14
; Keywords
25
[
3-
"rule"
46
"global"
5-
"private"
67
"import"
7-
"include"
8+
"private"
9+
] @constant.builtin
10+
11+
[
12+
"rule"
13+
] @function
14+
15+
[
16+
"meta"
817
"strings"
918
"condition"
10-
"meta"
11-
] @keyword
19+
] @property
1220

13-
; Keywords (condition)
21+
; Operators
1422
[
15-
"and"
16-
"or"
17-
"not"
1823
"matches"
1924
"contains"
2025
"icontains"
@@ -23,79 +28,110 @@
2328
"istartswith"
2429
"endswith"
2530
"iendswith"
26-
"for"
31+
"and"
32+
"or"
33+
"not"
34+
"=="
35+
"!="
36+
"<"
37+
">"
38+
">="
39+
"<="
2740
"of"
28-
"in"
41+
"for"
2942
"all"
3043
"any"
3144
"none"
32-
"them"
33-
"filesize"
34-
"entrypoint"
35-
] @keyword.operator
45+
"in"
46+
] @string.special
3647

3748
; String modifiers
3849
[
39-
"ascii"
4050
"wide"
51+
"ascii"
4152
"nocase"
4253
"fullword"
4354
"xor"
4455
"base64"
4556
"base64wide"
4657
] @keyword.modifier
4758

48-
; Rule names
49-
(rule_definition
50-
name: (identifier) @module)
51-
52-
; Tags
53-
((tag) @tag)
54-
55-
; Meta definitions
56-
(meta_definition
57-
key: (identifier) @property)
58-
59-
; String identifiers
60-
(string_identifier
61-
(identifier)? @string.special)
62-
63-
; Constants
64-
(boolean_literal) @constant.builtin
65-
59+
; Numbers and sizes
6660
(integer_literal) @constant.numeric
6761
(size_unit) @constant.numeric
6862

6963
; Strings
7064
(double_quoted_string) @string
7165
(single_quoted_string) @string
7266
(escape_sequence) @string.escape
67+
(text_string) @text.literal
7368

7469
; Hex strings
7570
(hex_string) @string.special
7671
(hex_byte) @constant.numeric
7772
(hex_wildcard) @constant.builtin
73+
(hex_jump) @constant.numeric
7874

79-
; Regex strings
75+
; Regular expressions
8076
(regex_string) @string.regexp
8177
(pattern) @string.regexp
8278

83-
; Operators
79+
; Boolean literals
8480
[
85-
">"
86-
"<"
87-
"=="
88-
"<="
89-
">="
90-
"!="
91-
"+"
92-
"-"
81+
"true"
82+
"false"
83+
] @constant.boolean
84+
85+
; Keywords and special identifiers
86+
[
87+
"them"
88+
"all"
89+
"any"
90+
"none"
91+
] @keyword.operator
92+
93+
94+
; String identifiers
95+
"$" @string.special.symbol
96+
(identifier) @string
97+
(string_identifier) @string.special.symbol
98+
99+
; Built-ins
100+
[
101+
(filesize_keyword)
102+
(entrypoint_keyword)
103+
] @constant.builtin
104+
105+
; Tags
106+
(tag_list
107+
[(identifier) (tag)] @tag)
108+
109+
; Punctuation and delimiters
110+
[
111+
"="
112+
":"
113+
"{"
114+
"}"
115+
"["
116+
"]"
117+
"("
118+
")"
119+
"#"
120+
"@"
121+
".."
122+
"|"
123+
","
124+
"!"
125+
"/"
126+
"\""
127+
"'"
93128
"*"
94-
"\\"
95-
"%"
96-
] @operator
129+
] @string.special.symbol
97130

98-
[":" "=" "{" "}" "(" ")" "[" "]" "$" "#" "@" "!" ".." "|" ","] @punctuation.delimiter
131+
; Rule names
132+
(rule_definition
133+
name: (identifier) @string.special)
99134

100-
; Comments
101-
(comment) @comment
135+
; Meta definitions
136+
(meta_definition
137+
key: (identifier) @string.special)

0 commit comments

Comments
 (0)