mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-09 15:00:04 -04:00
feat: add nasm parser (#5475)
* feat: add nasm parser * chore: update highlights --------- Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
This commit is contained in:
parent
51372f1d4e
commit
dfd4fb330f
5 changed files with 159 additions and 0 deletions
|
|
@ -295,6 +295,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||||
- [ ] [mermaid](https://github.com/monaqa/tree-sitter-mermaid) (experimental)
|
- [ ] [mermaid](https://github.com/monaqa/tree-sitter-mermaid) (experimental)
|
||||||
- [x] [meson](https://github.com/Decodetalkers/tree-sitter-meson) (maintained by @Decodetalkers)
|
- [x] [meson](https://github.com/Decodetalkers/tree-sitter-meson) (maintained by @Decodetalkers)
|
||||||
- [x] [mlir](https://github.com/artagnon/tree-sitter-mlir) (experimental, maintained by @artagnon)
|
- [x] [mlir](https://github.com/artagnon/tree-sitter-mlir) (experimental, maintained by @artagnon)
|
||||||
|
- [x] [nasm](https://github.com/naclsn/tree-sitter-nasm) (maintained by @ObserverOfTime)
|
||||||
- [ ] [nickel](https://github.com/nickel-lang/tree-sitter-nickel)
|
- [ ] [nickel](https://github.com/nickel-lang/tree-sitter-nickel)
|
||||||
- [x] [ninja](https://github.com/alemuller/tree-sitter-ninja) (maintained by @alemuller)
|
- [x] [ninja](https://github.com/alemuller/tree-sitter-ninja) (maintained by @alemuller)
|
||||||
- [x] [nix](https://github.com/cstrahan/tree-sitter-nix) (maintained by @leo60228)
|
- [x] [nix](https://github.com/cstrahan/tree-sitter-nix) (maintained by @leo60228)
|
||||||
|
|
|
||||||
|
|
@ -365,6 +365,9 @@
|
||||||
"mlir": {
|
"mlir": {
|
||||||
"revision": "e2053f7c8856d91bc36c87604f697784845cee69"
|
"revision": "e2053f7c8856d91bc36c87604f697784845cee69"
|
||||||
},
|
},
|
||||||
|
"nasm": {
|
||||||
|
"revision": "3bc691d2cfba44bea339a775ad496c8bc552c60d"
|
||||||
|
},
|
||||||
"nickel": {
|
"nickel": {
|
||||||
"revision": "b759233581fd8bae239e905c67a9ba453205da78"
|
"revision": "b759233581fd8bae239e905c67a9ba453205da78"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1105,6 +1105,14 @@ list.mlir = {
|
||||||
maintainers = { "@artagnon" },
|
maintainers = { "@artagnon" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.nasm = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/naclsn/tree-sitter-nasm",
|
||||||
|
files = { "src/parser.c" },
|
||||||
|
},
|
||||||
|
maintainers = { "@ObserverOfTime" },
|
||||||
|
}
|
||||||
|
|
||||||
list.nickel = {
|
list.nickel = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://github.com/nickel-lang/tree-sitter-nickel",
|
url = "https://github.com/nickel-lang/tree-sitter-nickel",
|
||||||
|
|
|
||||||
145
queries/nasm/highlights.scm
Normal file
145
queries/nasm/highlights.scm
Normal file
|
|
@ -0,0 +1,145 @@
|
||||||
|
;; adapted from https://github.com/naclsn/tree-sitter-nasm/blob/main/queries/highlights.scm
|
||||||
|
|
||||||
|
(word) @variable
|
||||||
|
((word) @constant
|
||||||
|
(#lua-match? @constant "^[A-Z_][?A-Z_0-9]+$"))
|
||||||
|
((word) @constant.builtin
|
||||||
|
(#lua-match? @constant.builtin "^__%?[A-Z_a-z0-9]+%?__$"))
|
||||||
|
|
||||||
|
[
|
||||||
|
(line_here_token)
|
||||||
|
(section_here_token)
|
||||||
|
] @variable.builtin
|
||||||
|
|
||||||
|
(label (word) @label)
|
||||||
|
(assembl_directive_symbols (word) @label)
|
||||||
|
(assembl_directive_sections (word) @label)
|
||||||
|
|
||||||
|
(unary_expression
|
||||||
|
operator: _ @operator)
|
||||||
|
(binary_expression
|
||||||
|
operator: _ @operator)
|
||||||
|
|
||||||
|
"?" @constant.builtin
|
||||||
|
|
||||||
|
(conditional_expression
|
||||||
|
[ "?" ":" ] @conditional.ternary)
|
||||||
|
|
||||||
|
[
|
||||||
|
":"
|
||||||
|
","
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
[
|
||||||
|
"(" ")"
|
||||||
|
"[" "]"
|
||||||
|
"{" "}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
(instruction_prefix) @keyword
|
||||||
|
(actual_instruction
|
||||||
|
instruction: (word) @function.builtin)
|
||||||
|
|
||||||
|
(call_syntax_expression
|
||||||
|
base: (word) @function.call)
|
||||||
|
|
||||||
|
(size_hint) @type
|
||||||
|
(struc_declaration
|
||||||
|
name: (word) @type)
|
||||||
|
(struc_instance
|
||||||
|
name: (word) @type)
|
||||||
|
|
||||||
|
(effective_address
|
||||||
|
hint: _ @type)
|
||||||
|
(effective_address
|
||||||
|
segment: _ @constant.builtin)
|
||||||
|
|
||||||
|
(register) @variable.builtin
|
||||||
|
|
||||||
|
(string_literal) @string
|
||||||
|
|
||||||
|
(float_literal) @float
|
||||||
|
|
||||||
|
[
|
||||||
|
(packed_bcd_literal)
|
||||||
|
(number_literal)
|
||||||
|
] @number
|
||||||
|
|
||||||
|
[
|
||||||
|
(preproc_alias)
|
||||||
|
(preproc_multiline_macro)
|
||||||
|
(preproc_multiline_unmacro)
|
||||||
|
(preproc_rotate)
|
||||||
|
(preproc_pathsearch)
|
||||||
|
(preproc_depend)
|
||||||
|
(preproc_use)
|
||||||
|
(preproc_push)
|
||||||
|
(preproc_pop)
|
||||||
|
(preproc_repl)
|
||||||
|
(preproc_arg)
|
||||||
|
(preproc_stacksize)
|
||||||
|
(preproc_local)
|
||||||
|
(preproc_reporting)
|
||||||
|
(preproc_pragma)
|
||||||
|
(preproc_line)
|
||||||
|
(preproc_clear)
|
||||||
|
] @preproc
|
||||||
|
|
||||||
|
(preproc_include) @include
|
||||||
|
|
||||||
|
(preproc_rep_loop) @repeat
|
||||||
|
|
||||||
|
(preproc_if) @conditional
|
||||||
|
|
||||||
|
[
|
||||||
|
(preproc_def)
|
||||||
|
(preproc_undef)
|
||||||
|
] @define
|
||||||
|
|
||||||
|
(preproc_function_def) @keyword.function
|
||||||
|
|
||||||
|
[
|
||||||
|
(preproc_expression)
|
||||||
|
(preproc_arg)
|
||||||
|
] @constant.macro
|
||||||
|
|
||||||
|
(preproc_multiline_macro
|
||||||
|
name: (word) @function)
|
||||||
|
|
||||||
|
[
|
||||||
|
(pseudo_instruction_dx)
|
||||||
|
(pseudo_instruction_resx)
|
||||||
|
(pseudo_instruction_incbin_command)
|
||||||
|
(pseudo_instruction_equ_command)
|
||||||
|
(pseudo_instruction_times_prefix)
|
||||||
|
(pseudo_instruction_alignx_macro)
|
||||||
|
] @function
|
||||||
|
|
||||||
|
[
|
||||||
|
(assembl_directive_target)
|
||||||
|
(assembl_directive_defaults)
|
||||||
|
(assembl_directive_sections)
|
||||||
|
(assembl_directive_absolute)
|
||||||
|
(assembl_directive_symbols)
|
||||||
|
(assembl_directive_common)
|
||||||
|
(assembl_directive_symbolfixes)
|
||||||
|
(assembl_directive_cpu)
|
||||||
|
(assembl_directive_floathandling)
|
||||||
|
(assembl_directive_org)
|
||||||
|
(assembl_directive_sectalign)
|
||||||
|
(assembl_directive_primitive_target)
|
||||||
|
(assembl_directive_primitive_defaults)
|
||||||
|
(assembl_directive_primitive_sections)
|
||||||
|
(assembl_directive_primitive_absolute)
|
||||||
|
(assembl_directive_primitive_symbols)
|
||||||
|
(assembl_directive_primitive_common)
|
||||||
|
(assembl_directive_primitive_symbolfixes)
|
||||||
|
(assembl_directive_primitive_cpu)
|
||||||
|
(assembl_directive_primitive_floathandling)
|
||||||
|
(assembl_directive_primitive_org)
|
||||||
|
(assembl_directive_primitive_sectalign)
|
||||||
|
(assembl_directive_primitive_warning)
|
||||||
|
(assembl_directive_primitive_map)
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
(comment) @comment @spell
|
||||||
2
queries/nasm/injections.scm
Normal file
2
queries/nasm/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
((comment) @injection.content
|
||||||
|
(#set! injection.language "comment"))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue