aboutsummaryrefslogtreecommitdiffstats
path: root/public/prism/prism-lisp.min.js
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-13 19:32:56 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commit006b15b467a5cd835a6eab1b49023100bdc8f2e6 (patch)
tree949c7295c2e206f42357f135bab4696ddf6576ec /public/prism/prism-lisp.min.js
parent00f147a7a687d5772bcc538bc606cfff972178cd (diff)
refactor(components): rewrite Code component and usePrism hook
* move Prism styles to Sass placeholders to avoid repeats * let usePrism consumer define its plugins (remove default ones) * remove `plugins` prop from Code component * add new props to Code component to let consumer configure plugins (and handle plugin list from the given options) However there are some problems with Prism plugins: line-highlight and treeview does not seems to be loaded. I don't want to use Babel instead of SWC so I have no solution for now.
Diffstat (limited to 'public/prism/prism-lisp.min.js')
-rw-r--r--public/prism/prism-lisp.min.js55
1 files changed, 26 insertions, 29 deletions
diff --git a/public/prism/prism-lisp.min.js b/public/prism/prism-lisp.min.js
index d9b5041..c641587 100644
--- a/public/prism/prism-lisp.min.js
+++ b/public/prism/prism-lisp.min.js
@@ -7,10 +7,9 @@
}
var t = '(?!\\d)[-+*/~!@$%^=<>{}\\w]+',
r = '(\\()',
- i = '(?=\\s)',
- s =
+ i =
'(?:[^()]|\\((?:[^()]|\\((?:[^()]|\\((?:[^()]|\\((?:[^()]|\\([^()]*\\))*\\))*\\))*\\))*\\))*',
- l = {
+ s = {
heading: { pattern: /;;;.*/, alias: ['comment', 'title'] },
comment: /;.*/,
string: {
@@ -30,15 +29,13 @@
keyword: [
{
pattern: RegExp(
- r +
- '(?:and|(?:cl-)?letf|cl-loop|cond|cons|error|if|(?:lexical-)?let\\*?|message|not|null|or|provide|require|setq|unless|use-package|when|while)' +
- i
+ '(\\()(?:and|(?:cl-)?letf|cl-loop|cond|cons|error|if|(?:lexical-)?let\\*?|message|not|null|or|provide|require|setq|unless|use-package|when|while)(?=\\s)'
),
lookbehind: !0,
},
{
pattern: RegExp(
- r + '(?:append|by|collect|concat|do|finally|for|in|return)' + i
+ '(\\()(?:append|by|collect|concat|do|finally|for|in|return)(?=\\s)'
),
lookbehind: !0,
},
@@ -52,13 +49,13 @@
boolean: { pattern: a('nil|t'), lookbehind: !0 },
number: { pattern: a('[-+]?\\d+(?:\\.\\d*)?'), lookbehind: !0 },
defvar: {
- pattern: RegExp(r + 'def(?:const|custom|group|var)\\s+' + t),
+ pattern: RegExp('(\\()def(?:const|custom|group|var)\\s+' + t),
lookbehind: !0,
inside: { keyword: /^def[a-z]+/, variable: RegExp(t) },
},
defun: {
pattern: RegExp(
- r + '(?:cl-)?(?:defmacro|defun\\*?)\\s+' + t + '\\s+\\(' + s + '\\)'
+ '(\\()(?:cl-)?(?:defmacro|defun\\*?)\\s+' + t + '\\s+\\(' + i + '\\)'
),
lookbehind: !0,
greedy: !0,
@@ -71,7 +68,7 @@
},
lambda: {
pattern: RegExp(
- r + 'lambda\\s+\\(\\s*(?:&?' + t + '(?:\\s+&?' + t + ')*\\s*)?\\)'
+ '(\\()lambda\\s+\\(\\s*(?:&?' + t + '(?:\\s+&?' + t + ')*\\s*)?\\)'
),
lookbehind: !0,
greedy: !0,
@@ -83,42 +80,42 @@
{ pattern: /(\s)\.(?=\s)/, lookbehind: !0 },
],
},
- o = {
+ l = {
'lisp-marker': RegExp('&(?!\\d)[-+*/~!@$%^=<>{}\\w]+'),
varform: {
- pattern: RegExp('\\(' + t + '\\s+(?=\\S)' + s + '\\)'),
- inside: l,
+ pattern: RegExp('\\(' + t + '\\s+(?=\\S)' + i + '\\)'),
+ inside: s,
},
argument: {
pattern: RegExp('(^|[\\s(])' + t),
lookbehind: !0,
alias: 'variable',
},
- rest: l,
+ rest: s,
},
- p = '\\S+(?:\\s+\\S+)*',
- d = {
- pattern: RegExp(r + s + '(?=\\))'),
+ o = '\\S+(?:\\s+\\S+)*',
+ p = {
+ pattern: RegExp(r + i + '(?=\\))'),
lookbehind: !0,
inside: {
- 'rest-vars': { pattern: RegExp('&(?:body|rest)\\s+' + p), inside: o },
+ 'rest-vars': { pattern: RegExp('&(?:body|rest)\\s+' + o), inside: l },
'other-marker-vars': {
- pattern: RegExp('&(?:aux|optional)\\s+' + p),
- inside: o,
+ pattern: RegExp('&(?:aux|optional)\\s+' + o),
+ inside: l,
},
keys: {
- pattern: RegExp('&key\\s+' + p + '(?:\\s+&allow-other-keys)?'),
- inside: o,
+ pattern: RegExp('&key\\s+' + o + '(?:\\s+&allow-other-keys)?'),
+ inside: l,
},
argument: { pattern: RegExp(t), alias: 'variable' },
punctuation: /[()]/,
},
};
- (l.lambda.inside.arguments = d),
- (l.defun.inside.arguments = e.util.clone(d)),
- (l.defun.inside.arguments.inside.sublist = d),
- (e.languages.lisp = l),
- (e.languages.elisp = l),
- (e.languages.emacs = l),
- (e.languages['emacs-lisp'] = l);
+ (s.lambda.inside.arguments = p),
+ (s.defun.inside.arguments = e.util.clone(p)),
+ (s.defun.inside.arguments.inside.sublist = p),
+ (e.languages.lisp = s),
+ (e.languages.elisp = s),
+ (e.languages.emacs = s),
+ (e.languages['emacs-lisp'] = s);
})(Prism);