Skip to content

Commit a491f9e

Browse files
committed
Jolie: Regexp optimisation + don't use captures if not needed + remove duplicates in keywords
1 parent 93d4002 commit a491f9e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

components/prism-jolie.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Prism.languages.jolie = Prism.languages.extend('clike', {
2-
'keyword': /\b(?:include|define|is_defined|undef|main|init|outputPort|inputPort|Location|Protocol|Interfaces|RequestResponse|OneWay|type|interface|extender|throws|cset|csets|forward|Aggregates|Redirects|embedded|courier|extender|execution|sequential|concurrent|single|scope|install|throw|comp|cH|default|global|linkIn|linkOut|synchronized|this|new|for|if|else|while|in|Jolie|Java|Javascript|nullProcess|spawn|constants|with|provide|until|exit|foreach|instanceof|over|service)\b/g,
2+
'keyword': /\b(?:include|define|is_defined|undef|main|init|outputPort|inputPort|Location|Protocol|Interfaces|RequestResponse|OneWay|type|interface|extender|throws|cset|csets|forward|Aggregates|Redirects|embedded|courier|execution|sequential|concurrent|single|scope|install|throw|comp|cH|default|global|linkIn|linkOut|synchronized|this|new|for|if|else|while|in|Jolie|Java|Javascript|nullProcess|spawn|constants|with|provide|until|exit|foreach|instanceof|over|service)\b/,
33
'builtin': /\b(?:undefined|string|int|void|long|Byte|bool|double|float|char|any)\b/,
44
'number': /\b\d*\.?\d+(?:e[+-]?\d+)?l?\b/i,
5-
'operator': /->|<<|[!+-<>=*]?=|[:<>!?*\/%^]|&&|\|\||--?|\+\+?/g,
5+
'operator': /-[-=>]?|\+[+=]?|<[<=]?|[>=*!]=?|&&|\|\||[:?\/%^]/,
66
'symbol': /[|;@]/,
77
'punctuation': /[,.]/,
88
'string': {
9-
pattern: /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
9+
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1010
greedy: true
11-
},
11+
}
1212
});
1313

1414
delete Prism.languages.jolie['class-name'];
@@ -46,10 +46,10 @@ Prism.languages.insertBefore( 'jolie', 'keyword', {
4646
pattern: /,/
4747
},
4848
'function': {
49-
pattern: /\w+/g
49+
pattern: /\w+/
5050
},
5151
'symbol': {
52-
pattern: /=>/g
52+
pattern: /=>/
5353
}
5454
}
5555
}

components/prism-jolie.min.js

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

0 commit comments

Comments
 (0)