Skip to content

Commit

Permalink
Improve syntax highlighting so it behaves more like the TextMate grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan committed Nov 27, 2023
1 parent 20534c9 commit 0c4fa4c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/theme/pluto.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Prism.languages.pluto = {
'comment': /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,
'function': /\b(?!in\s)(?!\d)(?!return)(?!case)\w+(?=\s*(?:[({"]))/,
'attr-name': /(?<=(function|class|extends)\s)[\w:]+/,
'function': [
/\b(?!in\s)(?!\d)(?!return)(?!case)(?!function)(?!local)\w+(?=\s*(?:[({"]))/,
/\b(function|enum|class)\b/,
/\b(debug|table|string|number|io|os|coroutine|_VERSION|_PVERSION|_PSOUP)\b/, // standard library + type hints
],
'attr-value': /<(const|constexpr|close)>/,
'string': {
pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,
greedy: true
Expand All @@ -16,6 +22,6 @@ Prism.languages.pluto = {
lookbehind: true
}
],
'constant': /(nil|\.\.\.|_VERSION|_PVERSION|_PSOUP)/,
'punctuation': /[\[\](){},;]|\.+|:+/
'constant': /(nil|\.\.\.)/,
'punctuation': /[\[\](){},;]|\.+|:+/,
};

0 comments on commit 0c4fa4c

Please sign in to comment.