xyw-vscode/syntaxes/xyw.tmLanguage.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "XYW Assembly",
"scopeName": "source.xyw",
"patterns": [
{
"include": "#comments"
},
{
"include": "#directives"
},
{
"include": "#labels"
},
{
"include": "#strings"
},
{
"include": "#numbers"
},
{
"include": "#instructions"
},
{
"include": "#identifiers"
}
],
"repository": {
"comments": {
"patterns": [
{
"name": "comment.line.semicolon.xyw",
"match": ";.*$"
}
]
},
"directives": {
"patterns": [
{
"name": "keyword.control.directive.xyw",
"match": "\\.(include|label|macro|string|byte)\\b"
}
]
},
"labels": {
"patterns": [
{
"comment": "Label definition: .label <name> where name starts with letter/underscore, can contain letters, numbers, underscores, dashes, or dots",
"name": "support.function.label.xyw",
"match": "(?<=\\.label\\s+)[a-zA-Z_][a-zA-Z0-9_.\\-]*"
},
{
"comment": "Macro definition: .macro <name> <args...> - name followed by space-separated arguments",
"match": "(?<=\\.macro\\s+)([a-zA-Z_][a-zA-Z0-9_.\\-]*)(.*)$",
"captures": {
"1": {
"name": "support.function.macro.xyw"
},
"2": {
"patterns": [
{
"include": "#comments"
},
{
"include": "#strings"
},
{
"include": "#numbers"
},
{
"include": "#instructions"
},
{
"include": "#identifiers"
}
]
}
}
}
]
},
"strings": {
"patterns": [
{
"name": "string.quoted.double.xyw",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.xyw",
"match": "\\\\."
}
]
}
]
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.hex.xyw",
"match": "\\$[0-9a-fA-F]+"
},
{
"name": "constant.numeric.binary.xyw",
"match": "%[01]+"
}
]
},
"instructions": {
"comment": "All 32 instructions from xyw_instructions with optional modifiers",
"patterns": [
{
"comment": "BRK and RTS have no modifiers",
"name": "variable.other.instruction.xyw",
"match": "\\b(BRK|RTS)\\b"
},
{
"comment": "OVR and ROT only support w modifier",
"match": "\\b(OVR|ROT)(w?)\\b",
"captures": {
"1": {
"name": "variable.other.instruction.xyw"
},
"2": {
"name": "storage.modifier.mode.xyw"
}
}
},
{
"comment": "JMP, JCN, JSR support x or y (not both) and w",
"match": "\\b(JMP|JCN|JSR)([xy]?w?)\\b",
"captures": {
"1": {
"name": "variable.other.instruction.xyw"
},
"2": {
"name": "storage.modifier.mode.xyw"
}
}
},
{
"comment": "All other instructions with optional xyw modifiers",
"match": "\\b(PSH|POP|CLR|LDB|LDW|STB|STW|INC|DEC|SHL|SHR|ADD|SUB|MUL|DIV|EQU|NEQ|GTH|LTH|AND|IOR|XOR|NOT|SWP|DUP)([xyw]*)\\b",
"captures": {
"1": {
"name": "variable.other.instruction.xyw"
},
"2": {
"name": "storage.modifier.mode.xyw"
}
}
}
]
},
"identifiers": {
"patterns": [
{
"comment": "Device identifiers: system.*, terminal.*, file.*, clock.*, beeper.*",
"name": "support.type.device.xyw",
"match": "\\b(system|terminal|file|clock|beeper)\\.[a-zA-Z0-9_.\\-]*\\b"
},
{
"comment": "Label/macro references: starts with letter/underscore, can contain letters, numbers, underscores, dashes, or dots",
"name": "entity.name.function.xyw",
"match": "\\b[a-zA-Z_][a-zA-Z0-9_.\\-]*\\b"
}
]
}
}
}
|