diff options
| author | Amaan Qureshi <amaanq12@gmail.com> | 2023-11-19 04:10:52 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-19 18:10:52 +0900 |
| commit | d87629647614b779fb2aad8f0042fe2864253ea6 (patch) | |
| tree | 46b35ae0134c3bc5446df7c5bdd2735b7b640f1a /queries | |
| parent | feat(lua): folds for parameter, argument lists (diff) | |
| download | nvim-treesitter-d87629647614b779fb2aad8f0042fe2864253ea6.tar nvim-treesitter-d87629647614b779fb2aad8f0042fe2864253ea6.tar.gz nvim-treesitter-d87629647614b779fb2aad8f0042fe2864253ea6.tar.bz2 nvim-treesitter-d87629647614b779fb2aad8f0042fe2864253ea6.tar.lz nvim-treesitter-d87629647614b779fb2aad8f0042fe2864253ea6.tar.xz nvim-treesitter-d87629647614b779fb2aad8f0042fe2864253ea6.tar.zst nvim-treesitter-d87629647614b779fb2aad8f0042fe2864253ea6.zip | |
feat: add Linkerscript (#5693)
Diffstat (limited to 'queries')
| -rw-r--r-- | queries/linkerscript/folds.scm | 6 | ||||
| -rw-r--r-- | queries/linkerscript/highlights.scm | 146 | ||||
| -rw-r--r-- | queries/linkerscript/indents.scm | 11 | ||||
| -rw-r--r-- | queries/linkerscript/injections.scm | 2 | ||||
| -rw-r--r-- | queries/linkerscript/locals.scm | 15 |
5 files changed, 180 insertions, 0 deletions
diff --git a/queries/linkerscript/folds.scm b/queries/linkerscript/folds.scm new file mode 100644 index 000000000..0fc77b1a7 --- /dev/null +++ b/queries/linkerscript/folds.scm @@ -0,0 +1,6 @@ +[ + (sections_command) + (output_section) + (memory_command) + (phdrs_command) +] @fold diff --git a/queries/linkerscript/highlights.scm b/queries/linkerscript/highlights.scm new file mode 100644 index 000000000..f933f31ca --- /dev/null +++ b/queries/linkerscript/highlights.scm @@ -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 diff --git a/queries/linkerscript/indents.scm b/queries/linkerscript/indents.scm new file mode 100644 index 000000000..a636ba109 --- /dev/null +++ b/queries/linkerscript/indents.scm @@ -0,0 +1,11 @@ +[ + (sections_command) + (output_section) + (memory_command) + (phdrs_command) +] @indent.begin + +[ + "}" + ")" +] @indent.branch @indent.end diff --git a/queries/linkerscript/injections.scm b/queries/linkerscript/injections.scm new file mode 100644 index 000000000..51e6d1f6b --- /dev/null +++ b/queries/linkerscript/injections.scm @@ -0,0 +1,2 @@ +((comment) + (#set! injection.language "comment")) diff --git a/queries/linkerscript/locals.scm b/queries/linkerscript/locals.scm new file mode 100644 index 000000000..93ddb4357 --- /dev/null +++ b/queries/linkerscript/locals.scm @@ -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) |
