diff options
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/queries/bpftrace/highlights.scm | 228 | ||||
| -rw-r--r-- | runtime/queries/bpftrace/injections.scm | 12 | ||||
| -rw-r--r-- | runtime/queries/html_tags/highlights.scm | 6 | ||||
| -rw-r--r-- | runtime/queries/kos/highlights.scm | 17 |
4 files changed, 260 insertions, 3 deletions
diff --git a/runtime/queries/bpftrace/highlights.scm b/runtime/queries/bpftrace/highlights.scm new file mode 100644 index 000000000..30a489537 --- /dev/null +++ b/runtime/queries/bpftrace/highlights.scm @@ -0,0 +1,228 @@ +; Comments +[ + (line_comment) + (block_comment) +] @comment @spell + +; String and numeric literals +(string_literal) @string + +(escape_sequence) @string.escape + +(integer_literal) @number + +(boolean_literal) @boolean + +; Variables +(identifier) @variable + +(args_keyword) @variable.builtin + +((identifier) @variable.builtin + (#lua-match? @variable.builtin "^arg[0-9]+$")) + +(scratch_variable) @variable + +(map_variable) @variable + +(script_parameter) @variable.parameter + +; Macro +(macro_definition + (identifier) @function.macro) + +; Probes +; fentry/fexit, kprobe/kretprobe, rawtracepoint +(probe + provider: (_) @type.builtin + module: (wildcard_identifier) @module + function: (wildcard_identifier) @property) + +(probe + provider: (_) @type.builtin + function: (wildcard_identifier) @property) + +; uprobe/uretprobe +(probe + provider: (uprobe_uretprobe_provider) @type.builtin + binary: (file_identifier) @string.special.path + function: (identifier) @property) + +; tracepoint +(probe + provider: (_) @type.builtin + subsys: (wildcard_identifier) @module + event: (wildcard_identifier) @property) + +; software/hardware +(probe + provider: (_) @type.builtin + event: (identifier_with_dash) @property + count: (integer_literal) @number) + +(probe + provider: (_) @type.builtin + event: (identifier_with_dash) @property) + +; bench/test +(probe + provider: (bench_test_provider) @type.builtin + function: (identifier) @property) + +; profile/interval +(probe + provider: (profile_interval_provider) @type.builtin + unit: (time_unit) @string.special + count: (integer_literal) @property) + +(probe + provider: (profile_interval_provider) @type.builtin + count: (integer_literal) @number) + +; iter +(probe + provider: (iter_provider) @type.builtin + object: (identifier) @module + pin: (file_identifier) @property) + +(probe + provider: (iter_provider) @type.builtin + object: (identifier) @module) + +; ustd +(probe + provider: (ustd_provider) @type.builtin + binary: (file_identifier) @string.special.path + namespace: (identifier) @variable + function: (identifier) @property) + +(probe + provider: (ustd_provider) @type.builtin + binary: (file_identifier) @string.special.path + function: (identifier) @property) + +; watchpoint/asyncwatchpoint +(probe + provider: (watchpoint_provider) @type.builtin + address: (integer_literal) @number + length: (integer_literal) @number + mode: (watchpoint_mode) @property) + +; Types +(type_specifier) @type + +(integer_type) @type.builtin + +[ + "BEGIN" + "begin" + "END" + "end" +] @type.builtin + +; Keywords +(hashbang) @keyword.directive + +(return_statement) @keyword.return + +[ + "config" + "let" + "macro" + "offsetof" + "sizeof" +] @keyword + +[ + "if" + "else" +] @keyword.conditional + +[ + "for" + "unroll" + "while" + (break_statement) + (continue_statement) +] @keyword.repeat + +"import" @keyword.import + +(field_expression + field: (identifier) @property) + +(call_expression + function: (identifier) @function.call) + +; Punctuations +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + "," + ";" + ":" + "." +] @punctuation.delimiter + +; Operators +[ + ; Field access + "->" + ; Range + ".." + ; Assignment + "=" + "<<=" + ">>=" + "+=" + "-=" + "*=" + "/=" + "%=" + "&=" + "|=" + "^=" + ; Update + "--" + "++" + ; Arithmetic + "%" + "+" + "-" + "*" + "/" + ; Relational + "<=" + "<" + ">=" + ">" + "==" + "!=" + ; Bitwise + "&" + "^" + "|" + "~" + "<<" + ">>" + ; Logical + "&&" + "||" + "!" +] @operator + +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +(predicate + "/" @punctuation.delimiter) diff --git a/runtime/queries/bpftrace/injections.scm b/runtime/queries/bpftrace/injections.scm new file mode 100644 index 000000000..8907d9f84 --- /dev/null +++ b/runtime/queries/bpftrace/injections.scm @@ -0,0 +1,12 @@ +([ + (c_struct) + (c_preproc) + (c_preproc_block) +] @injection.content + (#set! injection.language "c")) + +([ + (line_comment) + (block_comment) +] @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/html_tags/highlights.scm b/runtime/queries/html_tags/highlights.scm index 9eaf813be..94a338aa7 100644 --- a/runtime/queries/html_tags/highlights.scm +++ b/runtime/queries/html_tags/highlights.scm @@ -1,9 +1,11 @@ -(tag_name) @tag +(tag_name) @tag @nospell ; (erroneous_end_tag_name) @error ; we do not lint syntax errors (comment) @comment @spell -(attribute_name) @tag.attribute +(attribute_name) @tag.attribute @nospell + +(attribute_value) @nospell ((attribute (quoted_attribute_value) @string) diff --git a/runtime/queries/kos/highlights.scm b/runtime/queries/kos/highlights.scm index 0942b2b89..07757d2e3 100644 --- a/runtime/queries/kos/highlights.scm +++ b/runtime/queries/kos/highlights.scm @@ -4,8 +4,13 @@ (number) @number +(float_number) @number.float + (identifier) @variable +(parameter + parameter: (identifier) @variable.parameter) + (property_identifier) @property [ @@ -57,8 +62,9 @@ "=>" ] @keyword.function +"_" @character.special + [ - "_" (line) "assert" ;"async" @@ -96,6 +102,15 @@ "}" ] @punctuation.bracket +(string_literal_begin + "\\(" @punctuation.special) + +(string_literal_continuation + "\\(" @punctuation.special) + +(formatted_string + ")" @punctuation.special) + [ ";" ":" |
