Skip to content

Commit

Permalink
syntax: Fix substitutions
Browse files Browse the repository at this point in the history
Closes #112
  • Loading branch information
nhooyr committed Jul 13, 2023
1 parent 94b53fe commit 773dc96
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
17 changes: 10 additions & 7 deletions syntaxes/d2.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
{
"include": "#semicolon"
},
{
"include": "#key_value"
},
{
"include": "#spread_substitution"
},
{
"include": "#spread_import"
},
{
"include": "#key_value"
},
{
"include": "#key"
},
Expand Down Expand Up @@ -356,8 +356,8 @@
"name": "keyword.operator.substitution.d2"
}
},
"begin": "\\$",
"end": "(?=\\s*[\\n#;\\[\\]{}|$])",
"begin": "\\$\\{",
"end": "}(?=\\s*[\\n#;\\[\\]{}|$])",
"patterns": [
{
"include": "#key"
Expand Down Expand Up @@ -386,8 +386,8 @@
"name": "keyword.operator.substitution.d2"
}
},
"begin": "\\.\\.\\.\\$",
"end": "(?=\\s*[\\n#;\\[\\]{}|$])",
"begin": "\\.\\.\\.\\$\\{",
"end": "}(?=\\s*[\\n#;\\[\\]{}|$])",
"patterns": [
{
"include": "#key"
Expand Down Expand Up @@ -425,6 +425,9 @@
{
"include": "#semicolon"
},
{
"include": "#substitution"
},
{
"include": "#import"
},
Expand Down
11 changes: 6 additions & 5 deletions syntaxes/d2.tmLanguage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ patterns:
# - include: '#debug'
- include: "#comment"
- include: "#semicolon"
- include: "#key_value"
- include: "#spread_substitution"
- include: "#spread_import"
- include: "#key_value"
- include: "#key"
- include: "#error"
repository:
Expand Down Expand Up @@ -186,8 +186,8 @@ repository:
substitution:
name: meta.operator.substitution.d2
captures: { 0: { name: keyword.operator.substitution.d2 } }
begin: '\$'
end: '(?=\s*[\n#;\[\]{}|$])'
begin: '\$\{'
end: '}(?=\s*[\n#;\[\]{}|$])'
patterns:
- include: "#key"
import:
Expand All @@ -200,8 +200,8 @@ repository:
spread_substitution:
name: meta.operator.substitution.d2
captures: { 0: { name: keyword.operator.substitution.d2 } }
begin: '\.\.\.\$'
end: '(?=\s*[\n#;\[\]{}|$])'
begin: '\.\.\.\$\{'
end: '}(?=\s*[\n#;\[\]{}|$])'
patterns:
- include: "#key"
spread_import:
Expand All @@ -219,6 +219,7 @@ repository:
patterns:
- include: "#comment"
- include: "#semicolon"
- include: "#substitution"
- include: "#import"
- include: "#spread_substitution"
- include: "#spread_import"
Expand Down

0 comments on commit 773dc96

Please sign in to comment.