| 1 |
{ |
| 2 |
"scopeName": "source.ara", |
| 3 |
"name": "ara", |
| 4 |
"fileTypes": ["ara"], |
| 5 |
"patterns": [ |
| 6 |
{ |
| 7 |
"include": "#namespace" |
| 8 |
}, |
| 9 |
{ |
| 10 |
"include": "#named-arguments" |
| 11 |
}, |
| 12 |
{ |
| 13 |
"include": "#comments" |
| 14 |
}, |
| 15 |
{ |
| 16 |
"include": "#keywords" |
| 17 |
}, |
| 18 |
{ |
| 19 |
"include": "#strings" |
| 20 |
}, |
| 21 |
{ |
| 22 |
"include": "#numbers" |
| 23 |
}, |
| 24 |
{ |
| 25 |
"include": "#operators" |
| 26 |
}, |
| 27 |
{ |
| 28 |
"include": "#type" |
| 29 |
}, |
| 30 |
{ |
| 31 |
"include": "#function-call" |
| 32 |
} |
| 33 |
], |
| 34 |
"repository": { |
| 35 |
"class-name": { |
| 36 |
"patterns": [ |
| 37 |
{ |
| 38 |
"begin": "\\b(?i)(?<!\\$)(?=[\\\\a-zA-Z_])", |
| 39 |
"end": "(?i)([a-z_][a-z_0-9]*)?(?=[^a-z0-9_\\\\])\\b", |
| 40 |
"endCaptures": { |
| 41 |
"1": { |
| 42 |
"name": "support.class.ara" |
| 43 |
} |
| 44 |
}, |
| 45 |
"patterns": [ |
| 46 |
{ |
| 47 |
"include": "#namespace" |
| 48 |
} |
| 49 |
] |
| 50 |
} |
| 51 |
] |
| 52 |
}, |
| 53 |
"type": { |
| 54 |
"name": "support.type.php", |
| 55 |
"patterns": [ |
| 56 |
{ |
| 57 |
"match": "\\b(?:void|true|false|null|never|float|bool|int|string|dict|vec|object|mixed|nonnull|resource|self|static|parent|iterable)\\b", |
| 58 |
"name": "support.type.php" |
| 59 |
}, |
| 60 |
{ |
| 61 |
"begin": "([A-Za-z_][A-Za-z0-9_]*)<", |
| 62 |
"beginCaptures": { |
| 63 |
"1": { |
| 64 |
"name": "support.class.php" |
| 65 |
} |
| 66 |
}, |
| 67 |
"end": ">", |
| 68 |
"patterns": [ |
| 69 |
{ |
| 70 |
"include": "#type-annotation" |
| 71 |
} |
| 72 |
] |
| 73 |
}, |
| 74 |
{ |
| 75 |
"begin": "(shape\\()", |
| 76 |
"end": "((,|\\.\\.\\.)?\\s*\\))", |
| 77 |
"endCaptures": { |
| 78 |
"1": { |
| 79 |
"name": "keyword.operator.key.php" |
| 80 |
} |
| 81 |
}, |
| 82 |
"name": "storage.type.shape.php", |
| 83 |
"patterns": [ |
| 84 |
{ |
| 85 |
"include": "#type-annotation" |
| 86 |
}, |
| 87 |
{ |
| 88 |
"include": "#strings" |
| 89 |
}, |
| 90 |
{ |
| 91 |
"include": "#constants" |
| 92 |
} |
| 93 |
] |
| 94 |
}, |
| 95 |
{ |
| 96 |
"begin": "\\(", |
| 97 |
"end": "\\)", |
| 98 |
"patterns": [ |
| 99 |
{ |
| 100 |
"include": "#type-annotation" |
| 101 |
} |
| 102 |
] |
| 103 |
}, |
| 104 |
{ |
| 105 |
"begin": "\\(fn\\(", |
| 106 |
"end": "\\)", |
| 107 |
"patterns": [ |
| 108 |
{ |
| 109 |
"include": "#type-annotation" |
| 110 |
} |
| 111 |
] |
| 112 |
}, |
| 113 |
{ |
| 114 |
"include": "#class-name" |
| 115 |
}, |
| 116 |
{ |
| 117 |
"include": "#comments" |
| 118 |
} |
| 119 |
] |
| 120 |
}, |
| 121 |
"namespace": { |
| 122 |
"begin": "(?i)((namespace)|[a-z0-9_]+)?(\\\\)(?=.*?[^a-z_0-9\\\\])", |
| 123 |
"beginCaptures": { |
| 124 |
"1": { |
| 125 |
"name": "entity.name.type.namespace.php" |
| 126 |
}, |
| 127 |
"3": { |
| 128 |
"name": "punctuation.separator.inheritance.php" |
| 129 |
} |
| 130 |
}, |
| 131 |
"end": "(?i)(?=[a-z0-9_]*[^a-z0-9_\\\\])", |
| 132 |
"name": "support.other.namespace.php", |
| 133 |
"patterns": [ |
| 134 |
{ |
| 135 |
"name": "entity.name.type.namespace.php", |
| 136 |
"match": "(?i)[a-z0-9_]+(?=\\\\)" |
| 137 |
}, |
| 138 |
{ |
| 139 |
"captures": { |
| 140 |
"1": { |
| 141 |
"name": "punctuation.separator.inheritance.php" |
| 142 |
} |
| 143 |
}, |
| 144 |
"match": "(?i)(\\\\)" |
| 145 |
} |
| 146 |
] |
| 147 |
}, |
| 148 |
"named-arguments": { |
| 149 |
"match": "(?i)(?<=^|\\(|,)\\s*([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)\\s*(:)(?!:)", |
| 150 |
"captures": { |
| 151 |
"1": { |
| 152 |
"name": "entity.name.variable.parameter.ara" |
| 153 |
}, |
| 154 |
"2": { |
| 155 |
"name": "punctuation.separator.colon.ara" |
| 156 |
} |
| 157 |
} |
| 158 |
}, |
| 159 |
"comments": { |
| 160 |
"patterns": [ |
| 161 |
{ |
| 162 |
"begin": "/\\*", |
| 163 |
"captures": { |
| 164 |
"0": { |
| 165 |
"name": "punctuation.definition.comment.ara" |
| 166 |
} |
| 167 |
}, |
| 168 |
"end": "\\*/", |
| 169 |
"name": "comment.block.ara" |
| 170 |
}, |
| 171 |
{ |
| 172 |
"begin": "(^[ \\t]+)?(?=//)", |
| 173 |
"beginCaptures": { |
| 174 |
"1": { |
| 175 |
"name": "punctuation.whitespace.comment.leading.ara" |
| 176 |
} |
| 177 |
}, |
| 178 |
"end": "(?!\\G)", |
| 179 |
"patterns": [ |
| 180 |
{ |
| 181 |
"begin": "//", |
| 182 |
"beginCaptures": { |
| 183 |
"0": { |
| 184 |
"name": "punctuation.definition.comment.ara" |
| 185 |
} |
| 186 |
}, |
| 187 |
"end": "\\n", |
| 188 |
"name": "comment.line.double-slash.ara" |
| 189 |
} |
| 190 |
] |
| 191 |
} |
| 192 |
] |
| 193 |
}, |
| 194 |
"keywords": { |
| 195 |
"patterns": [ |
| 196 |
{ |
| 197 |
"name": "keyword.control.ara", |
| 198 |
"match": "\\b(await|async|concurrently|break|continue|do|else|elseif|for|if|loop|while|foreach|match|return|try|yield|from|catch|finally|default|exit)\\b" |
| 199 |
}, |
| 200 |
{ |
| 201 |
"name": "storage.decl.ara", |
| 202 |
"match": "\\b(const|enum|class|interface|trait|namespace|type|case|function|fn)\\b" |
| 203 |
}, |
| 204 |
{ |
| 205 |
"name": "storage.modifier.ara", |
| 206 |
"match": "\\b(final|abstract|static|readonly|public|private|protected)\\b" |
| 207 |
}, |
| 208 |
{ |
| 209 |
"name": "keyword.other.ara", |
| 210 |
"match": "\\b(as|is|extends|implements|use|where|clone|new)\\b" |
| 211 |
} |
| 212 |
] |
| 213 |
}, |
| 214 |
"function-call": { |
| 215 |
"patterns": [ |
| 216 |
{ |
| 217 |
"begin": "(?i)(?=\\\\?[a-z_0-9\\\\]+\\\\[a-z_][a-z0-9_]*\\s*(\\(|(::<)))", |
| 218 |
"comment": "Functions in a user-defined namespace (overrides any built-ins)", |
| 219 |
"end": "(?=\\s*(\\(|(::<)))", |
| 220 |
"patterns": [ |
| 221 |
{ |
| 222 |
"include": "#user-function-call" |
| 223 |
} |
| 224 |
] |
| 225 |
}, |
| 226 |
{ |
| 227 |
"begin": "(?i)(\\\\)?(?=\\b[a-z_][a-z_0-9]*\\s*(\\(|(::<)))", |
| 228 |
"beginCaptures": { |
| 229 |
"1": { |
| 230 |
"name": "punctuation.separator.inheritance.php" |
| 231 |
} |
| 232 |
}, |
| 233 |
"comment": "Root namespace function calls (built-in or user)", |
| 234 |
"end": "(?=\\s*(\\(|(::<)))", |
| 235 |
"patterns": [ |
| 236 |
{ |
| 237 |
"include": "#user-function-call" |
| 238 |
} |
| 239 |
] |
| 240 |
} |
| 241 |
] |
| 242 |
}, |
| 243 |
"user-function-call": { |
| 244 |
"begin": "(?i)(?=[a-z_0-9\\\\]*[a-z_][a-z0-9_]*\\s*\\()", |
| 245 |
"end": "(?i)[a-z_][a-z_0-9]*(?=\\s*\\()", |
| 246 |
"endCaptures": { |
| 247 |
"0": { |
| 248 |
"name": "entity.name.function.php" |
| 249 |
} |
| 250 |
}, |
| 251 |
"name": "meta.function-call.php", |
| 252 |
"patterns": [ |
| 253 |
{ |
| 254 |
"include": "#namespace" |
| 255 |
} |
| 256 |
] |
| 257 |
}, |
| 258 |
"strings": { |
| 259 |
"patterns": [ |
| 260 |
{ |
| 261 |
"name": "string.quoted.single.ara", |
| 262 |
"begin": "'", |
| 263 |
"end": "'", |
| 264 |
"patterns": [ |
| 265 |
{ |
| 266 |
"match": "\\\\[\\\\']", |
| 267 |
"name": "constant.character.escape.ara" |
| 268 |
} |
| 269 |
] |
| 270 |
}, |
| 271 |
{ |
| 272 |
"name": "string.quoted.double.ara", |
| 273 |
"begin": "\"", |
| 274 |
"end": "\"", |
| 275 |
"patterns": [ |
| 276 |
{ |
| 277 |
"include": "#interpolation" |
| 278 |
} |
| 279 |
] |
| 280 |
} |
| 281 |
] |
| 282 |
}, |
| 283 |
"interpolation": { |
| 284 |
"patterns": [ |
| 285 |
{ |
| 286 |
"comment": "Interpolating octal values e.g. \\01 or \\07.", |
| 287 |
"match": "\\\\[0-7]{1,3}", |
| 288 |
"name": "constant.numeric.octal.ara" |
| 289 |
}, |
| 290 |
{ |
| 291 |
"comment": "Interpolating hex values e.g. \\x1 or \\xFF.", |
| 292 |
"match": "\\\\x[0-9A-Fa-f]{1,2}", |
| 293 |
"name": "constant.numeric.hex.ara" |
| 294 |
}, |
| 295 |
{ |
| 296 |
"comment": "Escaped characters in double-quoted strings e.g. \\n or \\t.", |
| 297 |
"match": "\\\\[nrt\\\\\\$\\\"]", |
| 298 |
"name": "constant.character.escape.ara" |
| 299 |
} |
| 300 |
] |
| 301 |
}, |
| 302 |
"numbers": { |
| 303 |
"patterns": [ |
| 304 |
{ |
| 305 |
"match": "0[xX][0-9a-fA-F]+(?:_[0-9a-fA-F]+)*", |
| 306 |
"name": "constant.numeric.hex.ara" |
| 307 |
}, |
| 308 |
{ |
| 309 |
"match": "0[bB][01]+(?:_[01]+)*", |
| 310 |
"name": "constant.numeric.binary.ara" |
| 311 |
}, |
| 312 |
{ |
| 313 |
"match": "0[oO][0-7]+(?:_[0-7]+)*", |
| 314 |
"name": "constant.numeric.octal.ara" |
| 315 |
}, |
| 316 |
{ |
| 317 |
"match": "0(?:_?[0-7]+)+", |
| 318 |
"name": "constant.numeric.octal.ara" |
| 319 |
}, |
| 320 |
{ |
| 321 |
"match": "(?x)\n(?:\n (?:[0-9]+(?:_[0-9]+)*)?(\\.)[0-9]+(?:_[0-9]+)*(?:[eE][+-]?[0-9]+(?:_[0-9]+)*)?| # .3\n [0-9]+(?:_[0-9]+)*(\\.)(?:[0-9]+(?:_[0-9]+)*)?(?:[eE][+-]?[0-9]+(?:_[0-9]+)*)?| # 3.\n [0-9]+(?:_[0-9]+)*[eE][+-]?[0-9]+(?:_[0-9]+)* # 2e-3\n)", |
| 322 |
"name": "constant.numeric.decimal.ara", |
| 323 |
"captures": { |
| 324 |
"1": { |
| 325 |
"name": "punctuation.separator.decimal.period.ara" |
| 326 |
}, |
| 327 |
"2": { |
| 328 |
"name": "punctuation.separator.decimal.period.ara" |
| 329 |
} |
| 330 |
} |
| 331 |
}, |
| 332 |
{ |
| 333 |
"match": "0|[1-9](?:_?[0-9]+)*", |
| 334 |
"name": "constant.numeric.decimal.ara" |
| 335 |
} |
| 336 |
] |
| 337 |
}, |
| 338 |
"operators": { |
| 339 |
"patterns": [ |
| 340 |
{ |
| 341 |
"comment": "assignment operators", |
| 342 |
"name": "keyword.assignments.ara", |
| 343 |
"match": "(\\+=|-=|\\*=|/=|%=|\\^=|&&=|<=|>=|&=|\\|=|<<=|>>=|\\?\\?=)" |
| 344 |
}, |
| 345 |
{ |
| 346 |
"comment": "logical operators", |
| 347 |
"name": "keyword.operators.ara", |
| 348 |
"match": "(\\^|\\||\\|\\||&&|>>|<<|&|~|<<|>>|>|<|<=>|\\?\\?|\\?|:|\\?:)(?!=)" |
| 349 |
}, |
| 350 |
{ |
| 351 |
"comment": "comparison operators", |
| 352 |
"name": "keyword.operator.comparison.ara", |
| 353 |
"match": "(==|===|!==|!=|<=|>=|<|>)(?!=)" |
| 354 |
}, |
| 355 |
{ |
| 356 |
"comment": "math operators", |
| 357 |
"name": "keyword.operator.math.ara", |
| 358 |
"match": "(([+%]|(\\*(?!\\w)))(?!=))|(-(?!>))|(/(?!/))" |
| 359 |
}, |
| 360 |
{ |
| 361 |
"comment": "single equal assignment operator", |
| 362 |
"name": "keyword.operator.assignment.ara", |
| 363 |
"match": "(?<![<>])=(?!=|>)" |
| 364 |
}, |
| 365 |
{ |
| 366 |
"comment": "less than, greater than (special case)", |
| 367 |
"match": "(?:\\b|(?:(\\))|(\\])|(\\})))[ \\t]+([<>])[ \\t]+(?:\\b|(?:(\\()|(\\[)|(\\{)))", |
| 368 |
"captures": { |
| 369 |
"1": { |
| 370 |
"name": "punctuation.brackets.round.ara" |
| 371 |
}, |
| 372 |
"2": { |
| 373 |
"name": "punctuation.brackets.square.ara" |
| 374 |
}, |
| 375 |
"3": { |
| 376 |
"name": "punctuation.brackets.curly.ara" |
| 377 |
}, |
| 378 |
"4": { |
| 379 |
"name": "keyword.operator.comparison.ara" |
| 380 |
}, |
| 381 |
"5": { |
| 382 |
"name": "punctuation.brackets.round.ara" |
| 383 |
}, |
| 384 |
"6": { |
| 385 |
"name": "punctuation.brackets.square.ara" |
| 386 |
}, |
| 387 |
"7": { |
| 388 |
"name": "punctuation.brackets.curly.ara" |
| 389 |
} |
| 390 |
} |
| 391 |
}, |
| 392 |
{ |
| 393 |
"comment": "arrow method call, arrow property access", |
| 394 |
"name": "keyword.operator.arrow.ara", |
| 395 |
"match": "(?x)\n(?:\n -> | \\?-> \n)" |
| 396 |
}, |
| 397 |
{ |
| 398 |
"comment": "double arrow key-value pair", |
| 399 |
"name": "keyword.operator.double-arrow.ara", |
| 400 |
"match": "(?x)\n(?:\n =>\n)" |
| 401 |
}, |
| 402 |
{ |
| 403 |
"comment": "static method call, static property access", |
| 404 |
"name": "keyword.operator.static.ara", |
| 405 |
"match": "(?x)\n(?:\n ::\n)" |
| 406 |
}, |
| 407 |
{ |
| 408 |
"comment": "closure creation", |
| 409 |
"name": "keyword.operator.closure.ara", |
| 410 |
"match": "(?x)\n(?:\n \\(\\.\\.\\.\\)\n)" |
| 411 |
}, |
| 412 |
{ |
| 413 |
"comment": "spread operator", |
| 414 |
"name": "keyword.operator.spread.ara", |
| 415 |
"match": "(?x)\n(?:\n \\.\\.\\.\n)" |
| 416 |
}, |
| 417 |
{ |
| 418 |
"comment": "namespace operator", |
| 419 |
"name": "keyword.operator.namespace.ara", |
| 420 |
"match": "\\\\" |
| 421 |
} |
| 422 |
] |
| 423 |
} |
| 424 |
} |
| 425 |
} |
| 426 |
|