From a98b5ea6fe8e8cc98a55e0fd793e6e8660ea31c1 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Thu, 30 Dec 2021 19:47:21 +0100 Subject: chore: add prismjs for syntax highlighting --- public/prism/prism-tcl.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 public/prism/prism-tcl.js (limited to 'public/prism/prism-tcl.js') diff --git a/public/prism/prism-tcl.js b/public/prism/prism-tcl.js new file mode 100644 index 0000000..6e8a890 --- /dev/null +++ b/public/prism/prism-tcl.js @@ -0,0 +1,49 @@ +Prism.languages.tcl = { + comment: { + pattern: /(^|[^\\])#.*/, + lookbehind: true, + }, + string: { + pattern: /"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"/, + greedy: true, + }, + variable: [ + { + pattern: /(\$)(?:::)?(?:[a-zA-Z0-9]+::)*\w+/, + lookbehind: true, + }, + { + pattern: /(\$)\{[^}]+\}/, + lookbehind: true, + }, + { + pattern: /(^[\t ]*set[ \t]+)(?:::)?(?:[a-zA-Z0-9]+::)*\w+/m, + lookbehind: true, + }, + ], + function: { + pattern: /(^[\t ]*proc[ \t]+)\S+/m, + lookbehind: true, + }, + builtin: [ + { + pattern: + /(^[\t ]*)(?:break|class|continue|error|eval|exit|for|foreach|if|proc|return|switch|while)\b/m, + lookbehind: true, + }, + /\b(?:else|elseif)\b/, + ], + scope: { + pattern: /(^[\t ]*)(?:global|upvar|variable)\b/m, + lookbehind: true, + alias: 'constant', + }, + keyword: { + pattern: + /(^[\t ]*|\[)(?:Safe_Base|Tcl|after|append|apply|array|auto_(?:execok|import|load|mkindex|qualify|reset)|automkindex_old|bgerror|binary|catch|cd|chan|clock|close|concat|dde|dict|encoding|eof|exec|expr|fblocked|fconfigure|fcopy|file(?:event|name)?|flush|gets|glob|history|http|incr|info|interp|join|lappend|lassign|lindex|linsert|list|llength|load|lrange|lrepeat|lreplace|lreverse|lsearch|lset|lsort|math(?:func|op)|memory|msgcat|namespace|open|package|parray|pid|pkg_mkIndex|platform|puts|pwd|re_syntax|read|refchan|regexp|registry|regsub|rename|scan|seek|set|socket|source|split|string|subst|tcl(?:_endOfWord|_findLibrary|startOf(?:Next|Previous)Word|test|vars|wordBreak(?:After|Before))|tell|time|tm|trace|unknown|unload|unset|update|uplevel|vwait)\b/m, + lookbehind: true, + }, + operator: + /!=?|\*\*?|==|&&?|\|\|?|<[=<]?|>[=>]?|[-+~\/%?^]|\b(?:eq|in|ne|ni)\b/, + punctuation: /[{}()\[\]]/, +}; -- cgit v1.2.3