| 1 |
{ |
| 2 |
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", |
| 3 |
"name": "berry", |
| 4 |
"patterns": [ |
| 5 |
{ |
| 6 |
"include": "#controls" |
| 7 |
}, |
| 8 |
{ |
| 9 |
"include": "#strings" |
| 10 |
}, |
| 11 |
{ |
| 12 |
"include": "#comment-block" |
| 13 |
}, |
| 14 |
{ |
| 15 |
"include": "#comments" |
| 16 |
}, |
| 17 |
{ |
| 18 |
"include": "#keywords" |
| 19 |
}, |
| 20 |
{ |
| 21 |
"include": "#function" |
| 22 |
}, |
| 23 |
{ |
| 24 |
"include": "#member" |
| 25 |
}, |
| 26 |
{ |
| 27 |
"include": "#identifier" |
| 28 |
}, |
| 29 |
{ |
| 30 |
"include": "#number" |
| 31 |
}, |
| 32 |
{ |
| 33 |
"include": "#operator" |
| 34 |
} |
| 35 |
], |
| 36 |
"repository": { |
| 37 |
"controls": { |
| 38 |
"patterns": [ |
| 39 |
{ |
| 40 |
"name": "keyword.control.berry", |
| 41 |
"match": "\\b(if|elif|else|for|while|do|end|break|continue|return|try|except|raise)\\b" |
| 42 |
} |
| 43 |
] |
| 44 |
}, |
| 45 |
"strings": { |
| 46 |
"patterns": [ |
| 47 |
{ |
| 48 |
"name": "string.quoted.double.berry", |
| 49 |
"begin": "(\"|')", |
| 50 |
"end": "\\1", |
| 51 |
"patterns": [ |
| 52 |
{ |
| 53 |
"name": "constant.character.escape.berry", |
| 54 |
"match": "(\\\\x[\\h]{2})|(\\\\[0-7]{3})|(\\\\\\\\)|(\\\\\")|(\\\\')|(\\\\a)|(\\\\b)|(\\\\f)|(\\\\n)|(\\\\r)|(\\\\t)|(\\\\v)" |
| 55 |
} |
| 56 |
] |
| 57 |
}, |
| 58 |
{ |
| 59 |
"name": "string.quoted.other.berry", |
| 60 |
"begin": "f(\"|')", |
| 61 |
"end": "\\1", |
| 62 |
"patterns": [ |
| 63 |
{ |
| 64 |
"name": "constant.character.escape.berry", |
| 65 |
"match": "(\\\\x[\\h]{2})|(\\\\[0-7]{3})|(\\\\\\\\)|(\\\\\")|(\\\\')|(\\\\a)|(\\\\b)|(\\\\f)|(\\\\n)|(\\\\r)|(\\\\t)|(\\\\v)" |
| 66 |
}, |
| 67 |
{ |
| 68 |
"name": "string.quoted.other.berry", |
| 69 |
"match": "\\{\\{[^\\}]*\\}\\}" |
| 70 |
}, |
| 71 |
{ |
| 72 |
"name": "keyword.other.unit.berry", |
| 73 |
"begin": "\\{", |
| 74 |
"end": "\\}", |
| 75 |
"patterns": [ |
| 76 |
{ |
| 77 |
"include": "#keywords" |
| 78 |
}, |
| 79 |
{ |
| 80 |
"include": "#numbers" |
| 81 |
}, |
| 82 |
{ |
| 83 |
"include": "#identifier" |
| 84 |
}, |
| 85 |
{ |
| 86 |
"include": "#operator" |
| 87 |
}, |
| 88 |
{ |
| 89 |
"include": "#member" |
| 90 |
}, |
| 91 |
{ |
| 92 |
"include": "#function" |
| 93 |
} |
| 94 |
] |
| 95 |
} |
| 96 |
] |
| 97 |
} |
| 98 |
] |
| 99 |
}, |
| 100 |
"comment-block": { |
| 101 |
"name": "comment.berry", |
| 102 |
"begin": "\\#\\-", |
| 103 |
"end": "\\-#", |
| 104 |
"patterns": [{}] |
| 105 |
}, |
| 106 |
"comments": { |
| 107 |
"name": "comment.line.berry", |
| 108 |
"begin": "\\#", |
| 109 |
"end": "\\n", |
| 110 |
"patterns": [{}] |
| 111 |
}, |
| 112 |
"keywords": { |
| 113 |
"patterns": [ |
| 114 |
{ |
| 115 |
"name": "keyword.berry", |
| 116 |
"match": "\\b(var|static|def|class|true|false|nil|self|super|import|as|_class)\\b" |
| 117 |
} |
| 118 |
] |
| 119 |
}, |
| 120 |
"identifier": { |
| 121 |
"patterns": [ |
| 122 |
{ |
| 123 |
"name": "identifier.berry", |
| 124 |
"match": "\\b[_A-Za-z]\\w+\\b" |
| 125 |
} |
| 126 |
] |
| 127 |
}, |
| 128 |
"number": { |
| 129 |
"patterns": [ |
| 130 |
{ |
| 131 |
"name": "constant.numeric.berry", |
| 132 |
"match": "0x[a-fA-F0-9]+|\\d+|(\\d+\\.?|\\.\\d)\\d*([eE][+-]?\\d+)?" |
| 133 |
} |
| 134 |
] |
| 135 |
}, |
| 136 |
"operator": { |
| 137 |
"patterns": [ |
| 138 |
{ |
| 139 |
"name": "keyword.operator.berry", |
| 140 |
"match": "\\(|\\)|\\[|\\]|\\.|-|\\!|~|\\*|/|%|\\+|&|\\^|\\||<|>|=|:" |
| 141 |
} |
| 142 |
] |
| 143 |
}, |
| 144 |
"member": { |
| 145 |
"patterns": [ |
| 146 |
{ |
| 147 |
"match": "\\.([a-zA-Z_][a-zA-Z0-9_]*)", |
| 148 |
"captures": { |
| 149 |
"0": { |
| 150 |
"name": "entity.other.attribute-name.berry" |
| 151 |
} |
| 152 |
} |
| 153 |
} |
| 154 |
] |
| 155 |
}, |
| 156 |
"function": { |
| 157 |
"patterns": [ |
| 158 |
{ |
| 159 |
"name": "entity.name.function.berry", |
| 160 |
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*(?=\\s*\\())" |
| 161 |
} |
| 162 |
] |
| 163 |
} |
| 164 |
}, |
| 165 |
"scopeName": "source.berry" |
| 166 |
} |
| 167 |
|