aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/ld
diff options
context:
space:
mode:
authorMatthew Toohey2024-03-09 07:59:56 +0000
committerGitHub2024-03-09 07:59:56 +0000
commite3c6c82828299f1728f16a8d8fcfa5c3603a3d47 (patch)
tree9a7ee623dbfaa6b85ffd6435ed362a86869d0221 /runtime/queries/ld
parentfd89c3c8335399e344e038f1141ea0657653a591 (diff)
add linker script language (#9835)
Diffstat (limited to 'runtime/queries/ld')
-rw-r--r--runtime/queries/ld/highlights.scm173
-rw-r--r--runtime/queries/ld/indents.scm12
-rw-r--r--runtime/queries/ld/injections.scm2
3 files changed, 187 insertions, 0 deletions
diff --git a/runtime/queries/ld/highlights.scm b/runtime/queries/ld/highlights.scm
new file mode 100644
index 00000000..4f935e75
--- /dev/null
+++ b/runtime/queries/ld/highlights.scm
@@ -0,0 +1,173 @@
+; Identifiers
+
+(section
+ .
+ (NAME) @namespace)
+
+(NAME) @variable
+
+; Operators
+
+[
+ "="
+ "+="
+ "-="
+ "*="
+ "/="
+ "<<="
+ ">>="
+ "&="
+ "|="
+ "^="
+ "*"
+ "/"
+ "%"
+ "+"
+ "-"
+ "<<"
+ ">>"
+ "=="
+ "!="
+ "<="
+ ">="
+ "<"
+ ">"
+ "&"
+ "^"
+ "|"
+ "&&"
+ "||"
+ "?"
+] @operator
+
+; Keywords
+
+[
+ "ABSOLUTE"
+ "ADDR"
+ "ALIGNOF"
+ "ASSERT"
+ "BYTE"
+ "CONSTANT"
+ "DATA_SEGMENT_ALIGN"
+ "DATA_SEGMENT_END"
+ "DATA_SEGMENT_RELRO_END"
+ "DEFINED"
+ "LOADADDR"
+ "LOG2CEIL"
+ "LONG"
+ "MAX"
+ "MIN"
+ "NEXT"
+ "QUAD"
+ "SHORT"
+ "SIZEOF"
+ "SQUAD"
+ "FILL"
+ "SEGMENT_START"
+] @function.builtin
+
+[
+ "CONSTRUCTORS"
+ "CREATE_OBJECT_SYMBOLS"
+ "LINKER_VERSION"
+ "SIZEOF_HEADERS"
+] @constant.builtin
+
+[
+ "AFTER"
+ "ALIGN"
+ "ALIGN_WITH_INPUT"
+ "ASCIZ"
+ "AS_NEEDED"
+ "AT"
+ "BEFORE"
+ "BIND"
+ "BLOCK"
+ "COPY"
+ "DSECT"
+ "ENTRY"
+ "EXCLUDE_FILE"
+ "EXTERN"
+ "extern"
+ "FLOAT"
+ "FORCE_COMMON_ALLOCATION"
+ "FORCE_GROUP_ALLOCATION"
+ "global"
+ "GROUP"
+ "HIDDEN"
+ "HLL"
+ "INCLUDE"
+ "INFO"
+ "INHIBIT_COMMON_ALLOCATION"
+ "INPUT"
+ "INPUT_SECTION_FLAGS"
+ "KEEP"
+ "l"
+ "LD_FEATURE"
+ "len"
+ "LENGTH"
+ "local"
+ "MAP"
+ "MEMORY"
+ "NOCROSSREFS"
+ "NOCROSSREFS_TO"
+ "NOFLOAT"
+ "NOLOAD"
+ "o"
+ "ONLY_IF_RO"
+ "ONLY_IF_RW"
+ "org"
+ "ORIGIN"
+ "OUTPUT"
+ "OUTPUT_ARCH"
+ "OUTPUT_FORMAT"
+ "OVERLAY"
+ "PHDRS"
+ "PROVIDE"
+ "PROVIDE_HIDDEN"
+ "READONLY"
+ "REGION_ALIAS"
+ "REVERSE"
+ "SEARCH_DIR"
+ "SECTIONS"
+ "SORT"
+ "SORT_BY_ALIGNMENT"
+ "SORT_BY_INIT_PRIORITY"
+ "SORT_BY_NAME"
+ "SORT_NONE"
+ "SPECIAL"
+ "STARTUP"
+ "SUBALIGN"
+ "SYSLIB"
+ "TARGET"
+ "TYPE"
+ "VERSION"
+] @keyword
+
+; Delimiters
+
+[
+ ","
+ ";"
+ "&"
+ ":"
+ ">"
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+; Literals
+
+(INT) @constant.numeric.integer
+
+; Comment
+
+(comment) @comment
diff --git a/runtime/queries/ld/indents.scm b/runtime/queries/ld/indents.scm
new file mode 100644
index 00000000..2e2928b5
--- /dev/null
+++ b/runtime/queries/ld/indents.scm
@@ -0,0 +1,12 @@
+[
+ (sections)
+ (memory)
+ (section)
+ (phdrs)
+ (overlay_section)
+ (version)
+ (vers_node)
+ (vers_defns)
+] @indent
+
+"}" @outdent @extend.prevent-once
diff --git a/runtime/queries/ld/injections.scm b/runtime/queries/ld/injections.scm
new file mode 100644
index 00000000..2f0e58eb
--- /dev/null
+++ b/runtime/queries/ld/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))