mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 11:06:54 -04:00
feat(parsers): add bpftrace (#8399)
Co-authored-by: Riley Bruins <ribru17@hotmail.com>
This commit is contained in:
parent
6feaebb456
commit
9177f2ff06
4 changed files with 249 additions and 0 deletions
1
SUPPORTED_LANGUAGES.md
generated
1
SUPPORTED_LANGUAGES.md
generated
|
|
@ -28,6 +28,7 @@ Language | Tier | Queries | Maintainer
|
|||
[bitbake](https://github.com/tree-sitter-grammars/tree-sitter-bitbake) | unstable | `HFIJL` | @amaanq
|
||||
[blade](https://github.com/EmranMR/tree-sitter-blade) | unstable | `HFIJ ` | @calebdw
|
||||
[bp](https://github.com/ambroisie/tree-sitter-bp)[^bp] | unstable | `HFIJL` | @ambroisie
|
||||
[bpftrace](https://github.com/sgruszka/tree-sitter-bpftrace) | unstable | `H J ` | @sgruszka
|
||||
[brightscript](https://github.com/ajdelcimmuto/tree-sitter-brightscript) | unstable | `HFIJ ` | @ajdelcimmuto
|
||||
[c](https://github.com/tree-sitter/tree-sitter-c) | unstable | `HFIJL` | @amaanq
|
||||
[c3](https://github.com/c3lang/tree-sitter-c3) | unstable | `HFIJ ` | @cbuttner
|
||||
|
|
|
|||
|
|
@ -140,6 +140,14 @@ return {
|
|||
readme_note = 'Android Blueprint',
|
||||
tier = 2,
|
||||
},
|
||||
bpftrace = {
|
||||
install_info = {
|
||||
revision = '9cdfa285bb4fd3abc74cce6e2fb46f381feca987',
|
||||
url = 'https://github.com/sgruszka/tree-sitter-bpftrace',
|
||||
},
|
||||
maintainers = { '@sgruszka' },
|
||||
tier = 2,
|
||||
},
|
||||
brightscript = {
|
||||
install_info = {
|
||||
revision = '253fdfaa23814cb46c2d5fc19049fa0f2f62c6da',
|
||||
|
|
|
|||
228
runtime/queries/bpftrace/highlights.scm
Normal file
228
runtime/queries/bpftrace/highlights.scm
Normal file
|
|
@ -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)
|
||||
12
runtime/queries/bpftrace/injections.scm
Normal file
12
runtime/queries/bpftrace/injections.scm
Normal file
|
|
@ -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"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue