Skip to content

Commit 778b260

Browse files
cdce8pdncrews
authored andcommitted
Add syntax for if-expression blocks
1 parent 1222891 commit 778b260

File tree

1 file changed

+67
-1
lines changed

1 file changed

+67
-1
lines changed

language/syntaxes/expressions.tmGrammar.json

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
{
66
"include": "#expression"
77
},
8+
{
9+
"include": "#block-if-expression"
10+
},
811
{
912
"include": "#if-expression"
1013
}
@@ -38,8 +41,71 @@
3841
}
3942
}
4043
},
44+
"block-if-expression": {
45+
"contentName": "meta.embedded.block.github-actions-expression",
46+
"begin": "^\\s*\\b(if:) (?:(\\|)|(>))([1-9])?([-+])?(.*\\n?)",
47+
"beginCaptures": {
48+
"1": {
49+
"patterns": [
50+
{
51+
"include": "source.github-actions-workflow"
52+
}
53+
]
54+
},
55+
"2": {
56+
"name": "keyword.control.flow.block-scalar.literal.yaml"
57+
},
58+
"3": {
59+
"name": "keyword.control.flow.block-scalar.folded.yaml"
60+
},
61+
"4": {
62+
"name": "constant.numeric.indentation-indicator.yaml"
63+
},
64+
"5": {
65+
"name": "storage.modifier.chomping-indicator.yaml"
66+
},
67+
"6": {
68+
"patterns": [
69+
{
70+
"include": "#comment"
71+
},
72+
{
73+
"match": ".+",
74+
"name": "invalid.illegal.expected-comment-or-newline.yaml"
75+
}
76+
]
77+
}
78+
},
79+
"end": "^(?=\\S)|(?!\\G)",
80+
"patterns": [
81+
{
82+
"begin": "^([ ]+)(?! )",
83+
"end": "^(?!\\1|\\s*$)",
84+
"patterns": [
85+
{
86+
"include": "#function-call"
87+
},
88+
{
89+
"include": "#context"
90+
},
91+
{
92+
"include": "#string"
93+
},
94+
{
95+
"include": "#number"
96+
},
97+
{
98+
"include": "#boolean"
99+
},
100+
{
101+
"include": "#null"
102+
}
103+
]
104+
}
105+
]
106+
},
41107
"if-expression": {
42-
"match": "\\b(if:) (.*?)$",
108+
"match": "^\\s*\\b(if:) (.*?)$",
43109
"contentName": "meta.embedded.block.github-actions-expression",
44110
"captures": {
45111
"1": {

0 commit comments

Comments
 (0)