feat: add vscode extension for basic syntax highlighting
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -0,0 +1 @@
|
||||
.vscode
|
||||
19
vscode-ext/language-configurations.json
Normal file
19
vscode-ext/language-configurations.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"brackets": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["<", ">"]
|
||||
],
|
||||
"autoClosingPairs": [
|
||||
{ "open": "{", "close": "}" },
|
||||
{ "open": "[", "close": "]" },
|
||||
{ "open": "(", "close": ")" },
|
||||
{ "open": "<", "close": ">" }
|
||||
],
|
||||
"surroundingPairs": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"],
|
||||
["<", ">"]
|
||||
]
|
||||
}
|
||||
33
vscode-ext/package.json
Normal file
33
vscode-ext/package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "midas",
|
||||
"version": "0.1.0",
|
||||
"engines": {
|
||||
"vscode": "*"
|
||||
},
|
||||
"categories": ["Programming Languages"],
|
||||
"contributes": {
|
||||
"languages": [
|
||||
{
|
||||
"id": "midas",
|
||||
"extensions": [
|
||||
".mpy",
|
||||
".midas"
|
||||
],
|
||||
"aliases": [
|
||||
"Midas"
|
||||
],
|
||||
"configuration": "./language-configuration.json"
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
{
|
||||
"language": "midas",
|
||||
"scopeName": "source.midas",
|
||||
"path": "./syntaxes/midas.tmLanguage.json",
|
||||
"embeddedLanguages": {
|
||||
"meta.embedded.block.python": "python"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
135
vscode-ext/syntaxes/midas.tmLanguage.json
Normal file
135
vscode-ext/syntaxes/midas.tmLanguage.json
Normal file
@@ -0,0 +1,135 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
||||
"name": "Midas",
|
||||
"scopeName": "source.midas",
|
||||
"patterns": [{ "include": "#statement" }],
|
||||
"repository": {
|
||||
"comment": {
|
||||
"begin": "(//)",
|
||||
"end": "($)",
|
||||
"name": "comment.line",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "comment.line.double-dash"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type-def": {
|
||||
"begin": "\\b(type)\\s+([a-zA-Z_][a-zA-Z_\\d]*)",
|
||||
"end": "$",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.control.type.midas"
|
||||
},
|
||||
"2": {
|
||||
"name" : "variable.name"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{ "include": "#type-base" },
|
||||
{ "include": "#type-body" }
|
||||
]
|
||||
},
|
||||
"type-base": {
|
||||
"begin": "<",
|
||||
"end": ">",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.base.begin.midas"
|
||||
}
|
||||
},
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.base.end.midas"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{"include": "source.python"}
|
||||
]
|
||||
},
|
||||
"type-body": {
|
||||
"begin": "\\{",
|
||||
"end": "\\}",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.type-body.begin.midas"
|
||||
}
|
||||
},
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.type-body.end.midas"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{"include": "#type-prop"}
|
||||
]
|
||||
},
|
||||
"type-prop": {
|
||||
"match": "([a-zA-Z_][a-zA-Z_\\d]*)(:)\\s*([a-zA-Z_][a-zA-Z_\\d]*)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "variable.name"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.separator.annotation.midas"
|
||||
},
|
||||
"3": {
|
||||
"name": "meta.type.name"
|
||||
}
|
||||
}
|
||||
},
|
||||
"op-def": {
|
||||
"match": "\\b(op)\\s+<([a-zA-Z_][a-zA-Z_\\d]*)>\\s+(\\S+)\\s+<([a-zA-Z_][a-zA-Z_\\d]*)>\\s+(=)\\s+<([a-zA-Z_][a-zA-Z_\\d]*)>",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.control.op.midas"
|
||||
},
|
||||
"2": {
|
||||
"name" : "variable.name"
|
||||
},
|
||||
"3": {
|
||||
"name" : "keyword.operator"
|
||||
},
|
||||
"4": {
|
||||
"name" : "variable.name"
|
||||
},
|
||||
"5": {
|
||||
"name" : "keyword.operator.assignment"
|
||||
},
|
||||
"6": {
|
||||
"name" : "variable.name"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{ "include": "#type-base" },
|
||||
{ "include": "#type-body" }
|
||||
]
|
||||
},
|
||||
"constr-def": {
|
||||
"begin": "(constraint)\\s+([a-zA-Z_][a-zA-Z_\\d]*)\\s*(=)",
|
||||
"end": "$",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "keyword.control.constr.midas"
|
||||
},
|
||||
"2": {
|
||||
"name": "variable.name"
|
||||
},
|
||||
"3": {
|
||||
"name": "keyword.operator.assignment"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{ "include": "source.python" }
|
||||
]
|
||||
},
|
||||
"statement": {
|
||||
"patterns": [
|
||||
{ "include": "#comment" },
|
||||
{ "include": "#type-def" },
|
||||
{ "include": "#op-def" },
|
||||
{ "include": "#constr-def" }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user