Added support for local labels and single-quoted strings in the x86 assembly TextMate grammar. Updated label patterns for more accurate highlighting and enhanced string pattern handling to include both double and single quotes.
292 lines
7.9 KiB
JSON
292 lines
7.9 KiB
JSON
{
|
|
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
"name": "x86/x64/ARM Assembly",
|
|
"patterns": [
|
|
{ "include": "#comments" },
|
|
{ "include": "#strings" },
|
|
{ "include": "#constants" },
|
|
{ "include": "#registers" },
|
|
{ "include": "#instructions" },
|
|
{ "include": "#directives" },
|
|
{ "include": "#labels" },
|
|
{ "include": "#sections" },
|
|
{ "include": "#symbols" },
|
|
{ "include": "#functions" },
|
|
{ "include": "#memory_operands" },
|
|
{ "include": "#structure" },
|
|
{ "include": "#macros" }
|
|
],
|
|
"repository": {
|
|
"comments": {
|
|
"patterns": [
|
|
{
|
|
"name": "comment.line.semicolon.x86asm",
|
|
"match": ";.*$"
|
|
},
|
|
{
|
|
"name": "comment.block.x86asm",
|
|
"begin": "/\\*",
|
|
"end": "\\*/"
|
|
}
|
|
]
|
|
},
|
|
"directives": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.control.directive.define.x86asm",
|
|
"match": "%define\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.assign.x86asm",
|
|
"match": "%assign\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.equ.x86asm",
|
|
"match": "\\bequ\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.x86asm",
|
|
"match": "\\.(file|cfi_[a-zA-Z_]+|gcc_except_table|ctors|ascii|lcomm|byte|ident|align|rdata|rodata|comment|tbss|init|fini|note|debug|intel_syntax)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.offset.x86asm",
|
|
"match": "\\bOFFSET\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.uleb128.x86asm",
|
|
"match": "\\.uleb128\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.def.x86asm",
|
|
"match": "\\.def\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.long.x86asm",
|
|
"match": "\\.long\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.scl.x86asm",
|
|
"match": "\\.scl\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.type.x86asm",
|
|
"match": "\\.type\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.endef.x86asm",
|
|
"match": "\\.endef\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.globl.x86asm",
|
|
"match": "\\.globl\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.space.x86asm",
|
|
"match": "\\.space\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.intel_syntax.x86asm",
|
|
"match": "\\.intel_syntax\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.extern.x86asm",
|
|
"match": "\\bextern\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.global.x86asm",
|
|
"match": "\\bglobal\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.weak.x86asm",
|
|
"match": "\\.weak\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.hidden.x86asm",
|
|
"match": "\\.hidden\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.protected.x86asm",
|
|
"match": "\\.protected\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.internal.x86asm",
|
|
"match": "\\.internal\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.default.x86asm",
|
|
"match": "\\bdefault\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.rel.x86asm",
|
|
"match": "\\brel\\b"
|
|
}
|
|
]
|
|
},
|
|
"labels": {
|
|
"patterns": [
|
|
{
|
|
"name": "entity.name.label.local.x86asm",
|
|
"match": "^\\.[a-zA-Z_][a-zA-Z0-9_]*:"
|
|
},
|
|
{
|
|
"name": "entity.name.function.label.x86asm",
|
|
"match": "^[a-zA-Z_][a-zA-Z0-9_]*:"
|
|
},
|
|
{
|
|
"name": "entity.name.tag.label.x86asm",
|
|
"match": "^L[a-zA-Z0-9_]+:"
|
|
}
|
|
]
|
|
},
|
|
"sections": {
|
|
"patterns": [
|
|
{
|
|
"name": "entity.name.section.x86asm",
|
|
"match": "\\.(section .(text|data|bss|tbss|tcomm))\\b"
|
|
}
|
|
]
|
|
},
|
|
"instructions": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.control.instruction.x86asm",
|
|
"match": "\\b(mov|push|pop|call|ret|leave|jmp|je|jne|jz|jnz|add|sub|mul|div|and|or|xor|lea|cmp|test|inc|dec|shl|shr|nop|enter|int|syscall|sysret|hlt|in|out|rdmsr|wrmsr)\\b"
|
|
}
|
|
]
|
|
},
|
|
"registers": {
|
|
"patterns": [
|
|
{
|
|
"name": "variable.language.register.x86asm",
|
|
"match": "\\b(rax|rbx|rcx|rdx|rsi|rdi|rbp|rsp|r8|r9|r10|r11|r12|r13|r14|r15|eax|ebx|ecx|edx|esi|edi|ebp|esp|ax|bx|cx|dx|si|di|bp|sp|al|bl|cl|dl|cr[0-4]|dr[0-7]|tr[3-6]|cs|ds|ss|es|fs|gs)\\b"
|
|
}
|
|
]
|
|
},
|
|
"constants": {
|
|
"patterns": [
|
|
{
|
|
"name": "constant.numeric.hex.x86asm",
|
|
"match": "\\b(0x[0-9A-Fa-f]+)\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.decimal.x86asm",
|
|
"match": "\\b([0-9]+)\\b"
|
|
}
|
|
]
|
|
},
|
|
"strings": {
|
|
"patterns": [
|
|
{
|
|
"name": "string.quoted.double.x86asm",
|
|
"begin": "\"",
|
|
"end": "\"",
|
|
"patterns": [
|
|
{
|
|
"name": "constant.character.escape.x86asm",
|
|
"match": "\\\\."
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "string.quoted.single.x86asm",
|
|
"begin": "'",
|
|
"end": "'",
|
|
"patterns": [
|
|
{
|
|
"name": "constant.character.escape.x86asm",
|
|
"match": "\\\\."
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"memory_operands": {
|
|
"patterns": [
|
|
{
|
|
"name": "storage.type.memory.x86asm",
|
|
"match": "\\b(BYTE|WORD|DWORD|QWORD|XMMWORD|YMMWORD|ZMMWORD)\\s+PTR\\b"
|
|
},
|
|
{
|
|
"name": "storage.type.memory.x86asm",
|
|
"match": "\\b(TBYTE|TWORD|DQWORD|OWORD|FWORD)\\b"
|
|
},
|
|
{
|
|
"name": "storage.type.memory.bracketed.x86asm",
|
|
"match": "\\[(.*?)\\]",
|
|
"captures": {
|
|
"1": { "name": "entity.name.memory_operand.inside_brackets.x86asm" }
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"symbols": {
|
|
"patterns": [
|
|
{
|
|
"name": "entity.name.function.x86asm",
|
|
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*|__[a-zA-Z0-9_]+)\\b"
|
|
},
|
|
{
|
|
"name": "entity.name.label.x86asm",
|
|
"match": "\\b(L[a-zA-Z0-9_]+|FLAT:[a-zA-Z_][a-zA-Z0-9_]*)\\b"
|
|
}
|
|
]
|
|
},
|
|
"structure": {
|
|
"patterns": [
|
|
{
|
|
"name": "entity.name.structure.x86asm",
|
|
"match": "\\bSTRUC\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\b"
|
|
},
|
|
{
|
|
"name": "variable.parameter.structure_member.x86asm",
|
|
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s+OFFSET\\s*\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.size.x86asm",
|
|
"match": "\\b([0-9]+)\\s*:\\s*([0-9]+)\\b"
|
|
}
|
|
]
|
|
},
|
|
"directive_definitions": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.control.directive.def.x86asm",
|
|
"begin": "\\.def\\s+",
|
|
"end": ";",
|
|
"patterns": [
|
|
{
|
|
"name": "entity.name.function.x86asm",
|
|
"match": "([a-zA-Z_][a-zA-Z0-9_]*)"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.scl.x86asm",
|
|
"match": "\\.scl\\s+([0-9]+)"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.type.x86asm",
|
|
"match": "\\.type\\s+([0-9]+)"
|
|
},
|
|
{
|
|
"name": "keyword.control.directive.endef.x86asm",
|
|
"match": "\\.endef"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"macros": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.control.macro.x86asm",
|
|
"match": "\\b(macro|endm)\\b"
|
|
},
|
|
{
|
|
"name": "entity.name.macro.x86asm",
|
|
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s+macro\\b"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"scopeName": "source.x86asm"
|
|
}
|