Unnamed repository; edit this file 'description' to name the repository.
PTX support (#15052)
Co-authored-by: Kristoffer Plagborg Bak Sørensen <[email protected]>
| -rw-r--r-- | book/src/generated/lang-support.md | 1 | ||||
| -rw-r--r-- | languages.toml | 14 | ||||
| -rw-r--r-- | runtime/queries/ptx/folds.scm | 5 | ||||
| -rw-r--r-- | runtime/queries/ptx/highlights.scm | 47 | ||||
| -rw-r--r-- | runtime/queries/ptx/indents.scm | 9 |
5 files changed, 76 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index e35a388d..1c9b3aa3 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -225,6 +225,7 @@ | properties | ✓ | ✓ | | | | | | protobuf | ✓ | ✓ | ✓ | ✓ | | `buf`, `pb`, `protols` | | prql | ✓ | | | | | | +| ptx | ✓ | | ✓ | | | | | pug | ✓ | | | | | | | purescript | ✓ | ✓ | | | | `purescript-language-server` | | python | ✓ | ✓ | ✓ | ✓ | ✓ | `ty`, `ruff`, `jedi-language-server`, `pylsp` | diff --git a/languages.toml b/languages.toml index c52251a3..0b7149be 100644 --- a/languages.toml +++ b/languages.toml @@ -5345,3 +5345,17 @@ comment-token = "#" [[grammar]] name = "gnuplot" source = { git = "https://codeberg.org/maribu/tree-sitter-gnuplot", rev = "21a3a3929facb964b3592daeb69119294ff84cf2" } + +[[language]] +name = "ptx" +scope = "source.ptx" +injection-regex = "ptx" +file-types = ["ptx"] +language-servers = [] +comment-token = "//" +block-comment-tokens = { start = "/*", end = "*/" } +indent = { tab-width = 4, unit = " " } + +[[grammar]] +name = "ptx" +source = { git = "https://codeberg.org/jer-gremlin/tree-sitter-ptx", rev = "3dfa6758d4c15832d051f933101992b9e01d6611" } diff --git a/runtime/queries/ptx/folds.scm b/runtime/queries/ptx/folds.scm new file mode 100644 index 00000000..6d182e4a --- /dev/null +++ b/runtime/queries/ptx/folds.scm @@ -0,0 +1,5 @@ +; Folding for PTX +[ + (func_body) + (entry_declaration) +] @fold
\ No newline at end of file diff --git a/runtime/queries/ptx/highlights.scm b/runtime/queries/ptx/highlights.scm new file mode 100644 index 00000000..32dced3b --- /dev/null +++ b/runtime/queries/ptx/highlights.scm @@ -0,0 +1,47 @@ +; highlights.scm - Syntax highlighting for PTX + +; Comments +(comment) @comment + +; Directives +(version_directive) @keyword +(target_directive) @keyword +(address_size_directive) @keyword +(file_directive) @keyword +(section_directive) @keyword +(visibility_directive) @keyword +(pragma_directive) @keyword + +; Keywords +[ + ".global" + ".const" + ".param" + ".local" + ".shared" + ".tex" + ".func" + ".entry" +] @keyword + +; Types +(data_type) @type + +; Instructions +(opcode) @function + +; Identifiers +(identifier) @variable + +; Registers +(register) @variable + +; Numbers +(number) @constant.numeric.integer +(float_literal) @constant.numeric.float + +; Strings +(string) @string + +; Labels +(label) @label diff --git a/runtime/queries/ptx/indents.scm b/runtime/queries/ptx/indents.scm new file mode 100644 index 00000000..d45edcca --- /dev/null +++ b/runtime/queries/ptx/indents.scm @@ -0,0 +1,9 @@ +; Indentation for PTX +[ + (func_body) + (entry_declaration) +] @indent +; Do not indent on closing brace +[ + "}" +] @outdent
\ No newline at end of file |