vscode: add keywords, strings, comments, and selector labels to ivy grammar

This commit is contained in:
2024-11-11 21:39:22 +00:00
parent a424941481
commit d77aaefa20

View File

@@ -2,28 +2,115 @@
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Ivy", "name": "Ivy",
"patterns": [ "patterns": [
{
"include": "#comment"
},
{
"include": "#const"
},
{
"include": "#ident"
},
{ {
"include": "#keywords" "include": "#keywords"
}, },
{ {
"include": "#strings" "include": "#strings"
},
{
"include": "#class"
} }
], ],
"repository": { "repository": {
"keywords": { "ident": {
"patterns": [{
"name": "keyword.control.ivy",
"match": "\\b(if|while|for|return)\\b"
}]
},
"strings": {
"name": "string.quoted.double.ivy",
"begin": "\"",
"end": "\"",
"patterns": [ "patterns": [
{ {
"name": "constant.character.escape.ivy", "name": "variable.parameter.ivy",
"match": "\\\\." "match": "\\b[a-z]([A-Za-z0-9_]+):\\b"
},
{
"name": "entity.name.type.ivy",
"match": "\\[A-Z]{1,2}([a-z0-9]+[A-Z]{0,2})*\\b"
}
]
},
"const": {
"patterns": [
{
"name": "constant.numeric.ivy",
"match": "[\\b\\s]#[a-z0-9]*[\\b\\s]"
}
]
},
"keywords": {
"patterns": [
{
"name": "keyword.control.ivy",
"match": "\\b(for|while|break|continue|if|elif|else|unless|match)[^:]\\b"
},
{
"name": "keyword.control.ivy",
"match": "\\b(for|while|break|continue|if|elif|else|unless|match)[^:]\\b"
},
{
"name": "storage.type.ivy",
"match": "\\b(class|protocol)[^:]\\b"
},
{
"name": "keyword.other.ivy",
"match": "\\b(package|use|in)[^:]\\b"
},
{
"name": "keyword.other.ivy",
"match": "\\b(package|use|in)[^:]\\b"
}
]
},
"strings": {
"patterns": [
{
"name": "string.quoted.single.ivy",
"begin": "'",
"end": "'",
"patterns": [
{
"name": "constant.character.escape.ivy",
"match": "\\\\."
}
]
},
{
"name": "string.quoted.double.ivy",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.ivy",
"match": "\\\\."
}
]
}
]
},
"comment": {
"patterns": [
{
"name": "comment.block.ivy",
"begin": "/\\*",
"end": "\\*/"
},
{
"name": "comment.line",
"begin": "--",
"end": "\\n"
}
]
},
"class": {
"patterns": [
{
"name": "entity.name.function.ivy",
"match": "\\b(?<=- )[a-z][A-Za-z0-9_]*"
} }
] ]
} }