feat: add basic syntax highlighting for AIR (#21)

This commit is contained in:
Valery Antopol 2022-08-26 18:19:45 +03:00 committed by GitHub
parent 7c7e80bd75
commit 802e4c3810
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 137 additions and 1 deletions

View File

@ -0,0 +1,21 @@
{
"comments": {
"lineComment": ";"
},
"brackets": [
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
["[", "]"],
["(", ")"],
["\"", "\""],
["%", "%"]
],
"surroundingPairs": [
["[", "]"],
["(", ")"],
["\"", "\""],
["%", "%"]
]
}

View File

@ -33,7 +33,17 @@
"extensions": [
".aqua"
],
"configuration": "./language-configuration.json"
"configuration": "./language-configurations/aqua.json"
},
{
"id": "air",
"aliases": [
"AIR"
],
"extensions": [
".air"
],
"configuration": "./language-configurations/air.json"
}
],
"grammars": [
@ -41,6 +51,11 @@
"language": "aqua",
"scopeName": "source.aqua",
"path": "./syntaxes/aqua.tmLanguage.json"
},
{
"language": "air",
"scopeName": "source.air",
"path": "./syntaxes/air.tmLanguage.json"
}
],
"configuration": {

View File

@ -0,0 +1,100 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "air",
"patterns": [
{
"include": "#keywords"
},
{
"include": "#constants"
},
{
"include": "#strings"
},
{
"include": "#comments"
},
{
"include": "#variables"
},
{
"include": "#lambda"
}
],
"repository": {
"keywords": {
"patterns": [
{
"name": "keyword.instruction.air",
"match": "\\b(ap|call|canon|fold|par|next|match|mismatch|new|null|seq|xor)\\b"
}
]
},
"constants": {
"patterns": [
{
"name": "constant.language.air",
"match": "%init_peer_id%|%last_error%"
},
{
"name": "constant.numeric.air",
"match": "\\b\\d+\\b"
},
{
"name": "constant.language.boolean.air",
"match": "\\b(true|false)\\b"
}
]
},
"strings": {
"name": "string.quoted.double.air",
"begin": "\"",
"end": "\"",
"patterns": []
},
"comments": {
"name": "comment.line.air",
"begin": ";",
"end": "$"
},
"lambda": {
"//": "AIR lambdas",
"begin": "\\.\\$",
"end": "!",
"beginCaptures": {
"0": { "name": "punctuation.paren.open" }
},
"endCaptures": {
"0": { "name": "punctuation.paren.close" }
},
"name": "expression.group",
"patterns": [
{
"//": "Field accessor",
"name": "support.function.method.call",
"match": "\\.\\w+"
},
{
"//": "Array acessor",
"name": "keyword.control.other",
"match": "\\[[A-Za-z0-9\\-_\\\"]+\\]"
}
]
},
"variables": {
"patterns": [
{
"//": "Stream and canonicalized stream variables start with $ or # respectively",
"name": "variable.language.stream",
"match": "[\\$\\#][A-Za-z_\\-][A-Za-z0-9_\\-]*"
},
{
"//": "Scalar variables",
"name": "variable.other.scalar",
"match": "[A-Za-z_\\-][A-Za-z0-9_\\-]*"
}
]
}
},
"scopeName": "source.air"
}