vscode-central-asm/syntaxes/central-asm.tmLanguage.json
2024-11-08 23:11:29 +01:00

212 lines
4.6 KiB
JSON

{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Central(ASM)",
"patterns": [
{
"include": "#strings"
},
{
"include": "#comments"
},
{
"include": "#sections"
},
{
"include": "#labels"
},
{
"include": "#numerics"
},
{
"include": "#registers"
},
{
"include": "#preprocessor-lines"
},
{
"include": "#preprocessor-variables"
},
{
"include": "#assembly"
}
],
"repository": {
"strings": {
"name": "string.quoted.double.central-asm",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.central-asm",
"match": "\\\\."
}
]
},
"comments": {
"name": "comment.line.double-slash",
"match": "^.{2}//.*$"
},
"sections": {
"patterns": [
{
"name": "storage.section.named.central-asm",
"match": "^@{2}\\s{2,}[a-zA-Z][a-zA-Z0-9]*(\\.[a-zA-Z][a-zA-Z0-9]*)+\\s*$"
},
{
"name": "storage.section.auto-named.central-asm",
"match": "^@{2}\\s{2,}([a-zA-Z][a-zA-Z0-9]*)\\s*$",
"captures": {
"1": {
"name": "emphasis"
}
}
}
]
},
"labels": {
"patterns": [
{
"name": "entity.name.function.label.local.central-asm",
"match": "^\\.l\\s{2,}([a-zA-Z_][a-zA-Z_0-9]*(\\.[a-zA-Z_][a-zA-Z_0-9]*)*)\\s*$",
"captures": {
"1": {
"name": "emphasis"
}
}
},
{
"name": "entity.name.function.label.local.prepend-last.central-asm",
"match": "^\\.{2}\\s{2,}([a-zA-Z_][a-zA-Z_0-9]*(\\.[a-zA-Z_][a-zA-Z_0-9]*)*)\\s*$",
"captures": {
"1": {
"name": "emphasis"
}
}
},
{
"name": "entity.name.function.label.global.central-asm",
"match": "^\\.g\\s{2,}([a-zA-Z_][a-zA-Z_0-9]*(\\.[a-zA-Z_][a-zA-Z_0-9]*)*)\\s*$",
"captures": {
"1": {
"name": "strong"
}
}
},
{
"name": "entity.name.function.label.ref.relative.central-asm",
"match": "\\.[a-zA-Z_][a-zA-Z_0-9]*(\\.[a-zA-Z_][a-zA-Z_0-9]*)*"
},
{
"name": "entity.name.function.label.ref.absolute.central-asm",
"match": "&[a-zA-Z_][a-zA-Z_0-9]*(\\.[a-zA-Z_][a-zA-Z_0-9]*)*"
}
]
},
"numerics": {
"match": "((0x[0-9a-fA-F]+(_[0-9a-fA-F]+)*)|([0-9]+(_[0-9]+)*))('[0-9]+)?",
"captures": {
"1": {
"name": "constant.numeric.central-asm"
},
"6": {
"name": "storage.modifier.width.central-asm"
}
}
},
"registers": {
"patterns": [
{
"name": "variable.other.central-asm",
"match": "\\b((r[0-9]+)|lr|pc|sp|pc_user|sp_user|pc_svc|sp_svc|pc_fault|sp_fault)\\b"
},
{
"name": "variable.other.central-asm",
"match": "(ss[0-9]+)|(sr[0-9]+)"
}
]
},
"preprocessor-lines": {
"patterns": [
{
"name": "meta.preprocessor.line.central-asm",
"patterns": [
{
"name": "meta.preprocessor.directive.central-asm",
"match": "^%%\\s{2,}([a-zA-Z_][a-zA-Z_0-9]*)",
"captures": {
"1": {
"name": "emphasis"
}
}
},
{
"name": "meta.preprocessor.macro-call.central-asm",
"match": "^%\\*\\s{2,}([a-zA-Z_][a-zA-Z_0-9]*)",
"captures": {
"1": {
"name": "strong"
}
}
},
{
"name": "meta.preprocessor.continuation.central-asm",
"match": "^%-"
},
{
"include": "#preprocessor-key-value-args"
}
]
}
]
},
"preprocessor-key-value-args": {
"name": "meta.preprocessor.arg-key.central-asm",
"match": "\\b([a-zA-Z_][a-zA-Z_0-9]*)=",
"captures": {
"1": {
"name": "variable.parameter.central-asm"
}
}
},
"preprocessor-variables": {
"name": "meta.preprocessor.variable-substitution.central-asm",
"match": "%\\(([a-zA-Z_][a-zA-Z_0-9]*)\\)",
"captures": {
"1": {
"name": "variable.name.central-asm"
}
}
},
"assembly": {
"patterns": [
{
"match": "^\\s{4,}(nop|svc|ldr|str|add|adr|mov|movn|b|bx|ssr|ssw)(\\.(al|eq|neq|uge|cs|ult|cc|neg|pos|vs|vc|ugt|ule|sge|slt|sgt|sle))?\\b",
"captures": {
"1": {
"name": "keyword.control.instructions.central-asm"
},
"2": {
"name": "keyword.other.conditions.central-asm"
}
}
},
{
"name": "keyword.other.data-definition.central-asm",
"match": "^dd\\s{2,}"
},
{
"match": "^(ds)\\s{2,}(int|short|char|ptr)",
"captures": {
"1": {
"name": "keyword.other.data-space.central-asm"
},
"2": {
"name": "entity.name.type.data-space.central-asm"
}
}
}
]
}
},
"scopeName": "source.central-asm"
}