Skip to content

Commit 0c4fa4c

Browse files
committed
Improve syntax highlighting so it behaves more like the TextMate grammar
1 parent 20534c9 commit 0c4fa4c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/theme/pluto.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Prism.languages.pluto = {
22
'comment': /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,
3-
'function': /\b(?!in\s)(?!\d)(?!return)(?!case)\w+(?=\s*(?:[({"]))/,
3+
'attr-name': /(?<=(function|class|extends)\s)[\w:]+/,
4+
'function': [
5+
/\b(?!in\s)(?!\d)(?!return)(?!case)(?!function)(?!local)\w+(?=\s*(?:[({"]))/,
6+
/\b(function|enum|class)\b/,
7+
/\b(debug|table|string|number|io|os|coroutine|_VERSION|_PVERSION|_PSOUP)\b/, // standard library + type hints
8+
],
9+
'attr-value': /<(const|constexpr|close)>/,
410
'string': {
511
pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,
612
greedy: true
@@ -16,6 +22,6 @@ Prism.languages.pluto = {
1622
lookbehind: true
1723
}
1824
],
19-
'constant': /(nil|\.\.\.|_VERSION|_PVERSION|_PSOUP)/,
20-
'punctuation': /[\[\](){},;]|\.+|:+/
25+
'constant': /(nil|\.\.\.)/,
26+
'punctuation': /[\[\](){},;]|\.+|:+/,
2127
};

0 commit comments

Comments
 (0)