-
Notifications
You must be signed in to change notification settings - Fork 1
/
YamlPipeline.sublime-syntax
174 lines (151 loc) · 5.18 KB
/
YamlPipeline.sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
scope: source.yaml.pipeline
version: 2
hidden: true
extends: Packages/YAML/YAML.sublime-syntax
contexts:
flow-scalar-double-quoted-body:
- meta_prepend: true
- include: string-interpolations
flow-scalar-single-quoted-body:
- meta_prepend: true
- include: string-interpolations
flow-scalar-plain-out-body:
- meta_prepend: true
- include: string-interpolations
string-interpolations:
- match: \$\{\{
scope: punctuation.section.interpolation.begin.pipeline
push: inside-string-interpolations
inside-string-interpolations:
- clear_scopes: 1
- meta_include_prototype: false
- meta_scope: meta.interpolation.pipeline meta.block.pipeline
- include: inside-expression
interpolations:
- match: \$\{\{
scope: punctuation.section.interpolation.begin.pipeline
push: inside-expression
inside-expression:
- meta_include_prototype: false
- meta_scope: meta.interpolation.pipeline meta.block.pipeline
- match: \}\}
scope: punctuation.section.interpolation.end.pipeline
pop: 1
- match: \b(?:true|false)\b
scope: constant.language.boolean.pipeline
- match: \b(\w+)\s*(\()
captures:
0: meta.function-call.identifier.pipeline
1: support.function.pipeline
2: punctuation.section.parens.begin.pipeline
push: inside-function-call-parens
- include: strings
inside-function-call-parens:
- meta_content_scope: meta.function-call.arguments.pipeline
- match: \)
scope: punctuation.section.parens.end.pipeline
set: possible-accessor
- match: ','
scope: punctuation.separator.argument.pipeline
- include: inside-expression
script-block-node:
- meta_scope: meta.block.script.pipeline
- include: script-block-scalar
- include: flow-scalar-script-out
script-block-scalar:
# http://www.yaml.org/spec/1.2/spec.html#style/block/scalar
# c-l+literal(n) | c-l+folded(n)
- match: (?:(\|)|(>))([1-9])?([-+]) # c-b-block-header(m,t)
captures:
1: keyword.control.flow.block-scalar.literal.yaml
2: keyword.control.flow.block-scalar.folded.yaml
3: constant.numeric.indentation-indicator.yaml
4: storage.modifier.chomping-indicator.yaml
set: script-block-folded-scalar-begin
- match: (?:(\|)|(>))([1-9])? # c-b-block-header(m,t)
captures:
1: keyword.control.flow.block-scalar.literal.yaml
2: keyword.control.flow.block-scalar.folded.yaml
3: constant.numeric.indentation-indicator.yaml
4: storage.modifier.chomping-indicator.yaml
set: script-block-scalar-begin
flow-scalar-script-out:
- match: (?={{ns_plain_first_plain_out}})
set: flow-scalar-script-out-body
flow-scalar-script-out-body:
- meta_include_prototype: false
- meta_scope: meta.string.yaml string.unquoted.plain.out.yaml
- match: (?=\S)
embed: embedded-bash
escape: '{{_flow_scalar_end_plain_out}}'
pop: 1
script-block-scalar-begin:
- meta_include_prototype: false
- include: comment
- match: ^([ ]+)(?! ) # match first non-empty line to determine indentation level
scope: source.shell.bash.embedded
# note that we do not check if indentation is enough
embed: embedded-bash
escape: ^(?!\1|\s*$)
pop: 1
- match: ^(?=\S) # the block is empty
pop: 1
- include: comment # include comments but not properties
- match: .+
scope: invalid.illegal.expected-comment-or-newline.yaml
script-block-folded-scalar-begin:
- meta_include_prototype: false
- include: comment
- match: ^([ ]+)(?! ) # match first non-empty line to determine indentation level
scope: source.shell.bash.embedded
# note that we do not check if indentation is enough
embed: embedded-bash-folded
escape: ^(?!\1|\s*$)
pop: 1
- match: ^(?=\S) # the block is empty
pop: 1
- include: comment # include comments but not properties
- match: .+
scope: invalid.illegal.expected-comment-or-newline.yaml
possible-accessor:
- match: \.
scope: punctuation.accessor.dot.pipeline
set: variable-access
- match: \[
scope: punctuation.accessor.begin.pipeline
push: inside-property-index
- match: ''
pop: 1
inside-property-index:
- match: \]
scope: punctuation.accessor.end.pipeline
pop: 1
- include: variable-access
- include: strings
# TODO: use use inside-expression instead?
variable-access:
- match: '[-\w]+'
scope: variable.other.member.pipeline
set: possible-accessor
# - match: ''
# pop: 1
strings:
- match: \'
scope: punctuation.definition.string.begin.pipeline
push: inside-single-quoted-string
inside-single-quoted-string:
- meta_include_prototype: false
- meta_scope: meta.string.pipeline
- meta_content_scope: string.quoted.single.pipeline
- match: \'\'
scope: constant.character.escape.pipeline
- match: \'
scope: punctuation.definition.string.end.pipeline
pop: 1
embedded-bash:
- meta_include_prototype: false
embedded-bash-folded:
- meta_include_prototype: false