Skip to content

Commit 532212b

Browse files
Dataweave: Fixed keywords being highlighted as functions (#3113)
1 parent 5c412cb commit 532212b

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

components/prism-dataweave.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
pattern: /\/(?:[^\\\/\r\n]|\\[^\r\n])+\//,
3131
greedy: true
3232
},
33+
'keyword': /\b(?:and|as|at|case|do|else|fun|if|input|is|match|not|ns|null|or|output|type|unless|update|using|var)\b/,
3334
'function': /\b[A-Z_]\w*(?=\s*\()/i,
3435
'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
3536
'punctuation': /[{}[\];(),.:@]/,
3637
'operator': /<<|>>|->|[<>~=]=?|!=|--?-?|\+\+?|!|\?/,
3738
'boolean': /\b(?:false|true)\b/,
38-
'keyword': /\b(?:and|as|at|case|do|else|fun|if|input|is|match|not|ns|null|or|output|type|unless|update|using|var)\b/
3939
};
4040

4141
}(Prism));

components/prism-dataweave.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/languages/dataweave/keywords_feature.test

+12-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@ update {
1515
if(true or false and not true) do {
1616

1717
}
18-
else
18+
else
1919
payload match {
2020
case a is String -> x as String
2121
}
2222

23+
null
24+
unless
25+
using
26+
2327
----------------------------------------------------
2428

2529
[
@@ -89,7 +93,7 @@ payload match {
8993

9094
["punctuation", "}"],
9195

92-
["function", "if"],
96+
["keyword", "if"],
9397
["punctuation", "("],
9498
["boolean", "true"],
9599
["keyword", "or"],
@@ -105,7 +109,7 @@ payload match {
105109

106110
["keyword", "else"],
107111

108-
" \r\npayload ",
112+
"\r\npayload ",
109113
["keyword", "match"],
110114
["punctuation", "{"],
111115

@@ -118,7 +122,11 @@ payload match {
118122
["keyword", "as"],
119123
" String\r\n",
120124

121-
["punctuation", "}"]
125+
["punctuation", "}"],
126+
127+
["keyword", "null"],
128+
["keyword", "unless"],
129+
["keyword", "using"]
122130
]
123131

124132
----------------------------------------------------

0 commit comments

Comments
 (0)