vscode-omega
aien-dev/vscode-omega
Brought by drakestapleton
vscode-omega / syntaxes / omega.tmLanguage.json
| 1 | { |
| 2 | "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", |
| 3 | "name": "Omega", |
| 4 | "scopeName": "source.omega", |
| 5 | "fileTypes": [ |
| 6 | "om" |
| 7 | ], |
| 8 | "comment": "Follows aien-dev/tree-sitter-omega grammar.js and queries/highlights.scm (word lists copied from there; CI checks token agreement over the omega-mv corpus).", |
| 9 | "patterns": [ |
| 10 | { |
| 11 | "include": "#comment" |
| 12 | }, |
| 13 | { |
| 14 | "include": "#profile" |
| 15 | }, |
| 16 | { |
| 17 | "include": "#function-header" |
| 18 | }, |
| 19 | { |
| 20 | "include": "#layout" |
| 21 | }, |
| 22 | { |
| 23 | "include": "#assignment-target" |
| 24 | }, |
| 25 | { |
| 26 | "include": "#line-keyword" |
| 27 | }, |
| 28 | { |
| 29 | "include": "#words" |
| 30 | } |
| 31 | ], |
| 32 | "repository": { |
| 33 | "comment": { |
| 34 | "name": "comment.line.note.omega", |
| 35 | "match": "(?:^|(?<=[ \\t]))note(?:[ \\t\\r()].*)?$" |
| 36 | }, |
| 37 | "profile": { |
| 38 | "match": "^\\s*(om2|ir)(?![A-Za-z0-9_])((?:[ \\t]+[A-Za-z_][A-Za-z0-9_]*)*)[ \\t]*$", |
| 39 | "captures": { |
| 40 | "1": { |
| 41 | "name": "keyword.other.directive.omega" |
| 42 | }, |
| 43 | "2": { |
| 44 | "name": "keyword.other.directive.omega" |
| 45 | } |
| 46 | } |
| 47 | }, |
| 48 | "function-header": { |
| 49 | "begin": "^\\s*(?:(export)[ \\t]+)?(fn)[ \\t]+([A-Za-z_][A-Za-z0-9_]*)", |
| 50 | "beginCaptures": { |
| 51 | "1": { |
| 52 | "name": "keyword.other.omega" |
| 53 | }, |
| 54 | "2": { |
| 55 | "name": "keyword.other.omega" |
| 56 | }, |
| 57 | "3": { |
| 58 | "name": "entity.name.function.omega" |
| 59 | } |
| 60 | }, |
| 61 | "end": "$", |
| 62 | "patterns": [ |
| 63 | { |
| 64 | "include": "#comment" |
| 65 | }, |
| 66 | { |
| 67 | "match": "(?<![A-Za-z0-9_])to(?![A-Za-z0-9_])", |
| 68 | "name": "keyword.other.omega" |
| 69 | }, |
| 70 | { |
| 71 | "include": "#words" |
| 72 | } |
| 73 | ] |
| 74 | }, |
| 75 | "line-keyword": { |
| 76 | "patterns": [ |
| 77 | { |
| 78 | "match": "^\\s*(if|else|while|for|break|continue)(?![A-Za-z0-9_])(?!\\s*=(?!=))", |
| 79 | "captures": { |
| 80 | "1": { |
| 81 | "name": "keyword.control.omega" |
| 82 | } |
| 83 | } |
| 84 | }, |
| 85 | { |
| 86 | "match": "^\\s*(ret|exit|trap)(?![A-Za-z0-9_])(?!\\s*=(?!=))", |
| 87 | "captures": { |
| 88 | "1": { |
| 89 | "name": "keyword.control.return.omega" |
| 90 | } |
| 91 | } |
| 92 | }, |
| 93 | { |
| 94 | "match": "^\\s*(put)(?![A-Za-z0-9_])(?!\\s*=(?!=))", |
| 95 | "captures": { |
| 96 | "1": { |
| 97 | "name": "support.function.builtin.omega" |
| 98 | } |
| 99 | } |
| 100 | }, |
| 101 | { |
| 102 | "match": "^\\s*(end)(?![A-Za-z0-9_])", |
| 103 | "captures": { |
| 104 | "1": { |
| 105 | "name": "keyword.other.omega" |
| 106 | } |
| 107 | } |
| 108 | }, |
| 109 | { |
| 110 | "match": "^\\s*(global|text|const|struct|abstract|holds)[ \\t]+([A-Za-z_][A-Za-z0-9_]*)(?!\\s*=(?!=))", |
| 111 | "captures": { |
| 112 | "1": { |
| 113 | "name": "keyword.other.omega" |
| 114 | }, |
| 115 | "2": { |
| 116 | "name": "entity.name.type.omega" |
| 117 | } |
| 118 | } |
| 119 | } |
| 120 | ] |
| 121 | }, |
| 122 | "layout": { |
| 123 | "comment": "`layout NAME SIZE`, `field` lines, `end`. `field` is a keyword only here: elsewhere an OM-1 unit may call a function named field.", |
| 124 | "begin": "^\\s*(layout)[ \\t]+([A-Za-z_][A-Za-z0-9_]*)(?!\\s*=(?!=))", |
| 125 | "beginCaptures": { |
| 126 | "1": { |
| 127 | "name": "keyword.other.omega" |
| 128 | }, |
| 129 | "2": { |
| 130 | "name": "entity.name.type.omega" |
| 131 | } |
| 132 | }, |
| 133 | "end": "^\\s*(end)(?![A-Za-z0-9_])", |
| 134 | "endCaptures": { |
| 135 | "1": { |
| 136 | "name": "keyword.other.omega" |
| 137 | } |
| 138 | }, |
| 139 | "patterns": [ |
| 140 | { |
| 141 | "include": "#comment" |
| 142 | }, |
| 143 | { |
| 144 | "match": "^\\s*(field)[ \\t]+([A-Za-z_][A-Za-z0-9_]*)", |
| 145 | "captures": { |
| 146 | "1": { |
| 147 | "name": "keyword.other.omega" |
| 148 | }, |
| 149 | "2": { |
| 150 | "name": "variable.other.member.omega" |
| 151 | } |
| 152 | } |
| 153 | }, |
| 154 | { |
| 155 | "include": "#words" |
| 156 | } |
| 157 | ] |
| 158 | }, |
| 159 | "words": { |
| 160 | "patterns": [ |
| 161 | { |
| 162 | "include": "#comment" |
| 163 | }, |
| 164 | { |
| 165 | "include": "#string" |
| 166 | }, |
| 167 | { |
| 168 | "name": "constant.numeric.float.omega", |
| 169 | "match": "(?<![A-Za-z0-9_])-?[0-9]+(?:\\.[0-9]+(?:[eE][+-]?[0-9]+)?(?:f32|f64)?|[eE][+-]?[0-9]+(?:f32|f64)?|(?:f32|f64))(?![A-Za-z0-9_])" |
| 170 | }, |
| 171 | { |
| 172 | "name": "constant.numeric.integer.omega", |
| 173 | "match": "(?<![A-Za-z0-9_])(?:0x[0-9a-f]+|-?[0-9]+)(?![A-Za-z0-9_])" |
| 174 | }, |
| 175 | { |
| 176 | "match": "(?<![A-Za-z0-9_])(bound)(?![A-Za-z0-9_])", |
| 177 | "captures": { |
| 178 | "1": { |
| 179 | "name": "keyword.control.omega" |
| 180 | } |
| 181 | } |
| 182 | }, |
| 183 | { |
| 184 | "match": "[ \\t](end)[ \\t]*$", |
| 185 | "captures": { |
| 186 | "1": { |
| 187 | "name": "keyword.other.omega" |
| 188 | } |
| 189 | } |
| 190 | }, |
| 191 | { |
| 192 | "name": "constant.language.boolean.omega", |
| 193 | "match": "(?<![A-Za-z0-9_])(?:false|true)(?![A-Za-z0-9_])" |
| 194 | }, |
| 195 | { |
| 196 | "name": "support.type.builtin.omega", |
| 197 | "match": "(?<![A-Za-z0-9_])(?:ushort|uchar|ulong|short|bool|uint|byte|long|void|u16|u32|u64|i16|int|i32|i64|f32|f64|u8|i8)(?![A-Za-z0-9_])" |
| 198 | }, |
| 199 | { |
| 200 | "name": "keyword.operator.word.omega", |
| 201 | "match": "(?<![A-Za-z0-9_])(?:offsetof|bitcast|sizeof|fsqrt|rotr|rotl|fabs|fmin|fmax|add|sub|mul|div|rem|and|xor|shl|shr|neg|not|or|eq|ne|lt|le|gt|ge)(?![A-Za-z0-9_])" |
| 202 | }, |
| 203 | { |
| 204 | "name": "storage.modifier.omega", |
| 205 | "match": "(?<![A-Za-z0-9_])(?:inline|unroll|little|fresh|view|edit|own|out|big|ops|at)(?![A-Za-z0-9_])" |
| 206 | }, |
| 207 | { |
| 208 | "name": "keyword.other.omega", |
| 209 | "match": "(?<![A-Za-z0-9_])(?:invariant|requires|ensures|free|seal|open|part|new)(?![A-Za-z0-9_])" |
| 210 | }, |
| 211 | { |
| 212 | "name": "variable.language.result.omega", |
| 213 | "match": "(?<![A-Za-z0-9_])(?:result)(?![A-Za-z0-9_])" |
| 214 | }, |
| 215 | { |
| 216 | "name": "support.function.builtin.omega", |
| 217 | "match": "(?<![A-Za-z0-9_])(?:truncate|shutdown|mapwrite|sockname|execprog|peercred|readlnk|sockopt|envread|faccess|geteuid|getegid|getppid|getpgid|setpgid|mapdrop|mapread|devcall|mapaddr|maphold|mapbind|renames|killpid|pipefds|getdnts|connect|waitpid|sleepns|argread|socknew|makedir|pollfds|sendmsg|pwrite|random|envcnt|ftrunc|symlnk|getuid|getgid|fchdir|fdsync|setsid|getsid|syncfs|devctl|mapnew|uvmctl|mapget|mapset|realns|getpid|waitio|argcnt|fclose|fchmod|listen|accept|monons|unlink|write|pread|chdir|chmod|lstat|chown|umask|memfd|flock|rmdir|fstat|fsync|fseek|dupfd|fopen|read|stat|link|bind|recv|send|fork|get|len|cwd)(?![A-Za-z0-9_])" |
| 218 | }, |
| 219 | { |
| 220 | "name": "keyword.operator.assignment.omega", |
| 221 | "match": "(?<=[ \\t])=(?=[ \\t]|$)" |
| 222 | }, |
| 223 | { |
| 224 | "name": "punctuation.section.parens.omega", |
| 225 | "match": "[()]" |
| 226 | }, |
| 227 | { |
| 228 | "name": "storage.modifier.unsized.omega", |
| 229 | "match": "(?<![^ \\t])\\*(?![^ \\t\\n])" |
| 230 | }, |
| 231 | { |
| 232 | "name": "variable.other.omega", |
| 233 | "match": "[A-Za-z_][A-Za-z0-9_]*" |
| 234 | } |
| 235 | ] |
| 236 | }, |
| 237 | "string": { |
| 238 | "name": "string.quoted.double.omega", |
| 239 | "begin": "\"", |
| 240 | "end": "\"|$", |
| 241 | "patterns": [ |
| 242 | { |
| 243 | "name": "constant.character.escape.omega", |
| 244 | "match": "\\\\." |
| 245 | } |
| 246 | ] |
| 247 | }, |
| 248 | "assignment-target": { |
| 249 | "match": "^\\s*([A-Za-z_][A-Za-z0-9_]*)(?=[ \\t]*=(?!=))", |
| 250 | "captures": { |
| 251 | "1": { |
| 252 | "name": "variable.other.omega" |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | } |