mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat: add Linkerscript (#5693)
This commit is contained in:
parent
b016211057
commit
d876296476
8 changed files with 193 additions and 0 deletions
|
|
@ -284,6 +284,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
|||
- [x] [latex](https://github.com/latex-lsp/tree-sitter-latex) (maintained by @theHamsta, @clason)
|
||||
- [x] [ledger](https://github.com/cbarrete/tree-sitter-ledger) (maintained by @cbarrete)
|
||||
- [x] [leo](https://github.com/r001/tree-sitter-leo) (maintained by @r001)
|
||||
- [x] [linkerscript](https://github.com/amaanq/tree-sitter-linkerscript) (maintained by @amaanq)
|
||||
- [x] [liquidsoap](https://github.com/savonet/tree-sitter-liquidsoap) (maintained by @toots)
|
||||
- [x] [llvm](https://github.com/benwilliamgraham/tree-sitter-llvm) (maintained by @benwilliamgraham)
|
||||
- [x] [lua](https://github.com/MunifTanjim/tree-sitter-lua) (maintained by @muniftanjim)
|
||||
|
|
|
|||
|
|
@ -332,6 +332,9 @@
|
|||
"leo": {
|
||||
"revision": "23a9534d09d523d0dcee7dbf89e7c819e6835f6f"
|
||||
},
|
||||
"linkerscript": {
|
||||
"revision": "f99011a3554213b654985a4b0a65b3b032ec4621"
|
||||
},
|
||||
"liquidsoap": {
|
||||
"revision": "91d2708e12a5869154a85190b13ac89cb1414189"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1017,6 +1017,15 @@ list.llvm = {
|
|||
maintainers = { "@benwilliamgraham" },
|
||||
}
|
||||
|
||||
list.linkerscript = {
|
||||
install_info = {
|
||||
url = "https://github.com/amaanq/tree-sitter-linkerscript",
|
||||
files = { "src/parser.c" },
|
||||
},
|
||||
filetype = "ld",
|
||||
maintainers = { "@amaanq" },
|
||||
}
|
||||
|
||||
list.liquidsoap = {
|
||||
install_info = {
|
||||
url = "https://github.com/savonet/tree-sitter-liquidsoap",
|
||||
|
|
|
|||
6
queries/linkerscript/folds.scm
Normal file
6
queries/linkerscript/folds.scm
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[
|
||||
(sections_command)
|
||||
(output_section)
|
||||
(memory_command)
|
||||
(phdrs_command)
|
||||
] @fold
|
||||
146
queries/linkerscript/highlights.scm
Normal file
146
queries/linkerscript/highlights.scm
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
; Keywords
|
||||
|
||||
[
|
||||
"ENTRY"
|
||||
"SECTIONS"
|
||||
"AT"
|
||||
"OVERLAY"
|
||||
"NOCROSSREFS"
|
||||
"MEMORY"
|
||||
"PHDRS"
|
||||
"FILEHDR"
|
||||
] @keyword
|
||||
|
||||
; Conditionals
|
||||
|
||||
(conditional_expression [ "?" ":" ] @conditional.ternary)
|
||||
|
||||
; Variables
|
||||
|
||||
(symbol) @variable
|
||||
|
||||
(filename) @string.special @text.underline
|
||||
|
||||
; Functions
|
||||
|
||||
(call_expression
|
||||
function: (symbol) @function.call)
|
||||
|
||||
((call_expression
|
||||
function: (symbol) @preproc)
|
||||
(#eq? @preproc "DEFINED"))
|
||||
|
||||
((call_expression
|
||||
function: (symbol) @function.builtin)
|
||||
(#any-of? @function.builtin
|
||||
"ABSOLUTE" "ALIAS" "ADDR" "ALIGN" "ALIGNOF" "BASE" "BLOCK" "CHIP" "DATA_SEGMENT_ALIGN"
|
||||
"DATA_SEGMENT_END" "DATA_SEGMENT_RELRO_END" "END" "LENGTH" "LOADADDR" "LOG2CEIL" "MAX" "MIN"
|
||||
"NEXT" "ORIGIN" "SEGMENT_START" "SIZEOF" "BYTE" "FILL" "LONG" "SHORT" "QUAD" "SQUAD" "WORD"))
|
||||
|
||||
[
|
||||
"KEEP"
|
||||
"PROVIDE"
|
||||
"PROVIDE_HIDDEN"
|
||||
] @function.builtin
|
||||
|
||||
; Types
|
||||
|
||||
(section_type "(" [ "NOLOAD" "DSECT" "COPY" "INFO" "OVERLAY" ] @type.builtin ")")
|
||||
|
||||
; Fields
|
||||
|
||||
[
|
||||
"ORIGIN" "org" "o"
|
||||
"LENGTH" "len" "l"
|
||||
] @field.builtin
|
||||
|
||||
; Constants
|
||||
|
||||
((symbol) @constant
|
||||
(#lua-match? @constant "^[%u_][%u%d_]+$"))
|
||||
|
||||
; Labels
|
||||
|
||||
(entry_command name: (symbol) @label)
|
||||
|
||||
(output_section name: (symbol) @label)
|
||||
|
||||
(memory_command name: (symbol) @label)
|
||||
|
||||
(phdrs_command name: (symbol) @label)
|
||||
|
||||
(region ">" (symbol) @label)
|
||||
|
||||
(lma_region ">" (symbol) @label)
|
||||
|
||||
(phdr ":" (symbol) @label)
|
||||
|
||||
([(symbol) (filename)] @label
|
||||
(#lua-match? @label "^%."))
|
||||
|
||||
; Exceptions
|
||||
|
||||
"ASSERT" @exception
|
||||
|
||||
[
|
||||
"/DISCARD/"
|
||||
"."
|
||||
] @variable.builtin
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"||"
|
||||
"&&"
|
||||
"|"
|
||||
"&"
|
||||
"=="
|
||||
"!="
|
||||
">"
|
||||
">="
|
||||
"<="
|
||||
"<"
|
||||
"<<"
|
||||
">>"
|
||||
"!"
|
||||
"~"
|
||||
"="
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"<<="
|
||||
">>="
|
||||
"&="
|
||||
"|="
|
||||
] @operator
|
||||
|
||||
; Literals
|
||||
|
||||
(number) @number
|
||||
|
||||
(quoted_symbol) @string
|
||||
|
||||
(wildcard_pattern [ "*" "[" "]" ] @character.special)
|
||||
|
||||
(attributes) @character.special
|
||||
|
||||
; Punctuation
|
||||
|
||||
[ "{" "}" "(" ")" ] @punctuation.bracket
|
||||
|
||||
[
|
||||
":"
|
||||
";"
|
||||
] @punctuation.delimiter
|
||||
|
||||
">" @punctuation.special
|
||||
|
||||
; Comments
|
||||
|
||||
(comment) @comment @spell
|
||||
11
queries/linkerscript/indents.scm
Normal file
11
queries/linkerscript/indents.scm
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[
|
||||
(sections_command)
|
||||
(output_section)
|
||||
(memory_command)
|
||||
(phdrs_command)
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
"}"
|
||||
")"
|
||||
] @indent.branch @indent.end
|
||||
2
queries/linkerscript/injections.scm
Normal file
2
queries/linkerscript/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment)
|
||||
(#set! injection.language "comment"))
|
||||
15
queries/linkerscript/locals.scm
Normal file
15
queries/linkerscript/locals.scm
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
; References
|
||||
|
||||
[
|
||||
(symbol)
|
||||
(filename)
|
||||
(quoted_symbol)
|
||||
] @reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(output_section name: (symbol) @definition.var)
|
||||
|
||||
(memory_command name: (symbol) @definition.var)
|
||||
|
||||
(phdrs_command name: (symbol) @definition.var)
|
||||
Loading…
Add table
Add a link
Reference in a new issue