Skip to content

Instantly share code, notes, and snippets.

@donno2048
Last active February 5, 2025 06:01
Show Gist options
  • Save donno2048/2ba5b8baafc2de973e8ed9b68dc78054 to your computer and use it in GitHub Desktop.
Save donno2048/2ba5b8baafc2de973e8ed9b68dc78054 to your computer and use it in GitHub Desktop.
{
"scopeName": "source.c.linker",
"fileTypes": ["ld"],
"foldingStartMarker": "{",
"foldingStopMarker": "}",
"patterns": [
{
"name": "support.function.ld",
"match": "\\b(?^:(?^:(?:S(?:E(?:ARCH_DIR|CTIONS)|IZEOF(?:_HEADERS)?|TARTUP)|IN(?:HIBIT_COMMON_ALLOCATION|CLUDE|PUT)|D(?:ATA_SEGMENT_(?:ALIGN|END)|EFINED)|O(?:UTPUT(?:_(?:FORMAT|ARCH))?|RIGIN)|C(?:REATE_OBJECT_SYMBOL|ONSTRUCTOR)S|(?:FORCE_COMMON_ALLOCATIO|HIDDE)N|E(?:X(?:CLUDE_FILE|TERN)|NTRY)|P(?:ROVIDE(?:_HIDDEN)?|HDRS)|A(?:BSOLUTE|SSERT|LIGN|DDR)|N(?:OCROSSREFS|EXT)|L(?:OADADDR|ENGTH)|M(?:EMORY|AX|IN)|sizeof_headers|l(?:en)?|o(?:rg)?|TARGET|BLOCK|GROUP)))\\b"
},
{
"match": "(BYTE|SHORT|LONG|S?QUAD)\\s*\\(([^\\)]*)\\)",
"captures": {
"1": {
"name": "storage.type.ld"
},
"2": {
"name": "constant.numeric.ld"
}
}
},
{
"match": "((?=.*[^A-Z])[^\\s\\(;:\\{\\}]*)\\s*\\(([^\\)]*)\\)",
"captures": {
"1": {
"name": "variable.other.source.ld"
},
"2": {
"name": "constant.other.section.ld"
}
}
},
{
"match": "([^\\s\\(;:\\{\\}]*)(\\s+[^\\(\\s:]*|\\s*\\([^\\)]*\\))?\\s*:\\s*(AT\\s*\\([^\\)]*\\))?",
"captures": {
"1": {
"name": "constant.other.section.ld"
},
"2": {
"name": "constant.numeric.address.ld"
},
"3": {
"name": "keyword.other.at.ld"
}
},
{
"match": "\\}\\s*\\>\\s*([^\\s\\>:]*)\\s*(AT\\s*)?(?:\\>\\s*)?([^\\=\\>]*)?\\=\\s*([^\\s;\\}]*)"
"captures": {
"1": {
"name": "constant.numeric.memory.ld"
},
"2": {
"name": "keyword.other.at.ld"
},
"4": {
"name": "constant.numeric.memory.ld"
},
"5": {
"name": "constant.numeric.address.ld"
}
}
},
{
"match": "([^\\s\\(;\\{\\}]*)\\s*\\(\\s*([RrWwXx\\!]{,4})\\s*\\)"
"captures": {
"1": {
"name": "constant.numeric.memory.ld"
},
"2": {
"name": "support.constant.permissions.ld"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment