|
| 1 | +{ |
| 2 | + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", |
| 3 | + "name": "Core", |
| 4 | + "scopeName": "source.core", |
| 5 | + "foldingStartMarker": "\\{\\s*$", |
| 6 | + "foldingStopMarker": "^\\s*\\}", |
| 7 | + "fileTypes": [ |
| 8 | + "core" |
| 9 | + ], |
| 10 | + "patterns": [ |
| 11 | + { |
| 12 | + "include": "#comments" |
| 13 | + }, |
| 14 | + { |
| 15 | + "include": "#operators" |
| 16 | + }, |
| 17 | + { |
| 18 | + "include": "#keywords" |
| 19 | + }, |
| 20 | + { |
| 21 | + "include": "#annotations" |
| 22 | + }, |
| 23 | + { |
| 24 | + "include": "#true-false" |
| 25 | + }, |
| 26 | + { |
| 27 | + "include": "#numbers" |
| 28 | + }, |
| 29 | + { |
| 30 | + "include": "#strings" |
| 31 | + }, |
| 32 | + { |
| 33 | + "include": "#declarations" |
| 34 | + } |
| 35 | + ], |
| 36 | + "repository": { |
| 37 | + "comments": { |
| 38 | + "patterns": [ |
| 39 | + { |
| 40 | + "name": "comment.line.double-slash.core", |
| 41 | + "match": "^\\s*(?=//).*$" |
| 42 | + }, |
| 43 | + { |
| 44 | + "begin": "/\\*", |
| 45 | + "end": "\\*/", |
| 46 | + "name": "comment.block.core" |
| 47 | + } |
| 48 | + ] |
| 49 | + }, |
| 50 | + "operators": { |
| 51 | + "patterns": [ |
| 52 | + { |
| 53 | + "name": "keyword.operator.core", |
| 54 | + "match": "\\b(==|!=|>=|<=|\\&|\\*|=|>|<|-|\\+|/)\\b" |
| 55 | + } |
| 56 | + ] |
| 57 | + }, |
| 58 | + "keywords": { |
| 59 | + "patterns": [ |
| 60 | + { |
| 61 | + "name": "keyword.control.core", |
| 62 | + "match": "\\b(else|if|for|return|while)\\b" |
| 63 | + }, |
| 64 | + { |
| 65 | + "name": "keyword.other.core", |
| 66 | + "match": "\\b(const|class|value|union|enum|trait|impl|annotation|use|mod|is)\\b" |
| 67 | + } |
| 68 | + ] |
| 69 | + }, |
| 70 | + "annotations": { |
| 71 | + "patterns": [ |
| 72 | + { |
| 73 | + "name": "meta.tag.core", |
| 74 | + "match": "(?<!\\w)@[\\w\\.]+\\b" |
| 75 | + } |
| 76 | + ] |
| 77 | + }, |
| 78 | + "true-false": { |
| 79 | + "patterns": [ |
| 80 | + { |
| 81 | + "name": "constant.language.core", |
| 82 | + "match": "\\b(true|false)\\b" |
| 83 | + } |
| 84 | + ] |
| 85 | + }, |
| 86 | + "numbers": { |
| 87 | + "patterns": [ |
| 88 | + { |
| 89 | + "match": "(?<!\\$)(\\b\\d([0-9']*\\d)?\\.\\B(?!\\.)|\\b\\d([0-9']*\\d)?\\.([Ee][+-]?\\d([0-9']*\\d)?)(i32|i64|u8|f32|f64)?\\b|\\b\\d([0-9']*\\d)?\\.([Ee][+-]?\\d([0-9']*\\d)?)?(i32|i64|u8|f32|f64)\\b|\\b\\d([0-9']*\\d)?\\.(\\d([0-9']*\\d)?)([Ee][+-]?\\d([0-9']*\\d)?)?(i32|i64|u8|f32|f64)?\\b|(?<!\\.)\\B\\.\\d([0-9']*\\d)?([Ee][+-]?\\d([0-9']*\\d)?)?(i32|i64|u8|f32|f64)?\\b|\\b\\d([0-9']*\\d)?([Ee][+-]?\\d([0-9']*\\d)?)(i32|i64|u8|f32|f64)?\\b|\\b\\d([0-9']*\\d)?([Ee][+-]?\\d([0-9']*\\d)?)?(i32|i64|u8|f32|f64)\\b|\\b(0|[1-9]([0-9']*\\d)?)(?!\\.)(i32|i64|u8|f32|f64)?\\b)(?!\\$)", |
| 90 | + "name": "constant.numeric.decimal.core" |
| 91 | + }, |
| 92 | + { |
| 93 | + "match": "\\b(?<!\\$)0(x|X)((?<!\\.)[0-9a-fA-F]([0-9a-fA-F']*[0-9a-fA-F])?(i32|i64|u8|f32|f64)?(?!\\.)|([0-9a-fA-F]([0-9a-fA-F']*[0-9a-fA-F])?\\.?|([0-9a-fA-F]([0-9a-fA-F']*[0-9a-fA-F])?)?\\.[0-9a-fA-F]([0-9a-fA-F']*[0-9a-fA-F])?)[Pp][+-]?\\d([0-9']*\\d)?(i32|i64|u8|f32|f64)?)\\b(?!\\$)", |
| 94 | + "name": "constant.numeric.hex.core" |
| 95 | + }, |
| 96 | + { |
| 97 | + "match": "\\b(?<!\\$)0(b|B)[01]([01']*[01])?(i32|i64|u8|f32|f64)?\\b(?!\\$)", |
| 98 | + "name": "constant.numeric.binary.core" |
| 99 | + } |
| 100 | + ] |
| 101 | + }, |
| 102 | + "strings": { |
| 103 | + "patterns": [ |
| 104 | + { |
| 105 | + "begin": "\"", |
| 106 | + "end": "\"", |
| 107 | + "name": "string.quoted.double.core" |
| 108 | + } |
| 109 | + ] |
| 110 | + }, |
| 111 | + "declarations": { |
| 112 | + "patterns": [ |
| 113 | + { |
| 114 | + "match": "\\b(fun)\\b\\s*(?!//|/\\*)((?:(?:[A-Z\\p{Lt}\\p{Lu}_a-z$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*)))?", |
| 115 | + "captures": { |
| 116 | + "1": { |
| 117 | + "name": "keyword.declaration.core" |
| 118 | + }, |
| 119 | + "2": { |
| 120 | + "name": "entity.name.function.declaration.core" |
| 121 | + } |
| 122 | + } |
| 123 | + }, |
| 124 | + { |
| 125 | + "match": "\\b(let)\\b\\s*(?!//|/\\*)((?:(?:[A-Z\\p{Lt}\\p{Lu}_a-z$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*)))?", |
| 126 | + "captures": { |
| 127 | + "1": { |
| 128 | + "name": "keyword.declaration.core" |
| 129 | + }, |
| 130 | + "2": { |
| 131 | + "name": "entity.name.function.declaration.core" |
| 132 | + } |
| 133 | + } |
| 134 | + }, |
| 135 | + { |
| 136 | + "match": "\\b(var)\\b\\s*(?!//|/\\*)((?:(?:[A-Z\\p{Lt}\\p{Lu}_a-z$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*)))?", |
| 137 | + "captures": { |
| 138 | + "1": { |
| 139 | + "name": "keyword.declaration.core" |
| 140 | + }, |
| 141 | + "2": { |
| 142 | + "name": "entity.name.function.declaration.core" |
| 143 | + } |
| 144 | + } |
| 145 | + } |
| 146 | + ] |
| 147 | + } |
| 148 | + } |
| 149 | +} |
0 commit comments