mirror of
https://github.com/fluencelabs/aqua-vscode
synced 2025-04-24 16:12:14 +00:00
Add join and a lot more highlighting rules (#13)
This commit is contained in:
parent
b5f81af561
commit
f387caa792
@ -46,6 +46,8 @@ Enables syntax highlighting for `aqua` programming language
|
||||
|
||||
see [vsc-extension-quickstart.md](vsc-extension-quickstart.md)
|
||||
|
||||
NOTE: if you're going to change pattern names, check out the naming rules in [TextMate Grammar doc](https://macromates.com/manual/en/language_grammars). You have to use predefined pattern naming scheme, or the syntax won't be highlighted.
|
||||
|
||||
## License
|
||||
|
||||
[Apache 2.0](LICENSE)
|
||||
|
@ -10,10 +10,12 @@
|
||||
["[", "]"],
|
||||
["(", ")"],
|
||||
["\"", "\""],
|
||||
["%", "%"]
|
||||
],
|
||||
"surroundingPairs": [
|
||||
["[", "]"],
|
||||
["(", ")"],
|
||||
["\"", "\""],
|
||||
["%", "%"]
|
||||
]
|
||||
}
|
15
package-lock.json
generated
Normal file
15
package-lock.json
generated
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "aqua-syntax-highlight",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "aqua-syntax-highlight",
|
||||
"version": "1.0.0",
|
||||
"engines": {
|
||||
"vscode": "^1.50.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -21,13 +21,17 @@
|
||||
"repository": {
|
||||
"keywords": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "support.type.primitive.aqua",
|
||||
"match": "\\b(string|bool|u8|u16|u32|u64|s8|s16|s32|s64|f32|f64)\\b"
|
||||
},
|
||||
{
|
||||
"name": "keyword.control.flow.aqua",
|
||||
"match": "\\b(try|catch|par|if|else|otherwise|for|co)\\b"
|
||||
"match": "\\b(try|catch|par|if|else|otherwise|for|co|join)\\b"
|
||||
},
|
||||
{
|
||||
"name": "keyword.control.other.aqua",
|
||||
"match": "(<<-|<-|->|\\[\\]|\\*|\\?\\=|\\?)"
|
||||
"match": "(<<-|<-|->|\\[\\]|\\*|\\?\\=|\\?|==)"
|
||||
},
|
||||
{
|
||||
"name": "keyword.topology.aqua",
|
||||
@ -46,8 +50,8 @@
|
||||
"constants": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.language.other.aqua",
|
||||
"match": "%init_peer_id%"
|
||||
"name": "constant.language.topology.aqua",
|
||||
"match": "%init_peer_id%|%last_error%|%HOST_PEER_ID%"
|
||||
},
|
||||
{
|
||||
"name": "constant.numeric.aqua",
|
||||
@ -60,6 +64,11 @@
|
||||
{
|
||||
"name": "constant.language.option.nil.aqua",
|
||||
"match": "nil"
|
||||
},
|
||||
{
|
||||
"//": "Defines tokens for constants used anywhere in code",
|
||||
"name": "constant.language.other.aqua",
|
||||
"match": "\\b[A-Z][A-Z0-9_]*\\b"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -82,33 +91,64 @@
|
||||
"semantics": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "support.type.primitive.aqua",
|
||||
"match": "\\b(string|bool|u8|u16|u32|u64|s8|s16|s32|s64|f32|f64)\\b"
|
||||
"//": "Matches type name defined with alias clause",
|
||||
"name": "entity.name.type",
|
||||
"match": "(?<=alias\\s*)[A-Z]\\w*(?=\\s*:)"
|
||||
},
|
||||
{
|
||||
"//": "Defines tokens for data types in Aqua (declaration). Tokens are expected to have colon after them (`data Something:`)",
|
||||
"name": "entity.name.type.struct.aqua",
|
||||
"match": "\\b[A-Z][A-Za-z0-9_]+(?=:)"
|
||||
"//": "Matches type specifier after function arguments and variables",
|
||||
"name": "support.type.specifier",
|
||||
"match": "(?<=alias.*?:.*?,*\\s**[\\[\\]\\*\\?]*)[A-Z][A-Za-z0-9_]*"
|
||||
},
|
||||
{
|
||||
"//": "Matches type specifier in lambda type aliases",
|
||||
"name": "support.type.specifier",
|
||||
"match": "(?<=:\\s*[\\[\\]\\*\\?]*)[A-Z][A-Za-z0-9_]*"
|
||||
},
|
||||
{
|
||||
"//": "Defines tokens for data types in Aqua (usage). Data types in aqua start with a captial letter and are followed by any space char.",
|
||||
"name": "support.class.aqua",
|
||||
"name": "support.type.specifier",
|
||||
"match": "\\b[A-Z][A-Za-z0-9_]+(?=\\s)"
|
||||
},
|
||||
{
|
||||
"//": "Defines tokens for service methods calls. Token is located between dot and open bracket",
|
||||
"name": "support.variable.method.aqua",
|
||||
"//": "Defines tokens for data and service definitions ('data XXX:')",
|
||||
"name": "entity.name.type.data.aqua",
|
||||
"match": "\\b(?<=(data)\\s+)[A-Z][A-Za-z0-9_]+(?=:)\\b"
|
||||
},
|
||||
{
|
||||
"//": "Defines tokens for data and service definitions ('service YYY:')",
|
||||
"name": "entity.name.type.service.aqua",
|
||||
"match": "\\b(?<=(service)\\s+)[A-Z][A-Za-z0-9_]+(?=(\\(\"\\w*\"\\))*:)\\b"
|
||||
},
|
||||
{
|
||||
"//": "Metod name in 'Srv.method(args)' call",
|
||||
"name": "support.function.method.call.aqua",
|
||||
"match": "(?<=\\.)[a-z][a-zA-Z0-9_]+(?=\\()"
|
||||
},
|
||||
{
|
||||
"//": "Defines tokens for constants used anywhere in code",
|
||||
"name": "support.type.constant.aqua",
|
||||
"match": "\\b[A-Z][A-Z0-9_]*\\b"
|
||||
"//": "Service name in 'Srv.method(args)' call",
|
||||
"name": "support.type.service.aqua",
|
||||
"match": "\\b[A-Z][A-Za-z0-9_]*(?=\\..*?\\()"
|
||||
},
|
||||
{
|
||||
"//": "Defines tokens for service names both in declaration and in usage. Token starts with a capital letter and is followed by either dot (service usage) or open bracket (service declaratiokn)",
|
||||
"name": "support.service.aqua",
|
||||
"match": "\\b[A-Z][A-Za-z0-9_]+(?=[\\(\\.])"
|
||||
"//": "Matches function arguments",
|
||||
"name": "support.variable.parameter.function.arg",
|
||||
"match": "\\b[a-z]\\w*(?=:)\\b"
|
||||
},
|
||||
{
|
||||
"//": "Matches defined variables",
|
||||
"name": "variable.other",
|
||||
"match": "\\b[a-z]\\w*(?=\\s*<-)\\b"
|
||||
},
|
||||
{
|
||||
"//": "Matches function definition",
|
||||
"name": "entity.name.function",
|
||||
"match": "\\b(?<=func\\s*)[a-z]\\w*(?=\\s*\\()\\b"
|
||||
},
|
||||
{
|
||||
"//": "Matches method definition",
|
||||
"name": "entity.name.function",
|
||||
"match": "\\b[a-z]\\w*(?=\\s*\\(.*?\\)\\s*)\\b"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user