the TextMate language definition was completely rewritten by Claude from my Sublime Syntax definition some tests against Midas files show that it seems on par with the other definition Co-authored-by: Claude <noreply@anthropic.com>
560 lines
17 KiB
JSON
560 lines
17 KiB
JSON
{
|
|
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
"name": "Midas",
|
|
"scopeName": "source.midas",
|
|
"fileTypes": [
|
|
"midas"
|
|
],
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"include": "#alias-stmt"
|
|
},
|
|
{
|
|
"include": "#type-stmt"
|
|
},
|
|
{
|
|
"include": "#extend-stmt"
|
|
},
|
|
{
|
|
"include": "#extend-body"
|
|
},
|
|
{
|
|
"include": "#predicate-stmt"
|
|
}
|
|
],
|
|
"repository": {
|
|
"comments": {
|
|
"patterns": [
|
|
{
|
|
"begin": "//",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.definition.comment.midas"
|
|
}
|
|
},
|
|
"end": "$",
|
|
"name": "comment.line.double-slash.midas"
|
|
},
|
|
{
|
|
"begin": "/\\*",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.definition.comment.midas"
|
|
}
|
|
},
|
|
"end": "\\*/",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.definition.comment.midas"
|
|
}
|
|
},
|
|
"name": "comment.block.midas"
|
|
}
|
|
]
|
|
},
|
|
"string": {
|
|
"begin": "\"",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.definition.string.begin.midas"
|
|
}
|
|
},
|
|
"end": "\"",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.definition.string.end.midas"
|
|
}
|
|
},
|
|
"name": "string.quoted.double.c"
|
|
},
|
|
"alias-stmt": {
|
|
"begin": "\\b(alias)\\b",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "keyword.declaration.midas"
|
|
}
|
|
},
|
|
"end": "$",
|
|
"name": "meta.declaration.alias.midas",
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"match": "[A-Za-z_][A-Za-z0-9_]*",
|
|
"name": "entity.name.type.midas"
|
|
},
|
|
{
|
|
"begin": "=",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "keyword.operator.equal.midas"
|
|
}
|
|
},
|
|
"end": "$",
|
|
"patterns": [
|
|
{
|
|
"include": "#type-expr"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"type-stmt": {
|
|
"begin": "\\b(type)\\b",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "keyword.declaration.midas"
|
|
}
|
|
},
|
|
"end": "$",
|
|
"name": "meta.declaration.type.midas",
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"match": "[A-Za-z_][A-Za-z0-9_]*",
|
|
"name": "entity.name.type.midas"
|
|
},
|
|
{
|
|
"begin": "\\[",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.brackets.begin.midas"
|
|
}
|
|
},
|
|
"end": "\\]",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.brackets.end.midas"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"include": "#type-params"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"begin": "=",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "keyword.operator.equal.midas"
|
|
}
|
|
},
|
|
"end": "$",
|
|
"patterns": [
|
|
{
|
|
"include": "#type-expr"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"type-params": {
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"match": "<:",
|
|
"name": "keyword.operator.subtype.midas"
|
|
},
|
|
{
|
|
"match": "[A-Za-z][A-Za-z0-9_]*",
|
|
"name": "entity.name.type.midas"
|
|
}
|
|
]
|
|
},
|
|
"extend-stmt": {
|
|
"begin": "\\b(extend)\\b",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "keyword.declaration.midas"
|
|
}
|
|
},
|
|
"end": "(?=\\{)|$",
|
|
"name": "meta.declaration.extend.midas",
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"match": "[A-Za-z_][A-Za-z0-9_]*",
|
|
"name": "entity.name.type.midas"
|
|
},
|
|
{
|
|
"begin": "\\[",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.brackets.begin.midas"
|
|
}
|
|
},
|
|
"end": "\\]",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.brackets.end.midas"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"include": "#type-params"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"extend-body": {
|
|
"begin": "\\{",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.block.begin.midas"
|
|
}
|
|
},
|
|
"end": "\\}",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.block.end.midas"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"include": "#member-stmt"
|
|
}
|
|
]
|
|
},
|
|
"member-stmt": {
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"begin": "\\b(prop|def)\\b",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "keyword.other.midas"
|
|
}
|
|
},
|
|
"end": "$",
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"match": "[A-Za-z_][A-Za-z0-9_]*",
|
|
"name": "variable.other.member.midas"
|
|
},
|
|
{
|
|
"begin": ":",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.separator.annotation.midas"
|
|
}
|
|
},
|
|
"end": "$",
|
|
"patterns": [
|
|
{
|
|
"include": "#type-expr"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"predicate-stmt": {
|
|
"begin": "\\b(predicate)\\b",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "keyword.declaration.midas"
|
|
}
|
|
},
|
|
"end": "$",
|
|
"name": "meta.declaration.predicate.midas",
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"match": "[A-Za-z_][A-Za-z0-9_]*",
|
|
"name": "entity.name.function.midas"
|
|
},
|
|
{
|
|
"begin": "\\(",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.group.begin.midas"
|
|
}
|
|
},
|
|
"end": "\\)",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.group.end.midas"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#predicate-params"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"begin": "=",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "keyword.operator.equal.midas"
|
|
}
|
|
},
|
|
"end": "$",
|
|
"patterns": [
|
|
{
|
|
"include": "#constraint"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"predicate-params": {
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"begin": "([A-Za-z_][A-Za-z0-9_]*)(:)",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "variable.parameter.midas"
|
|
},
|
|
"2": {
|
|
"name": "punctuation.separator.annotation.midas"
|
|
}
|
|
},
|
|
"end": "(?=,)|(?=\\))",
|
|
"patterns": [
|
|
{
|
|
"include": "#type-expr"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"match": ",",
|
|
"name": "punctuation.separator.midas"
|
|
}
|
|
]
|
|
},
|
|
"type-expr": {
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"begin": "\\b(fn)\\s*(\\()",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "keyword.other.midas"
|
|
},
|
|
"2": {
|
|
"name": "punctuation.section.group.begin.midas"
|
|
}
|
|
},
|
|
"end": "\\)",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.group.end.midas"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#fn-params"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"match": "->",
|
|
"name": "keyword.operator.arrow.midas"
|
|
},
|
|
{
|
|
"begin": "\\b(where)\\b",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "keyword.other.midas"
|
|
}
|
|
},
|
|
"end": "$",
|
|
"patterns": [
|
|
{
|
|
"include": "#constraint"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"begin": "(\\bFrame\\b)(\\s*)(\\[)",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "entity.name.type.midas"
|
|
},
|
|
"3": {
|
|
"name": "punctuation.section.brackets.begin.midas"
|
|
}
|
|
},
|
|
"end": "\\]",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.brackets.end.midas"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#frame-schema"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"match": "\\bFrame\\b",
|
|
"name": "entity.name.type.midas"
|
|
},
|
|
{
|
|
"match": "[A-Za-z_][A-Za-z0-9_]*",
|
|
"name": "entity.name.type.midas"
|
|
},
|
|
{
|
|
"begin": "\\[",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.brackets.begin.midas"
|
|
}
|
|
},
|
|
"end": "\\]",
|
|
"endCaptures": {
|
|
"0": {
|
|
"name": "punctuation.section.brackets.end.midas"
|
|
}
|
|
},
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"include": "#type-expr"
|
|
},
|
|
{
|
|
"match": ",",
|
|
"name": "punctuation.separator.midas"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"fn-params": {
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"begin": "([A-Za-z_][A-Za-z0-9_]*)(:)",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "variable.parameter.midas"
|
|
},
|
|
"2": {
|
|
"name": "punctuation.separator.annotation.midas"
|
|
}
|
|
},
|
|
"end": "(?=,)|(?=\\))",
|
|
"patterns": [
|
|
{
|
|
"include": "#type-expr"
|
|
},
|
|
{
|
|
"match": "\\?",
|
|
"name": "keyword.operator.qmark.midas"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"match": ",",
|
|
"name": "punctuation.separator.midas"
|
|
},
|
|
{
|
|
"include": "#type-expr"
|
|
}
|
|
]
|
|
},
|
|
"constraint": {
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"match": "\\d+(\\.\\d+)?",
|
|
"name": "constant.numeric.midas"
|
|
},
|
|
{
|
|
"match": "\\b(true|false|none)\\b",
|
|
"name": "constant.language.midas"
|
|
},
|
|
{
|
|
"include": "#string"
|
|
},
|
|
{
|
|
"match": "(<=|>=|<|>|==|!=|&)",
|
|
"name": "keyword.operator.midas"
|
|
},
|
|
{
|
|
"match": "_",
|
|
"name": "variable.language.midas"
|
|
},
|
|
{
|
|
"match": "[A-Za-z_][A-Za-z0-9_]*(?=\\s*\\()",
|
|
"name": "variable.function.midas"
|
|
},
|
|
{
|
|
"match": "[A-Za-z_][A-Za-z0-9_]*",
|
|
"name": "variable.other.readwrite.midas"
|
|
}
|
|
]
|
|
},
|
|
"frame-schema": {
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"match": "[A-Za-z_][A-Za-z0-9_]*",
|
|
"name": "variable.other.member.midas"
|
|
},
|
|
{
|
|
"begin": ":",
|
|
"beginCaptures": {
|
|
"0": {
|
|
"name": "punctuation.separator.annotation.midas"
|
|
}
|
|
},
|
|
"end": "(?=,)|(?=\\])",
|
|
"patterns": [
|
|
{
|
|
"include": "#type-expr"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"match": ",",
|
|
"name": "punctuation.separator.midas"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
} |