/
source.wdl.js
147 lines (146 loc) · 4.83 KB
/
source.wdl.js
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
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/broadinstitute/wdl-sublime-syntax-highlighter>
// and licensed `bsd-3-clause`.
// See <https://github.com/wooorm/starry-night> for more info.
/** @type {import('../lib/index.js').Grammar} */
const grammar = {
extensions: ['.wdl'],
names: ['wdl', 'workflow-description-language'],
patterns: [
{match: '\\=', name: 'keyword.operator.assignment.wdl'},
{
match: '<\\=|>\\=|\\=\\=|<|>|\\!\\=',
name: 'keyword.operator.comparison.wdl'
},
{
match:
'\\+\\=|-\\=|\\*\\=|/\\=|//\\=|%\\=|&\\=|\\|\\=|\\^\\=|>>\\=|<<\\=|\\*\\*\\=',
name: 'keyword.operator.assignment.augmented.wdl'
},
{
match: '\\+|\\-|\\*|\\*\\*|/|//|%|<<|>>|&|\\||\\^|~',
name: 'keyword.operator.arithmetic.wdl'
},
{match: '\\b(true|false)\\b', name: 'constant.language.wdl'},
{include: '#builtin_types'},
{include: '#comments'},
{include: '#input_output'},
{include: '#keywords'},
{include: '#string_quoted_single'},
{include: '#string_quoted_double'},
{include: '#command_block'}
],
repository: {
builtin_types: {
match:
'(?<!\\.)\\b(Array|Boolean|File|Float|Int|Map|Object|String|Pair)\\b',
name: 'support.type.wdl'
},
command_block: {
patterns: [
{
begin: '(command)\\s*\\{(\\n|\\s)*',
beginCaptures: {1: {name: 'keyword.other.wdl'}},
end: '(^|\\s+)\\}',
name: 'command.block.wdl'
},
{
begin: '(command)\\s*<{3}(\\n|\\s)*',
beginCaptures: {1: {name: 'keyword.other.wdl'}},
end: '(^|\\s+)>{3}',
name: 'command.block.wdl'
}
]
},
comments: {
patterns: [
{
captures: {1: {name: 'punctuation.definition.comment.wdl'}},
match: '(#).*$\\n?',
name: 'comment.line.number-sign.wdl'
}
]
},
constant_placeholder: {
match:
'(?i:%(\\([a-z_]+\\))?#?0?\\-?[ ]?\\+?([0-9]*|\\*)(\\.([0-9]*|\\*))?[hL]?[a-z%])',
name: 'constant.other.placeholder.wdl'
},
escaped_char: {
captures: {
1: {name: 'constant.character.escape.hex.wdl'},
10: {name: 'constant.character.escape.linefeed.wdl'},
11: {name: 'constant.character.escape.return.wdl'},
12: {name: 'constant.character.escape.tab.wdl'},
13: {name: 'constant.character.escape.vertical-tab.wdl'},
2: {name: 'constant.character.escape.octal.wdl'},
3: {name: 'constant.character.escape.newline.wdl'},
4: {name: 'constant.character.escape.backlash.wdl'},
5: {name: 'constant.character.escape.double-quote.wdl'},
6: {name: 'constant.character.escape.single-quote.wdl'},
7: {name: 'constant.character.escape.bell.wdl'},
8: {name: 'constant.character.escape.backspace.wdl'},
9: {name: 'constant.character.escape.formfeed.wdl'}
},
match:
'(\\\\x[0-9a-fA-F]{2})|(\\\\[0-7]{3})|(\\\\\\n)|(\\\\\\\\)|(\\\\\\")|(\\\\\')|(\\\\a)|(\\\\b)|(\\\\f)|(\\\\n)|(\\\\r)|(\\\\t)|(\\\\v)'
},
escaped_unicode_char: {
captures: {
1: {name: 'constant.character.escape.unicode.16-bit-hex.wdl'},
2: {name: 'constant.character.escape.unicode.32-bit-hex.wdl'},
3: {name: 'constant.character.escape.unicode.name.wdl'}
},
match:
'(\\\\U[0-9A-Fa-f]{8})|(\\\\u[0-9A-Fa-f]{4})|(\\\\N\\{[a-zA-Z0-9\\, ]+\\})'
},
keywords: {
patterns: [
{
match:
'(^|\\s)(call|runtime|task|workflow|if|then|else|import|as|input|output|meta|parameter_meta|scatter)[^A-Za-z_]',
name: 'keyword.other.wdl'
}
]
},
string_quoted_double: {
patterns: [
{
begin: '(")',
beginCaptures: {1: {name: 'punctuation.definition.string.begin.wdl'}},
end: '(")',
endCaptures: {
1: {name: 'punctuation.definition.string.end.wdl'},
2: {name: 'invalid.illegal.unclosed-string.wdl'}
},
name: 'string.quoted.double.single-line.wdl',
patterns: [
{include: '#constant_placeholder'},
{include: '#escaped_char'}
]
}
]
},
string_quoted_single: {
patterns: [
{
begin: "(')",
beginCaptures: {1: {name: 'punctuation.definition.string.begin.wdl'}},
end: "(')",
endCaptures: {
1: {name: 'punctuation.definition.string.end.wdl'},
2: {name: 'invalid.illegal.unclosed-string.wdl'}
},
name: 'string.quoted.single.single-line.wdl',
patterns: [
{include: '#constant_placeholder'},
{include: '#escaped_char'}
]
}
]
}
},
scopeName: 'source.wdl'
}
export default grammar