411 lines
12 KiB
JSON
411 lines
12 KiB
JSON
|
|
{
|
||
|
|
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
||
|
|
"name": "Bjolang",
|
||
|
|
"scopeName": "source.bjolang",
|
||
|
|
"fileTypes": [
|
||
|
|
"bjo",
|
||
|
|
"protobjo"
|
||
|
|
],
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"include": "#forms"
|
||
|
|
}
|
||
|
|
],
|
||
|
|
"repository": {
|
||
|
|
"forms": {
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"include": "#comment"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#character"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#boolean"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#interpolated-string"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#string"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#hash-forms"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#signature"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#definition"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#special-form"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#keyword"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#arrow"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#member"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#number"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#type-variable"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#quoted-symbol"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#quote"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#primitive-type"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#type-name"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#braces"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#delimiter"
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"comment": {
|
||
|
|
"comment": "A ; comment runs to the end of the line. There are no block comments.",
|
||
|
|
"match": "(;+).*$",
|
||
|
|
"name": "comment.line.semicolon.bjolang",
|
||
|
|
"captures": {
|
||
|
|
"1": {
|
||
|
|
"name": "punctuation.definition.comment.bjolang"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"character": {
|
||
|
|
"comment": "#\\c, #\\space, #\\x41, #\\( — a name when more than one symbol character follows, otherwise the one character.",
|
||
|
|
"match": "(?<![^\\s()\\[\\]{},:\"';])#\\\\(?:[^\\s()\\[\\]{},:\"';]{2,}|.)",
|
||
|
|
"name": "constant.character.bjolang"
|
||
|
|
},
|
||
|
|
"boolean": {
|
||
|
|
"match": "(?<![^\\s()\\[\\]{},:\"';])#[tf](?![^\\s()\\[\\]{},:\"';])",
|
||
|
|
"name": "constant.language.boolean.bjolang"
|
||
|
|
},
|
||
|
|
"escape": {
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"match": "\\\\[ntr\"\\\\]",
|
||
|
|
"name": "constant.character.escape.bjolang"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"comment": "An escape Bjolang does not define keeps both characters.",
|
||
|
|
"match": "\\\\."
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"string": {
|
||
|
|
"begin": "\"",
|
||
|
|
"beginCaptures": {
|
||
|
|
"0": {
|
||
|
|
"name": "punctuation.definition.string.begin.bjolang"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"end": "\"",
|
||
|
|
"endCaptures": {
|
||
|
|
"0": {
|
||
|
|
"name": "punctuation.definition.string.end.bjolang"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"name": "string.quoted.double.bjolang",
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"include": "#escape"
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"interpolated-string": {
|
||
|
|
"comment": "#\"a ${x} b\": a hole is any expression, interpolated strings and braces included.",
|
||
|
|
"begin": "(?<![^\\s()\\[\\]{},:\"';])#\"",
|
||
|
|
"beginCaptures": {
|
||
|
|
"0": {
|
||
|
|
"name": "punctuation.definition.string.begin.bjolang"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"end": "\"",
|
||
|
|
"endCaptures": {
|
||
|
|
"0": {
|
||
|
|
"name": "punctuation.definition.string.end.bjolang"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"name": "string.interpolated.bjolang",
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"match": "\\\\\\$",
|
||
|
|
"name": "constant.character.escape.bjolang"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"include": "#escape"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"begin": "\\$\\{",
|
||
|
|
"beginCaptures": {
|
||
|
|
"0": {
|
||
|
|
"name": "punctuation.section.embedded.begin.bjolang"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"end": "\\}",
|
||
|
|
"endCaptures": {
|
||
|
|
"0": {
|
||
|
|
"name": "punctuation.section.embedded.end.bjolang"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"name": "meta.embedded.line.bjolang",
|
||
|
|
"contentName": "source.bjolang",
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"include": "#forms"
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"hash-forms": {
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"comment": "#[1 2 3], an array, and #(...).",
|
||
|
|
"match": "(?<![^\\s()\\[\\]{},:\"';])#[\\[(]",
|
||
|
|
"name": "punctuation.section.array.begin.bjolang"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"comment": "#'(template), a syntax quote.",
|
||
|
|
"match": "(?<![^\\s()\\[\\]{},:\"';])#'",
|
||
|
|
"name": "keyword.operator.quote.bjolang"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"comment": "#name( and #name[, a hash macro. #t( and #f( are booleans, which come first.",
|
||
|
|
"match": "(?<![^\\s()\\[\\]{},:\"';])#[^\\s()\\[\\]{},:\"';]+(?=[\\[(])",
|
||
|
|
"name": "entity.name.function.macro.bjolang"
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"signature": {
|
||
|
|
"comment": "(: name type). The colon alone, which is not a :keyword.",
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"match": "(?<=\\()(:)\\s+([A-Z][^\\s()\\[\\]{},:\"';]*)",
|
||
|
|
"captures": {
|
||
|
|
"1": {
|
||
|
|
"name": "keyword.other.signature.bjolang"
|
||
|
|
},
|
||
|
|
"2": {
|
||
|
|
"name": "entity.name.type.bjolang"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"match": "(?<=\\()(:)\\s+([^\\s()\\[\\]{},:\"';]+)",
|
||
|
|
"captures": {
|
||
|
|
"1": {
|
||
|
|
"name": "keyword.other.signature.bjolang"
|
||
|
|
},
|
||
|
|
"2": {
|
||
|
|
"name": "entity.name.function.bjolang"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"match": "(?<=\\()(:)(?=\\s|\\()",
|
||
|
|
"captures": {
|
||
|
|
"1": {
|
||
|
|
"name": "keyword.other.signature.bjolang"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"definition": {
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"comment": "(defun (name args) ...): the name is inside the parameter list.",
|
||
|
|
"match": "(?<=\\()(def/pattern|defbjouble|def/macro|defbjo|defun)(?![^\\s()\\[\\]{},:\"';])(?:\\s*(\\()\\s*([^\\s()\\[\\]{},:\"';]+))?",
|
||
|
|
"captures": {
|
||
|
|
"1": {
|
||
|
|
"name": "storage.type.function.bjolang"
|
||
|
|
},
|
||
|
|
"2": {
|
||
|
|
"name": "punctuation.section.parens.begin.bjolang"
|
||
|
|
},
|
||
|
|
"3": {
|
||
|
|
"name": "entity.name.function.bjolang"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"comment": "(def/trait (Name %a) ...), (impl (Trait Type) ...).",
|
||
|
|
"match": "(?<=\\()(impl/extern|type/derive|def/trait|impl)(?![^\\s()\\[\\]{},:\"';])(?:\\s*(\\()\\s*([^\\s()\\[\\]{},:\"';]+))?",
|
||
|
|
"captures": {
|
||
|
|
"1": {
|
||
|
|
"name": "storage.type.bjolang"
|
||
|
|
},
|
||
|
|
"2": {
|
||
|
|
"name": "punctuation.section.parens.begin.bjolang"
|
||
|
|
},
|
||
|
|
"3": {
|
||
|
|
"name": "entity.name.type.bjolang"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"comment": "(def name value). A def whose pattern is a list names nothing here.",
|
||
|
|
"match": "(?<=\\()(def/mutable|def)(?![^\\s()\\[\\]{},:\"';])(?:\\s+([^\\s()\\[\\]{},:\"';]+))?",
|
||
|
|
"captures": {
|
||
|
|
"1": {
|
||
|
|
"name": "storage.type.bjolang"
|
||
|
|
},
|
||
|
|
"2": {
|
||
|
|
"name": "entity.name.variable.bjolang"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"match": "(?<=\\()(def/json-type|type-rec|def\\*|type)(?![^\\s()\\[\\]{},:\"';])",
|
||
|
|
"captures": {
|
||
|
|
"1": {
|
||
|
|
"name": "storage.type.bjolang"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"special-form": {
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"match": "(?<=\\()(import/extern|import/class|prefix-types|postfix-defs|prefix-defs|re-export|include|postfix|import|export|except|rename|prefix|only)(?![^\\s()\\[\\]{},:\"';])",
|
||
|
|
"captures": {
|
||
|
|
"1": {
|
||
|
|
"name": "keyword.control.import.bjolang"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"match": "(?<=\\()(spawn/detached|parameterize\\*|with-deadline|with-response|parameterize|syntax-match|syntax-quote|spawn/daemon|with-return|with-cancel|with-shield|record-set!|struct-set!|task->event|record-ref|record-set|struct-ref|struct-set|yield-from|bjoroutine|with-open|spawn-evt|let/mono|when-let|with-run|time-it|unless|letrec|if-let|some->|match|begin|yield|spawn|when|case|else|let\\*|loop|seql|set!|cast|cond|let|seq|try|fun|and|not|bjo|if|do|or)(?![^\\s()\\[\\]{},:\"';])",
|
||
|
|
"captures": {
|
||
|
|
"1": {
|
||
|
|
"name": "keyword.control.bjolang"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"keyword": {
|
||
|
|
"comment": "#:keyword and :keyword, which is also how loop clauses and def's failure parts are written.",
|
||
|
|
"match": "#?:[^\\s()\\[\\]{},:\"';]+",
|
||
|
|
"name": "variable.parameter.keyword.bjolang"
|
||
|
|
},
|
||
|
|
"arrow": {
|
||
|
|
"comment": "->, -bjo-> (a bjoroutine), -?-> (either colour), and =>.",
|
||
|
|
"match": "(?<![^\\s()\\[\\]{},:\"';])(?:->|-bjo->|-\\?->|=>)(?![^\\s()\\[\\]{},:\"';])",
|
||
|
|
"name": "storage.type.function.arrow.bjolang"
|
||
|
|
},
|
||
|
|
"member": {
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"match": "(?<![^\\s()\\[\\]{},:\"';])\\.\\.\\.(?![^\\s()\\[\\]{},:\"';])",
|
||
|
|
"name": "keyword.operator.spread.bjolang"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"comment": ".-Length, a .NET property or field.",
|
||
|
|
"match": "(?<![^\\s()\\[\\]{},:\"';])\\.-[^\\s()\\[\\]{},:\"';]+",
|
||
|
|
"name": "variable.other.property.bjolang"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"comment": ".Write, a .NET method.",
|
||
|
|
"match": "(?<![^\\s()\\[\\]{},:\"';])\\.[^\\s()\\[\\]{},:\\\"';.\\d][^\\s()\\[\\]{},:\"';]*",
|
||
|
|
"name": "entity.name.function.member.bjolang"
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"number": {
|
||
|
|
"match": "(?<![^\\s()\\[\\]{},:\"';])-?\\d[\\w.\\-]*",
|
||
|
|
"name": "constant.numeric.bjolang"
|
||
|
|
},
|
||
|
|
"type-variable": {
|
||
|
|
"match": "(?<![^\\s()\\[\\]{},:\"';])%[^\\s()\\[\\]{},:\"';]+",
|
||
|
|
"name": "entity.name.type.parameter.bjolang"
|
||
|
|
},
|
||
|
|
"quoted-symbol": {
|
||
|
|
"match": "'[^\\s()\\[\\]{},:\"';]+",
|
||
|
|
"name": "constant.language.symbol.bjolang"
|
||
|
|
},
|
||
|
|
"quote": {
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"match": ",@",
|
||
|
|
"name": "keyword.operator.unquote.bjolang"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"match": ",",
|
||
|
|
"name": "keyword.operator.unquote.bjolang"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"match": "'",
|
||
|
|
"name": "keyword.operator.quote.bjolang"
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"primitive-type": {
|
||
|
|
"match": "(?<![^\\s()\\[\\]{},:\"';])(?:decimal|ushort|double|string|short|ulong|sbyte|float|long|uint|byte|bool|char|void|unit|int)(?![^\\s()\\[\\]{},:\"';])",
|
||
|
|
"name": "support.type.primitive.bjolang"
|
||
|
|
},
|
||
|
|
"type-name": {
|
||
|
|
"comment": "A capitalised name: a type, a union case or a .NET class, Some and System.Text.StringBuilder alike.",
|
||
|
|
"match": "(?<![^\\s()\\[\\]{},:\"';])[A-Z][^\\s()\\[\\]{},:\"';]*",
|
||
|
|
"name": "entity.name.type.bjolang"
|
||
|
|
},
|
||
|
|
"braces": {
|
||
|
|
"comment": "A comprehension. A region, so that a } inside an interpolated string's hole closes the right one.",
|
||
|
|
"begin": "\\{",
|
||
|
|
"beginCaptures": {
|
||
|
|
"0": {
|
||
|
|
"name": "punctuation.section.braces.begin.bjolang"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"end": "\\}",
|
||
|
|
"endCaptures": {
|
||
|
|
"0": {
|
||
|
|
"name": "punctuation.section.braces.end.bjolang"
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"include": "#forms"
|
||
|
|
}
|
||
|
|
]
|
||
|
|
},
|
||
|
|
"delimiter": {
|
||
|
|
"patterns": [
|
||
|
|
{
|
||
|
|
"match": "\\(",
|
||
|
|
"name": "punctuation.section.parens.begin.bjolang"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"match": "\\)",
|
||
|
|
"name": "punctuation.section.parens.end.bjolang"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"match": "\\[",
|
||
|
|
"name": "punctuation.section.brackets.begin.bjolang"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"match": "\\]",
|
||
|
|
"name": "punctuation.section.brackets.end.bjolang"
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|