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)
|
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
|
## License
|
||||||
|
|
||||||
[Apache 2.0](LICENSE)
|
[Apache 2.0](LICENSE)
|
||||||
|
@ -10,10 +10,12 @@
|
|||||||
["[", "]"],
|
["[", "]"],
|
||||||
["(", ")"],
|
["(", ")"],
|
||||||
["\"", "\""],
|
["\"", "\""],
|
||||||
|
["%", "%"]
|
||||||
],
|
],
|
||||||
"surroundingPairs": [
|
"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": {
|
"repository": {
|
||||||
"keywords": {
|
"keywords": {
|
||||||
"patterns": [
|
"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",
|
"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",
|
"name": "keyword.control.other.aqua",
|
||||||
"match": "(<<-|<-|->|\\[\\]|\\*|\\?\\=|\\?)"
|
"match": "(<<-|<-|->|\\[\\]|\\*|\\?\\=|\\?|==)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "keyword.topology.aqua",
|
"name": "keyword.topology.aqua",
|
||||||
@ -46,8 +50,8 @@
|
|||||||
"constants": {
|
"constants": {
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"name": "constant.language.other.aqua",
|
"name": "constant.language.topology.aqua",
|
||||||
"match": "%init_peer_id%"
|
"match": "%init_peer_id%|%last_error%|%HOST_PEER_ID%"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "constant.numeric.aqua",
|
"name": "constant.numeric.aqua",
|
||||||
@ -60,6 +64,11 @@
|
|||||||
{
|
{
|
||||||
"name": "constant.language.option.nil.aqua",
|
"name": "constant.language.option.nil.aqua",
|
||||||
"match": "nil"
|
"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": {
|
"semantics": {
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"name": "support.type.primitive.aqua",
|
"//": "Matches type name defined with alias clause",
|
||||||
"match": "\\b(string|bool|u8|u16|u32|u64|s8|s16|s32|s64|f32|f64)\\b"
|
"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:`)",
|
"//": "Matches type specifier after function arguments and variables",
|
||||||
"name": "entity.name.type.struct.aqua",
|
"name": "support.type.specifier",
|
||||||
"match": "\\b[A-Z][A-Za-z0-9_]+(?=:)"
|
"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.",
|
"//": "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)"
|
"match": "\\b[A-Z][A-Za-z0-9_]+(?=\\s)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"//": "Defines tokens for service methods calls. Token is located between dot and open bracket",
|
"//": "Defines tokens for data and service definitions ('data XXX:')",
|
||||||
"name": "support.variable.method.aqua",
|
"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_]+(?=\\()"
|
"match": "(?<=\\.)[a-z][a-zA-Z0-9_]+(?=\\()"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"//": "Defines tokens for constants used anywhere in code",
|
"//": "Service name in 'Srv.method(args)' call",
|
||||||
"name": "support.type.constant.aqua",
|
"name": "support.type.service.aqua",
|
||||||
"match": "\\b[A-Z][A-Z0-9_]*\\b"
|
"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)",
|
"//": "Matches function arguments",
|
||||||
"name": "support.service.aqua",
|
"name": "support.variable.parameter.function.arg",
|
||||||
"match": "\\b[A-Z][A-Za-z0-9_]+(?=[\\(\\.])"
|
"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