aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDamian Tarnawski <gthetarnav@gmail.com>2024-04-23 22:27:09 +0200
committerDamian Tarnawski <gthetarnav@gmail.com>2024-04-23 22:27:09 +0200
commit0811ac96707824adfac7df8ad29b88d43a52857f (patch)
tree5ae773b310b2811ae375e4402b8ab408c9d53e15 /editors
parent21d3473bacfbd8dc81fa855d085a9bb67cc5be01 (diff)
Add attributes grammar
Diffstat (limited to 'editors')
-rw-r--r--editors/vscode/syntaxes/odin.tmLanguage.json30
1 files changed, 30 insertions, 0 deletions
diff --git a/editors/vscode/syntaxes/odin.tmLanguage.json b/editors/vscode/syntaxes/odin.tmLanguage.json
index 7f8ec14..7e10373 100644
--- a/editors/vscode/syntaxes/odin.tmLanguage.json
+++ b/editors/vscode/syntaxes/odin.tmLanguage.json
@@ -10,6 +10,7 @@
"repository": {
"statements": {
"patterns": [
+ { "include": "#attribute" },
{ "include": "#procedure-assignment" },
{ "include": "#type-assignment" },
{ "include": "#distinct-type-assignment" },
@@ -47,6 +48,35 @@
{ "include": "#variable-name" }
]
},
+ "attribute": {
+ "patterns": [{
+ "name": "meta.attribute.odin",
+ "match": "(@)\\s*([A-Za-z_]\\w*)\\b",
+ "captures": {
+ "1": {"name": "keyword.control.attribute.odin"},
+ "2": {"name": "entity.other.attribute-name.odin"}
+ }
+ }, {
+ "name": "meta.attribute.odin",
+ "begin": "(@)\\s*(\\()",
+ "beginCaptures": {
+ "1": {"name": "keyword.control.attribute.odin"},
+ "2": {"name": "meta.brace.round.odin"}
+ },
+ "end": "\\)",
+ "endCaptures": {"0": {"name": "meta.brace.round.odin"}},
+ "patterns": [{
+ "match": "\\b([A-Za-z_]\\w*)\\b",
+ "name": "entity.other.attribute-name.odin"
+ }, {
+ "begin": "=",
+ "beginCaptures": {"0": {"name": "keyword.operator.assignment.odin"}},
+ "end": "(,)|(?=\\))",
+ "endCaptures": {"1": {"name": "punctuation.odin"}},
+ "patterns": [{"include": "#expressions"}]
+ }]
+ }]
+ },
"procedure-assignment": {
"name": "meta.definition.variable.odin",
"begin": "\\b([A-Za-z_]\\w*)\\s*(:\\s*:|=)\\s*(#\\w+)?\\s*(?=proc\\b)",