Skip to content

Commit

Permalink
Add syntax for object and tuple structural types (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschright authored Jul 2, 2020
1 parent ca8df52 commit 4df64eb
Showing 1 changed file with 87 additions and 1 deletion.
88 changes: 87 additions & 1 deletion syntaxes/terraform.tmGrammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"end": "\\*/"
},
"attribute_definition": {
"match": "(\\()?((?!null|false|true)[[:alpha:]][[:alnum:]_-]*)(\\))?\\s*(\\=[^\\=|\\>])\\s*",
"match": "(\\()?((?!null|false|true)[[:alpha:]][[:alnum:]_-]*)(\\))?\\s*(\\=(?!\\=|\\>))\\s*",
"comment": "Identifier \"=\" with optional parens",
"name": "variable.declaration.terraform",
"captures": {
Expand Down Expand Up @@ -174,6 +174,9 @@
{
"include": "#attribute_access"
},
{
"include": "#structural_types"
},
{
"include": "#functions"
},
Expand Down Expand Up @@ -652,6 +655,89 @@
}
}
},
"structural_types": {
"patterns": [
{
"begin": "(object)(\\()(\\{)\\s*",
"name": "meta.function-call.terraform",
"comment": "Object structural type",
"beginCaptures": {
"1": {
"name": "support.function.builtin.terraform"
},
"2": {
"name": "punctuation.section.parens.begin.terraform"
},
"3": {
"name": "punctuation.section.braces.begin.terraform"
}
},
"end": "(\\})(\\))",
"endCaptures": {
"1": {
"name": "punctuation.section.braces.end.terraform"
},
"2": {
"name": "punctuation.section.parens.end.terraform"
}
},
"patterns": [
{
"include": "#comma"
},
{
"match": "((?!null|false|true)[[:alpha:]][[:alnum:]_-]*)\\s*(\\=(?!\\=|\\>))\\s*",
"comment": "Identifier \"=\"",
"name": "variable.declaration.terraform",
"captures": {
"1": {
"name": "variable.other.readwrite.terraform"
},
"2": {
"name": "keyword.operator.assignment.terraform"
}
}
},
{
"include": "#terraform_type_keywords"
}
]
},
{
"begin": "(tuple)(\\()(\\[)\\s*",
"name": "meta.function-call.terraform",
"comment": "Tuple structural type",
"beginCaptures": {
"1": {
"name": "support.function.builtin.terraform"
},
"2": {
"name": "punctuation.section.parens.begin.terraform"
},
"3": {
"name": "punctuation.section.brackets.begin.terraform"
}
},
"end": "(\\])(\\))",
"endCaptures": {
"1": {
"name": "punctuation.section.brackets.end.terraform"
},
"2": {
"name": "punctuation.section.parens.end.terraform"
}
},
"patterns": [
{
"include": "#comma"
},
{
"include": "#terraform_type_keywords"
}
]
}
]
},
"functions": {
"begin": "(\\w+)(\\()",
"name": "meta.function-call.terraform",
Expand Down

0 comments on commit 4df64eb

Please sign in to comment.