diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2023-06-12 09:54:30 -0600 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2025-05-12 18:43:40 +0200 |
| commit | 692b051b09935653befdb8f7ba8afdb640adf17b (patch) | |
| tree | 167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/linkerscript | |
| parent | feat(c-family): inherit injections (diff) | |
| download | nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2 nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip | |
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/linkerscript')
| -rw-r--r-- | runtime/queries/linkerscript/folds.scm | 6 | ||||
| -rw-r--r-- | runtime/queries/linkerscript/highlights.scm | 173 | ||||
| -rw-r--r-- | runtime/queries/linkerscript/indents.scm | 11 | ||||
| -rw-r--r-- | runtime/queries/linkerscript/injections.scm | 2 | ||||
| -rw-r--r-- | runtime/queries/linkerscript/locals.scm | 16 |
5 files changed, 208 insertions, 0 deletions
diff --git a/runtime/queries/linkerscript/folds.scm b/runtime/queries/linkerscript/folds.scm new file mode 100644 index 000000000..0fc77b1a7 --- /dev/null +++ b/runtime/queries/linkerscript/folds.scm @@ -0,0 +1,6 @@ +[ + (sections_command) + (output_section) + (memory_command) + (phdrs_command) +] @fold diff --git a/runtime/queries/linkerscript/highlights.scm b/runtime/queries/linkerscript/highlights.scm new file mode 100644 index 000000000..12330169e --- /dev/null +++ b/runtime/queries/linkerscript/highlights.scm @@ -0,0 +1,173 @@ +; Keywords +[ + "ENTRY" + "SECTIONS" + "AT" + "OVERLAY" + "NOCROSSREFS" + "MEMORY" + "PHDRS" + "FILEHDR" +] @keyword + +; Conditionals +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +; Variables +(symbol) @variable + +(filename) @string.special.path + +; Functions +(call_expression + function: (symbol) @function.call) + +((call_expression + function: (symbol) @keyword.directive) + (#eq? @keyword.directive "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" +] @variable.member + +; 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" @keyword.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/runtime/queries/linkerscript/indents.scm b/runtime/queries/linkerscript/indents.scm new file mode 100644 index 000000000..a636ba109 --- /dev/null +++ b/runtime/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/runtime/queries/linkerscript/injections.scm b/runtime/queries/linkerscript/injections.scm new file mode 100644 index 000000000..51e6d1f6b --- /dev/null +++ b/runtime/queries/linkerscript/injections.scm @@ -0,0 +1,2 @@ +((comment) + (#set! injection.language "comment")) diff --git a/runtime/queries/linkerscript/locals.scm b/runtime/queries/linkerscript/locals.scm new file mode 100644 index 000000000..6b7660370 --- /dev/null +++ b/runtime/queries/linkerscript/locals.scm @@ -0,0 +1,16 @@ +; References +[ + (symbol) + (filename) + (quoted_symbol) +] @local.reference + +; Definitions +(output_section + name: (symbol) @local.definition.var) + +(memory_command + name: (symbol) @local.definition.var) + +(phdrs_command + name: (symbol) @local.definition.var) |
