Distribute and run LLMs with a single file.
C++ cross-platformggufllama-cpplocal-ailocal-inferencelocal-llmopen-source-aisingle-file-executablespeech-to-text
Start porting syntax highlighter to JavaScript
Justine Tunneyef08074f3346
diff --git a/llamafile/BUILD.mk b/llamafile/BUILD.mkindex 022a92c1..254add21 100644--- a/llamafile/BUILD.mk+++ b/llamafile/BUILD.mk@@ -182,10 +182,11 @@ o/$(MODE)/llamafile/highlight_c_test: \o/$(MODE)/llamafile/is_keyword_c_pod.o \o/$(MODE)/llamafile/is_keyword_cpp.o \-o/$(MODE)/llamafile/highlight_python_test: \- o/$(MODE)/llamafile/highlight_python_test.o \- o/$(MODE)/llamafile/highlight_python.o \- o/$(MODE)/llamafile/is_keyword_python.o \+o/$(MODE)/llamafile/highlight_python_test: \+ o/$(MODE)/llamafile/highlight_python_test.o \+ o/$(MODE)/llamafile/highlight_python.o \+ o/$(MODE)/llamafile/is_keyword_python.o \+ o/$(MODE)/llamafile/is_keyword_python_constant.o \o/$(MODE)/llamafile/high: \o/$(MODE)/llamafile/high.o \diff --git a/llamafile/chatbot.cpp b/llamafile/chatbot.cppindex ae6f123a..53bdd4e7 100644--- a/llamafile/chatbot.cpp+++ b/llamafile/chatbot.cpp@@ -405,6 +405,8 @@ static void eval_tokens(std::vector<llama_token> tokens, int n_batch) {die_out_of_context(n_eval);g_history.insert(g_history.end(), tokens.begin() + i, tokens.begin() + i + n_eval);}+ if (N > n_batch)+ clear_ephemeral();}static void eval_id(int id) {diff --git a/llamafile/flags.cpp b/llamafile/flags.cppindex 6d0581ff..aacc4406 100644--- a/llamafile/flags.cpp+++ b/llamafile/flags.cpp@@ -15,6 +15,7 @@// See the License for the specific language governing permissions and// limitations under the License.+#include "flags.h"#include "debug.h"#include "llama.cpp/cores.h"#include "llamafile.h"@@ -47,7 +48,7 @@ bool FLAG_trace = false;bool FLAG_unsecure = false;const char *FLAG_file = nullptr;const char *FLAG_ip_header = nullptr;-const char *FLAG_listen = "0.0.0.0:8080";+const char *FLAG_listen = "127.0.0.1:8080";const char *FLAG_model = nullptr;const char *FLAG_prompt = nullptr;const char *FLAG_url_prefix = "";@@ -74,6 +75,8 @@ int FLAG_verbose = 0;int FLAG_warmup = true;int FLAG_workers;+std::vector<std::string> FLAG_headers;+static wontreturn void usage(int rc, int fd) {tinyprint(fd, "usage: ", program_invocation_name, " -m MODEL -l [HOST:]PORT\n", NULL);exit(rc);@@ -236,6 +239,13 @@ void llamafile_get_flags(int argc, char **argv) {continue;}+ if (!strcmp(flag, "-H") || !strcmp(flag, "--header")) {+ if (i == argc)+ missing("--header");+ FLAG_headers.push_back(argv[i++]);+ continue;+ }+if (!strcmp(flag, "--http-ibuf-size")) {if (i == argc)missing("--http-ibuf-size");diff --git a/llamafile/flags.h b/llamafile/flags.hnew file mode 100644index 00000000..5a5f7370--- /dev/null+++ b/llamafile/flags.h@@ -0,0 +1,22 @@+// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-+// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :vi+//+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++#pragma once+#include <string>+#include <vector>++extern std::vector<std::string> FLAG_headers;diff --git a/llamafile/highlight.cpp b/llamafile/highlight.cppindex ed4b5131..574adaa1 100644--- a/llamafile/highlight.cpp+++ b/llamafile/highlight.cpp@@ -103,6 +103,7 @@ Highlight *Highlight::create(const std::string_view &lang) {return new HighlightCss;if (lang == "html" || //+ lang == "htm" || //lang == "xhtml" || //lang == "xml")return new HighlightHtml;diff --git a/llamafile/highlight.h b/llamafile/highlight.hindex dc134ff8..a2fadd57 100644--- a/llamafile/highlight.h+++ b/llamafile/highlight.h@@ -69,6 +69,7 @@ is_keyword_f is_keyword_js_constant;is_keyword_f is_keyword_java;is_keyword_f is_keyword_java_constant;is_keyword_f is_keyword_python;+is_keyword_f is_keyword_python_constant;is_keyword_f is_keyword_rust;is_keyword_f is_keyword_rust_type;is_keyword_f is_keyword_rust_constant;@@ -94,6 +95,7 @@ is_keyword_f is_keyword_lua_builtin;is_keyword_f is_keyword_lua_constant;is_keyword_f is_keyword_lisp;is_keyword_f is_keyword_ada;+is_keyword_f is_keyword_ada_constant;is_keyword_f is_keyword_haskell;is_keyword_f is_keyword_perl;is_keyword_f is_keyword_shell;diff --git a/llamafile/highlight_ada.cpp b/llamafile/highlight_ada.cppindex a6adab3d..581ec7ca 100644--- a/llamafile/highlight_ada.cpp+++ b/llamafile/highlight_ada.cpp@@ -71,6 +71,10 @@ void HighlightAda::feed(std::string *r, std::string_view input) {*r += HI_KEYWORD;*r += symbol_;*r += HI_RESET;+ } else if (is_keyword_ada_constant(symbol_.data(), symbol_.size())) {+ *r += HI_CONSTANT;+ *r += symbol_;+ *r += HI_RESET;} else {*r += symbol_;}@@ -129,6 +133,10 @@ void HighlightAda::flush(std::string *r) {*r += HI_KEYWORD;*r += symbol_;*r += HI_RESET;+ } else if (is_keyword_ada_constant(symbol_.data(), symbol_.size())) {+ *r += HI_CONSTANT;+ *r += symbol_;+ *r += HI_RESET;} else {*r += symbol_;}diff --git a/llamafile/highlight_c.cpp b/llamafile/highlight_c.cppindex 43bcb6da..2cc9b2f6 100644--- a/llamafile/highlight_c.cpp+++ b/llamafile/highlight_c.cpp@@ -120,6 +120,7 @@ void HighlightC::feed(std::string *r, std::string_view input) {is_cpp_ = false;is_define_ = true;}+ *r += HI_RESET;} else if (is_keyword_c_constant(word_.data(), word_.size())) {*r += HI_CONSTANT;*r += word_;diff --git a/llamafile/highlight_python.cpp b/llamafile/highlight_python.cppindex 4239ae9b..83bd1505 100644--- a/llamafile/highlight_python.cpp+++ b/llamafile/highlight_python.cpp@@ -23,24 +23,22 @@ enum {NORMAL,WORD,COM,-- SQUOTE, // '- SQUOTESTR, // '...- SQUOTESTR_BACKSLASH, // '...- SQUOTE2, // ''- SQUOTE3, // '''...+ SQUOTE,+ SQUOTESTR,+ SQUOTESTR_BACKSLASH,+ SQUOTE2,+ SQUOTE3,SQUOTE3_BACKSLASH,- SQUOTE31, // '''...'- SQUOTE32, // '''...''-- DQUOTE, // "- DQUOTESTR, // "...- DQUOTESTR_BACKSLASH, // "...- DQUOTE2, // ""- DQUOTE3, // """...+ SQUOTE31,+ SQUOTE32,+ DQUOTE,+ DQUOTESTR,+ DQUOTESTR_BACKSLASH,+ DQUOTE2,+ DQUOTE3,DQUOTE3_BACKSLASH,- DQUOTE31, // """..."- DQUOTE32, // """...""+ DQUOTE31,+ DQUOTE32,};HighlightPython::HighlightPython() {@@ -86,6 +84,10 @@ void HighlightPython::feed(std::string *r, std::string_view input) {*r += HI_KEYWORD;*r += word_;*r += HI_RESET;+ } else if (is_keyword_python_constant(word_.data(), word_.size())) {+ *r += HI_CONSTANT;+ *r += word_;+ *r += HI_RESET;} else {*r += word_;}@@ -266,6 +268,10 @@ void HighlightPython::flush(std::string *r) {*r += HI_KEYWORD;*r += word_;*r += HI_RESET;+ } else if (is_keyword_python_constant(word_.data(), word_.size())) {+ *r += HI_CONSTANT;+ *r += word_;+ *r += HI_RESET;} else {*r += word_;}diff --git a/llamafile/is_keyword_ada_constant.gperf b/llamafile/is_keyword_ada_constant.gperfnew file mode 100644index 00000000..c2977a0e--- /dev/null+++ b/llamafile/is_keyword_ada_constant.gperf@@ -0,0 +1,14 @@+%{+#include <string.h>+#include <libc/str/tab.h>+#define GPERF_DOWNCASE+%}+%pic+%ignore-case+%compare-strncmp+%language=ANSI-C+%readonly-tables+%define lookup-function-name is_keyword_ada_constant+%%+True+Falsediff --git a/llamafile/is_keyword_python.gperf b/llamafile/is_keyword_python.gperfindex 32eac90c..9f4829f3 100644--- a/llamafile/is_keyword_python.gperf+++ b/llamafile/is_keyword_python.gperf@@ -7,9 +7,6 @@%readonly-tables%define lookup-function-name is_keyword_python%%-False-None-Trueandasassertdiff --git a/llamafile/is_keyword_python_constant.gperf b/llamafile/is_keyword_python_constant.gperfnew file mode 100644index 00000000..514f5b87--- /dev/null+++ b/llamafile/is_keyword_python_constant.gperf@@ -0,0 +1,12 @@+%{+#include <string.h>+%}+%pic+%compare-strncmp+%language=ANSI-C+%readonly-tables+%define lookup-function-name is_keyword_python_constant+%%+False+None+Truediff --git a/llamafile/server/client.cpp b/llamafile/server/client.cppindex b793bf3d..dd775dca 100644--- a/llamafile/server/client.cpp+++ b/llamafile/server/client.cpp@@ -27,6 +27,7 @@#include <unistd.h>#include "llama.cpp/llama.h"+#include "llamafile/flags.h"#include "llamafile/llamafile.h"#include "llamafile/string.h"#include "llamafile/threadlocal.h"@@ -346,6 +347,12 @@ Client::append_http_response_message(char* p, int code, const char* reason)if (close_connection_)p = stpcpy(p, "Connection: close\r\n");+ // send user supplied headers+ for (const auto& h : FLAG_headers) {+ p = (char*)mempcpy(p, h.data(), h.size());+ p = stpcpy(p, "\r\n");+ }+return p;}diff --git a/llamafile/server/slot.cpp b/llamafile/server/slot.cppindex ffbdb903..18e8873e 100644--- a/llamafile/server/slot.cpp+++ b/llamafile/server/slot.cpp@@ -16,6 +16,7 @@// limitations under the License.#include "slot.h"+#include "llama.cpp/common.h"#include "llamafile/llama.h"#include "llamafile/llamafile.h"#include "llamafile/macros.h"@@ -132,6 +133,9 @@ Slot::prefill(const std::vector<int>& tokens)unassert(ctx_);size_t erase_count = 0;size_t reuse_count = lf::vector_common_prefix_length(tokens, history_);+ // xxx: ensure we prefill at least one token (prevents badness)+ if (reuse_count >= 1)+ reuse_count -= 1;if (history_.size() > reuse_count) {erase_count = history_.size() - reuse_count;if (llama_kv_cache_seq_rm(ctx_, 0, reuse_count, -1)) {@@ -144,7 +148,7 @@ Slot::prefill(const std::vector<int>& tokens)history_.clear();}}- std::vector<int> new_tokens(tokens.begin() + history_.size(), tokens.end());+ std::vector<int> new_tokens(tokens.begin() + reuse_count, tokens.end());SLOG("prefilling %zu tokens (after removing %zu and reusing %zu)",new_tokens.size(),erase_count,diff --git a/llamafile/server/www/chatbot.js b/llamafile/server/www/chatbot.jsindex e05c9765..2f5dc4b2 100644--- a/llamafile/server/www/chatbot.js+++ b/llamafile/server/www/chatbot.js@@ -20,6 +20,8 @@ const chatInput = document.getElementById("chat-input");const sendButton = document.getElementById("send-button");const typingIndicator = document.getElementById("typing-indicator");+let streamingMessageContent = [];+let chatHistory = [{role: "system",@@ -32,7 +34,10 @@ let chatHistory = [function createMessageElement(content, role) {const messageDiv = document.createElement("div");messageDiv.classList.add("message", role);- messageDiv.textContent = content;+ let hdom = new HighlightDom(messageDiv);+ const high = new HighlightMarkdown(hdom);+ high.feed(content);+ high.flush();return messageDiv;}@@ -42,6 +47,7 @@ function scrollToBottom() {function setTypingIndicatorVisibility(visible) {typingIndicator.style.display = visible ? "flex" : "none";+ chatMessages.scrollTop = chatMessages.scrollHeight;}async function handleChatStream(response) {@@ -50,6 +56,9 @@ async function handleChatStream(response) {let buffer = "";let currentMessageElement = createMessageElement("", "assistant");chatMessages.appendChild(currentMessageElement);+ let hdom = new HighlightDom(currentMessageElement);+ const high = new HighlightMarkdown(hdom);+ streamingMessageContent = [];try {while (true) {@@ -69,7 +78,8 @@ async function handleChatStream(response) {try {const parsed = JSON.parse(data);const content = parsed.choices[0]?.delta?.content || "";- currentMessageElement.textContent += content;+ streamingMessageContent.push(content);+ high.feed(content);scrollToBottom();} catch (e) {console.error("Error parsing JSON:", e);@@ -83,6 +93,7 @@ async function handleChatStream(response) {} catch (error) {console.error("Error reading stream:", error);} finally {+ high.flush();setTypingIndicatorVisibility(false);sendButton.disabled = false;chatInput.disabled = false;@@ -131,7 +142,7 @@ async function sendMessage() {await handleChatStream(response);// update chat history with response- const lastMessage = chatMessages.lastElementChild.textContent;+ const lastMessage = streamingMessageContent.join('');chatHistory.push({ role: "assistant", content: lastMessage });} catch (error) {diff --git a/llamafile/server/www/ctype.js b/llamafile/server/www/ctype.jsnew file mode 100644index 00000000..80e2342c--- /dev/null+++ b/llamafile/server/www/ctype.js@@ -0,0 +1,44 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++function isascii(c) {+ let i = c.charCodeAt(0);+ return 0 <= i && i <= 127;+}++function isalpha(c) {+ let i = c.charCodeAt(0);+ return (65 <= i && i <= 90) ||+ (97 <= i && i <= 122);+}++function isalnum(c) {+ let i = c.charCodeAt(0);+ return (48 <= i && i <= 57) ||+ (65 <= i && i <= 90) ||+ (97 <= i && i <= 122);+}++function isspace(c) {+ return c == ' ' ||+ c == '\t' ||+ c == '\n' ||+ c == '\r' ||+ c == '\v';+}++function isblank(c) {+ return c == ' ' ||+ c == '\t';+}diff --git a/llamafile/server/www/highlight.css b/llamafile/server/www/highlight.cssnew file mode 100644index 00000000..f13911ee--- /dev/null+++ b/llamafile/server/www/highlight.css@@ -0,0 +1,44 @@+.bold { font-weight: bold; }+.italic { font-style: italic; }+.keyword { color: #07B; }+.string { color: #970; }+.comment { color: #173; }+.var { color: #871094; }+.macro { color: #871094; }+.attrib { color: #871094; }+.lineno { color: #666; }+.contin { color: #880; }+.label { color: #880; }+.def { color: #880; }+.type { color: #4a9; }+.class { color: bold #4a9; }+.selector { color: #880; }+.property { color: #4a9; }+.tag { color: #880; }+.incode { color: #871094; }+.builtin { color: #825; }+.constant { color: #b0b; }+.lispkw { color: #871094; }+.entity { color: #4a9; }+.operator { color: #4a9; }+.escape { color: #880; }+.qualifier { color: #871094; }+.immediate { color: #4a9; }+.register { color: #b0b; }+.directive { color: #c31; }+.warning { color: #c31; }+.math { color: #b0b; }++.num { color: #000000; } /* number */+.str { color: #67580c; } /* string */+.esc { color: #80216b; } /* escape sequence */+.ipl { color: #008080; } /* string interpolation */+.ppc { color: #685809; } /* preprocessor */+.pps { color: #273122; } /* preprocessor string */+.com { color: #0e6729; } /* multiline comment */+.slc { color: #0e6729; } /* single line comment */+.lin { color: #75715e; } /* wut */+.opt { color: #000000; } /* operator */+.kwb { color: #8c1a94; } /* type */+.kwc { color: #6b2c75; } /* builtin */+.kwd { color: #9609a7; } /* constant */diff --git a/llamafile/server/www/highlight.js b/llamafile/server/www/highlight.jsnew file mode 100644index 00000000..5c043438--- /dev/null+++ b/llamafile/server/www/highlight.js@@ -0,0 +1,135 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++class Highlight {++ constructor() {+ }++ feed(text) {+ throw new Error('not implemented');+ }++ push(className) {+ throw new Error('not implemented');+ }++ pop() {+ throw new Error('not implemented');+ }++ flush() {+ throw new Error('not implemented');+ }+}++class HighlightDom extends Highlight {++ constructor(containerElement) {+ super();+ this.currentElement = containerElement;+ this.containerElement = containerElement;+ this.text = '';+ }++ feed(s) {+ for (let i = 0; i < s.length; ++i) {+ if (s[i] == '\n') {+ let classes = [];+ this.flushText();+ while (this.currentElement.tagName == 'SPAN') {+ classes.push([this.currentElement.tagName,+ this.currentElement.className]);+ this.currentElement = this.currentElement.parentNode;+ }+ this.currentElement.appendChild(document.createElement('br'));+ while (classes.length) {+ let c = classes.pop();+ this.push(c[0], c[1]);+ }+ } else {+ this.text += s[i];+ }+ }+ }++ push(tagName, className) {+ this.flushText();+ const elem = document.createElement(tagName);+ elem.className = className;+ this.currentElement.appendChild(elem);+ this.currentElement = elem;+ return elem;+ }++ pop() {+ if (this.currentElement == this.containerElement) {+ throw Error('bad pop');+ }+ this.flushText();+ this.currentElement = this.currentElement.parentNode;+ }++ flush() {+ this.flushText();+ while (this.currentElement != this.containerElement) {+ this.currentElement = this.currentElement.parentNode;+ }+ }++ flushText() {+ if (this.text) {+ this.currentElement.appendChild(document.createTextNode(this.text));+ this.text = '';+ }+ }+}++class Highlighter extends Highlight {++ static REGISTRY = {};++ static create(lang, delegate) {+ let clazz = Highlighter.REGISTRY[lang.toLowerCase()];+ if (clazz) {+ return new clazz(delegate);+ } else {+ return null;+ }+ }++ constructor(delegate) {+ super();+ this.delegate = delegate;+ this.state = 0;+ this.delta = 1;+ }++ push(tagName, className) {+ return this.delegate.push(tagName, className);+ }++ pop() {+ this.delegate.pop();+ }++ epsilon(t) {+ this.state = t;+ this.delta = 0;+ }++ append(s) {+ this.delegate.feed(s);+ }+}diff --git a/llamafile/server/www/highlight_ada.js b/llamafile/server/www/highlight_ada.jsnew file mode 100644index 00000000..8170c7c8--- /dev/null+++ b/llamafile/server/www/highlight_ada.js@@ -0,0 +1,233 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const ADA_CONSTANTS = new Set([+ 'true',+ 'false',+]);++const ADA_KEYWORDS = new Set([+ 'abort',+ 'abs',+ 'abstract',+ 'accept',+ 'access',+ 'aliased',+ 'all',+ 'and',+ 'array',+ 'at',+ 'begin',+ 'body',+ 'case',+ 'constant',+ 'declare',+ 'delay',+ 'delta',+ 'digits',+ 'do',+ 'else',+ 'elsif',+ 'end',+ 'entry',+ 'exception',+ 'exit',+ 'for',+ 'function',+ 'generic',+ 'goto',+ 'if',+ 'in',+ 'interface',+ 'is',+ 'limited',+ 'loop',+ 'mod',+ 'new',+ 'not',+ 'null',+ 'of',+ 'or',+ 'others',+ 'out',+ 'overriding',+ 'package',+ 'parallel',+ 'pragma',+ 'private',+ 'procedure',+ 'protected',+ 'raise',+ 'range',+ 'record',+ 'rem',+ 'renames',+ 'requeue',+ 'return',+ 'reverse',+ 'select',+ 'separate',+ 'some',+ 'subtype',+ 'synchronized',+ 'tagged',+ 'task',+ 'terminate',+ 'then',+ 'type',+ 'until',+ 'use',+ 'when',+ 'while',+ 'with',+ 'xor',+]);++class HighlightAda extends Highlighter {++ static NORMAL = 0;+ static WORD = 1;+ static QUOTE = 2;+ static DQUOTE = 3;+ static HYPHEN = 4;+ static COMMENT = 5;++ constructor(delegate) {+ super(delegate);+ this.last = 0;+ this.word = '';+ this.current = 0;+ }++ feed(input) {+ for (let i = 0; i < input.length; i += this.delta) {+ this.delta = 1;+ this.last = this.current;+ const c = input[i];+ this.current = c;++ switch (this.state) {+ case HighlightAda.NORMAL:+ if (!isascii(c) || isalpha(c)) {+ this.epsilon(HighlightAda.WORD);+ } else if (c === '-') {+ this.state = HighlightAda.HYPHEN;+ } else if (c === '\'' && this.last !== ')') {+ this.push('span', 'string');+ this.append(c);+ this.state = HighlightAda.QUOTE;+ } else if (c === '"') {+ this.push('span', 'string');+ this.append(c);+ this.state = HighlightAda.DQUOTE;+ } else {+ this.append(c);+ }+ break;++ case HighlightAda.WORD:+ if (!isascii(c) || isalnum(c) || c === '_' || c === '\'') {+ this.word += c;+ } else {+ if (ADA_KEYWORDS.has(this.word.toLowerCase())) {+ this.push('span', 'keyword');+ this.append(this.word);+ this.pop();+ } else if (ADA_CONSTANTS.has(this.word.toLowerCase())) {+ this.push('span', 'constant');+ this.append(this.word);+ this.pop();+ } else {+ this.append(this.word);+ }+ this.word = '';+ this.epsilon(HighlightAda.NORMAL);+ }+ break;++ case HighlightAda.HYPHEN:+ if (c === '-') {+ this.push('span', 'comment');+ this.append('--');+ this.state = HighlightAda.COMMENT;+ } else {+ this.append('-');+ this.epsilon(HighlightAda.NORMAL);+ }+ break;++ case HighlightAda.COMMENT:+ this.append(c);+ if (c === '\n') {+ this.pop();+ this.state = HighlightAda.NORMAL;+ }+ break;++ case HighlightAda.QUOTE:+ this.append(c);+ if (c === '\'') {+ this.pop();+ this.state = HighlightAda.NORMAL;+ }+ break;++ case HighlightAda.DQUOTE:+ this.append(c);+ if (c === '"') {+ this.pop();+ this.state = HighlightAda.NORMAL;+ }+ break;++ default:+ throw new Error('Invalid state');+ }+ }+ }++ flush() {+ switch (this.state) {+ case HighlightAda.WORD:+ if (ADA_KEYWORDS.has(this.word.toLowerCase())) {+ this.push('span', 'keyword');+ this.append(this.word);+ this.pop();+ } else if (ADA_CONSTANTS.has(this.word.toLowerCase())) {+ this.push('span', 'constant');+ this.append(this.word);+ this.pop();+ } else {+ this.append(this.word);+ }+ this.word = '';+ break;+ case HighlightAda.HYPHEN:+ this.append('-');+ break;+ case HighlightAda.QUOTE:+ case HighlightAda.DQUOTE:+ case HighlightAda.COMMENT:+ this.pop();+ break;+ default:+ break;+ }+ this.state = HighlightAda.NORMAL;+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['ada'] = HighlightAda;+Highlighter.REGISTRY['adb'] = HighlightAda;diff --git a/llamafile/server/www/highlight_asm.js b/llamafile/server/www/highlight_asm.jsnew file mode 100644index 00000000..f68d0d79--- /dev/null+++ b/llamafile/server/www/highlight_asm.js@@ -0,0 +1,91 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const ASM_PREFIXS = new Set([+ 'addr32',+ 'cs',+ 'data16',+ 'ds',+ 'es',+ 'fs',+ 'gs',+ 'lock',+ 'rep',+ 'repe',+ 'repne',+ 'repnz',+ 'repz',+ 'rex',+ 'rex.b',+ 'rex.r',+ 'rex.rb',+ 'rex.rx',+ 'rex.rxb',+ 'rex.w',+ 'rex.wb',+ 'rex.wr',+ 'rex.wrb',+ 'rex.wrx',+ 'rex.wrxb',+ 'rex.wx',+ 'rex.wxb',+ 'rex.x',+ 'rex.xb',+ 'ss',+]);++const ASM_QUALIFIERS = new Set([+ ':req',+ ':vararg',+ '@dtpmod',+ '@dtpoff',+ '@fini_array',+ '@function',+ '@gnu_indirect_function',+ '@got',+ '@gotoff',+ '@gotpcrel',+ '@gottpoff',+ '@init_array',+ '@nobits',+ '@note',+ '@notype',+ '@object',+ '@plt',+ '@pltoff',+ '@progbits',+ '@size',+ '@tlsgd',+ '@tlsld',+ '@tpoff',+ '@unwind',+ 'comdat',+]);++class HighlightAsm extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['asm'] = HighlightAsm;diff --git a/llamafile/server/www/highlight_basic.js b/llamafile/server/www/highlight_basic.jsnew file mode 100644index 00000000..df3ca95c--- /dev/null+++ b/llamafile/server/www/highlight_basic.js@@ -0,0 +1,551 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const BASIC_KEYWORDSS = new Set([+ '#const',+ '#else',+ '#elseif',+ '#end',+ '#if',+ 'addhandler',+ 'addressof',+ 'alias',+ 'and',+ 'andalso',+ 'as',+ 'attribute',+ 'byref',+ 'byval',+ 'cbool',+ 'cbyte',+ 'cchar',+ 'cdate',+ 'cdbl',+ 'cdec',+ 'cint',+ 'clng',+ 'cobj',+ 'csbyte',+ 'cshort',+ 'csng',+ 'cstr',+ 'ctype',+ 'cuint',+ 'culng',+ 'cushort',+ 'call',+ 'case',+ 'catch',+ 'class',+ 'const',+ 'constraint',+ 'continue',+ 'declare',+ 'default',+ 'delegate',+ 'dim',+ 'directcast',+ 'do',+ 'each',+ 'else',+ 'elseif',+ 'end',+ 'endif',+ 'enum',+ 'erase',+ 'error',+ 'event',+ 'exit',+ 'finally',+ 'for',+ 'friend',+ 'function',+ 'get',+ 'gettype',+ 'getxmlnamespace',+ 'global',+ 'gosub',+ 'goto',+ 'handles',+ 'if',+ 'implements',+ 'imports',+ 'in',+ 'inherits',+ 'interface',+ 'is',+ 'isnot',+ 'ltrim',+ 'let',+ 'lib',+ 'like',+ 'loop',+ 'mirr',+ 'macid',+ 'macscript',+ 'me',+ 'mod',+ 'module',+ 'mustinherit',+ 'mustoverride',+ 'mybase',+ 'myclass',+ 'nper',+ 'nameof',+ 'namespace',+ 'narrowing',+ 'new',+ 'next',+ 'not',+ 'notinheritable',+ 'notoverridable',+ 'of',+ 'on',+ 'operator',+ 'option',+ 'optional',+ 'or',+ 'orelse',+ 'out',+ 'overloads',+ 'overridable',+ 'overrides',+ 'paramarray',+ 'partial',+ 'private',+ 'property',+ 'protected',+ 'public',+ 'rem',+ 'rtrim',+ 'raiseevent',+ 'redim',+ 'readonly',+ 'removehandler',+ 'resume',+ 'return',+ 'select',+ 'set',+ 'shadows',+ 'shared',+ 'statement',+ 'static',+ 'step',+ 'stop',+ 'structure',+ 'sub',+ 'synclock',+ 'then',+ 'throw',+ 'to',+ 'trim',+ 'try',+ 'trycast',+ 'type',+ 'typeof',+ 'using',+ 'wend',+ 'when',+ 'while',+ 'widening',+ 'with',+ 'withevents',+ 'writeonly',+ 'xor',+]);++const BASIC_BUILTINS = new Set([+ 'abs',+ 'array',+ 'asc',+ 'atan',+ 'atn',+ 'callbyname',+ 'choose',+ 'chr',+ 'command',+ 'cos',+ 'curdir',+ 'ddb',+ 'date',+ 'dateadd',+ 'datediff',+ 'datepart',+ 'dateserial',+ 'datevalue',+ 'day',+ 'dir',+ 'doevents',+ 'eof',+ 'environ',+ 'exp',+ 'fileattr',+ 'fileclose',+ 'filecopy',+ 'filedatetime',+ 'fileget',+ 'filegetobject',+ 'filelen',+ 'fileopen',+ 'fileput',+ 'fileputobject',+ 'filewidth',+ 'fix',+ 'format',+ 'freefile',+ 'getattr',+ 'getobject',+ 'hex',+ 'instr',+ 'instrrev',+ 'input',+ 'inputbox',+ 'inputstring',+ 'int',+ 'isarray',+ 'isdate',+ 'isempty',+ 'iserror',+ 'ismissing',+ 'isnull',+ 'isobject',+ 'join',+ 'kill',+ 'lbound',+ 'lcase',+ 'lof',+ 'left',+ 'len',+ 'lineinput',+ 'loc',+ 'lock',+ 'log',+ 'mid',+ 'month',+ 'monthname',+ 'msgbox',+ 'now',+ 'oct',+ 'ppmt',+ 'pv',+ 'partition',+ 'pmt',+ 'print',+ 'qbcolor',+ 'randomize',+ 'read',+ 'replace',+ 'reset',+ 'right',+ 'rnd',+ 'round',+ 'spc',+ 'second',+ 'seek',+ 'setattr',+ 'shell',+ 'sign',+ 'sin',+ 'split',+ 'sqr',+ 'sqrt',+ 'str',+ 'strcomp',+ 'strconv',+ 'strreverse',+ 'switch',+ 'tab',+ 'tan',+ 'time',+ 'timer',+ 'ubound',+ 'ucase',+ 'unlock',+ 'val',+ 'vartype',+ 'weekday',+ 'weekdayname',+ 'write',+ 'writeline',+ 'year',+]);++const BASIC_CONSTANTS = new Set([+ 'false',+ 'nothing',+ 'true',+ 'vbabort',+ 'vbabortretryignore',+ 'vbapplicationmodal',+ 'vbarchive',+ 'vbarray',+ 'vbback',+ 'vbbinarycompare',+ 'vbboolean',+ 'vbbyte',+ 'vbcancel',+ 'vbcr',+ 'vbcrlf',+ 'vbcritical',+ 'vbcurrency',+ 'vbdate',+ 'vbdecimal',+ 'vbdefaultbutton1',+ 'vbdefaultbutton2',+ 'vbdefaultbutton3',+ 'vbdirectory',+ 'vbdouble',+ 'vbempty',+ 'vbexclamation',+ 'vbfalse',+ 'vbfirstfourdays',+ 'vbfirstfullweek',+ 'vbfirstjan1',+ 'vbformfeed',+ 'vbfriday',+ 'vbgeneraldate',+ 'vbget',+ 'vbhidden',+ 'vbhide',+ 'vbhiragana',+ 'vbignore',+ 'vbinformation',+ 'vbinteger',+ 'vbkatakana',+ 'vblet',+ 'vblf',+ 'vblinguisticcasing',+ 'vblong',+ 'vblongdate',+ 'vblongtime',+ 'vblowercase',+ 'vbmaximizedfocus',+ 'vbmethod',+ 'vbminimizedfocus',+ 'vbminimizednofocus',+ 'vbmonday',+ 'vbmsgboxhelp',+ 'vbmsgboxright',+ 'vbmsgboxrtlreading',+ 'vbmsgboxsetforeground',+ 'vbnarrow',+ 'vbnewline',+ 'vbno',+ 'vbnormal',+ 'vbnormalfocus',+ 'vbnormalnofocus',+ 'vbnull',+ 'vbnullchar',+ 'vbnullstring',+ 'vbok',+ 'vbokcancel',+ 'vbokonly',+ 'vbobject',+ 'vbobjecterror',+ 'vbpropercase',+ 'vbquestion',+ 'vbreadonly',+ 'vbretry',+ 'vbretrycancel',+ 'vbsaturday',+ 'vbset',+ 'vbshortdate',+ 'vbshorttime',+ 'vbsimplifiedchinese',+ 'vbsingle',+ 'vbstring',+ 'vbsunday',+ 'vbsystem',+ 'vbsystemmodal',+ 'vbtab',+ 'vbtextcompare',+ 'vbthursday',+ 'vbtraditionalchinese',+ 'vbtrue',+ 'vbtuesday',+ 'vbuppercase',+ 'vbusedefault',+ 'vbusesystem',+ 'vbusesystemdayofweek',+ 'vbuserdefinedtype',+ 'vbvariant',+ 'vbverticaltab',+ 'vbvolume',+ 'vbwednesday',+ 'vbwide',+ 'vbyes',+ 'vbyesno',+ 'vbyesnocancel',+]);++const BASIC_TYPES = new Set([+ 'boolean',+ 'byte',+ 'char',+ 'date',+ 'decimal',+ 'double',+ 'integer',+ 'long',+ 'object',+ 'sbyte',+ 'short',+ 'single',+ 'string',+ 'uinteger',+ 'ulong',+ 'ushort',+ 'variant',+]);++class HighlightBasic extends Highlighter {++ static NORMAL = 0;+ static WORD = 1;+ static LINENO = 2;+ static DQUOTE = 3;+ static COMMENT = 4;+ static DIRECTIVE = 5;++ constructor(delegate) {+ super(delegate);+ this.word = '';+ this.is_bol = true;+ }++ feed(input) {+ for (let i = 0; i < input.length; i += this.delta) {+ this.delta = 1;+ this.last = this.current;+ const c = input[i];+ this.current = c;++ switch (this.state) {+ case HighlightBasic.NORMAL:+ if (!isascii(c) || isalpha(c)) {+ this.epsilon(HighlightBasic.WORD);+ } else if (c === '-') {+ this.state = HighlightBasic.HYPHEN;+ } else if (c === '\'' && this.last !== ')') {+ this.push('span', 'string');+ this.append(c);+ this.state = HighlightBasic.QUOTE;+ } else if (c === '"') {+ this.push('span', 'string');+ this.append(c);+ this.state = HighlightBasic.DQUOTE;+ } else {+ this.append(c);+ }+ break;++ case HighlightBasic.WORD:+ if (!isascii(c) || isalnum(c) || c === '_' || c === '\'') {+ this.word += c;+ } else {+ if (is_keyword_basic(this.word)) {+ this.push('span', 'keyword');+ this.append(this.word);+ this.pop();+ } else {+ this.append(this.word);+ }+ this.word = '';+ this.epsilon(HighlightBasic.NORMAL);+ }+ break;++ case HighlightBasic.HYPHEN:+ if (c === '-') {+ this.push('span', 'comment');+ this.append('--');+ this.state = HighlightBasic.COMMENT;+ } else {+ this.append('-');+ this.epsilon(HighlightBasic.NORMAL);+ }+ break;++ case HighlightBasic.COMMENT:+ this.append(c);+ if (c === '\n') {+ this.pop();+ this.state = HighlightBasic.NORMAL;+ }+ break;++ case HighlightBasic.QUOTE:+ this.append(c);+ if (c === '\'') {+ this.pop();+ this.state = HighlightBasic.NORMAL;+ }+ break;++ case HighlightBasic.DQUOTE:+ this.append(c);+ if (c === '"') {+ this.pop();+ this.state = HighlightBasic.NORMAL;+ }+ break;++ default:+ throw new Error('Invalid state');+ }+ if (this.is_bol) {+ if (!isspace(c))+ this.is_bol = false;+ } else {+ if (c == '\n')+ this.is_bol = true;+ }+ }+ }++ flush() {+ switch (this.state) {+ case HighlightBasic.WORD:+ if (is_keyword_basic(this.word)) {+ this.push('span', 'keyword');+ this.append(this.word);+ } else {+ this.append(this.word);+ }+ this.word = '';+ break;+ case HighlightBasic.HYPHEN:+ this.append('-');+ break;+ case HighlightBasic.QUOTE:+ case HighlightBasic.DQUOTE:+ case HighlightBasic.COMMENT:+ this.pop();+ break;+ default:+ break;+ }+ this.state = HighlightBasic.NORMAL;+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['basic'] = HighlightBasic;+Highlighter.REGISTRY['vb'] = HighlightBasic;+Highlighter.REGISTRY['vba'] = HighlightBasic;+Highlighter.REGISTRY['vbs'] = HighlightBasic;+Highlighter.REGISTRY['bas'] = HighlightBasic;+Highlighter.REGISTRY['vb.net'] = HighlightBasic;+Highlighter.REGISTRY['qbasic'] = HighlightBasic;+Highlighter.REGISTRY['freebasic'] = HighlightBasic;diff --git a/llamafile/server/www/highlight_c.js b/llamafile/server/www/highlight_c.jsnew file mode 100644index 00000000..4e3efd82--- /dev/null+++ b/llamafile/server/www/highlight_c.js@@ -0,0 +1,2089 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const C_KEYWORDS = new Set([+ '_Alignas',+ '_Alignof',+ '_Atomic',+ '_BitInt',+ '_Bool',+ '_Complex',+ '_Decimal128',+ '_Decimal32',+ '_Decimal64',+ '_Float128',+ '_Float16',+ '_Float32',+ '_Float64',+ '_Generic',+ '_Imaginary',+ '_Noreturn',+ '_Static_assert',+ '_Thread_local',+ '__access__',+ '__alias__',+ '__aligned__',+ '__alignof',+ '__alignof__',+ '__alloc_align__',+ '__alloc_size__',+ '__always_inline__',+ '__artificial__',+ '__asm',+ '__asm__',+ '__assume_aligned__',+ '__attribute',+ '__attribute__',+ '__auto_type',+ '__avx2',+ '__bf16',+ '__builtin___',+ '__builtin_offsetof',+ '__builtin_va_arg',+ '__byte__',+ '__cmn_err__',+ '__cold__',+ '__complex',+ '__complex__',+ '__const',+ '__const__',+ '__constructor__',+ '__copy__',+ '__deprecated__',+ '__destructor__',+ '__error__',+ '__extension__',+ '__externally_visible__',+ '__fd_arg',+ '__fd_arg__',+ '__fentry__',+ '__flatten__',+ '__float80',+ '__force_align_arg_pointer__',+ '__format__',+ '__format_arg__',+ '__funline',+ '__gnu_format__',+ '__gnu_inline__',+ '__gnu_printf__',+ '__gnu_scanf__',+ '__hardbool__',+ '__hot__',+ '__ifunc__',+ '__imag',+ '__imag__',+ '__imag__ ',+ '__inline',+ '__inline__',+ '__interrupt__',+ '__interrupt_handler__',+ '__label__',+ '__leaf__',+ '__malloc__',+ '__may_alias__',+ '__mcarch__',+ '__mcfarch__',+ '__mcffpu__',+ '__mcfhwdiv__',+ '__mode__',+ '__ms_abi__',+ '__msabi',+ '__muarch__',+ '__no_address_safety_analysis__',+ '__no_caller_saved_registers__',+ '__no_icf__',+ '__no_instrument_function__',+ '__no_profile_instrument_function__',+ '__no_reorder__',+ '__no_sanitize__',+ '__no_sanitize_address__',+ '__no_sanitize_thread__',+ '__no_sanitize_undefined__',+ '__no_split_stack__',+ '__no_stack_limit__',+ '__no_stack_protector__',+ '__noclone__',+ '__noinline__',+ '__noipa__',+ '__nonnull__',+ '__noplt__',+ '__noreturn__',+ '__nothrow__',+ '__null',+ '__optimize__',+ '__packed__',+ '__params_nonnull__',+ '__patchable_function_entry__',+ '__pic__',+ '__pie__',+ '__pointer__',+ '__printf__',+ '__pure__',+ '__read_only',+ '__read_only__',+ '__read_write',+ '__read_write__',+ '__real',+ '__real__',+ '__real__ ',+ '__restrict',+ '__restrict__',+ '__retain__',+ '__return__',+ '__returns_nonnull__',+ '__returns_twice__',+ '__scanf__',+ '__section__',+ '__seg_fs',+ '__seg_gs',+ '__sentinel__',+ '__signed',+ '__signed__',+ '__simd__',+ '__strfmon__',+ '__strftime__',+ '__strong__',+ '__symver__',+ '__sysv_abi__',+ '__tainted_args__',+ '__target__',+ '__target_clones',+ '__target_clones__',+ '__thread',+ '__transparent_union__',+ '__typeof',+ '__typeof__',+ '__typeof_unqual__',+ '__unix__',+ '__unused__',+ '__used__',+ '__vax__',+ '__vector_size__',+ '__vex',+ '__visibility__',+ '__volatile',+ '__volatile__',+ '__volatile__ ',+ '__warn_if_not_aligned__',+ '__warn_unused_result__',+ '__warning__',+ '__weak__',+ '__word__',+ '__write_only',+ '__write_only__',+ '__wur',+ '__zero_call_used_regs__',+ 'alignas',+ 'alignof',+ 'asm',+ 'auto',+ 'autotype',+ 'bool',+ 'break',+ 'case',+ 'char',+ 'const',+ 'constexpr',+ 'continue',+ 'default',+ 'do',+ 'dontcallback',+ 'dontthrow',+ 'double',+ 'else',+ 'enum',+ 'extern',+ 'float',+ 'for',+ 'forcealign',+ 'forcealignargpointer',+ 'forceinline',+ 'goto',+ 'hasatleast',+ 'if',+ 'inline',+ 'int',+ 'interruptfn',+ 'libcesque',+ 'long',+ 'mallocesque',+ 'memcpyesque',+ 'nocallersavedregisters',+ 'nosideeffect',+ 'nullptr',+ 'nullterminated',+ 'paramsnonnull',+ 'printfesque',+ 'privileged',+ 'pureconst',+ 'reallocesque',+ 'register',+ 'relegated',+ 'restrict',+ 'return',+ 'returnsaligned',+ 'returnsnonnull',+ 'returnspointerwithnoaliases',+ 'returnstwice',+ 'scanfesque',+ 'short',+ 'signed',+ 'sizeof',+ 'static',+ 'strftimeesque',+ 'strlenesque',+ 'struct',+ 'switch',+ 'textwindows',+ 'thatispacked',+ 'thread_local',+ 'typedef',+ 'typeof',+ 'typeof_unqual',+ 'union',+ 'unsigned',+ 'vallocesque',+ 'void',+ 'volatile',+ 'while',+ 'wontreturn',+]);++const C_BUILTINS = new Set([+ 'COSMOPOLITAN_CXX_END_',+ 'COSMOPOLITAN_CXX_START_',+ 'COSMOPOLITAN_CXX_USING_',+ 'COSMOPOLITAN_C_END_',+ 'COSMOPOLITAN_C_START_',+ 'STRINGIFY',+ '__ATOMIC_ACQUIRE',+ '__ATOMIC_ACQ_REL',+ '__ATOMIC_CONSUME',+ '__ATOMIC_RELAXED',+ '__ATOMIC_RELEASE',+ '__ATOMIC_SEQ_CST',+ '__atomic_add_fetch',+ '__atomic_always_lock_free',+ '__atomic_and_fetch',+ '__atomic_clear',+ '__atomic_compare_exchange',+ '__atomic_compare_exchange_n',+ '__atomic_exchange',+ '__atomic_exchange_n',+ '__atomic_fetch_add',+ '__atomic_fetch_and',+ '__atomic_fetch_nand',+ '__atomic_fetch_or',+ '__atomic_fetch_sub',+ '__atomic_fetch_xor',+ '__atomic_is_lock_free',+ '__atomic_load',+ '__atomic_load_n',+ '__atomic_nand_fetch',+ '__atomic_or_fetch',+ '__atomic_signal_fence',+ '__atomic_store',+ '__atomic_store_n',+ '__atomic_sub_fetch',+ '__atomic_test_and_set',+ '__atomic_thread_fence',+ '__atomic_xor_fetch',+ '__builtin_FILE',+ '__builtin_FUNCTION',+ '__builtin_LINE',+ '__builtin_abs',+ '__builtin_add_overflow',+ '__builtin_add_overflow_p',+ '__builtin_addc',+ '__builtin_addcl',+ '__builtin_addcll',+ '__builtin_addf128_round_to_odd',+ '__builtin_addg6s',+ '__builtin_alloc',+ '__builtin_alloc_with_align',+ '__builtin_alloca',+ '__builtin_alloca_with_align',+ '__builtin_alloca_with_align_and_max',+ '__builtin_apply',+ '__builtin_apply_args',+ '__builtin_assoc_barrier',+ '__builtin_assume',+ '__builtin_assume_aligned',+ '__builtin_bit_cast',+ '__builtin_bswap128',+ '__builtin_bswap16',+ '__builtin_bswap32',+ '__builtin_bswap64',+ '__builtin_btf_type_id',+ '__builtin_byte_in_either_range',+ '__builtin_byte_in_range',+ '__builtin_byte_in_set',+ '__builtin_call_with_static_chain',+ '__builtin_calloc',+ '__builtin_cbcdtd',+ '__builtin_cdtbcd',+ '__builtin_cfuged',+ '__builtin_choose_expr',+ '__builtin_classify_type',+ '__builtin_clear_padding',+ '__builtin_clrsb',+ '__builtin_clrsbg',+ '__builtin_clrsbl',+ '__builtin_clrsbll',+ '__builtin_clz',+ '__builtin_clzg',+ '__builtin_clzl',+ '__builtin_clzll',+ '__builtin_cmpb',+ '__builtin_cntlzdm',+ '__builtin_cnttzdm',+ '__builtin_complex',+ '__builtin_constant_p',+ '__builtin_convertvector',+ '__builtin_copysignfn',+ '__builtin_copysignfnx',+ '__builtin_copysignq',+ '__builtin_cpu_init',+ '__builtin_cpu_is',+ '__builtin_cpu_supports',+ '__builtin_ctz',+ '__builtin_ctzg',+ '__builtin_ctzl',+ '__builtin_ctzll',+ '__builtin_dynamic_object_size',+ '__builtin_eni',+ '__builtin_expect',+ '__builtin_expect_with_probability',+ '__builtin_extend_pointer',+ '__builtin_extract_return_addr',+ '__builtin_fabsfn',+ '__builtin_fabsfnx',+ '__builtin_fabsq',+ '__builtin_ffs',+ '__builtin_ffsg',+ '__builtin_ffsl',+ '__builtin_ffsll',+ '__builtin_flushd',+ '__builtin_flushda',+ '__builtin_fma',+ '__builtin_fmaf128',+ '__builtin_fmaf128_round_to_odd',+ '__builtin_fpclassify',+ '__builtin_fprintf',+ '__builtin_fprintf_unlocked',+ '__builtin_fputc',+ '__builtin_fputc_unlocked',+ '__builtin_fputs',+ '__builtin_fputs_unlocked',+ '__builtin_frame_address',+ '__builtin_free',+ '__builtin_frob_return_addr',+ '__builtin_fwrite',+ '__builtin_fwrite_unlocked',+ '__builtin_get_texasr',+ '__builtin_get_texasru',+ '__builtin_get_tfhar',+ '__builtin_get_tfiar',+ '__builtin_goacc_parlevel_id',+ '__builtin_goacc_parlevel_size',+ '__builtin_has_attribute',+ '__builtin_huge_val',+ '__builtin_huge_valf',+ '__builtin_huge_valfn',+ '__builtin_huge_valfnx',+ '__builtin_huge_vall',+ '__builtin_huge_valq',+ '__builtin_inf',+ '__builtin_infd128',+ '__builtin_infd32',+ '__builtin_infd64',+ '__builtin_inff',+ '__builtin_inffn',+ '__builtin_inffnx',+ '__builtin_infl',+ '__builtin_infq',+ '__builtin_is_constant_evaluated',+ '__builtin_iseqsig',+ '__builtin_isfinite',+ '__builtin_isgreater',+ '__builtin_isgreaterequal',+ '__builtin_isinf_sign',+ '__builtin_isnan',+ '__builtin_isnormal',+ '__builtin_issignaling',+ '__builtin_isunordered',+ '__builtin_ldbio',+ '__builtin_ldbuio',+ '__builtin_ldex',+ '__builtin_ldhio',+ '__builtin_ldhuio',+ '__builtin_ldsex',+ '__builtin_ldwio',+ '__builtin_longjmp',+ '__builtin_lroundf',+ '__builtin_malloc',+ '__builtin_memcpy',+ '__builtin_memcpy_chk',+ '__builtin_memmove',+ '__builtin_memset',+ '__builtin_memset_chk',+ '__builtin_mffs',+ '__builtin_mffsl',+ '__builtin_mul_overflow',+ '__builtin_mul_overflow_p',+ '__builtin_mulf128_round_to_odd',+ '__builtin_nan',+ '__builtin_nand128',+ '__builtin_nand32',+ '__builtin_nand64',+ '__builtin_nanf',+ '__builtin_nanfn',+ '__builtin_nanfnx',+ '__builtin_nanl',+ '__builtin_nanq',+ '__builtin_nans',+ '__builtin_nansd128',+ '__builtin_nansd32',+ '__builtin_nansd64',+ '__builtin_nansf',+ '__builtin_nansfn',+ '__builtin_nansfnx',+ '__builtin_nansl',+ '__builtin_nansq',+ '__builtin_next_arg',+ '__builtin_non_tx_store',+ '__builtin_nvptx_brev',+ '__builtin_nvptx_brevll',+ '__builtin_object_size',+ '__builtin_offsetof',+ '__builtin_pack_dec128',+ '__builtin_pack_ibm128',+ '__builtin_pack_longdouble',+ '__builtin_pack_vector_int128',+ '__builtin_parity',+ '__builtin_parityg',+ '__builtin_parityl',+ '__builtin_parityll',+ '__builtin_pdepd',+ '__builtin_pextd',+ '__builtin_popcount',+ '__builtin_popcountg',+ '__builtin_popcountl',+ '__builtin_popcountll',+ '__builtin_powi',+ '__builtin_powif',+ '__builtin_powil',+ '__builtin_ppc_get_timebase',+ '__builtin_ppc_mftb',+ '__builtin_prefetch',+ '__builtin_preserve_access_index',+ '__builtin_preserve_enum_value',+ '__builtin_preserve_field_info',+ '__builtin_preserve_type_info',+ '__builtin_printf',+ '__builtin_printf_unlocked',+ '__builtin_putc',+ '__builtin_putc_unlocked',+ '__builtin_putchar',+ '__builtin_putchar_unlocked',+ '__builtin_puts',+ '__builtin_puts_unlocked',+ '__builtin_rdctl',+ '__builtin_rdprs',+ '__builtin_read16',+ '__builtin_read32',+ '__builtin_read64',+ '__builtin_read8',+ '__builtin_realloc',+ '__builtin_recipdiv',+ '__builtin_recipdivf',+ '__builtin_return',+ '__builtin_return_address',+ '__builtin_rs6000_speculation_barrier',+ '__builtin_rsqrt',+ '__builtin_rsqrtf',+ '__builtin_sadd_overflow',+ '__builtin_saddl_overflow',+ '__builtin_saddll_overflow',+ '__builtin_set_fpscr_drn',+ '__builtin_set_fpscr_rn',+ '__builtin_set_texasr',+ '__builtin_set_texasru',+ '__builtin_set_tfhar',+ '__builtin_set_tfiar',+ '__builtin_set_thread_pointer',+ '__builtin_setjmp',+ '__builtin_sh_get_fpscr',+ '__builtin_sh_set_fpscr',+ '__builtin_shuffle',+ '__builtin_shufflevector',+ '__builtin_signbit',+ '__builtin_signbitf',+ '__builtin_signbitl',+ '__builtin_smul_overflow',+ '__builtin_smull_overflow',+ '__builtin_smulll_overflow',+ '__builtin_speculation_safe_copy',+ '__builtin_speculation_safe_value',+ '__builtin_sqrtf128',+ '__builtin_sqrtf128_round_to_odd',+ '__builtin_ssub_overflow',+ '__builtin_ssubl_overflow',+ '__builtin_ssubll_overflow',+ '__builtin_stack_address',+ '__builtin_stack_restore',+ '__builtin_stack_save',+ '__builtin_stbio',+ '__builtin_stdc_bit_ceil',+ '__builtin_stdc_bit_floor',+ '__builtin_stdc_bit_width',+ '__builtin_stdc_count_ones',+ '__builtin_stdc_count_zeros',+ '__builtin_stdc_first_leading_one',+ '__builtin_stdc_first_leading_zero',+ '__builtin_stdc_first_trailing_one',+ '__builtin_stdc_first_trailing_zero',+ '__builtin_stdc_has_single_bit',+ '__builtin_stdc_leading_ones',+ '__builtin_stdc_leading_zeros',+ '__builtin_stdc_trailing_ones',+ '__builtin_stdc_trailing_zeros',+ '__builtin_stex',+ '__builtin_sthio',+ '__builtin_strchr',+ '__builtin_strcpy',+ '__builtin_strcpy_chk',+ '__builtin_strlen',+ '__builtin_stsex',+ '__builtin_stwio',+ '__builtin_sub_overflow',+ '__builtin_sub_overflow_p',+ '__builtin_subc',+ '__builtin_subcl',+ '__builtin_subcll',+ '__builtin_subf128_round_to_odd',+ '__builtin_sync',+ '__builtin_tabort',+ '__builtin_tabortdc',+ '__builtin_tabortdci',+ '__builtin_tabortwc',+ '__builtin_tabortwci',+ '__builtin_tbegin',+ '__builtin_tbegin_nofloat',+ '__builtin_tbegin_retry',+ '__builtin_tbegin_retry_nofloat',+ '__builtin_tbeginc',+ '__builtin_tcheck',+ '__builtin_tend',+ '__builtin_tendall',+ '__builtin_tgmath',+ '__builtin_thread_pointer',+ '__builtin_trap',+ '__builtin_trechkpt',+ '__builtin_treclaim',+ '__builtin_tresume',+ '__builtin_truncf128_round_to_odd',+ '__builtin_tsr',+ '__builtin_tsuspend',+ '__builtin_ttest',+ '__builtin_tx_assist',+ '__builtin_tx_nesting_depth',+ '__builtin_types_compatible_p',+ '__builtin_uadd_overflow',+ '__builtin_uaddl_overflow',+ '__builtin_uaddll_overflow',+ '__builtin_umul_overflow',+ '__builtin_umull_overflow',+ '__builtin_umulll_overflow',+ '__builtin_unpack_dec128',+ '__builtin_unpack_ibm128',+ '__builtin_unpack_longdouble',+ '__builtin_unpack_vector_int128',+ '__builtin_unreachable',+ '__builtin_usub_overflow',+ '__builtin_usubl_overflow',+ '__builtin_usubll_overflow',+ '__builtin_va_arg',+ '__builtin_va_arg_pack',+ '__builtin_va_arg_pack_len',+ '__builtin_va_copy',+ '__builtin_va_end',+ '__builtin_va_list',+ '__builtin_va_start',+ '__builtin_vfprintf',+ '__builtin_vprintf',+ '__builtin_wrctl',+ '__builtin_write16',+ '__builtin_write32',+ '__builtin_write64',+ '__builtin_write8',+ '__builtin_wrpie',+ '__conceal',+ '__dll_import',+ '__expropriate',+ '__has_feature',+ '__has_include',+ '__has_nothrow_assign',+ '__has_nothrow_constructor',+ '__has_nothrow_copy',+ '__has_trivial_assign',+ '__has_trivial_constructor',+ '__has_trivial_copy',+ '__has_trivial_destructor',+ '__has_virtual_destructor',+ '__integer_pack',+ '__is_abstract',+ '__is_base_of',+ '__is_class',+ '__is_empty',+ '__is_enum',+ '__is_literal_type',+ '__is_pod',+ '__is_polymorphic',+ '__is_same',+ '__is_standard_layout',+ '__is_trivial',+ '__is_union',+ '__notice',+ '__shfl',+ '__shfl_down',+ '__shfl_down_sync',+ '__shfl_sync',+ '__shfl_up_sync',+ '__shfl_xor',+ '__shfl_xor_sync',+ '__static_yoink',+ '__strong_reference',+ '__target_clones',+ '__underlying_type',+ '__veil',+ '__vex',+ '__weak_reference',+ '__yoink',+ 'static_assert',+]);++const C_CONSTANTS = new Set([+ 'ARG_MAX',+ 'ATEXIT_MAX',+ 'ATOMIC_FLAG_INIT',+ 'BC_BASE_MAX',+ 'BC_DIM_MAX',+ 'BC_SCALE_MAX',+ 'BC_STRING_MAX',+ 'BUFSIZ',+ 'CHARCLASS_NAME_MAX',+ 'CHAR_BIT',+ 'CHAR_MAX',+ 'CHAR_MIN',+ 'CHILD_MAX',+ 'CLK_TCK',+ 'COLL_WEIGHTS_MAX',+ 'DBL_DECIMAL_DIG',+ 'DBL_DIG',+ 'DBL_EPSILON',+ 'DBL_HAS_SUBNORM',+ 'DBL_IS_IEC_60559',+ 'DBL_MANT_DIG',+ 'DBL_MAX',+ 'DBL_MAX_10_EXP',+ 'DBL_MAX_EXP',+ 'DBL_MIN',+ 'DBL_MIN_10_EXP',+ 'DBL_MIN_EXP',+ 'DBL_NORM_MAX',+ 'DBL_TRUE_MIN',+ 'DECIMAL_DIG',+ 'DELAYTIMER_MAX',+ 'EOF',+ 'EXPR_NEST_MAX',+ 'FILENAME_MAX',+ 'FILESIZEBITS',+ 'FLT_DECIMAL_DIG',+ 'FLT_DIG',+ 'FLT_EPSILON',+ 'FLT_HAS_SUBNORM',+ 'FLT_IS_IEC_60559',+ 'FLT_MANT_DIG',+ 'FLT_MAX',+ 'FLT_MAX_10_EXP',+ 'FLT_MAX_EXP',+ 'FLT_MIN',+ 'FLT_MIN_10_EXP',+ 'FLT_MIN_EXP',+ 'FLT_NORM_MAX',+ 'FLT_RADIX',+ 'FLT_ROUNDS',+ 'FLT_TRUE_MIN',+ 'FOPEN_MAX',+ 'FP_FAST_FMA',+ 'FP_FAST_FMAF',+ 'FP_FAST_FMAL',+ 'FP_ILOGB0',+ 'FP_ILOGBNAN',+ 'FP_INFINITE',+ 'FP_NAN',+ 'FP_NORMAL',+ 'FP_SUBNORMAL',+ 'FP_ZERO',+ 'HLF_MAX',+ 'HLF_MIN',+ 'HOST_NAME_MAX',+ 'HUGE_VAL',+ 'HUGE_VALF',+ 'HUGE_VALL',+ 'INFINITY',+ 'INT128_MAX',+ 'INT128_MIN',+ 'INT16_MAX',+ 'INT16_MIN',+ 'INT32_MAX',+ 'INT32_MIN',+ 'INT64_MAX',+ 'INT64_MIN',+ 'INT8_MAX',+ 'INT8_MIN',+ 'INTMAX_MAX',+ 'INTMAX_MIN',+ 'INTPTR_MAX',+ 'INTPTR_MIN',+ 'INT_FAST16_MAX',+ 'INT_FAST16_MIN',+ 'INT_FAST32_MAX',+ 'INT_FAST32_MIN',+ 'INT_FAST64_MAX',+ 'INT_FAST64_MIN',+ 'INT_FAST8_MAX',+ 'INT_FAST8_MIN',+ 'INT_LEAST16_MAX',+ 'INT_LEAST16_MIN',+ 'INT_LEAST32_MAX',+ 'INT_LEAST32_MIN',+ 'INT_LEAST64_MAX',+ 'INT_LEAST64_MIN',+ 'INT_LEAST8_MAX',+ 'INT_LEAST8_MIN',+ 'INT_MAX',+ 'INT_MIN',+ 'LDBL_DECIMAL_DIG',+ 'LDBL_DIG',+ 'LDBL_EPSILON',+ 'LDBL_HAS_SUBNORM',+ 'LDBL_IS_IEC_60559',+ 'LDBL_MANT_DIG',+ 'LDBL_MAX',+ 'LDBL_MAX_10_EXP',+ 'LDBL_MAX_EXP',+ 'LDBL_MIN',+ 'LDBL_MIN_10_EXP',+ 'LDBL_MIN_EXP',+ 'LDBL_NORM_MAX',+ 'LDBL_TRUE_MIN',+ 'LINE_MAX',+ 'LLONG_MAX',+ 'LLONG_MIN',+ 'LOGIN_NAME_MAX',+ 'LONG_BIT',+ 'LONG_LONG_MAX',+ 'LONG_LONG_MIN',+ 'LONG_MAX',+ 'LONG_MIN',+ 'L_ctermid',+ 'L_tmpnam',+ 'MATH_ERREXCEPT',+ 'MATH_ERRNO',+ 'MB_CUR_MAX',+ 'MB_LEN_MAX',+ 'MQ_PRIO_MAX',+ 'M_1_PI',+ 'M_1_PIf',+ 'M_1_PIl',+ 'M_2_PI',+ 'M_2_PIf',+ 'M_2_PIl',+ 'M_2_SQRTPI',+ 'M_2_SQRTPIf',+ 'M_2_SQRTPIl',+ 'M_E',+ 'M_Ef',+ 'M_El',+ 'M_LN10',+ 'M_LN10f',+ 'M_LN10l',+ 'M_LN2',+ 'M_LN2f',+ 'M_LN2l',+ 'M_LOG10E',+ 'M_LOG10Ef',+ 'M_LOG10El',+ 'M_LOG2E',+ 'M_LOG2Ef',+ 'M_LOG2El',+ 'M_PI',+ 'M_PI_2',+ 'M_PI_2f',+ 'M_PI_2l',+ 'M_PI_4',+ 'M_PI_4f',+ 'M_PI_4l',+ 'M_PIf',+ 'M_PIl',+ 'M_SQRT1_2',+ 'M_SQRT1_2f',+ 'M_SQRT1_2l',+ 'M_SQRT2',+ 'M_SQRT2f',+ 'M_SQRT2l',+ 'NAME_MAX',+ 'NAN',+ 'NDEBUG',+ 'NL_ARGMAX',+ 'NL_LANGMAX',+ 'NL_MSGMAX',+ 'NL_SETMAX',+ 'NL_TEXTMAX',+ 'NSIG',+ 'NULL',+ 'NZERO',+ 'OPEN_MAX',+ 'PATH_MAX',+ 'PIPE_MAX',+ 'PRIB128',+ 'PRIB16',+ 'PRIB32',+ 'PRIB64',+ 'PRIB8',+ 'PRIBFAST128',+ 'PRIBFAST16',+ 'PRIBFAST32',+ 'PRIBFAST64',+ 'PRIBFAST8',+ 'PRIBLEAST128',+ 'PRIBLEAST16',+ 'PRIBLEAST32',+ 'PRIBLEAST64',+ 'PRIBLEAST8',+ 'PRIX128',+ 'PRIX16',+ 'PRIX32',+ 'PRIX64',+ 'PRIX8',+ 'PRIXFAST128',+ 'PRIXFAST16',+ 'PRIXFAST32',+ 'PRIXFAST64',+ 'PRIXFAST8',+ 'PRIXLEAST128',+ 'PRIXLEAST16',+ 'PRIXLEAST32',+ 'PRIXLEAST64',+ 'PRIXLEAST8',+ 'PRIXMAX',+ 'PRIXPTR',+ 'PRIb128',+ 'PRIb16',+ 'PRIb32',+ 'PRIb64',+ 'PRIb8',+ 'PRIbFAST128',+ 'PRIbFAST16',+ 'PRIbFAST32',+ 'PRIbFAST64',+ 'PRIbFAST8',+ 'PRIbLEAST128',+ 'PRIbLEAST16',+ 'PRIbLEAST32',+ 'PRIbLEAST64',+ 'PRIbLEAST8',+ 'PRId128',+ 'PRId16',+ 'PRId32',+ 'PRId64',+ 'PRId8',+ 'PRIdFAST128',+ 'PRIdFAST16',+ 'PRIdFAST32',+ 'PRIdFAST64',+ 'PRIdFAST8',+ 'PRIdLEAST128',+ 'PRIdLEAST16',+ 'PRIdLEAST32',+ 'PRIdLEAST64',+ 'PRIdLEAST8',+ 'PRIdMAX',+ 'PRIdPTR',+ 'PRIi128',+ 'PRIi16',+ 'PRIi32',+ 'PRIi64',+ 'PRIi8',+ 'PRIiFAST128',+ 'PRIiFAST16',+ 'PRIiFAST32',+ 'PRIiFAST64',+ 'PRIiFAST8',+ 'PRIiLEAST128',+ 'PRIiLEAST16',+ 'PRIiLEAST32',+ 'PRIiLEAST64',+ 'PRIiLEAST8',+ 'PRIiMAX',+ 'PRIiPTR',+ 'PRIo128',+ 'PRIo16',+ 'PRIo32',+ 'PRIo64',+ 'PRIo8',+ 'PRIoFAST128',+ 'PRIoFAST16',+ 'PRIoFAST32',+ 'PRIoFAST64',+ 'PRIoFAST8',+ 'PRIoLEAST128',+ 'PRIoLEAST16',+ 'PRIoLEAST32',+ 'PRIoLEAST64',+ 'PRIoLEAST8',+ 'PRIoMAX',+ 'PRIoPTR',+ 'PRIu128',+ 'PRIu16',+ 'PRIu32',+ 'PRIu64',+ 'PRIu8',+ 'PRIuFAST128',+ 'PRIuFAST16',+ 'PRIuFAST32',+ 'PRIuFAST64',+ 'PRIuFAST8',+ 'PRIuLEAST128',+ 'PRIuLEAST16',+ 'PRIuLEAST32',+ 'PRIuLEAST64',+ 'PRIuLEAST8',+ 'PRIuMAX',+ 'PRIuPTR',+ 'PRIx128',+ 'PRIx16',+ 'PRIx32',+ 'PRIx64',+ 'PRIx8',+ 'PRIxFAST128',+ 'PRIxFAST16',+ 'PRIxFAST32',+ 'PRIxFAST64',+ 'PRIxFAST8',+ 'PRIxLEAST128',+ 'PRIxLEAST16',+ 'PRIxLEAST32',+ 'PRIxLEAST64',+ 'PRIxLEAST8',+ 'PRIxMAX',+ 'PRIxPTR',+ 'PTRDIFF_MAX',+ 'PTRDIFF_MIN',+ 'P_tmpdir',+ 'RE_DUP_MAX',+ 'SCHAR_MAX',+ 'SCHAR_MIN',+ 'SCNb128',+ 'SCNb16',+ 'SCNb32',+ 'SCNb64',+ 'SCNb8',+ 'SCNbFAST128',+ 'SCNbFAST16',+ 'SCNbFAST32',+ 'SCNbFAST64',+ 'SCNbFAST8',+ 'SCNbLEAST128',+ 'SCNbLEAST16',+ 'SCNbLEAST32',+ 'SCNbLEAST64',+ 'SCNbLEAST8',+ 'SCNd128',+ 'SCNd16',+ 'SCNd32',+ 'SCNd64',+ 'SCNd8',+ 'SCNdFAST128',+ 'SCNdFAST16',+ 'SCNdFAST32',+ 'SCNdFAST64',+ 'SCNdFAST8',+ 'SCNdLEAST128',+ 'SCNdLEAST16',+ 'SCNdLEAST32',+ 'SCNdLEAST64',+ 'SCNdLEAST8',+ 'SCNdMAX',+ 'SCNdPTR',+ 'SCNi128',+ 'SCNi16',+ 'SCNi32',+ 'SCNi64',+ 'SCNi8',+ 'SCNiFAST128',+ 'SCNiFAST16',+ 'SCNiFAST32',+ 'SCNiFAST64',+ 'SCNiFAST8',+ 'SCNiLEAST128',+ 'SCNiLEAST16',+ 'SCNiLEAST32',+ 'SCNiLEAST64',+ 'SCNiLEAST8',+ 'SCNiMAX',+ 'SCNiPTR',+ 'SCNo128',+ 'SCNo16',+ 'SCNo32',+ 'SCNo64',+ 'SCNo8',+ 'SCNoFAST128',+ 'SCNoFAST16',+ 'SCNoFAST32',+ 'SCNoFAST64',+ 'SCNoFAST8',+ 'SCNoLEAST128',+ 'SCNoLEAST16',+ 'SCNoLEAST32',+ 'SCNoLEAST64',+ 'SCNoLEAST8',+ 'SCNoMAX',+ 'SCNoPTR',+ 'SCNu128',+ 'SCNu16',+ 'SCNu32',+ 'SCNu64',+ 'SCNu8',+ 'SCNuFAST128',+ 'SCNuFAST16',+ 'SCNuFAST32',+ 'SCNuFAST64',+ 'SCNuFAST8',+ 'SCNuLEAST128',+ 'SCNuLEAST16',+ 'SCNuLEAST32',+ 'SCNuLEAST64',+ 'SCNuLEAST8',+ 'SCNuMAX',+ 'SCNuPTR',+ 'SCNx128',+ 'SCNx16',+ 'SCNx32',+ 'SCNx64',+ 'SCNx8',+ 'SCNxFAST128',+ 'SCNxFAST16',+ 'SCNxFAST32',+ 'SCNxFAST64',+ 'SCNxFAST8',+ 'SCNxLEAST128',+ 'SCNxLEAST16',+ 'SCNxLEAST32',+ 'SCNxLEAST64',+ 'SCNxLEAST8',+ 'SCNxMAX',+ 'SCNxPTR',+ 'SEM_NSEMS_MAX',+ 'SEM_VALUE_MAX',+ 'SHRT_MAX',+ 'SHRT_MIN',+ 'SIG_ATOMIC_MAX',+ 'SIG_ATOMIC_MIN',+ 'SIZE_MAX',+ 'SIZE_MIN',+ 'SSIZE_MAX',+ 'SYMLOOP_MAX',+ 'TMP_MAX',+ 'TTY_NAME_MAX',+ 'TZNAME_MAX',+ 'UCHAR_MAX',+ 'UCHAR_MIN',+ 'UINT128_MAX',+ 'UINT128_MIN',+ 'UINT16_MAX',+ 'UINT16_MIN',+ 'UINT32_MAX',+ 'UINT32_MIN',+ 'UINT64_MAX',+ 'UINT64_MIN',+ 'UINT8_MAX',+ 'UINT8_MIN',+ 'UINTMAX_MAX',+ 'UINTMAX_MIN',+ 'UINTPTR_MAX',+ 'UINTPTR_MIN',+ 'UINT_FAST16_MAX',+ 'UINT_FAST32_MAX',+ 'UINT_FAST64_MAX',+ 'UINT_FAST8_MAX',+ 'UINT_LEAST16_MAX',+ 'UINT_LEAST32_MAX',+ 'UINT_LEAST64_MAX',+ 'UINT_LEAST8_MAX',+ 'UINT_MAX',+ 'UINT_MIN',+ 'ULLONG_MAX',+ 'ULLONG_MIN',+ 'ULONG_LONG_MAX',+ 'ULONG_LONG_MIN',+ 'ULONG_MAX',+ 'ULONG_MIN',+ 'USHRT_MAX',+ 'USHRT_MIN',+ 'WCHAR_MAX',+ 'WCHAR_MIN',+ 'WEOF',+ 'WINT_MAX',+ 'WINT_MIN',+ 'WORD_BIT',+ '_ARCH_PWR5X',+ '_BSD_SOURCE',+ '_COSMO_SOURCE',+ '_GNU_SOURCE',+ '_IOFBF',+ '_IOLBF',+ '_IONBF',+ '_MSC_VER',+ '_WIN32',+ '_XOPEN_SOURCE',+ '__AARCH64EB__',+ '__ABM__',+ '__ADX__',+ '__AES__',+ '__ANDROID__',+ '__APPLE__',+ '__ARM_ARCH',+ '__ARM_FEATURE_ATOMICS',+ '__ARM_FEATURE_CLZ',+ '__ARM_FEATURE_CRC32',+ '__ARM_FEATURE_CRYPTO',+ '__ARM_FEATURE_DOTPROD',+ '__ARM_FEATURE_FMA',+ '__ARM_FEATURE_FP16_FML',+ '__ARM_FEATURE_FP16_VECTOR_ARITHMETIC',+ '__ARM_FEATURE_FRINT',+ '__ARM_FEATURE_MATMUL_INT8',+ '__ARM_FEATURE_NUMERIC_MAXMIN',+ '__ARM_FEATURE_QBIT',+ '__ARM_FEATURE_QRDMX',+ '__ARM_FEATURE_RNG',+ '__ARM_FEATURE_SHA2',+ '__ARM_FEATURE_SHA3',+ '__ARM_FEATURE_SHA512',+ '__ARM_FEATURE_SM3',+ '__ARM_FEATURE_SM4',+ '__ARM_FP16_ARGS',+ '__ARM_FP16_FORMAT_ALTERNATIVE',+ '__ARM_FP16_IEEE',+ '__ARM_FP_FAST',+ '__ARM_NEON',+ '__ASSEMBLER__',+ '__AVX2__',+ '__AVX5124VNNIW__',+ '__AVX512BF16__',+ '__AVX512BW__',+ '__AVX512CD__',+ '__AVX512DQ__',+ '__AVX512FP16__',+ '__AVX512F__',+ '__AVX512IFMA__',+ '__AVX512VBMI__',+ '__AVX512VL__',+ '__AVX512VNNI__',+ '__AVXVNNIINT16__',+ '__AVXVNNIINT8__',+ '__AVXVNNI__',+ '__AVX__',+ '__BASE_FILE__',+ '__BIGGEST_ALIGNMENT__',+ '__BMI2__',+ '__BMI__',+ '__BUILTIN_CPU_SUPPORTS__',+ '__BYTE_ORDER__',+ '__CET__',+ '__CHAR_BIT__',+ '__CLFLUSHOPT__',+ '__CLZERO__',+ '__COSMOCC__',+ '__COSMOPOLITAN__',+ '__COUNTER__',+ '__CRTDLL__',+ '__CUDA_ARCH_LIST__',+ '__CUDA_ARCH__',+ '__CYGWIN__',+ '__DATE__',+ '__ELF__',+ '__EMSCRIPTEN__',+ '__F16C__',+ '__FAST_MATH__',+ '__FATCOSMOCC__',+ '__FILE__',+ '__FINITE_MATH_ONLY__',+ '__FLT16_DECIMAL_DIG__',+ '__FLT16_DENORM_MIN__',+ '__FLT16_DIG__',+ '__FLT16_EPSILON__',+ '__FLT16_HAS_DENORM__',+ '__FLT16_HAS_INFINITY__',+ '__FLT16_HAS_QUIET_NAN__',+ '__FLT16_IS_IEC_60559__',+ '__FLT16_MANT_DIG__',+ '__FLT16_MAX_10_EXP__',+ '__FLT16_MAX_EXP__',+ '__FLT16_MAX__',+ '__FLT16_MIN_10_EXP__',+ '__FLT16_MIN_EXP__',+ '__FLT16_MIN__',+ '__FLT16_NORM_MAX__',+ '__FLT_EVAL_METHOD__',+ '__FMA4__',+ '__FMA__',+ '__FNO_OMIT_FRAME_POINTER__',+ '__FUNCTION__',+ '__FreeBSD__',+ '__Fuchsia__',+ '__GCC_ASM_FLAG_OUTPUTS__',+ '__GLIBC__',+ '__GNUC_GNU_INLINE__',+ '__GNUC_MINOR__',+ '__GNUC_PATCHLEVEL__',+ '__GNUC_STDC_INLINE__',+ '__GNUC__',+ '__GNUG__',+ '__HAIKU__',+ '__HIP_PLATFORM_AMD__',+ '__HIP__',+ '__INCLUDE_LEVEL__',+ '__INT16_MAX__',+ '__INT32_MAX__',+ '__INT64_MAX__',+ '__INT8_MAX__',+ '__INTEL_COMPILER',+ '__INTMAX_WIDTH__',+ '__INTPTR_MAX__',+ '__INTPTR_WIDTH__',+ '__INT_FAST16_MAX__',+ '__INT_FAST16_WIDTH__',+ '__INT_FAST32_MAX__',+ '__INT_FAST32_WIDTH__',+ '__INT_FAST64_MAX__',+ '__INT_FAST64_WIDTH__',+ '__INT_FAST8_MAX__',+ '__INT_FAST8_WIDTH__',+ '__INT_LEAST16_MAX__',+ '__INT_LEAST16_WIDTH__',+ '__INT_LEAST32_MAX__',+ '__INT_LEAST32_WIDTH__',+ '__INT_LEAST64_MAX__',+ '__INT_LEAST64_WIDTH__',+ '__INT_LEAST8_MAX__',+ '__INT_LEAST8_WIDTH__',+ '__INT_WIDTH__',+ '__LINE__',+ '__LINKER__',+ '__LIW__',+ '__LONG_LONG_WIDTH__',+ '__LONG_WIDTH__',+ '__MACH__',+ '__MFENTRY__',+ '__MICROBLAZE__',+ '__MINGW32__',+ '__MNOP_MCOUNT__',+ '__MNO_RED_ZONE__',+ '__MNO_VZEROUPPER__',+ '__MRECORD_MCOUNT__',+ '__MSVCRT_VERSION__',+ '__MSVCRT__',+ '__MWAITX__',+ '__NEXT_RUNTIME__',+ '__NO_LIW__',+ '__NO_MATH_ERRNO__',+ '__NO_SETLB__',+ '__NetBSD_Version__',+ '__NetBSD__',+ '__OPTIMIZE__',+ '__ORDER_BIG_ENDIAN__',+ '__ORDER_LITTLE_ENDIAN__',+ '__ORDER_PDP_ENDIAN__',+ '__OpenBSD__',+ '__PCLMUL__',+ '__PIC__',+ '__PIE__',+ '__POPCNT__',+ '__POWER9_VECTOR__',+ '__POWERPC__',+ '__PRETTY_FUNCTION__',+ '__PTRDIFF_MAX__',+ '__PTRDIFF_WIDTH__',+ '__PTX_ISA_VERSION_MAJOR__',+ '__PTX_ISA_VERSION_MINOR__',+ '__PTX_SM__',+ '__RDPID__',+ '__RDRND__',+ '__RDSEED__',+ '__ROUNDING_MATH__',+ '__RX_ALLOW_STRING_INSNS__',+ '__RX_DISALLOW_STRING_INSNS__',+ '__SCHAR_WIDTH__',+ '__SETLB__',+ '__SET_FPSCR_RN_RETURNS_FPSCR__',+ '__SGX__',+ '__SHA__',+ '__SHRT_WIDTH__',+ '__SIG_ATOMIC_MAX__',+ '__SIG_ATOMIC_MIN__',+ '__SIG_ATOMIC_WIDTH__',+ '__SIZEOF_DOUBLE__',+ '__SIZEOF_FLOAT__',+ '__SIZEOF_INTMAX__',+ '__SIZEOF_INT__',+ '__SIZEOF_LONG_DOUBLE__',+ '__SIZEOF_LONG_LONG__',+ '__SIZEOF_LONG__',+ '__SIZEOF_POINTER__',+ '__SIZEOF_PTRDIFF_T__',+ '__SIZEOF_SHORT__',+ '__SIZEOF_SIZE_T__',+ '__SIZEOF_UINTMAX__',+ '__SIZEOF_WCHAR_T__',+ '__SIZEOF_WINT_T__',+ '__SIZE_MAX__',+ '__SIZE_WIDTH__',+ '__SSE2__',+ '__SSE3__',+ '__SSE4A__',+ '__SSE4_1__',+ '__SSE4_2__',+ '__SSE__',+ '__SSSE3__',+ '__STDC_ANALYZABLE__',+ '__STDC_DEC_FP__',+ '__STDC_HOSTED__',+ '__STDC_IEC_559_COMPLEX__',+ '__STDC_IEC_559__',+ '__STDC_ISO_10646__',+ '__STDC_LIB_EXT1__',+ '__STDC_MB_MIGHT_NEQ_WC__',+ '__STDC_NO_ATOMICS__',+ '__STDC_NO_COMPLEX__',+ '__STDC_NO_THREADS__',+ '__STDC_NO_VLA__',+ '__STDC_UTF_16__',+ '__STDC_UTF_32__',+ '__STDC_VERSION__',+ '__STDC_WANT_LIB_EXT1__',+ '__STDC__',+ '__STRICT_ANSI__',+ '__SUPPORT_SNAN__',+ '__TIMESTAMP__',+ '__TIME__',+ '__TM_FENCE__',+ '__UINT16_MAX__',+ '__UINT32_MAX__',+ '__UINT64_MAX__',+ '__UINT8_MAX__',+ '__UINTMAX_MAX__',+ '__UINTPTR_MAX__',+ '__UINT_FAST16_MAX__',+ '__UINT_FAST32_MAX__',+ '__UINT_FAST64_MAX__',+ '__UINT_FAST8_MAX__',+ '__UINT_LEAST16_MAX__',+ '__UINT_LEAST32_MAX__',+ '__UINT_LEAST64_MAX__',+ '__UINT_LEAST8_MAX__',+ '__VAES__',+ '__VA_ARGS__',+ '__VA_OPT__',+ '__VEC__',+ '__VPCLMULQDQ__',+ '__VSX__',+ '__WCHAR_MAX__',+ '__WCHAR_MIN__',+ '__WCHAR_UNSIGNED__',+ '__WCHAR_WIDTH__',+ '__WINT_MAX__',+ '__WINT_MIN__',+ '__WINT_WIDTH__',+ '__XSAVE__',+ '__XXX__',+ '__aarch64__',+ '__amd64__',+ '__arm__',+ '__chibicc__',+ '__clang__',+ '__cplusplus',+ '__func__',+ '__gun_linux__',+ '__i386__',+ '__i486__',+ '__i586__',+ '__i686__',+ '__ia16__',+ '__linux__',+ '__llvm__',+ '__m68k__',+ '__mips64',+ '__mips__',+ '__powerpc64__',+ '__powerpc__',+ '__ppc__',+ '__riscv',+ '__riscv_flen',+ '__riscv_xlen',+ '__s390__',+ '__s390x__',+ '__wasm_simd128__',+ '__x86_64__',+ 'false',+ 'true',+]);++const C_PODS = new Set([+ 'enum',+ 'struct',+ 'union',+]);++const C_TYPES = new Set([+ 'DIR',+ 'FILE',+ '__m128',+ '__m128i',+ '__m256',+ '__m256i',+ '__m512',+ '__m512bh',+ '__m512i',+ 'atomic_bool',+ 'atomic_bool32',+ 'atomic_char',+ 'atomic_char16_t',+ 'atomic_char32_t',+ 'atomic_flag',+ 'atomic_int',+ 'atomic_int_fast16_t',+ 'atomic_int_fast32_t',+ 'atomic_int_fast64_t',+ 'atomic_int_fast8_t',+ 'atomic_int_least16_t',+ 'atomic_int_least32_t',+ 'atomic_int_least64_t',+ 'atomic_int_least8_t',+ 'atomic_intptr_t',+ 'atomic_llong',+ 'atomic_long',+ 'atomic_ptrdiff_t',+ 'atomic_schar',+ 'atomic_short',+ 'atomic_size_t',+ 'atomic_uchar',+ 'atomic_uint',+ 'atomic_uint_fast16_t',+ 'atomic_uint_fast32_t',+ 'atomic_uint_fast64_t',+ 'atomic_uint_fast8_t',+ 'atomic_uint_least16_t',+ 'atomic_uint_least32_t',+ 'atomic_uint_least64_t',+ 'atomic_uint_least8_t',+ 'atomic_uintptr_t',+ 'atomic_ullong',+ 'atomic_ulong',+ 'atomic_ushort',+ 'atomic_wchar_t',+ 'axdx_t',+ 'bfloat16_t',+ 'blkcnt_t',+ 'blksize_t',+ 'bool32',+ 'cc_t',+ 'char16_t',+ 'char32_t',+ 'clock_t',+ 'clockid_t',+ 'cpu_set_t',+ 'data_t',+ 'dev_t',+ 'dim3',+ 'div_t',+ 'double_t',+ 'errno_t',+ 'fenv_t',+ 'fexcept_t',+ 'float128_t',+ 'float16_t',+ 'float16x8_t',+ 'float32_t',+ 'float32x4_t',+ 'float64_t',+ 'float_t',+ 'fpos_t',+ 'fsblkcnt_t',+ 'fsfilcnt_t',+ 'gid_t',+ 'glob_t',+ 'iconv_t',+ 'id_t',+ 'idtype_t',+ 'imaxdiv_t',+ 'in_addr_t',+ 'in_port_t',+ 'ino_t',+ 'int128_t',+ 'int16_t',+ 'int32_t',+ 'int64_t',+ 'int8_t',+ 'intN_t',+ 'int_fast16_t',+ 'int_fast32_t',+ 'int_fast64_t',+ 'int_fast8_t',+ 'int_least16_t',+ 'int_least32_t',+ 'int_least64_t',+ 'int_least8_t',+ 'intmax_t',+ 'intptr_t',+ 'key_t',+ 'ldiv_t',+ 'lldiv_t',+ 'locale_t',+ 'loff_t',+ 'max_align_t',+ 'mbstate_t',+ 'mcontext_t',+ 'mode_t',+ 'mqd_t',+ 'msglen_t',+ 'msgqnum_t',+ 'nfds_t',+ 'nlink_t',+ 'off_t',+ 'pid_t',+ 'posix_spawn_file_actions_t',+ 'posix_spawnattr_t',+ 'posix_trace_attr_t',+ 'pthread_attr_t',+ 'pthread_barrier_t',+ 'pthread_barrierattr_t',+ 'pthread_cond_t',+ 'pthread_condattr_t',+ 'pthread_key_t',+ 'pthread_mutex_t',+ 'pthread_mutexattr_t',+ 'pthread_once_t',+ 'pthread_rwlock_t',+ 'pthread_rwlockattr_t',+ 'pthread_spinlock_t',+ 'pthread_t',+ 'ptrdiff_t',+ 'regex_t',+ 'register_t',+ 'regmatch_t',+ 'regoff_t',+ 'rlim_t',+ 'rlimit_t',+ 'sa_family_t',+ 'sem_t',+ 'semaphore_t',+ 'shmatt_t',+ 'sig_atomic_t',+ 'siginfo_t',+ 'sigset_t',+ 'size_t',+ 'socklen_t',+ 'speed_t',+ 'ssize_t',+ 'ssizet_t',+ 'stack_t',+ 'suseconds_t',+ 'syscall_arg_t',+ 't_scalar_t',+ 't_uscalar_t',+ 'tcflag_t',+ 'thrd_t',+ 'time_t',+ 'timed_mutex_t',+ 'timed_thread_t',+ 'timer_t',+ 'trace_attr_t',+ 'trace_event_id_t',+ 'trace_event_set_t',+ 'trace_id_t',+ 'ucontext_t',+ 'uid_t',+ 'uint128_t',+ 'uint16_t',+ 'uint24_t',+ 'uint32_t',+ 'uint64_t',+ 'uint8_t',+ 'uint_fast16_t',+ 'uint_fast32_t',+ 'uint_fast64_t',+ 'uint_fast8_t',+ 'uint_least16_t',+ 'uint_least32_t',+ 'uint_least64_t',+ 'uint_least8_t',+ 'uintmax_t',+ 'uintptr_t',+ 'useconds_t',+ 'ushort_t',+ 'va_list',+ 'wchar_t',+ 'wctrans_t',+ 'wctype_t',+ 'wint_t',+ 'wordexp_t',+]);++class HighlightC extends Highlighter {++ static NORMAL = 0;+ static WORD = 1;+ static QUOTE = 2;+ static QUOTE_BACKSLASH = 3;+ static DQUOTE = 4;+ static DQUOTE_BACKSLASH = 5;+ static SLASH = 6;+ static SLASH_SLASH = 7;+ static SLASH_STAR = 8;+ static SLASH_SLASH_BACKSLASH = 9;+ static SLASH_STAR_STAR = 10;+ static R = 11;+ static R_DQUOTE = 12;+ static RAW = 13;+ static QUESTION = 14;+ static TRIGRAPH = 15;+ static CPP_LT = 16;+ static BACKSLASH = 17;+ static UNIVERSAL = 18;++ constructor(delegate) {+ super(delegate);+ this.last = 0;+ this.word = '';+ this.current = 0;+ this.t = 0;+ this.i = 0;+ this.is_pod = 0;+ this.is_bol = true;+ this.is_cpp = false;+ this.is_define = false;+ this.is_include = false;+ this.is_cpp_builtin = false;+ this.heredoc = '';+ this.keywords = C_KEYWORDS;+ this.builtins = C_BUILTINS;+ this.constants = C_CONSTANTS;+ this.types = C_TYPES;+ }++ feed(input) {+ for (let i = 0; i < input.length; i += this.delta) {+ this.delta = 1;+ const c = input[i];++ switch (this.state) {++ case HighlightC.NORMAL:+ if (c == 'R') {+ this.state = HighlightC.R;+ } else if (!isascii(c) || isalpha(c) || c == '_') {+ this.state = HighlightC.WORD;+ this.word += c;+ } else if (c == '#' && this.is_bol && !this.is_cpp && !this.is_define) {+ this.is_cpp = true;+ this.is_cpp_builtin = true;+ this.push('span', 'builtin');+ this.append('#');+ } else if (c == '<' && this.is_include) {+ this.push('span', 'string');+ this.append('<');+ this.state = HighlightC.CPP_LT;+ } else if (c == '\\') {+ this.state = HighlightC.BACKSLASH;+ } else if (c == '/') {+ this.state = HighlightC.SLASH;+ } else if (c == '?') {+ this.state = HighlightC.QUESTION;+ } else if (c == '\'') {+ this.state = HighlightC.QUOTE;+ this.push('span', 'string');+ this.append('\'');+ } else if (c == '"') {+ this.state = HighlightC.DQUOTE;+ this.push('span', 'string');+ this.append('"');+ } else if (c == '\n') {+ this.append('\n');+ if (this.is_cpp) {+ if (this.is_cpp_builtin) {+ this.pop();+ }+ this.is_include = false;+ this.is_cpp = false;+ }+ this.is_define = false;+ this.is_cpp_builtin = false;+ } else {+ this.append(c);+ }+ break;++ case HighlightC.WORD:+ if (!isascii(c) || isalnum(c) || c == '_' || c == '$') {+ this.word += c;+ } else {+ if (this.is_cpp) {+ if (CPP_KEYWORDS.has(this.word)) {+ this.push('span', 'builtin');+ this.append(this.word);+ this.pop();+ if (this.word == "include" || this.word == "include_next")+ this.is_include = true;+ if (this.word == "define") {+ this.is_cpp = false;+ this.is_define = true;+ }+ if (this.is_cpp_builtin) {+ this.pop();+ this.is_cpp_builtin = false;+ }+ } else if (C_CONSTANTS.has(this.word)) {+ this.push('span', 'constant');+ this.append(this.word);+ this.pop();+ } else {+ this.append(this.word);+ }+ } else {+ if (this.keywords.has(this.word)) {+ this.push('span', 'keyword');+ this.append(this.word);+ this.pop();+ if (C_PODS.has(this.word))+ this.is_pod = true;+ } else if (this.is_pod || (this.types && this.types.has(this.word))) {+ this.push('span', 'type');+ this.append(this.word);+ this.pop();+ this.is_pod = false;+ } else if (this.builtin && this.builtins.has(this.word)) {+ this.push('span', 'builtin');+ this.append(this.word);+ this.pop();+ this.is_pod = false;+ } else if (this.constants && this.constants.has(this.word)) {+ this.push('span', 'constant');+ this.append(this.word);+ this.pop();+ this.is_pod = false;+ } else {+ this.append(this.word);+ this.is_pod = false;+ }+ }+ this.word = '';+ this.epsilon(HighlightC.NORMAL);+ }+ break;++ case HighlightC.BACKSLASH:+ if (c == 'u') {+ this.push('span', 'escape');+ this.append("\\u");+ this.state = HighlightC.UNIVERSAL;+ this.i = 4;+ } else if (c == 'U') {+ this.push('span', 'escape');+ this.append("\\U");+ this.state = HighlightC.UNIVERSAL;+ this.i = 8;+ } else {+ this.append('\\');+ this.append(c);+ this.state = HighlightC.NORMAL;+ }+ break;++ case HighlightC.UNIVERSAL:+ if (isascii(c) && isxdigit(c)) {+ this.append(c);+ if (!--this.i) {+ this.pop();+ this.state = HighlightC.NORMAL;+ }+ } else {+ this.pop();+ this.epsilon(HighlightC.NORMAL);+ }+ break;++ case HighlightC.QUESTION:+ if (c == '?') {+ this.state = HighlightC.TRIGRAPH;+ } else {+ this.append('?');+ this.epsilon(HighlightC.NORMAL);+ }+ break;++ case HighlightC.TRIGRAPH:+ if (c == '=' || // '#'+ c == '(' || // '['+ c == '/' || // '\\'+ c == ')' || // ']'+ c == '\'' || // '^'+ c == '<' || // '{'+ c == '!' || // '|'+ c == '>' || // '}'+ c == '-') { // '~'+ this.push('span', 'escape');+ this.append("??");+ this.append(c);+ this.pop();+ this.state = HighlightC.NORMAL;+ } else {+ this.append("??");+ this.epsilon(HighlightC.NORMAL);+ }+ break;++ case HighlightC.SLASH:+ if (c == '/') {+ this.push('span', 'comment');+ this.append("//");+ this.state = HighlightC.SLASH_SLASH;+ } else if (c == '*') {+ this.push('span', 'comment');+ this.append("/*");+ this.state = HighlightC.SLASH_STAR;+ } else {+ this.append('/');+ this.epsilon(HighlightC.NORMAL);+ }+ break;++ case HighlightC.SLASH_SLASH:+ this.append(c);+ if (c == '\n') {+ this.pop();+ this.state = HighlightC.NORMAL;+ } else if (c == '\\') {+ this.state = HighlightC.SLASH_SLASH_BACKSLASH;+ }+ break;++ case HighlightC.SLASH_SLASH_BACKSLASH:+ this.append(c);+ this.state = HighlightC.SLASH_SLASH;+ break;++ case HighlightC.SLASH_STAR:+ this.append(c);+ if (c == '*')+ this.state = HighlightC.SLASH_STAR_STAR;+ break;++ case HighlightC.SLASH_STAR_STAR:+ this.append(c);+ if (c == '/') {+ this.pop();+ this.state = HighlightC.NORMAL;+ } else if (c != '*') {+ this.state = HighlightC.SLASH_STAR;+ }+ break;++ case HighlightC.QUOTE:+ this.append(c);+ if (c == '\'') {+ this.pop();+ this.state = HighlightC.NORMAL;+ } else if (c == '\\') {+ this.state = HighlightC.QUOTE_BACKSLASH;+ }+ break;++ case HighlightC.QUOTE_BACKSLASH:+ this.append(c);+ this.state = HighlightC.QUOTE;+ break;++ case HighlightC.CPP_LT:+ this.append(c);+ if (c == '>') {+ this.pop();+ this.state = HighlightC.NORMAL;+ }+ break;++ case HighlightC.DQUOTE:+ this.append(c);+ if (c == '"') {+ this.pop();+ this.state = HighlightC.NORMAL;+ } else if (c == '\\') {+ this.state = HighlightC.DQUOTE_BACKSLASH;+ }+ break;++ case HighlightC.DQUOTE_BACKSLASH:+ this.append(c);+ this.state = HighlightC.DQUOTE;+ break;++ case HighlightC.R:+ if (c == '"') {+ this.state = HighlightC.R_DQUOTE;+ this.append('R');+ this.push('span', 'string');+ this.append('"');+ this.heredoc = ")";+ } else {+ this.word += 'R';+ this.epsilon(HighlightC.WORD);+ }+ break;++ case HighlightC.R_DQUOTE:+ this.append(c);+ if (c == '(') {+ this.state = HighlightC.RAW;+ this.i = 0;+ this.heredoc += '"';+ } else {+ this.heredoc += c;+ }+ break;++ case HighlightC.RAW:+ this.append(c);+ if (this.heredoc[this.i] == c) {+ if (++this.i == this.heredoc.size()) {+ this.state = HighlightC.NORMAL;+ this.pop();+ }+ } else {+ this.i = 0;+ }+ break;++ default:+ throw new Error('Invalid state');+ }+ if (this.is_bol) {+ if (!isspace(c))+ this.is_bol = false;+ } else {+ if (c == '\n')+ this.is_bol = true;+ }+ }+ }++ flush() {+ switch (this.state) {+ case HighlightC.WORD:+ if (this.is_cpp) {+ if (CPP_KEYWORDS.has(this.word)) {+ this.push('span', 'builtin');+ this.append(this.word);+ this.pop();+ } else if (C_CONSTANTS.has(this.word)) {+ this.push('span', 'constant');+ this.append(this.word);+ this.pop();+ } else {+ this.append(this.word);+ }+ } else {+ if (this.keywords.has(this.word)) {+ this.push('span', 'keyword');+ this.append(this.word);+ this.pop();+ } else if (this.is_pod || (this.types && this.types.has(this.word))) {+ this.push('span', 'type');+ this.append(this.word);+ this.pop();+ } else if (this.builtins && this.builtins.has(this.word)) {+ this.push('span', 'builtin');+ this.append(this.word);+ this.pop();+ } else if (this.constants && this.constants(this.word)) {+ this.push('span', 'constant');+ this.append(this.word);+ this.pop();+ } else {+ this.append(this.word);+ }+ }+ this.word = '';+ break;+ case HighlightC.SLASH:+ this.append('/');+ break;+ case HighlightC.QUESTION:+ this.append('?');+ break;+ case HighlightC.TRIGRAPH:+ this.append("??");+ break;+ case HighlightC.R:+ this.append('R');+ break;+ case HighlightC.BACKSLASH:+ this.append('\\');+ break;+ case HighlightC.QUOTE:+ case HighlightC.QUOTE_BACKSLASH:+ case HighlightC.DQUOTE:+ case HighlightC.DQUOTE_BACKSLASH:+ case HighlightC.SLASH_SLASH:+ case HighlightC.SLASH_SLASH_BACKSLASH:+ case HighlightC.SLASH_STAR:+ case HighlightC.SLASH_STAR_STAR:+ case HighlightC.R_DQUOTE:+ case HighlightC.RAW:+ this.pop();+ break;+ default:+ break;+ }+ if (this.is_cpp) {+ if (this.is_cpp_builtin) {+ this.pop();+ }+ this.is_cpp = false;+ }+ this.is_cpp_builtin = false;+ this.is_include = false;+ this.is_define = false;+ this.is_pod = false;+ this.is_bol = true;+ this.state = HighlightC.NORMAL;+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['c'] = HighlightC;+Highlighter.REGISTRY['h'] = HighlightC;+Highlighter.REGISTRY['m'] = HighlightC;diff --git a/llamafile/server/www/highlight_cobol.js b/llamafile/server/www/highlight_cobol.jsnew file mode 100644index 00000000..557ff5d4--- /dev/null+++ b/llamafile/server/www/highlight_cobol.js@@ -0,0 +1,453 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const COBOL_KEYWORDS = new Set([+ 'accept',+ 'access',+ 'add',+ 'address',+ 'advancing',+ 'after',+ 'all',+ 'alphabet',+ 'alphabetic',+ 'alphabetic-lower',+ 'alphabetic-upper',+ 'alphanumeric',+ 'alphanumeric-edited',+ 'also',+ 'alter',+ 'alternate',+ 'and',+ 'any',+ 'apply',+ 'are',+ 'area',+ 'areas',+ 'ascending',+ 'assign',+ 'at',+ 'author',+ 'basis',+ 'before',+ 'beginning',+ 'binary',+ 'blank',+ 'block',+ 'bottom',+ 'by',+ 'call',+ 'cancel',+ 'cbl',+ 'cd',+ 'cf',+ 'ch',+ 'character',+ 'characters',+ 'class',+ 'class-id',+ 'clock-units',+ 'close',+ 'cobol',+ 'code',+ 'code-set',+ 'collating',+ 'column',+ 'com-reg',+ 'comma',+ 'common',+ 'communication',+ 'comp',+ 'comp-1',+ 'comp-2',+ 'comp-3',+ 'comp-4',+ 'comp-5',+ 'computational',+ 'computational-1',+ 'computational-2',+ 'computational-3',+ 'computational-4',+ 'computational-5',+ 'compute',+ 'configuration',+ 'contains',+ 'content',+ 'continue',+ 'control',+ 'controls',+ 'converting',+ 'copy',+ 'corr',+ 'corresponding',+ 'count',+ 'currency',+ 'data',+ 'date-compiled',+ 'date-written',+ 'day',+ 'day-of-week',+ 'dbcs',+ 'de',+ 'debug-contents',+ 'debug-item',+ 'debug-line',+ 'debug-name',+ 'debug-sub-1',+ 'debug-sub-2',+ 'debug-sub-3',+ 'debugging',+ 'decimal-point',+ 'declaratives',+ 'delete',+ 'delimited',+ 'delimiter',+ 'depending',+ 'descending',+ 'destination',+ 'detail',+ 'display',+ 'display-1',+ 'divide',+ 'division',+ 'down',+ 'duplicates',+ 'dynamic',+ 'egcs',+ 'egi',+ 'eject',+ 'else',+ 'emi',+ 'enable',+ 'end',+ 'end-add',+ 'end-call',+ 'end-compute',+ 'end-delete',+ 'end-divide',+ 'end-evaluate',+ 'end-if',+ 'end-invoke',+ 'end-multiply',+ 'end-of-page',+ 'end-perform',+ 'end-read',+ 'end-receive',+ 'end-return',+ 'end-rewrite',+ 'end-search',+ 'end-start',+ 'end-string',+ 'end-subtract',+ 'end-unstring',+ 'end-write',+ 'ending',+ 'enter',+ 'entry',+ 'environment',+ 'eop',+ 'equal',+ 'error',+ 'esi',+ 'evaluate',+ 'every',+ 'exception',+ 'exit',+ 'extend',+ 'external',+ 'false',+ 'fd',+ 'file',+ 'file-control',+ 'filler',+ 'final',+ 'first',+ 'footing',+ 'for',+ 'from',+ 'function',+ 'generate',+ 'giving',+ 'global',+ 'go',+ 'goback',+ 'greater',+ 'group',+ 'heading',+ 'high-value',+ 'high-values',+ 'i-o',+ 'i-o-control',+ 'id',+ 'identification',+ 'if',+ 'in',+ 'index',+ 'indexed',+ 'indicate',+ 'inherits',+ 'initial',+ 'initialize',+ 'initiate',+ 'input',+ 'input-output',+ 'insert',+ 'inspect',+ 'installation',+ 'into',+ 'invalid',+ 'invoke',+ 'is',+ 'just',+ 'justified ',+ 'kanji',+ 'key',+ 'label',+ 'last',+ 'leading',+ 'left',+ 'length',+ 'less',+ 'limit',+ 'limits',+ 'linage',+ 'linage-counter',+ 'line',+ 'line-counter',+ 'lines',+ 'linkage',+ 'local-storage',+ 'lock',+ 'low-value',+ 'low-values',+ 'memory',+ 'merge',+ 'message',+ 'metaclass',+ 'method',+ 'method-id',+ 'mode',+ 'modules',+ 'more-labels',+ 'move',+ 'multiple',+ 'multiply',+ 'native',+ 'native_binary',+ 'negative',+ 'next',+ 'no',+ 'not',+ 'null',+ 'nulls',+ 'number',+ 'numeric',+ 'numeric-edited',+ 'object',+ 'object-computer',+ 'occurs',+ 'of',+ 'off',+ 'omitted',+ 'on',+ 'open',+ 'optional',+ 'or',+ 'order',+ 'organization',+ 'other',+ 'output',+ 'overflow',+ 'override',+ 'packed-decimal',+ 'padding',+ 'page',+ 'page-counter',+ 'password',+ 'perform',+ 'pf',+ 'ph',+ 'pic',+ 'picture',+ 'plus',+ 'pointer',+ 'position',+ 'positive',+ 'printing',+ 'procedure',+ 'procedure-pointer',+ 'procedures',+ 'proceed',+ 'processing',+ 'program',+ 'program-id',+ 'purge',+ 'queue',+ 'quote',+ 'quotes',+ 'random',+ 'rd',+ 'read',+ 'ready',+ 'receive',+ 'record',+ 'recording',+ 'records',+ 'recursive',+ 'redefines',+ 'reel',+ 'reference',+ 'references',+ 'relative',+ 'release',+ 'reload',+ 'remainder',+ 'remarks',+ 'removal',+ 'renames',+ 'replace',+ 'replacing',+ 'report',+ 'reporting',+ 'reports',+ 'repository',+ 'rerun',+ 'reserve',+ 'reset',+ 'return',+ 'return-code',+ 'returning',+ 'reversed',+ 'rewind',+ 'rewrite',+ 'rf',+ 'rh',+ 'right',+ 'rounded',+ 'run',+ 'same',+ 'sd',+ 'search',+ 'section',+ 'security',+ 'segment',+ 'segment-limit',+ 'select',+ 'self',+ 'send',+ 'sentence',+ 'separate',+ 'sequence',+ 'sequential',+ 'service',+ 'set',+ 'shift-in',+ 'shift-out',+ 'sign',+ 'size',+ 'skip1',+ 'skip2',+ 'skip3',+ 'sort',+ 'sort-control',+ 'sort-core-size',+ 'sort-file-size',+ 'sort-merge',+ 'sort-message',+ 'sort-mode-size',+ 'sort-return',+ 'source',+ 'source-computer',+ 'space',+ 'spaces',+ 'special-names',+ 'standard',+ 'standard-1',+ 'standard-2',+ 'start',+ 'status',+ 'stop',+ 'string',+ 'sub-queue-1',+ 'sub-queue-2',+ 'sub-queue-3',+ 'subtract',+ 'sum',+ 'super',+ 'suppress',+ 'symbolic',+ 'sync',+ 'synchronized',+ 'table',+ 'tally',+ 'tallying',+ 'tape',+ 'terminal',+ 'terminate',+ 'test',+ 'text',+ 'than',+ 'then',+ 'through',+ 'thru',+ 'time',+ 'times',+ 'title',+ 'to',+ 'top',+ 'trace',+ 'trailing',+ 'true',+ 'type',+ 'unit',+ 'unstring',+ 'until',+ 'up',+ 'upon',+ 'usage',+ 'use',+ 'using',+ 'value',+ 'values',+ 'varying',+ 'when',+ 'when-compiled',+ 'with',+ 'words',+ 'working-storage',+ 'write',+ 'write-only',+ 'zero',+ 'zeroes',+ 'zeros',+]);++class HighlightCobol extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['cobol'] = HighlightCobol;+Highlighter.REGISTRY['cob'] = HighlightCobol;+Highlighter.REGISTRY['cbl'] = HighlightCobol;diff --git a/llamafile/server/www/highlight_cpp.js b/llamafile/server/www/highlight_cpp.jsnew file mode 100644index 00000000..77043bb3--- /dev/null+++ b/llamafile/server/www/highlight_cpp.js@@ -0,0 +1,39 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const CPP_KEYWORDS = new Set([+ '__has_attribute',+ '__has_builtin',+ '__has_cpp_attribute',+ '__has_extension',+ 'define',+ 'defined',+ 'elif',+ 'elifdef',+ 'elifndef',+ 'else',+ 'embed',+ 'endif',+ 'error',+ 'if',+ 'ifdef',+ 'ifndef',+ 'import',+ 'include',+ 'include_next',+ 'line',+ 'pragma',+ 'undef',+ 'warning',+]);diff --git a/llamafile/server/www/highlight_csharp.js b/llamafile/server/www/highlight_csharp.jsnew file mode 100644index 00000000..51884fad--- /dev/null+++ b/llamafile/server/www/highlight_csharp.js@@ -0,0 +1,159 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const CSHARP_KEYWORDS = new Set([+ 'abstract',+ 'add',+ 'alias',+ 'allows',+ 'and',+ 'args',+ 'as',+ 'ascending',+ 'async',+ 'await',+ 'base',+ 'bool',+ 'break',+ 'by',+ 'byte',+ 'case',+ 'catch',+ 'char',+ 'checked',+ 'class',+ 'const',+ 'continue',+ 'decimal',+ 'default',+ 'delegate',+ 'descending',+ 'do',+ 'double',+ 'dynamic',+ 'else',+ 'enum',+ 'equals',+ 'event',+ 'explicit',+ 'extern',+ 'file',+ 'finally',+ 'fixed',+ 'float',+ 'for',+ 'foreach',+ 'from',+ 'get',+ 'global',+ 'goto',+ 'group',+ 'if',+ 'implicit',+ 'in',+ 'init',+ 'int',+ 'interface',+ 'internal',+ 'into',+ 'is',+ 'join',+ 'let',+ 'lock',+ 'long',+ 'managed',+ 'nameof',+ 'namespace',+ 'new',+ 'nint',+ 'not',+ 'notnull',+ 'nuint',+ 'object',+ 'on',+ 'operator',+ 'or',+ 'orderby',+ 'out',+ 'override',+ 'params',+ 'partial',+ 'private',+ 'protected',+ 'public',+ 'readonly',+ 'record',+ 'ref',+ 'remove',+ 'required',+ 'return',+ 'sbyte',+ 'scoped',+ 'sealed',+ 'select',+ 'set',+ 'short',+ 'sizeof',+ 'stackalloc',+ 'static',+ 'string',+ 'struct',+ 'switch',+ 'this',+ 'throw',+ 'try',+ 'typeof',+ 'uint',+ 'ulong',+ 'unchecked',+ 'unmanaged',+ 'unsafe',+ 'ushort',+ 'using',+ 'value',+ 'var',+ 'virtual',+ 'void',+ 'volatile',+ 'when',+ 'where',+ 'while',+ 'with',+ 'yield',+]);++const CSHARP_CONSTANTS = new Set([+ 'false',+ 'null',+ 'true',+]);++class HighlightCsharp extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['csharp'] = HighlightCsharp;+Highlighter.REGISTRY['cs'] = HighlightCsharp;+Highlighter.REGISTRY['c#'] = HighlightCsharp;diff --git a/llamafile/server/www/highlight_css.js b/llamafile/server/www/highlight_css.jsnew file mode 100644index 00000000..b0bc65a0--- /dev/null+++ b/llamafile/server/www/highlight_css.js@@ -0,0 +1,28 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++class HighlightCss extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}diff --git a/llamafile/server/www/highlight_cxx.js b/llamafile/server/www/highlight_cxx.jsnew file mode 100644index 00000000..87718b32--- /dev/null+++ b/llamafile/server/www/highlight_cxx.js@@ -0,0 +1,203 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const CXX_KEYWORDS = new Set([+ '_Float128',+ '_Float16',+ '_Float32',+ '_Float64',+ '__FUNCTION__',+ '__PRETTY_FUNCTION__',+ '__alignof',+ '__alignof__',+ '__asm',+ '__asm__',+ '__attribute',+ '__attribute__',+ '__bf16',+ '__builtin_offsetof',+ '__builtin_va_arg',+ '__complex',+ '__complex__',+ '__const',+ '__constant__',+ '__device__',+ '__extension__',+ '__float80',+ '__forceinline__',+ '__global__',+ '__host__',+ '__imag',+ '__imag__ ',+ '__inline',+ '__inline__',+ '__label__',+ '__launch_bounds__',+ '__null',+ '__real',+ '__real__ ',+ '__restrict',+ '__restrict__',+ '__shared__',+ '__signed',+ '__signed__',+ '__thread',+ '__typeof',+ '__volatile',+ '__volatile__ ',+ '__wur',+ 'alignas',+ 'alignof',+ 'and',+ 'and_eq',+ 'asm',+ 'atomic_cancel',+ 'atomic_commit',+ 'atomic_noexcept',+ 'auto',+ 'autotype',+ 'bitand',+ 'bitor',+ 'blockDim',+ 'blockIdx',+ 'bool',+ 'break',+ 'case',+ 'catch',+ 'char',+ 'char16_t',+ 'char32_t',+ 'char8_t',+ 'class',+ 'co_await',+ 'co_return',+ 'co_yield',+ 'compl',+ 'concept',+ 'const',+ 'const_cast',+ 'consteval',+ 'constexpr',+ 'constinit',+ 'continue',+ 'decltype',+ 'default',+ 'delete',+ 'do',+ 'dontcallback',+ 'dontthrow',+ 'double',+ 'dynamic_cast',+ 'else',+ 'enum',+ 'explicit',+ 'export',+ 'extern',+ 'float',+ 'for',+ 'forcealign',+ 'forcealignargpointer',+ 'forceinline',+ 'friend',+ 'goto',+ 'gridDim',+ 'hasatleast',+ 'if',+ 'inline',+ 'int',+ 'interruptfn',+ 'libcesque',+ 'long',+ 'mallocesque',+ 'memcpyesque',+ 'mutable',+ 'namespace',+ 'new',+ 'nocallersavedregisters',+ 'noexcept',+ 'nosideeffect',+ 'not',+ 'not_eq',+ 'nullptr',+ 'nullterminated',+ 'operator',+ 'or',+ 'or_eq',+ 'paramsnonnull',+ 'printfesque',+ 'private',+ 'privileged',+ 'protected',+ 'public',+ 'pureconst',+ 'reallocesque',+ 'reflexpr',+ 'register',+ 'reinterpret_cast',+ 'relegated',+ 'requires',+ 'return',+ 'returnsaligned',+ 'returnsnonnull',+ 'returnspointerwithnoaliases',+ 'returnstwice',+ 'scanfesque',+ 'short',+ 'signed',+ 'sizeof',+ 'static',+ 'static_cast',+ 'strftimeesque',+ 'strlenesque',+ 'struct',+ 'switch',+ 'synchronized',+ 'template',+ 'textwindows',+ 'thatispacked',+ 'this',+ 'threadIdx',+ 'thread_local',+ 'throw',+ 'try',+ 'typedef',+ 'typeid',+ 'typename',+ 'union',+ 'unsigned',+ 'using',+ 'vallocesque',+ 'virtual',+ 'void',+ 'volatile',+ 'wchar_t',+ 'while',+ 'wontreturn',+ 'xor',+ 'xor_eq',+]);++class HighlightCxx extends HighlightC {+ constructor(delegate) {+ super(delegate);+ this.keywords = CXX_KEYWORDS;+ }+}++Highlighter.REGISTRY['c++'] = HighlightCxx;+Highlighter.REGISTRY['cxx'] = HighlightCxx;+Highlighter.REGISTRY['cpp'] = HighlightCxx;+Highlighter.REGISTRY['hpp'] = HighlightCxx;+Highlighter.REGISTRY['cc'] = HighlightCxx;+Highlighter.REGISTRY['cu'] = HighlightCxx;diff --git a/llamafile/server/www/highlight_d.js b/llamafile/server/www/highlight_d.jsnew file mode 100644index 00000000..4793338c--- /dev/null+++ b/llamafile/server/www/highlight_d.js@@ -0,0 +1,141 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const D_KEYWORDS = new Set([+ '__FILE_FULL_PATH__',+ '__FILE__',+ '__FUNCTION__',+ '__LINE__',+ '__MODULE__',+ '__PRETTY_FUNCTION__',+ '__gshared',+ '__parameters',+ '__traits',+ '__vector',+ 'abstract',+ 'alias',+ 'align',+ 'asm',+ 'assert',+ 'auto',+ 'body',+ 'bool',+ 'break',+ 'byte',+ 'case',+ 'cast',+ 'catch',+ 'cdouble',+ 'cent',+ 'cfloat',+ 'char',+ 'class',+ 'const',+ 'continue',+ 'creal',+ 'dchar',+ 'debug',+ 'default',+ 'delegate',+ 'delete',+ 'deprecated',+ 'do',+ 'double',+ 'else',+ 'enum',+ 'export',+ 'extern',+ 'final',+ 'finally',+ 'float',+ 'for',+ 'foreach',+ 'foreach_reverse',+ 'function',+ 'goto',+ 'idouble',+ 'if',+ 'ifloat',+ 'immutable',+ 'import',+ 'in',+ 'inout',+ 'int',+ 'interface',+ 'invariant',+ 'ireal',+ 'is',+ 'lazy',+ 'long',+ 'macro',+ 'mixin',+ 'module',+ 'new',+ 'nothrow',+ 'out',+ 'override',+ 'package',+ 'pragma',+ 'private',+ 'protected',+ 'public',+ 'pure',+ 'real',+ 'ref',+ 'return',+ 'scope',+ 'shared',+ 'short',+ 'static',+ 'struct',+ 'super',+ 'switch',+ 'synchronized',+ 'template',+ 'this',+ 'throw',+ 'try',+ 'typeid',+ 'typeof',+ 'ubyte',+ 'ucent',+ 'uint',+ 'ulong',+ 'union',+ 'unittest',+ 'ushort',+ 'version',+ 'void',+ 'wchar',+ 'while',+ 'with',+]);++const D_CONSTANTS = new Set([+ 'false',+ 'null',+ 'true',+]);++class HighlightD extends HighlightC {+ constructor(delegate) {+ super(delegate);+ this.keywords = D_KEYWORDS;+ this.builtins = null;+ this.constants = D_CONSTANTS;+ this.types = null;+ }+}++Highlighter.REGISTRY['d'] = HighlightD;diff --git a/llamafile/server/www/highlight_forth.js b/llamafile/server/www/highlight_forth.jsnew file mode 100644index 00000000..dd64f4ae--- /dev/null+++ b/llamafile/server/www/highlight_forth.js@@ -0,0 +1,93 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const FORTH_KEYWORDS = new Set([+ '+loop',+ '2literal',+ ':noname',+ ';',+ '?do',+ '?of',+ 'again',+ 'begin',+ 'begin-structure',+ 'case',+ 'do',+ 'does>',+ 'else',+ 'end-structure',+ 'endcase',+ 'endof',+ 'exit',+ 'fliteral',+ 'if',+ 'immediate',+ 'is',+ 'leave',+ 'literal',+ 'loop',+ 'of',+ 'postpone',+ 'repeat',+ 'sliteral',+ 'then',+ 'to',+ 'unloop',+ 'until',+ 'while',+]);++const FORTH_DEFS = new Set([+ '+field',+ '2constant',+ '2value',+ '2variable',+ ':',+ 'cfield:',+ 'code',+ 'constant',+ 'create',+ 'defer',+ 'dffield:',+ 'fconstant',+ 'ffield:',+ 'field:',+ 'fvalue',+ 'fvariable',+ 'sffield:',+ 'synonym',+ 'value',+ 'variable',+]);++class HighlightForth extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['forth'] = HighlightForth;+Highlighter.REGISTRY['fth'] = HighlightForth;+Highlighter.REGISTRY['frt'] = HighlightForth;+Highlighter.REGISTRY['4th'] = HighlightForth;+Highlighter.REGISTRY['fs'] = HighlightForth;diff --git a/llamafile/server/www/highlight_fortran.js b/llamafile/server/www/highlight_fortran.jsnew file mode 100644index 00000000..4a0beec4--- /dev/null+++ b/llamafile/server/www/highlight_fortran.js@@ -0,0 +1,270 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const FORTRAN_KEYWORDS = new Set([+ '.and.',+ '.eq.',+ '.eqv.',+ '.false.',+ '.ge.',+ '.gt.',+ '.le.',+ '.lt.',+ '.ne.',+ '.neqv.',+ '.not.',+ '.or.',+ '.true.',+ 'abstract',+ 'all',+ 'allocatable',+ 'allocate',+ 'assign',+ 'associate',+ 'asynchronous',+ 'backspace',+ 'bind',+ 'block',+ 'call',+ 'case',+ 'class',+ 'close',+ 'codimension',+ 'common',+ 'concurrent',+ 'contains',+ 'contiguous',+ 'continue',+ 'critical',+ 'cycle',+ 'data',+ 'deallocate',+ 'deferred',+ 'dimension',+ 'do',+ 'elemental',+ 'else',+ 'elseif',+ 'elsewhere',+ 'end',+ 'enddo',+ 'endfile',+ 'endif',+ 'entry',+ 'enum',+ 'enumerator',+ 'equivalence',+ 'error',+ 'exit',+ 'extends',+ 'external',+ 'final',+ 'flush',+ 'forall',+ 'format',+ 'function',+ 'generic',+ 'go',+ 'goto',+ 'if',+ 'images',+ 'implicit',+ 'import',+ 'impure',+ 'include',+ 'inquire',+ 'intent',+ 'interface',+ 'intrinsic',+ 'lock',+ 'memory',+ 'module',+ 'namelist',+ 'non_overridable',+ 'non_recursive',+ 'nopass',+ 'nullify',+ 'only',+ 'open',+ 'operator',+ 'optional',+ 'parameter',+ 'pass',+ 'pause',+ 'pointer',+ 'print',+ 'private',+ 'procedure',+ 'program',+ 'protected',+ 'public',+ 'pure',+ 'rank',+ 'read',+ 'recursive',+ 'result',+ 'return',+ 'rewind',+ 'rewrite',+ 'save',+ 'select',+ 'sequence',+ 'stop',+ 'submodule',+ 'subroutine',+ 'sync',+ 'target',+ 'then',+ 'to',+ 'unlock',+ 'use',+ 'value',+ 'volatile',+ 'wait',+ 'where',+ 'while',+ 'write',+]);++const FORTRAN_BUILTINS = new Set([+ 'abs',+ 'acos',+ 'aimag',+ 'aint',+ 'alog',+ 'alog10',+ 'amax0',+ 'amax1',+ 'amin0',+ 'amin1',+ 'amod',+ 'anint',+ 'asin',+ 'atan',+ 'atan2',+ 'cabs',+ 'ccos',+ 'cexp',+ 'char',+ 'clog',+ 'cmplx',+ 'conjg',+ 'cos',+ 'cosh',+ 'csin',+ 'csqrt',+ 'dabs',+ 'dacos',+ 'dasin',+ 'datan',+ 'datan2',+ 'dble',+ 'dcos',+ 'dcosh',+ 'ddim',+ 'dexp',+ 'dim',+ 'dint',+ 'dlog',+ 'dlog10',+ 'dmax1',+ 'dmin1',+ 'dmod',+ 'dnint',+ 'dprod',+ 'dsign',+ 'dsin',+ 'dsinh',+ 'dsqrt',+ 'dtan',+ 'dtanh',+ 'exp',+ 'float',+ 'iabs',+ 'ichar',+ 'idim',+ 'idint',+ 'idnint',+ 'ifix',+ 'index',+ 'int',+ 'isign',+ 'len',+ 'lge',+ 'lgt',+ 'lle',+ 'llt',+ 'log',+ 'log10',+ 'max',+ 'max0',+ 'max1',+ 'min',+ 'min0',+ 'min1',+ 'mod',+ 'nint',+ 'real',+ 'sign',+ 'sin',+ 'sinh',+ 'sngl',+ 'sqrt',+ 'tan',+ 'tanh',+]);++const FORTRAN_TYPES = new Set([+ 'allocatable',+ 'byte',+ 'character',+ 'common',+ 'complex',+ 'data',+ 'dimension',+ 'double',+ 'integer',+ 'intrinsic',+ 'logical',+ 'map',+ 'none',+ 'parameter',+ 'pointer',+ 'precision',+ 'real',+ 'record',+ 'save',+ 'sequence',+ 'structure',+ 'target',+ 'type',+]);++class HighlightFortran extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['fortran'] = HighlightFortran;+Highlighter.REGISTRY['f'] = HighlightFortran;diff --git a/llamafile/server/www/highlight_go.js b/llamafile/server/www/highlight_go.jsnew file mode 100644index 00000000..1b3ecaa2--- /dev/null+++ b/llamafile/server/www/highlight_go.js@@ -0,0 +1,79 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const GO_KEYWORDS = new Set([+ 'break',+ 'case',+ 'chan',+ 'const',+ 'continue',+ 'default',+ 'defer',+ 'else',+ 'fallthrough',+ 'for',+ 'func',+ 'go',+ 'goto',+ 'if',+ 'import',+ 'interface',+ 'map',+ 'package',+ 'range',+ 'return',+ 'select',+ 'struct',+ 'switch',+ 'type',+ 'var',+]);++const GO_TYPES = new Set([+ 'byte',+ 'complex128',+ 'complex64',+ 'float32',+ 'float64',+ 'int',+ 'int16',+ 'int32',+ 'int64',+ 'int8',+ 'rune',+ 'string',+ 'uint',+ 'uint16',+ 'uint32',+ 'uint64',+ 'uint8',+ 'uintptr',+]);++class HighlightGo extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['go'] = HighlightGo;diff --git a/llamafile/server/www/highlight_haskell.js b/llamafile/server/www/highlight_haskell.jsnew file mode 100644index 00000000..820d1427--- /dev/null+++ b/llamafile/server/www/highlight_haskell.js@@ -0,0 +1,64 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const HASKELL_KEYWORDS = new Set([+ 'as',+ 'case',+ 'class',+ 'data',+ 'default',+ 'deriving',+ 'do',+ 'else',+ 'family',+ 'forall',+ 'foreign',+ 'hiding',+ 'if',+ 'import',+ 'in',+ 'infix',+ 'infixl',+ 'infixr',+ 'instance',+ 'let',+ 'mdo',+ 'module',+ 'newtype',+ 'of',+ 'proc',+ 'qualified',+ 'rec',+ 'then',+ 'type',+ 'where',+]);++class HighlightHaskell extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['haskell'] = HighlightHaskell;+Highlighter.REGISTRY['hs'] = HighlightHaskell;diff --git a/llamafile/server/www/highlight_html.js b/llamafile/server/www/highlight_html.jsnew file mode 100644index 00000000..178f05b0--- /dev/null+++ b/llamafile/server/www/highlight_html.js@@ -0,0 +1,33 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++class HighlightHtml extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['html'] = HighlightHtml;+Highlighter.REGISTRY['htm'] = HighlightHtml;+Highlighter.REGISTRY['xhtml'] = HighlightHtml;+Highlighter.REGISTRY['xml'] = HighlightHtml;diff --git a/llamafile/server/www/highlight_java.js b/llamafile/server/www/highlight_java.jsnew file mode 100644index 00000000..a025d17a--- /dev/null+++ b/llamafile/server/www/highlight_java.js@@ -0,0 +1,89 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const JAVA_KEYWORDS = new Set([+ 'abstract',+ 'assert',+ 'boolean',+ 'break',+ 'byte',+ 'case',+ 'catch',+ 'char',+ 'class',+ 'const',+ 'continue',+ 'default',+ 'do',+ 'double',+ 'else',+ 'enum',+ 'extends',+ 'final',+ 'finally',+ 'float',+ 'for',+ 'goto',+ 'if',+ 'implements',+ 'import',+ 'instanceof',+ 'int',+ 'interface',+ 'long',+ 'native',+ 'new',+ 'package',+ 'private',+ 'protected',+ 'public',+ 'return',+ 'short',+ 'static',+ 'strictfp',+ 'super',+ 'switch',+ 'synchronized',+ 'this',+ 'throw',+ 'throws',+ 'transient',+ 'try',+ 'void',+ 'volatile',+ 'while',+]);++const JAVA_CONSTANTS = new Set([+ 'true',+ 'false',+ 'null',+]);++class HighlightJava extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['java'] = HighlightJava;diff --git a/llamafile/server/www/highlight_js.js b/llamafile/server/www/highlight_js.jsnew file mode 100644index 00000000..00c74557--- /dev/null+++ b/llamafile/server/www/highlight_js.js@@ -0,0 +1,168 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const JS_KEYWORDS = new Set([+ 'abstract',+ 'as',+ 'async',+ 'await',+ 'break',+ 'case',+ 'catch',+ 'class',+ 'const',+ 'continue',+ 'debugger',+ 'default',+ 'delete',+ 'do',+ 'else',+ 'enum',+ 'export',+ 'extends',+ 'finally',+ 'for',+ 'from',+ 'function',+ 'if',+ 'implements',+ 'import',+ 'in',+ 'instanceof',+ 'interface',+ 'let',+ 'native',+ 'new',+ 'of',+ 'package',+ 'private',+ 'protected',+ 'public',+ 'return',+ 'static',+ 'super',+ 'switch',+ 'synchronized',+ 'this',+ 'throw',+ 'throws',+ 'transient',+ 'try',+ 'typeof',+ 'var',+ 'void',+ 'volatile',+ 'while',+ 'with',+ 'yield',+]);++const JS_BUILTINS = new Set([+ 'AggregateError',+ 'Array',+ 'ArrayBuffer',+ 'AsyncFunction',+ 'AsyncGenerator',+ 'AsyncGeneratorFunction',+ 'AsyncIterator',+ 'Atomics',+ 'BigInt',+ 'BigInt64Array',+ 'BigUint64Array',+ 'Boolean',+ 'DataView',+ 'Date',+ 'Error',+ 'EvalError',+ 'FinalizationRegistry',+ 'Float16Array',+ 'Float32Array',+ 'Float64Array',+ 'Function',+ 'Generator',+ 'GeneratorFunction',+ 'Int16Array',+ 'Int32Array',+ 'Int8Array',+ 'InternalError',+ 'Intl',+ 'Iterator',+ 'JSON',+ 'Map',+ 'Math',+ 'Number',+ 'Object',+ 'Promise',+ 'Proxy',+ 'RangeError',+ 'ReferenceError',+ 'Reflect',+ 'RegExp',+ 'Set',+ 'SharedArrayBuffer',+ 'String',+ 'Symbol',+ 'SyntaxError',+ 'TypeError',+ 'URIError',+ 'Uint16Array',+ 'Uint32Array',+ 'Uint8Array',+ 'Uint8ClampedArray',+ 'WeakMap',+ 'WeakRef',+ 'WeakSet',+ 'console',+ 'decodeURI',+ 'decodeURIComponent',+ 'encodeURI',+ 'encodeURIComponent',+ 'escape',+ 'eval',+ 'isFinite',+ 'isNaN',+ 'parseFloat',+ 'parseInt',+ 'unescape',+]);++const JS_CONSTANTS = new Set([+ 'Infinity',+ 'NaN',+ 'arguments',+ 'false',+ 'globalThis',+ 'null',+ 'true',+ 'undefined',+]);++class HighlightJs extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['javascript'] = HighlightJs;+Highlighter.REGISTRY['json'] = HighlightJs;+Highlighter.REGISTRY['js'] = HighlightJs;diff --git a/llamafile/server/www/highlight_julia.js b/llamafile/server/www/highlight_julia.jsnew file mode 100644index 00000000..242370b2--- /dev/null+++ b/llamafile/server/www/highlight_julia.js@@ -0,0 +1,62 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const JULIA_KEYWORDS = new Set([+ 'baremodule',+ 'begin',+ 'break',+ 'catch',+ 'const',+ 'continue',+ 'do',+ 'else',+ 'elseif',+ 'end',+ 'export',+ 'false',+ 'finally',+ 'for',+ 'function',+ 'global',+ 'if',+ 'import',+ 'let',+ 'local',+ 'macro',+ 'module',+ 'quote',+ 'return',+ 'struct',+ 'true',+ 'try',+ 'using',+ 'while',+]);++class HighlightJulia extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['julia'] = HighlightJulia;diff --git a/llamafile/server/www/highlight_kotlin.js b/llamafile/server/www/highlight_kotlin.jsnew file mode 100644index 00000000..c0f0dae5--- /dev/null+++ b/llamafile/server/www/highlight_kotlin.js@@ -0,0 +1,107 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const KOTLIN_KEYWORDS = new Set([+ 'abstract',+ 'actual',+ 'annotation',+ 'as',+ 'break',+ 'by',+ 'catch',+ 'class',+ 'companion',+ 'const',+ 'constructor',+ 'continue',+ 'crossinline',+ 'data',+ 'delegate',+ 'do',+ 'dynamic',+ 'else',+ 'enum',+ 'expect',+ 'external',+ 'field',+ 'file',+ 'final',+ 'finally',+ 'for',+ 'fun',+ 'get',+ 'if',+ 'import',+ 'in',+ 'infix',+ 'init',+ 'inline',+ 'inner',+ 'interface',+ 'internal',+ 'is',+ 'it',+ 'lateinit',+ 'noinline',+ 'object',+ 'open',+ 'operator',+ 'out',+ 'override',+ 'package',+ 'param',+ 'private',+ 'property',+ 'protected',+ 'public',+ 'receiver',+ 'reified',+ 'return',+ 'sealed',+ 'set',+ 'setparam',+ 'super',+ 'suspend',+ 'tailrec',+ 'this',+ 'throw',+ 'try',+ 'typealias',+ 'typeof',+ 'val',+ 'var',+ 'vararg',+ 'when',+ 'where',+ 'while',+]);++class HighlightKotlin extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['kotlin'] = HighlightKotlin;+Highlighter.REGISTRY['kts'] = HighlightKotlin;+Highlighter.REGISTRY['kt'] = HighlightKotlin;diff --git a/llamafile/server/www/highlight_ld.js b/llamafile/server/www/highlight_ld.jsnew file mode 100644index 00000000..f9c2d4eb--- /dev/null+++ b/llamafile/server/www/highlight_ld.js@@ -0,0 +1,140 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const LD_KEYWORDS = new Set([+ 'AFTER',+ 'ASSERT',+ 'AS_NEEDED',+ 'AT',+ 'BEFORE',+ 'BYTE',+ 'COMMON',+ 'CONSTRUCTORS',+ 'COPY',+ 'CREATE_OBJECT_SYMBOLS',+ 'DSECT',+ 'ENTRY',+ 'EXTERN',+ 'FILEHDR',+ 'FILL',+ 'FLAGS',+ 'FORCE_COMMON_ALLOCATION',+ 'GROUP',+ 'HIDDEN',+ 'INCLUDE',+ 'INFO',+ 'INHIBIT_COMMON_ALLOCATION',+ 'INPUT',+ 'INSERT',+ 'KEEP',+ 'LD_FEATURE',+ 'LONG',+ 'MEMORY',+ 'NOCROSSREFS',+ 'NOCROSSREFS_TO',+ 'NOLOAD',+ 'ONLY_IF_RO',+ 'ONLY_IF_RW',+ 'OUTPUT',+ 'OUTPUT_ARCH',+ 'OUTPUT_FORMAT',+ 'OVERLAY',+ 'PHDR',+ 'PHDRS',+ 'PROVIDE',+ 'PROVIDE_HIDDEN',+ 'PT_DYNAMIC',+ 'PT_GNU_STACK',+ 'PT_INTERP',+ 'PT_LOAD',+ 'PT_NOTE',+ 'PT_NULL',+ 'PT_PHDR',+ 'PT_SHLIB',+ 'PT_TLS',+ 'QUAD',+ 'REGION_ALIAS',+ 'SEARCH_DIR',+ 'SECTIONS',+ 'SHORT',+ 'SORT',+ 'SORT_BY_ALIGNMENT',+ 'SORT_BY_INIT_PRIORITY',+ 'SORT_BY_NAME',+ 'SORT_NONE',+ 'SQUAD',+ 'STARTUP',+ 'SUBALIGN',+ 'TARGET',+ 'VERSION',+ '__CTOR_END__',+ '__CTOR_LIST__',+ '__DTOR_END__',+ '__DTOR_LIST__',+]);++const LD_BUILTINS = new Set([+ 'ABSOLUTE',+ 'ADDR',+ 'ALIGN',+ 'ALIGNOF',+ 'BLOCK',+ 'COMMONPAGESIZE',+ 'CONSTANT',+ 'DATA_SEGMENT_ALIGN',+ 'DATA_SEGMENT_END',+ 'DATA_SEGMENT_RELRO_END',+ 'DEFINED',+ 'LENGTH',+ 'LOADADDR',+ 'LOG2CEIL',+ 'MAX',+ 'MAXPAGESIZE',+ 'MIN',+ 'NEXT',+ 'ORIGIN',+ 'SEGMENT_START',+ 'SIZEOF',+ 'SIZEOF_HEADERS',+ 'l',+ 'len',+ 'o',+ 'org',+ 'sizeof_headers',+]);++const LD_WARNINGS = new Set([+ '/DISCARD/',+ ':NONE',+ 'EXCLUDE_FILE',+]);++class HighlightLd extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['ld-script'] = HighlightLd;+Highlighter.REGISTRY['lds'] = HighlightLd;+Highlighter.REGISTRY['ld'] = HighlightLd;diff --git a/llamafile/server/www/highlight_lisp.js b/llamafile/server/www/highlight_lisp.jsnew file mode 100644index 00000000..731f4054--- /dev/null+++ b/llamafile/server/www/highlight_lisp.js@@ -0,0 +1,147 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const LISP_KEYWORDS = new Set([+ 'assert',+ 'block',+ 'break',+ 'case',+ 'ccase',+ 'check-type',+ 'cl-defsubst',+ 'compiler-let',+ 'cond',+ 'condition-case',+ 'ctypecase',+ 'declaim',+ 'declare',+ 'defadvice',+ 'defalias',+ 'defconst',+ 'defconstant',+ 'defcustom',+ 'defface',+ 'defgeneric',+ 'defgroup',+ 'define',+ 'define-advice',+ 'define-compiler-macro',+ 'define-condition',+ 'define-derived-mode',+ 'define-generic-mode',+ 'define-global-minor-mode',+ 'define-globalized-minor-mode',+ 'define-inline',+ 'define-method-combination',+ 'define-minor-mode',+ 'define-modify-macro',+ 'define-setf-expander',+ 'define-skeleton',+ 'define-symbol-macro',+ 'define-widget',+ 'defmacro',+ 'defmethod',+ 'defn',+ 'defpackage',+ 'defparameter',+ 'defsetf',+ 'defstruct',+ 'defsubst',+ 'deftheme',+ 'deftype',+ 'defun',+ 'defvar-local',+ 'defvaralias',+ 'destructuring-bind',+ 'do',+ 'do*',+ 'dolist',+ 'dotimes',+ 'ecase',+ 'ert-deftest',+ 'etypecase',+ 'eval-when',+ 'flet',+ 'flet*',+ 'go',+ 'handler-bind',+ 'handler-case',+ 'if',+ 'ignore-errors',+ 'in-package',+ 'labels',+ 'lambda',+ 'let',+ 'let*',+ 'letf',+ 'locally',+ 'loop',+ 'macrolet',+ 'multiple-value-bind',+ 'multiple-value-prog1',+ 'proclaim',+ 'prog',+ 'prog*',+ 'prog1',+ 'prog2',+ 'progn',+ 'progv',+ 'restart-bind',+ 'restart-case',+ 'return',+ 'return-from',+ 'symbol-macrolet',+ 'tagbody',+ 'the',+ 'typecase',+ 'unless',+ 'unwind-protect',+ 'when',+ 'while',+ 'with-accessors',+ 'with-compilation-unit',+ 'with-condition-restarts',+ 'with-hash-table-iterator',+ 'with-input-from-string',+ 'with-open-file',+ 'with-open-stream',+ 'with-output-to-string',+ 'with-package-iterator',+ 'with-simple-restart',+ 'with-slots',+ 'with-standard-io-syntax',+]);++class HighlightLisp extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['clojure'] = HighlightLisp;+Highlighter.REGISTRY['scheme'] = HighlightLisp;+Highlighter.REGISTRY['elisp'] = HighlightLisp;+Highlighter.REGISTRY['clisp'] = HighlightLisp;+Highlighter.REGISTRY['lisp'] = HighlightLisp;+Highlighter.REGISTRY['jl'] = HighlightLisp;+Highlighter.REGISTRY['cl'] = HighlightLisp;diff --git a/llamafile/server/www/highlight_lua.js b/llamafile/server/www/highlight_lua.jsnew file mode 100644index 00000000..bf9b974b--- /dev/null+++ b/llamafile/server/www/highlight_lua.js@@ -0,0 +1,123 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const LUA_KEYWORDS = new Set([+ 'and',+ 'break',+ 'do',+ 'else',+ 'elseif',+ 'end',+ 'for',+ 'function',+ 'goto',+ 'if',+ 'in',+ 'local',+ 'not',+ 'or',+ 'repeat',+ 'return',+ 'then',+ 'until',+ 'while',+]);++const LUA_BUILTINS = new Set([+ '__add',+ '__band',+ '__bnot',+ '__bor',+ '__bxor',+ '__call',+ '__close',+ '__concat',+ '__div',+ '__eq',+ '__gc',+ '__idiv',+ '__index',+ '__le',+ '__len',+ '__lt',+ '__mod',+ '__mode',+ '__mul',+ '__name',+ '__newindex',+ '__pow',+ '__shl',+ '__shr',+ '__sub',+ '__unm',+ 'assert',+ 'collectgarbage',+ 'coroutine',+ 'debug',+ 'dofile',+ 'error',+ 'getmetatable',+ 'io',+ 'ipairs',+ 'load',+ 'loadfile',+ 'math',+ 'next',+ 'os',+ 'package',+ 'pairs',+ 'pcall',+ 'print',+ 'rawequal',+ 'rawget',+ 'rawlen',+ 'rawset',+ 'require',+ 'select',+ 'setmetatable',+ 'string',+ 'table',+ 'tonumber',+ 'tostring',+ 'type',+ 'utf8',+ 'warn',+ 'xpcall',+]);++const LUA_CONSTANTS = new Set([+ '_G',+ '_VERSION',+ 'arg',+ 'false',+ 'nil',+ 'true',+]);++class HighlightLua extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['lua'] = HighlightLua;diff --git a/llamafile/server/www/highlight_m4.js b/llamafile/server/www/highlight_m4.jsnew file mode 100644index 00000000..b0074e74--- /dev/null+++ b/llamafile/server/www/highlight_m4.js@@ -0,0 +1,200 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const M4_KEYWORDS = new Set([+ '__file__',+ '__gnu__',+ '__line__',+ '__os2__',+ '__program__',+ '__unix__',+ '__windows__',+ 'argn',+ 'array',+ 'array_set',+ 'builtin',+ 'capitalize',+ 'changecom',+ 'changequote',+ 'changeword',+ 'cleardivert',+ 'cond',+ 'copy',+ 'curry',+ 'debugfile',+ 'debugmode',+ 'decr',+ 'define',+ 'define_blind',+ 'defn',+ 'divert',+ 'divnum',+ 'downcase',+ 'dquote',+ 'dquote_elt',+ 'dumpdef',+ 'errprint',+ 'esyscmd',+ 'eval',+ 'example',+ 'exch',+ 'fatal_error',+ 'file',+ 'foreach',+ 'foreachq',+ 'forloop',+ 'format',+ 'gnu',+ 'ifdef',+ 'ifelse',+ 'include',+ 'incr',+ 'index',+ 'indir',+ 'join',+ 'joinall',+ 'len',+ 'line',+ 'm4___file__',+ 'm4___gnu__',+ 'm4___line__',+ 'm4___os2__',+ 'm4___program__',+ 'm4___unix__',+ 'm4___windows__',+ 'm4_argn',+ 'm4_array',+ 'm4_array_set',+ 'm4_builtin',+ 'm4_capitalize',+ 'm4_changecom',+ 'm4_changequote',+ 'm4_changeword',+ 'm4_cleardivert',+ 'm4_cond',+ 'm4_copy',+ 'm4_curry',+ 'm4_debugfile',+ 'm4_debugmode',+ 'm4_decr',+ 'm4_define',+ 'm4_define_blind',+ 'm4_defn',+ 'm4_divert',+ 'm4_divnum',+ 'm4_downcase',+ 'm4_dquote',+ 'm4_dquote_elt',+ 'm4_dumpdef',+ 'm4_errprint',+ 'm4_esyscmd',+ 'm4_eval',+ 'm4_example',+ 'm4_exch',+ 'm4_fatal_error',+ 'm4_file',+ 'm4_foreach',+ 'm4_foreachq',+ 'm4_forloop',+ 'm4_format',+ 'm4_gnu',+ 'm4_ifdef',+ 'm4_ifelse',+ 'm4_include',+ 'm4_incr',+ 'm4_index',+ 'm4_indir',+ 'm4_join',+ 'm4_joinall',+ 'm4_len',+ 'm4_line',+ 'm4_m4exit',+ 'm4_m4wrap',+ 'm4_maketemp',+ 'm4_mkstemp',+ 'm4_nargs',+ 'm4_os2',+ 'm4_patsubst',+ 'm4_popdef',+ 'm4_pushdef',+ 'm4_quote',+ 'm4_regexp',+ 'm4_rename',+ 'm4_reverse',+ 'm4_shift',+ 'm4_sinclude',+ 'm4_stack_foreach',+ 'm4_stack_foreach_lifo',+ 'm4_stack_foreach_sep',+ 'm4_stack_foreach_sep_lifo',+ 'm4_substr',+ 'm4_syscmd',+ 'm4_sysval',+ 'm4_traceoff',+ 'm4_traceon',+ 'm4_translit',+ 'm4_undefine',+ 'm4_undivert',+ 'm4_unix',+ 'm4_upcase',+ 'm4_windows',+ 'm4exit',+ 'm4wrap',+ 'maketemp',+ 'mkstemp',+ 'nargs',+ 'os2',+ 'patsubst',+ 'popdef',+ 'pushdef',+ 'quote',+ 'regexp',+ 'rename',+ 'reverse',+ 'shift',+ 'sinclude',+ 'stack_foreach',+ 'stack_foreach_lifo',+ 'stack_foreach_sep',+ 'stack_foreach_sep_lifo',+ 'substr',+ 'syscmd',+ 'sysval',+ 'traceoff',+ 'traceon',+ 'translit',+ 'undefine',+ 'undivert',+ 'unix',+ 'upcase',+ 'windows',+]);++class HighlightM4 extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['m4'] = HighlightM4;+Highlighter.REGISTRY['ac'] = HighlightM4;diff --git a/llamafile/server/www/highlight_make.js b/llamafile/server/www/highlight_make.jsnew file mode 100644index 00000000..7e8fa505--- /dev/null+++ b/llamafile/server/www/highlight_make.js@@ -0,0 +1,94 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const MAKE_KEYWORDS = new Set([+ '-include',+ '-sinclude',+ 'define',+ 'else',+ 'endef',+ 'endif',+ 'export',+ 'if',+ 'ifdef',+ 'ifeq',+ 'ifndef',+ 'ifneq',+ 'include',+ 'override',+ 'private',+ 'sinclude',+ 'undefine',+ 'unexport',+ 'vpath',+]);++const MAKE_BUILTINS = new Set([+ 'abspath',+ 'addprefix',+ 'addsuffix',+ 'and',+ 'basename',+ 'call',+ 'dir',+ 'error',+ 'eval',+ 'file',+ 'filter',+ 'filter-out',+ 'findstring',+ 'firstword',+ 'flavor',+ 'foreach',+ 'if',+ 'join',+ 'lastword',+ 'notdir',+ 'or',+ 'origin',+ 'patsubst',+ 'realpath',+ 'shell',+ 'sort',+ 'strip',+ 'subst',+ 'suffix',+ 'value',+ 'warning',+ 'wildcard',+ 'word',+ 'wordlist',+ 'words',+]);++class HighlightMake extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['make'] = HighlightMake;+Highlighter.REGISTRY['mk'] = HighlightMake;+Highlighter.REGISTRY['gmake'] = HighlightMake;+Highlighter.REGISTRY['makefile'] = HighlightMake;+Highlighter.REGISTRY['gmakefile'] = HighlightMake;diff --git a/llamafile/server/www/highlight_markdown.js b/llamafile/server/www/highlight_markdown.jsnew file mode 100644index 00000000..6160c265--- /dev/null+++ b/llamafile/server/www/highlight_markdown.js@@ -0,0 +1,332 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++class HighlightMarkdown extends Highlighter {++ static NORMAL = 0;+ static TICK = 1;+ static TICK_TICK = 2;+ static LANG = 3;+ static CODE = 4;+ static CODE_TICK = 5;+ static CODE_TICK_TICK = 6;+ static STAR = 7;+ static STRONG = 8;+ static STRONG_BACKSLASH = 9;+ static STRONG_STAR = 10;+ static BACKSLASH = 11;+ static INCODE = 12;+ static INCODE2 = 13;+ static INCODE2_TICK = 14;+ static EMPHASIS = 15;+ static EMPHASIS_BACKSLASH = 16;+ static LANG2 = 17;+ static NEWLINE = 18;+ static EAT_NEWLINE = 19;++ constructor(delegate) {+ super(delegate);+ this.bol = true;+ this.tail = false;+ this.lang = '';+ this.highlighter = null;+ this.newlines = 0;+ }++ feed(input) {+ for (let i = 0; i < input.length; i += this.delta) {+ this.delta = 1;+ const c = input[i];+ switch (this.state) {++ case HighlightMarkdown.NORMAL:+ if (c == '`') {+ this.state = HighlightMarkdown.TICK;+ break;+ } else if (c == '*') {+ this.state = HighlightMarkdown.STAR;+ break;+ } else if (c == '\\') {+ // handle \*\*not bold\*\* etc.+ this.state = HighlightMarkdown.BACKSLASH;+ } else if (c == '\n') {+ this.bol = true;+ this.tail = false;+ this.state = HighlightMarkdown.NEWLINE;+ this.newlines = 1;+ break;+ } else {+ this.append(c);+ }+ this.tail = true;+ if (!isblank(c))+ this.bol = false;+ break;++ case HighlightMarkdown.NEWLINE:+ if (c == '\n') {+ ++this.newlines;+ } else {+ if (this.newlines >= 2) {+ this.push('p', '');+ this.pop();+ } else {+ this.append('\n');+ }+ this.epsilon(HighlightMarkdown.NORMAL);+ }+ break;++ case HighlightMarkdown.BACKSLASH:+ this.append(c);+ this.state = HighlightMarkdown.NORMAL;+ break;++ case HighlightMarkdown.STAR:+ if (c == '*') {+ // handle **strong** text+ this.state = HighlightMarkdown.STRONG;+ this.push('span', 'bold');+ } else if (this.bol && isblank(c)) {+ this.append('*');+ this.append(c);+ this.state = HighlightMarkdown.NORMAL;+ } else {+ // handle *emphasized* text+ // inverted because \e[3m has a poorly supported western bias+ this.push('span', 'italic');+ this.append(c);+ this.state = HighlightMarkdown.EMPHASIS;+ if (c == '\\')+ this.state = HighlightMarkdown.EMPHASIS_BACKSLASH;+ }+ break;++ case HighlightMarkdown.EMPHASIS:+ // this is for *emphasized* text+ if (c == '*') {+ this.state = HighlightMarkdown.NORMAL;+ this.pop();+ } else if (c == '\\') {+ this.state = HighlightMarkdown.EMPHASIS_BACKSLASH;+ } else {+ this.append(c);+ }+ break;++ case HighlightMarkdown.EMPHASIS_BACKSLASH:+ // so we can say *unbroken \* italic* and have it work+ this.append(c);+ this.state = HighlightMarkdown.EMPHASIS;+ break;++ case HighlightMarkdown.STRONG:+ if (c == '*') {+ this.state = HighlightMarkdown.STRONG_STAR;+ } else if (c == '\\') {+ this.state = HighlightMarkdown.STRONG_BACKSLASH;+ } else {+ this.append(c);+ }+ break;++ case HighlightMarkdown.STRONG_BACKSLASH:+ // so we can say **unbroken \*\* bold** and have it work+ this.append(c);+ this.state = HighlightMarkdown.STRONG;+ break;++ case HighlightMarkdown.STRONG_STAR:+ if (c == '*') {+ this.state = HighlightMarkdown.NORMAL;+ this.pop();+ } else if (c == '\n' && !this.tail) { // handle *** line break+ this.pop();+ this.push('hr', '');+ this.pop();+ this.epsilon(HighlightMarkdown.NORMAL);+ } else if (c == '\\') {+ this.state = HighlightMarkdown.STRONG_BACKSLASH;+ } else {+ this.append(c);+ this.state = HighlightMarkdown.STRONG;+ }+ break;++ case HighlightMarkdown.TICK:+ if (c == '`') {+ this.state = HighlightMarkdown.TICK_TICK;+ } else {+ this.push('code', '');+ this.append(c);+ this.state = HighlightMarkdown.INCODE;+ }+ break;++ case HighlightMarkdown.INCODE:+ // this is for `inline code` like that+ // no backslash escapes are supported here+ if (c == '`') {+ this.pop();+ this.state = HighlightMarkdown.NORMAL;+ } else {+ this.append(c);+ }+ break;++ case HighlightMarkdown.INCODE2:+ // this is for ``inline ` code`` like that+ // it lets you put backtick inside the code+ if (c == '`') {+ this.state = HighlightMarkdown.INCODE2_TICK;+ } else {+ this.append(c);+ }+ break;++ case HighlightMarkdown.INCODE2_TICK:+ if (c == '`') {+ this.pop();+ this.state = HighlightMarkdown.NORMAL;+ } else {+ this.append(c);+ this.state = HighlightMarkdown.INCODE2;+ }+ break;++ case HighlightMarkdown.TICK_TICK:+ if (c == '`') {+ this.state = HighlightMarkdown.LANG;+ } else {+ this.push('code', '');+ this.append(c);+ this.state = HighlightMarkdown.INCODE2;+ }+ break;++ case HighlightMarkdown.LANG:+ if (!isascii(c) || !isspace(c)) {+ this.lang += c.toLowerCase();+ } else {+ this.epsilon(HighlightMarkdown.LANG2);+ }+ break;++ case HighlightMarkdown.LANG2:+ if (c == "\n") {+ this.flush();+ let hdom = new HighlightDom(this.push('pre', ''));+ console.log(this.lang);+ if (!(this.highlighter = Highlighter.create(this.lang, hdom)))+ this.highlighter = Highlighter.create('txt', hdom);+ this.state = HighlightMarkdown.CODE;+ this.lang = '';+ }+ break;++ case HighlightMarkdown.CODE:+ if (c == '`') {+ this.state = HighlightMarkdown.CODE_TICK;+ } else {+ this.highlighter.feed(c);+ }+ break;++ case HighlightMarkdown.CODE_TICK:+ if (c == '`') {+ this.state = HighlightMarkdown.CODE_TICK_TICK;+ } else {+ this.highlighter.feed("`" + c);+ this.state = HighlightMarkdown.CODE;+ }+ break;++ case HighlightMarkdown.CODE_TICK_TICK:+ if (c == '`') {+ this.state = HighlightMarkdown.EAT_NEWLINE;+ this.highlighter.flush();+ this.highlighter = null;+ this.pop();+ } else {+ this.highlighter.feed("``" + c);+ this.state = HighlightMarkdown.CODE;+ }+ break;++ case HighlightMarkdown.EAT_NEWLINE:+ if (c != '\n') {+ this.epsilon(HighlightMarkdown.NORMAL);+ }+ break;++ default:+ throw new Error('Invalid state');+ }+ }+ }++ flush() {+ switch (this.state) {+ case HighlightMarkdown.LANG:+ this.lang = '';+ break;+ case HighlightMarkdown.STAR:+ this.append('*');+ break;+ case HighlightMarkdown.TICK:+ this.append('`');+ break;+ case HighlightMarkdown.TICK_TICK:+ this.append("``");+ break;+ case HighlightMarkdown.INCODE:+ case HighlightMarkdown.INCODE2:+ case HighlightMarkdown.INCODE2_TICK:+ case HighlightMarkdown.STRONG:+ case HighlightMarkdown.STRONG_BACKSLASH:+ case HighlightMarkdown.STRONG_STAR:+ case HighlightMarkdown.EMPHASIS:+ case HighlightMarkdown.EMPHASIS_BACKSLASH:+ this.pop();+ break;+ case HighlightMarkdown.CODE:+ this.highlighter.flush();+ this.highlighter = null;+ this.pop();+ break;+ case HighlightMarkdown.CODE_TICK:+ this.append('`');+ this.highlighter.flush();+ this.highlighter = null;+ this.pop();+ break;+ case HighlightMarkdown.CODE_TICK_TICK:+ this.append('``');+ this.highlighter.flush();+ this.highlighter = null;+ this.pop();+ break;+ default:+ break;+ }+ this.state = HighlightMarkdown.NORMAL;+ this.bol = true;+ this.tail = false;+ this.newlines = 0;+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['markdown'] = HighlightMarkdown;+Highlighter.REGISTRY['md'] = HighlightMarkdown;diff --git a/llamafile/server/www/highlight_matlab.js b/llamafile/server/www/highlight_matlab.jsnew file mode 100644index 00000000..024142bb--- /dev/null+++ b/llamafile/server/www/highlight_matlab.js@@ -0,0 +1,532 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const MATLAB_KEYWORDS = new Set([+ 'break',+ 'case',+ 'catch',+ 'classdef',+ 'continue',+ 'else',+ 'elseif',+ 'end',+ 'for',+ 'function',+ 'global',+ 'if',+ 'methods',+ 'otherwise',+ 'parfor',+ 'pause',+ 'persistent',+ 'properties',+ 'return',+ 'switch',+ 'try',+ 'while',+]);++const MATLAB_BUILTINS = new Set([+ 'abs',+ 'acos',+ 'acosd',+ 'acosh',+ 'acot',+ 'acotd',+ 'acoth',+ 'acsc',+ 'acscd',+ 'acsch',+ 'addedge',+ 'addnode',+ 'adjacency',+ 'airy',+ 'allcycles',+ 'allfinite',+ 'allpaths',+ 'amd',+ 'angle',+ 'anymissing',+ 'anynan',+ 'asec',+ 'asecd',+ 'asech',+ 'asin',+ 'asind',+ 'asinh',+ 'atan',+ 'atan2',+ 'atan2d',+ 'atand',+ 'atanh',+ 'balance',+ 'bandwidth',+ 'bctree',+ 'besselh',+ 'besseli',+ 'besselj',+ 'besselk',+ 'bessely',+ 'beta',+ 'betainc',+ 'betaincinv',+ 'betaln',+ 'bfsearch',+ 'bicg',+ 'bicgstab',+ 'bicgstabl',+ 'biconncomp',+ 'blkdiag',+ 'bsxfun',+ 'cart2pol',+ 'cart2sph',+ 'cat',+ 'cdf2rdf',+ 'ceil',+ 'centrality',+ 'cgs',+ 'chol',+ 'cholupdate',+ 'circshift',+ 'clip',+ 'colamd',+ 'colon',+ 'colperm',+ 'combinations',+ 'compan',+ 'complex',+ 'cond',+ 'condeig',+ 'condensation',+ 'condest',+ 'conj',+ 'conncomp',+ 'conv',+ 'conv2',+ 'convn',+ 'cos',+ 'cosd',+ 'cosh',+ 'cospi',+ 'cot',+ 'cotd',+ 'coth',+ 'cplxpair',+ 'cross',+ 'csc',+ 'cscd',+ 'csch',+ 'ctranspose',+ 'cumprod',+ 'cumsum',+ 'cyclebasis',+ 'decomposition',+ 'deconv',+ 'deg2rad',+ 'degree',+ 'det',+ 'detrend',+ 'dfsearch',+ 'diag',+ 'diff',+ 'digraph',+ 'disp',+ 'dissect',+ 'distances',+ 'dmperm',+ 'dot',+ 'edgecount',+ 'eig',+ 'eigs',+ 'ellipj',+ 'ellipke',+ 'equilibrate',+ 'erf',+ 'erfc',+ 'erfcinv',+ 'erfcx',+ 'erfinv',+ 'etree',+ 'etreeplot',+ 'eval',+ 'exp',+ 'expint',+ 'expm',+ 'expm1',+ 'expmv',+ 'eye',+ 'factor',+ 'factorial',+ 'fft',+ 'fft2',+ 'fftn',+ 'fftshift',+ 'fftw',+ 'fillmissing',+ 'fillmissing2',+ 'filloutliers',+ 'filter',+ 'filter2',+ 'find',+ 'findedge',+ 'findnode',+ 'fix',+ 'flip',+ 'flipedge',+ 'fliplr',+ 'flipud',+ 'floor',+ 'fminbnd',+ 'fminsearch',+ 'freqspace',+ 'full',+ 'funm',+ 'fzero',+ 'gallery',+ 'gamma',+ 'gammainc',+ 'gammaincinv',+ 'gammaln',+ 'gcd',+ 'gmres',+ 'gplot',+ 'graph',+ 'griddata',+ 'griddatan',+ 'griddedInterpolant',+ 'gsvd',+ 'hadamard',+ 'hankel',+ 'hascycles',+ 'head',+ 'hess',+ 'highlight',+ 'hilb',+ 'horzcat',+ 'hypot',+ 'ichol',+ 'idivide',+ 'ifft',+ 'ifft2',+ 'ifftn',+ 'ifftshift',+ 'ilu',+ 'imag',+ 'incidence',+ 'ind2sub',+ 'indegree',+ 'inedges',+ 'interp1',+ 'interp2',+ 'interp3',+ 'interpft',+ 'interpn',+ 'inv',+ 'invhilb',+ 'ipermute',+ 'isbanded',+ 'isbetween',+ 'ischange',+ 'iscolumn',+ 'isdag',+ 'isdiag',+ 'isempty',+ 'isfinite',+ 'ishermitian',+ 'isinf',+ 'isisomorphic',+ 'islocalmax',+ 'islocalmax2',+ 'islocalmin',+ 'islocalmin2',+ 'ismatrix',+ 'ismember',+ 'ismembertol',+ 'ismissing',+ 'ismultigraph',+ 'isnan',+ 'isomorphism',+ 'isoutlier',+ 'isprime',+ 'isreal',+ 'isregular',+ 'isrow',+ 'isscalar',+ 'issorted',+ 'issortedrows',+ 'issparse',+ 'issymmetric',+ 'istril',+ 'istriu',+ 'isuniform',+ 'isvector',+ 'kron',+ 'labeledge',+ 'labelnode',+ 'laplacian',+ 'layout',+ 'layoutcoords',+ 'lcm',+ 'ldl',+ 'legendre',+ 'length',+ 'linsolve',+ 'linspace',+ 'log',+ 'log10',+ 'log1p',+ 'log2',+ 'logical',+ 'logm',+ 'logspace',+ 'lscov',+ 'lsqminnorm',+ 'lsqnonneg',+ 'lsqr',+ 'lu',+ 'magic',+ 'makima',+ 'matchpairs',+ 'maxflow',+ 'meshgrid',+ 'minres',+ 'minspantree',+ 'mkpp',+ 'mldivide',+ 'mod',+ 'movmean',+ 'movmedian',+ 'movsum',+ 'mpower',+ 'mrdivide',+ 'mtimes',+ 'nchoosek',+ 'ndgrid',+ 'ndims',+ 'nearest',+ 'neighbors',+ 'nextpow2',+ 'nnz',+ 'nonzeros',+ 'norm',+ 'normalize',+ 'normest',+ 'nthroot',+ 'nufft',+ 'nufftn',+ 'null',+ 'numedges',+ 'numel',+ 'numnodes',+ 'nzmax',+ 'ones',+ 'optimget',+ 'optimset',+ 'ordeig',+ 'ordqz',+ 'ordschur',+ 'orth',+ 'outdegree',+ 'outedges',+ 'paddata',+ 'padecoef',+ 'pagectranspose',+ 'pageeig',+ 'pageinv',+ 'pagelsqminnorm',+ 'pagemldivide',+ 'pagemrdivide',+ 'pagemtimes',+ 'pagenorm',+ 'pagepinv',+ 'pagesvd',+ 'pagetranspose',+ 'pascal',+ 'pcg',+ 'pchip',+ 'perms',+ 'permute',+ 'pinv',+ 'planerot',+ 'plot',+ 'pol2cart',+ 'poly',+ 'polyder',+ 'polydiv',+ 'polyeig',+ 'polyfit',+ 'polyint',+ 'polyval',+ 'polyvalm',+ 'pow2',+ 'ppval',+ 'predecessors',+ 'primes',+ 'prod',+ 'psi',+ 'qmr',+ 'qr',+ 'qrdelete',+ 'qrinsert',+ 'qrupdate',+ 'qz',+ 'rad2deg',+ 'rand',+ 'randi',+ 'randn',+ 'randperm',+ 'rank',+ 'rat',+ 'rats',+ 'rcond',+ 'real',+ 'reallog',+ 'realpow',+ 'realsqrt',+ 'rem',+ 'reordernodes',+ 'repelem',+ 'repmat',+ 'rescale',+ 'reshape',+ 'residue',+ 'resize',+ 'retime',+ 'rmedge',+ 'rmmissing',+ 'rmnode',+ 'rmoutliers',+ 'rng',+ 'roots',+ 'rosser',+ 'rot90',+ 'round',+ 'rows2vars',+ 'rref',+ 'rsf2csf',+ 'scatteredInterpolant',+ 'schur',+ 'sec',+ 'secd',+ 'sech',+ 'shiftdim',+ 'shortestpath',+ 'shortestpathtree',+ 'sign',+ 'simplify',+ 'sin',+ 'sind',+ 'sinh',+ 'sinpi',+ 'size',+ 'smoothdata',+ 'smoothdata2',+ 'sort',+ 'sortrows',+ 'spalloc',+ 'sparse',+ 'spaugment',+ 'spconvert',+ 'spdiags',+ 'speye',+ 'spfun',+ 'sph2cart',+ 'spline',+ 'spones',+ 'spparms',+ 'sprand',+ 'sprandn',+ 'sprandsym',+ 'sprank',+ 'spy',+ 'sqrt',+ 'sqrtm',+ 'squeeze',+ 'ss2tf',+ 'stack',+ 'standardizeMissing',+ 'sub2ind',+ 'subgraph',+ 'subspace',+ 'successors',+ 'sum',+ 'svd',+ 'svdappend',+ 'svds',+ 'svdsketch',+ 'sylvester',+ 'symamd',+ 'symbfact',+ 'symmlq',+ 'symrcm',+ 'table',+ 'tail',+ 'tan',+ 'tand',+ 'tanh',+ 'tensorprod',+ 'tfqmr',+ 'toeplitz',+ 'toposort',+ 'trace',+ 'transclosure',+ 'transpose',+ 'transreduction',+ 'treelayout',+ 'treeplot',+ 'trenddecomp',+ 'tril',+ 'trimdata',+ 'triu',+ 'uminus',+ 'unique',+ 'uniquetol',+ 'unmesh',+ 'unmkpp',+ 'unstack',+ 'unwrap',+ 'uplus',+ 'vander',+ 'vecnorm',+ 'vertcat',+ 'wilkinson',+ 'zeros',+]);++const MATLAB_CONSTANTS = new Set([+ 'Inf',+ 'NaN',+ 'eps',+ 'false',+ 'flintmax',+ 'pi',+ 'true',+]);++class HighlightMatlab extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['matlab'] = HighlightMatlab;diff --git a/llamafile/server/www/highlight_ocaml.js b/llamafile/server/www/highlight_ocaml.jsnew file mode 100644index 00000000..672f0ea0--- /dev/null+++ b/llamafile/server/www/highlight_ocaml.js@@ -0,0 +1,119 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const OCAML_KEYWORDS = new Set([+ 'and',+ 'as',+ 'asr',+ 'assert',+ 'begin',+ 'class',+ 'constraint',+ 'do',+ 'done',+ 'downto',+ 'else',+ 'end',+ 'exception',+ 'external',+ 'for',+ 'fun',+ 'function',+ 'functor',+ 'if',+ 'in',+ 'include',+ 'inherit',+ 'initializer',+ 'land',+ 'lazy',+ 'let',+ 'lor',+ 'lsl',+ 'lsr',+ 'lxor',+ 'match',+ 'method',+ 'mod',+ 'module',+ 'mutable',+ 'new',+ 'nonrec',+ 'object',+ 'of',+ 'open',+ 'or',+ 'private',+ 'rec',+ 'sig',+ 'struct',+ 'then',+ 'to',+ 'try',+ 'type',+ 'val',+ 'virtual',+ 'when',+ 'while',+ 'with',+]);++const OCAML_BUILTINS = new Set([+ 'Assert_failure',+ 'Division_by_zero',+ 'End_of_file',+ 'Failure',+ 'Invalid_argument',+ 'Match_failure',+ 'Not_found',+ 'Out_of_memory',+ 'Stack_overflow',+ 'Sys_blocked_io',+ 'Sys_error',+ 'Undefined_recursive_module',+ 'at_exit',+ 'exit',+ 'failwith',+ 'failwithf',+ 'ignore',+ 'invalid_arg',+ 'parser',+ 'raise',+ 'raise_notrace',+ 'ref',+]);++const OCAML_CONSTANTS = new Set([+ 'false',+ 'true',+]);++class HighlightOcaml extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['ocaml'] = HighlightOcaml;+Highlighter.REGISTRY['ml'] = HighlightOcaml;+Highlighter.REGISTRY['mli'] = HighlightOcaml;diff --git a/llamafile/server/www/highlight_pascal.js b/llamafile/server/www/highlight_pascal.jsnew file mode 100644index 00000000..b29e32cc--- /dev/null+++ b/llamafile/server/www/highlight_pascal.js@@ -0,0 +1,736 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const PASCAL_KEYWORDS = new Set([+ 'abstract',+ 'alias',+ 'and',+ 'as',+ 'asm',+ 'assembler',+ 'begin',+ 'break',+ 'case',+ 'cdecl',+ 'class',+ 'const',+ 'constructor',+ 'continue',+ 'destructor',+ 'div',+ 'do',+ 'downto',+ 'dynamic',+ 'else',+ 'end',+ 'except',+ 'export',+ 'exports',+ 'external',+ 'finalization',+ 'finally',+ 'for',+ 'function',+ 'get',+ 'goto',+ 'if',+ 'implementation',+ 'in',+ 'inherited',+ 'initialization',+ 'inline',+ 'input',+ 'interface',+ 'is',+ 'label',+ 'library',+ 'mod',+ 'nil',+ 'nostackframe',+ 'not',+ 'of',+ 'on',+ 'operator',+ 'or',+ 'output',+ 'override',+ 'packed',+ 'pascal',+ 'private',+ 'procedure',+ 'program',+ 'property',+ 'protected',+ 'public',+ 'published',+ 'put',+ 'raise',+ 'record',+ 'register',+ 'reintroduce',+ 'repeat',+ 'reset',+ 'rewrite',+ 'safecall',+ 'set',+ 'shl',+ 'shr',+ 'softfloat',+ 'stdcall',+ 'then',+ 'threadvar',+ 'to',+ 'try',+ 'type',+ 'unit',+ 'until',+ 'uses',+ 'var',+ 'varargs',+ 'virtual',+ 'while',+ 'with',+ 'xor',+]);++const PASCAL_BUILTINS = new Set([+ 'abort',+ 'abs',+ 'acquireexceptionobject',+ 'activateclassgroup',+ 'addexitproc',+ 'addterminateproc',+ 'adjustlinebreaks',+ 'allocatehwnd',+ 'allocmem',+ 'ansicomparefilename',+ 'ansicomparestr',+ 'ansicomparetext',+ 'ansidequotedstr',+ 'ansiextractquotedstr',+ 'ansilastchar',+ 'ansilowercase',+ 'ansilowercasefilename',+ 'ansipos',+ 'ansiquotedstr',+ 'ansisamestr',+ 'ansisametext',+ 'ansistrcomp',+ 'ansistricomp',+ 'ansistrlastchar',+ 'ansistrlcomp',+ 'ansistrlicomp',+ 'ansistrlower',+ 'ansistrpos',+ 'ansistrrscan',+ 'ansistrscan',+ 'ansistrupper',+ 'ansitoutf8',+ 'ansiuppercase',+ 'ansiuppercasefilename',+ 'append',+ 'appendstr',+ 'arccos',+ 'arccosh',+ 'arccot',+ 'arccoth',+ 'arccsc',+ 'arccsch',+ 'arcsec',+ 'arcsech',+ 'arcsin',+ 'arcsinh',+ 'arctan',+ 'arctan2',+ 'arctanh',+ 'assert',+ 'assigned',+ 'assignfile',+ 'assignstr',+ 'beep',+ 'beginthread',+ 'bintohex',+ 'blockread',+ 'blockwrite',+ 'booltostr',+ 'bytetocharindex',+ 'bytetocharlen',+ 'bytetype',+ 'callterminateprocs',+ 'ceil',+ 'changefileext',+ 'charlength',+ 'chartobyteindex',+ 'chartobytelen',+ 'chdir',+ 'checksynchronize',+ 'chr',+ 'close',+ 'closefile',+ 'collectionsequal',+ 'comparemem',+ 'comparestr',+ 'comparetext',+ 'comparevalue',+ 'comptocurrency',+ 'comptodouble',+ 'concat',+ 'continue',+ 'copy',+ 'cos',+ 'cosecant',+ 'cosh',+ 'cot',+ 'cotan',+ 'coth',+ 'countgenerations',+ 'createdir',+ 'createguid',+ 'csc',+ 'csch',+ 'currentyear',+ 'currtostr',+ 'currtostrf',+ 'cycletodeg',+ 'cycletograd',+ 'cycletorad',+ 'date',+ 'datetimetofiledate',+ 'datetimetostr',+ 'datetimetostring',+ 'datetimetosystemtime',+ 'datetimetotimestamp',+ 'datetostr',+ 'dayofweek',+ 'deallocatehwnd',+ 'dec',+ 'decodedate',+ 'decodedatefully',+ 'decodetime',+ 'degtocycle',+ 'degtograd',+ 'degtorad',+ 'delete',+ 'deletefile',+ 'directoryexists',+ 'diskfree',+ 'disksize',+ 'dispose',+ 'disposestr',+ 'divmod',+ 'doubledecliningbalance',+ 'doubletocomp',+ 'encodedate',+ 'encodetime',+ 'endthread',+ 'ensurerange',+ 'enummodules',+ 'enumresourcemodules',+ 'eof',+ 'eoln',+ 'equalrect',+ 'erase',+ 'exceptaddr',+ 'exceptionerrormessage',+ 'exceptobject',+ 'exclude',+ 'excludetrailingbackslash',+ 'excludetrailingpathdelimiter',+ 'exit',+ 'exp',+ 'expandfilename',+ 'expandfilenamecase',+ 'expanduncfilename',+ 'extractfiledir',+ 'extractfiledrive',+ 'extractfileext',+ 'extractfilename',+ 'extractfilepath',+ 'extractrelativepath',+ 'extractshortpathname',+ 'extractstrings',+ 'fileage',+ 'fileclose',+ 'filecreate',+ 'filedatetodatetime',+ 'fileexists',+ 'filegetattr',+ 'filegetdate',+ 'fileisreadonly',+ 'fileopen',+ 'filepos',+ 'fileread',+ 'filesearch',+ 'fileseek',+ 'filesetattr',+ 'filesetdate',+ 'filesetreadonly',+ 'filesize',+ 'filewrite',+ 'fillchar',+ 'finalize',+ 'finalizepackage',+ 'findclass',+ 'findclasshinstance',+ 'findclose',+ 'findcmdlineswitch',+ 'findfirst',+ 'findglobalcomponent',+ 'findhinstance',+ 'findnext',+ 'findresourcehinstance',+ 'floattocurr',+ 'floattodatetime',+ 'floattodecimal',+ 'floattostr',+ 'floattostrf',+ 'floattotext',+ 'floattotextfmt',+ 'floor',+ 'flush',+ 'fmtloadstr',+ 'fmtstr',+ 'forcedirectories',+ 'format',+ 'formatbuf',+ 'formatcurr',+ 'formatdatetime',+ 'formatfloat',+ 'frac',+ 'freeandnil',+ 'freemem',+ 'frexp',+ 'futurevalue',+ 'get8087cw',+ 'getclass',+ 'getcurrentdir',+ 'getdir',+ 'getenvironmentvariable',+ 'getexceptionmask',+ 'getfileversion',+ 'getformatsettings',+ 'getlasterror',+ 'getlocaleformatsettings',+ 'getmem',+ 'getmemorymanager',+ 'getmodulefilename',+ 'getmodulename',+ 'getpackagedescription',+ 'getpackageinfo',+ 'getprecisionmode',+ 'getroundmode',+ 'gettime',+ 'getvariantmanager',+ 'gradtocycle',+ 'gradtodeg',+ 'gradtorad',+ 'groupdescendantswith',+ 'guidtostring',+ 'halt',+ 'hextobin',+ 'high',+ 'hypot',+ 'identtoint',+ 'inc',+ 'incamonth',+ 'include',+ 'includetrailingbackslash',+ 'includetrailingpathdelimiter',+ 'incmonth',+ 'initialize',+ 'initializepackage',+ 'initinheritedcomponent',+ 'inrange',+ 'insert',+ 'int',+ 'interestpayment',+ 'interestrate',+ 'interlockeddecrement',+ 'interlockedexchange',+ 'interlockedexchangeadd',+ 'interlockedincrement',+ 'internalrateofreturn',+ 'intpower',+ 'inttohex',+ 'inttoident',+ 'inttostr',+ 'invalidpoint',+ 'ioresult',+ 'isdelimiter',+ 'isequalguid',+ 'isinfinite',+ 'isleapyear',+ 'ismemorymanagerset',+ 'isnan',+ 'ispathdelimiter',+ 'isuniqueglobalcomponentname',+ 'isvalidident',+ 'isvariantmanagerset',+ 'iszero',+ 'languages',+ 'lastdelimiter',+ 'ldexp',+ 'linestart',+ 'lnxp1',+ 'loadpackage',+ 'loadstr',+ 'log10',+ 'log2',+ 'logn',+ 'low',+ 'lowercase',+ 'max',+ 'maxintvalue',+ 'maxvalue',+ 'mean',+ 'meanandstddev',+ 'min',+ 'minintvalue',+ 'minvalue',+ 'mkdir',+ 'momentskewkurtosis',+ 'move',+ 'msecstotimestamp',+ 'netpresentvalue',+ 'new',+ 'newstr',+ 'nextcharindex',+ 'norm',+ 'now',+ 'numberofperiods',+ 'objectbinarytotext',+ 'objectresourcetotext',+ 'objecttexttobinary',+ 'objecttexttoresource',+ 'odd',+ 'olestrtostring',+ 'olestrtostrvar',+ 'ord',+ 'outofmemoryerror',+ 'paramcount',+ 'paramstr',+ 'payment',+ 'periodpayment',+ 'pi',+ 'pointsequal',+ 'poly',+ 'popnstddev',+ 'popnvariance',+ 'power',+ 'pred',+ 'presentvalue',+ 'pucs4chars',+ 'quotedstr',+ 'radtocycle',+ 'radtodeg',+ 'radtograd',+ 'raiselastoserror',+ 'raiselastwin32error',+ 'randg',+ 'random',+ 'randomize',+ 'randomrange',+ 'read',+ 'readcomponentres',+ 'readcomponentresex',+ 'readcomponentresfile',+ 'readln',+ 'reallocmem',+ 'rect',+ 'registerclass',+ 'registerclassalias',+ 'registerclasses',+ 'registercomponents',+ 'registerintegerconsts',+ 'registernoicon',+ 'registernonactivex',+ 'releaseexceptionobject',+ 'removedir',+ 'rename',+ 'renamefile',+ 'replacedate',+ 'replacetime',+ 'reset',+ 'rewrite',+ 'rmdir',+ 'round',+ 'roundto',+ 'runerror',+ 'safeloadlibrary',+ 'samefilename',+ 'sametext',+ 'samevalue',+ 'sec',+ 'secant',+ 'sech',+ 'seek',+ 'seekeof',+ 'seekeoln',+ 'set8087cw',+ 'setcurrentdir',+ 'setexceptionmask',+ 'setlength',+ 'setlinebreakstyle',+ 'setmemorymanager',+ 'setprecisionmode',+ 'setroundmode',+ 'setstring',+ 'settextbuf',+ 'setvariantmanager',+ 'showexception',+ 'sign',+ 'simpleroundto',+ 'sin',+ 'sincos',+ 'sinh',+ 'sizeof',+ 'sleep',+ 'slice',+ 'slndepreciation',+ 'smallpoint',+ 'sqr',+ 'sqrt',+ 'startclassgroup',+ 'stddev',+ 'stralloc',+ 'strbufsize',+ 'strbytetype',+ 'strcat',+ 'strcharlength',+ 'strcomp',+ 'strcopy',+ 'strdispose',+ 'strecopy',+ 'strend',+ 'strfmt',+ 'stricomp',+ 'stringofchar',+ 'stringreplace',+ 'stringtoguid',+ 'stringtoolestr',+ 'stringtowidechar',+ 'strlcat',+ 'strlcomp',+ 'strlcopy',+ 'strlen',+ 'strlfmt',+ 'strlicomp',+ 'strlower',+ 'strmove',+ 'strnew',+ 'strnextchar',+ 'strpas',+ 'strpcopy',+ 'strplcopy',+ 'strpos',+ 'strrscan',+ 'strscan',+ 'strtobool',+ 'strtobooldef',+ 'strtocurr',+ 'strtocurrdef',+ 'strtodate',+ 'strtodatedef',+ 'strtodatetime',+ 'strtodatetimedef',+ 'strtofloat',+ 'strtofloatdef',+ 'strtoint',+ 'strtoint64',+ 'strtoint64def',+ 'strtointdef',+ 'strtotime',+ 'strtotimedef',+ 'strupper',+ 'succ',+ 'sum',+ 'sumint',+ 'sumofsquares',+ 'sumsandsquares',+ 'supports',+ 'swap',+ 'syddepreciation',+ 'syserrormessage',+ 'systemtimetodatetime',+ 'tan',+ 'tanh',+ 'teststreamformat',+ 'texttofloat',+ 'timestamptodatetime',+ 'timestamptomsecs',+ 'timetostr',+ 'totalvariance',+ 'trim',+ 'trimleft',+ 'trimright',+ 'trunc',+ 'truncate',+ 'tryencodedate',+ 'tryencodetime',+ 'tryfloattocurr',+ 'tryfloattodatetime',+ 'trystrtobool',+ 'trystrtocurr',+ 'trystrtodate',+ 'trystrtodatetime',+ 'trystrtofloat',+ 'trystrtoint',+ 'trystrtoint64',+ 'trystrtotime',+ 'typeinfo',+ 'ucs4stringtowidestring',+ 'unicodetoutf8',+ 'uniquestring',+ 'unloadpackage',+ 'unregisterclass',+ 'unregisterclasses',+ 'unregisterintegerconsts',+ 'unregistermoduleclasses',+ 'upcase',+ 'uppercase',+ 'utf8decode',+ 'utf8encode',+ 'utf8toansi',+ 'utf8tounicode',+ 'vararrayredim',+ 'varclear',+ 'variance',+ 'widecharlentostring',+ 'widecharlentostrvar',+ 'widechartostring',+ 'widechartostrvar',+ 'widecomparestr',+ 'widecomparetext',+ 'widefmtstr',+ 'wideformat',+ 'wideformatbuf',+ 'widelowercase',+ 'widesamestr',+ 'widesametext',+ 'widestringtoucs4string',+ 'wideuppercase',+ 'win32check',+ 'wraptext',+ 'write',+ 'writecomponentresfile',+ 'writeln',+]);++const PASCAL_TYPES = new Set([+ 'ansichar',+ 'ansistring',+ 'array',+ 'bool',+ 'boolean',+ 'byte',+ 'bytebool',+ 'cardinal',+ 'char',+ 'comp',+ 'currency',+ 'double',+ 'dword',+ 'extended',+ 'file',+ 'fixedint',+ 'int16',+ 'int32',+ 'int64',+ 'integer',+ 'iunknown',+ 'longbool',+ 'longint',+ 'longword',+ 'nativeint',+ 'pansichar',+ 'pansistring',+ 'pbool',+ 'pboolean',+ 'pbyte',+ 'pbytearray',+ 'pcardinal',+ 'pchar',+ 'pcomp',+ 'pcurrency',+ 'pdate',+ 'pdatetime',+ 'pdouble',+ 'pdword',+ 'pextended',+ 'phandle',+ 'pint64',+ 'pinteger',+ 'plongint',+ 'plongword',+ 'pointer',+ 'ppointer',+ 'pshortint',+ 'pshortstring',+ 'psingle',+ 'psmallint',+ 'pstring',+ 'pvariant',+ 'pwidechar',+ 'pwidestring',+ 'pword',+ 'pwordarray',+ 'pwordbool',+ 'real',+ 'real48',+ 'record',+ 'set',+ 'shortint',+ 'shortstring',+ 'single',+ 'smallint',+ 'string',+ 'tclass',+ 'tdate',+ 'tdatetime',+ 'text',+ 'textfile',+ 'thandle',+ 'tobject',+ 'ttime',+ 'ucs2char',+ 'ucs4char',+ 'uint16',+ 'uint32',+ 'uint64',+ 'uint8',+ 'variant',+ 'widechar',+ 'widestring',+ 'word',+ 'wordbool',+]);++class HighlightPascal extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['pascal'] = HighlightPascal;+Highlighter.REGISTRY['pas'] = HighlightPascal;+Highlighter.REGISTRY['delphi'] = HighlightPascal;diff --git a/llamafile/server/www/highlight_perl.js b/llamafile/server/www/highlight_perl.jsnew file mode 100644index 00000000..6099d1bc--- /dev/null+++ b/llamafile/server/www/highlight_perl.js@@ -0,0 +1,70 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const PERL_KEYWORDS = new Set([+ 'BEGIN',+ 'END',+ 'continue',+ 'default',+ 'die',+ 'do',+ 'dump',+ 'else',+ 'elsif',+ 'eval',+ 'exec',+ 'exit',+ 'for',+ 'foreach',+ 'given',+ 'goto',+ 'has',+ 'if',+ 'import',+ 'last',+ 'local',+ 'my',+ 'next',+ 'no',+ 'our',+ 'package',+ 'redo',+ 'require',+ 'return',+ 'state',+ 'sub',+ 'unless',+ 'until',+ 'use',+ 'when',+ 'while',+]);++class HighlightPerl extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['perl'] = HighlightPerl;+Highlighter.REGISTRY['pl'] = HighlightPerl;diff --git a/llamafile/server/www/highlight_php.js b/llamafile/server/www/highlight_php.jsnew file mode 100644index 00000000..63e1f984--- /dev/null+++ b/llamafile/server/www/highlight_php.js@@ -0,0 +1,117 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const PHP_KEYWORDS = new Set([+ '__class__',+ '__dir__',+ '__file__',+ '__function__',+ '__line__',+ '__method__',+ '__namespace__',+ '__trait__',+ '__halt_compiler',+ 'abstract',+ 'and',+ 'array',+ 'as',+ 'break',+ 'callable',+ 'case',+ 'catch',+ 'class',+ 'clone',+ 'const',+ 'continue',+ 'declare',+ 'default',+ 'die',+ 'do',+ 'echo',+ 'else',+ 'elseif',+ 'empty',+ 'enddeclare',+ 'endfor',+ 'endforeach',+ 'endif',+ 'endswitch',+ 'endwhile',+ 'eval',+ 'exit',+ 'extends',+ 'final',+ 'finally',+ 'fn',+ 'for',+ 'foreach',+ 'function',+ 'global',+ 'goto',+ 'if',+ 'implements',+ 'include',+ 'include_once',+ 'instanceof',+ 'insteadof',+ 'interface',+ 'isset',+ 'list',+ 'match',+ 'namespace',+ 'new',+ 'or',+ 'print',+ 'private',+ 'protected',+ 'public',+ 'readonly',+ 'require',+ 'require_once',+ 'return',+ 'static',+ 'switch',+ 'throw',+ 'trait',+ 'try',+ 'unset',+ 'use',+ 'var',+ 'while',+ 'xor',+ 'yield',+]);++const PHP_CONSTANTS = new Set([+ 'true',+ 'false',+]);++class HighlightPhp extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['php'] = HighlightPhp;+Highlighter.REGISTRY['pl'] = HighlightPhp;diff --git a/llamafile/server/www/highlight_python.js b/llamafile/server/www/highlight_python.jsnew file mode 100644index 00000000..13087d3c--- /dev/null+++ b/llamafile/server/www/highlight_python.js@@ -0,0 +1,72 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const PYTHON_KEYWORDS = new Set([+ 'and',+ 'as',+ 'assert',+ 'async',+ 'await',+ 'break',+ 'class',+ 'continue',+ 'def',+ 'del',+ 'elif',+ 'else',+ 'except',+ 'finally',+ 'for',+ 'from',+ 'global',+ 'if',+ 'import',+ 'in',+ 'is',+ 'lambda',+ 'nonlocal',+ 'not',+ 'or',+ 'pass',+ 'raise',+ 'return',+ 'try',+ 'while',+ 'with',+ 'yield',+]);++const PYTHON_CONSTANTS = new Set([+ 'False',+ 'None',+ 'True',+]);++class HighlightPython extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['python'] = HighlightPython;+Highlighter.REGISTRY['py'] = HighlightPython;diff --git a/llamafile/server/www/highlight_r.js b/llamafile/server/www/highlight_r.jsnew file mode 100644index 00000000..0e8aebcb--- /dev/null+++ b/llamafile/server/www/highlight_r.js@@ -0,0 +1,211 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const R_KEYWORDS = new Set([+ 'NA',+ 'NA_character_',+ 'NA_complex_',+ 'NA_integer_',+ 'NA_real_',+ 'break',+ 'else',+ 'for',+ 'function',+ 'if',+ 'in',+ 'next',+ 'repeat',+ 'while',+]);++const R_BUILTINS = new Set([+ 'Arg',+ 'Conj',+ 'Im',+ 'Mod',+ 'Re',+ 'acos',+ 'aggregate',+ 'anova',+ 'aov',+ 'apply',+ 'as.array',+ 'as.character',+ 'as.complex',+ 'as.data.frame',+ 'as.logical',+ 'as.numeric',+ 'asin',+ 'atan',+ 'atan2',+ 'attr',+ 'attributes',+ 'barplot',+ 'binom.test',+ 'boxplot',+ 'by',+ 'cbind',+ 'choose',+ 'class',+ 'colMeans',+ 'colSums',+ 'colsum',+ 'convolve',+ 'coplot',+ 'cor',+ 'cos',+ 'cov',+ 'cummax',+ 'cummin',+ 'cumprod',+ 'cumsum',+ 'cut',+ 'density',+ 'diag',+ 'diff',+ 'dim',+ 'dimnames',+ 'do.call',+ 'dotchart',+ 'exp',+ 'fft',+ 'filter',+ 'grep',+ 'gsub',+ 'hist',+ 'ifelse',+ 'interaction.plot',+ 'is.array',+ 'is.character',+ 'is.complex',+ 'is.data.frame',+ 'is.element',+ 'is.na',+ 'is.null',+ 'is.numeric',+ 'lapply',+ 'length',+ 'list',+ 'log',+ 'log10',+ 'match',+ 'matrix',+ 'max',+ 'mean',+ 'median',+ 'merge',+ 'min',+ 'mvfft',+ 'na.fail',+ 'na.omit',+ 'ncol',+ 'nrow',+ 'optim',+ 'pairwise.t.test',+ 'paste',+ 'pie',+ 'plot',+ 'pmatch',+ 'pmax',+ 'pmin',+ 'power.t.test',+ 'print',+ 'prod',+ 'prop.table',+ 'prop.test',+ 'quantile',+ 'range',+ 'rank',+ 'rbeta',+ 'rbind',+ 'rbinom',+ 'rcauchy',+ 'rchisq',+ 'reshape',+ 'return',+ 'rev',+ 'rexp',+ 'rf',+ 'rgamma',+ 'rgeom',+ 'rhyper',+ 'rlnorm',+ 'rlogis',+ 'rnbinom',+ 'rnorm',+ 'round',+ 'rowMeans',+ 'rowsum',+ 'rpois',+ 'rt',+ 'runif',+ 'rweibull',+ 'rwilcox',+ 'sample',+ 'scale',+ 'sd',+ 'seq',+ 'sin',+ 'solve',+ 'sort',+ 'stack',+ 'stripplot',+ 'strsplit',+ 'subset',+ 'substr',+ 'sum',+ 'sunflowerplot',+ 't',+ 'table',+ 'tan',+ 'tapply',+ 'tolower',+ 'toupper',+ 'typeof',+ 'unclass',+ 'union',+ 'unique',+ 'unstack',+ 'var',+ 'weighted.mean',+ 'which',+ 'which.max',+ 'which.min',+ 'xtabs',+]);++const R_CONSTANTS = new Set([+ 'FALSE',+ 'Inf',+ 'NULL',+ 'NaN',+ 'TRUE',+]);++class HighlightR extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['r'] = HighlightR;diff --git a/llamafile/server/www/highlight_ruby.js b/llamafile/server/www/highlight_ruby.jsnew file mode 100644index 00000000..68cfe520--- /dev/null+++ b/llamafile/server/www/highlight_ruby.js@@ -0,0 +1,149 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const RUBY_KEYWORDS = new Set([+ 'BEGIN',+ 'END',+ 'alias',+ 'and',+ 'begin',+ 'break',+ 'case',+ 'class',+ 'def',+ 'defined?',+ 'do',+ 'else',+ 'elsif',+ 'end',+ 'ensure',+ 'fail',+ 'for',+ 'if',+ 'in',+ 'module',+ 'next',+ 'not',+ 'or',+ 'redo',+ 'rescue',+ 'retry',+ 'return',+ 'self',+ 'super',+ 'then',+ 'undef',+ 'unless',+ 'until',+ 'when',+ 'while',+ 'yield',+]);++const RUBY_BUILTINS = new Set([+ '__callee__',+ '__dir__',+ '__method__',+ 'abort',+ 'alias_method',+ 'at_exit',+ 'attr',+ 'attr_accessor',+ 'attr_reader',+ 'attr_writer',+ 'autoload',+ 'autoload?',+ 'binding',+ 'block_given?',+ 'callcc',+ 'caller',+ 'catch',+ 'define_method',+ 'eval',+ 'exec',+ 'exit',+ 'exit!',+ 'extend',+ 'fail',+ 'fork',+ 'format',+ 'global_variables',+ 'include',+ 'lambda',+ 'load',+ 'local_variables',+ 'loop',+ 'module_function',+ 'open',+ 'p',+ 'prepend',+ 'print',+ 'printf',+ 'private',+ 'private_class_method',+ 'private_constant',+ 'proc',+ 'protected',+ 'public',+ 'public_class_method',+ 'public_constant',+ 'putc',+ 'puts',+ 'raise',+ 'rand',+ 'readline',+ 'readlines',+ 'refine',+ 'require',+ 'require_relative',+ 'sleep',+ 'spawn',+ 'sprintf',+ 'srand',+ 'syscall',+ 'system',+ 'throw',+ 'trace_var',+ 'trap',+ 'untrace_var',+ 'using',+ 'warn',+]);++const RUBY_CONSTANTS = new Set([+ '__ENCODING__',+ '__FILE__',+ '__LINE__',+ 'false',+ 'nil',+ 'true',+]);++class HighlightRuby extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['ruby'] = HighlightRuby;+Highlighter.REGISTRY['rb'] = HighlightRuby;diff --git a/llamafile/server/www/highlight_rust.js b/llamafile/server/www/highlight_rust.jsnew file mode 100644index 00000000..bd079349--- /dev/null+++ b/llamafile/server/www/highlight_rust.js@@ -0,0 +1,110 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const RUST_KEYWORDS = new Set([+ 'Self',+ 'abstract',+ 'as',+ 'async',+ 'await',+ 'become',+ 'box',+ 'break',+ 'const',+ 'continue',+ 'crate',+ 'do',+ 'dyn',+ 'else',+ 'enum',+ 'extern',+ 'final',+ 'fn',+ 'for',+ 'if',+ 'impl',+ 'in',+ 'let',+ 'loop',+ 'macro',+ 'match',+ 'mod',+ 'move',+ 'mut',+ 'override',+ 'priv',+ 'pub',+ 'ref',+ 'return',+ 'self',+ 'static',+ 'struct',+ 'super',+ 'trait',+ 'try',+ 'type',+ 'typeof',+ 'union',+ 'unsafe',+ 'unsized',+ 'use',+ 'virtual',+ 'where',+ 'while',+ 'yield',+]);++const RUST_CONSTANTS = new Set([+ 'false',+ 'true',+]);++const RUST_TYPES = new Set([+ '!',+ 'bool',+ 'char',+ 'f32',+ 'f64',+ 'i128',+ 'i16',+ 'i32',+ 'i64',+ 'i8',+ 'isize',+ 'str',+ 'u128',+ 'u16',+ 'u32',+ 'u64',+ 'u8',+ 'usize',+]);++class HighlightRust extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['rust'] = HighlightRust;+Highlighter.REGISTRY['rs'] = HighlightRust;diff --git a/llamafile/server/www/highlight_scala.js b/llamafile/server/www/highlight_scala.jsnew file mode 100644index 00000000..8b08d1eb--- /dev/null+++ b/llamafile/server/www/highlight_scala.js@@ -0,0 +1,72 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const SCALA_KEYWORDS = new Set([+ 'abstract',+ 'case',+ 'catch',+ 'class',+ 'def',+ 'do',+ 'else',+ 'extends',+ 'final',+ 'finally',+ 'for',+ 'forSome',+ 'if',+ 'implicit',+ 'import',+ 'lazy',+ 'macro',+ 'match',+ 'new',+ 'object',+ 'override',+ 'package',+ 'private',+ 'protected',+ 'return',+ 'sealed',+ 'super',+ 'this',+ 'throw',+ 'trait',+ 'try',+ 'type',+ 'val',+ 'var',+ 'while',+ 'with',+ 'yield',+]);++class HighlightScala extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['scala'] = HighlightScala;+Highlighter.REGISTRY['sbt'] = HighlightScala;+Highlighter.REGISTRY['sc'] = HighlightScala;diff --git a/llamafile/server/www/highlight_shell.js b/llamafile/server/www/highlight_shell.jsnew file mode 100644index 00000000..2a034fa8--- /dev/null+++ b/llamafile/server/www/highlight_shell.js@@ -0,0 +1,102 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const SHELL_KEYWORDS = new Set([+ 'break',+ 'case',+ 'coproc',+ 'do',+ 'done',+ 'elif',+ 'else',+ 'esac',+ 'exec',+ 'exit',+ 'expr',+ 'fi',+ 'for',+ 'function',+ 'if',+ 'in',+ 'return',+ 'select',+ 'then',+ 'time',+ 'trap',+ 'until',+ 'while',+]);++const SHELL_BUILTINS = new Set([+ 'alias',+ 'bg',+ 'bind',+ 'builtin',+ 'caller',+ 'cd',+ 'chdir',+ 'command',+ 'declare',+ 'echo',+ 'enable',+ 'eval',+ 'false',+ 'fg',+ 'getopts',+ 'hash',+ 'help',+ 'jobs',+ 'kill',+ 'let',+ 'local',+ 'logout',+ 'mapfile',+ 'printf',+ 'read',+ 'readarray',+ 'set',+ 'shift',+ 'source',+ 'stop',+ 'suspend',+ 'test',+ 'times',+ 'true',+ 'type',+ 'typeset',+ 'ulimit',+ 'unalias',+ 'unset',+ 'wait',+]);++class HighlightShell extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['shell'] = HighlightShell;+Highlighter.REGISTRY['bash'] = HighlightShell;+Highlighter.REGISTRY['ksh'] = HighlightShell;+Highlighter.REGISTRY['sh'] = HighlightShell;diff --git a/llamafile/server/www/highlight_sql.js b/llamafile/server/www/highlight_sql.jsnew file mode 100644index 00000000..64eff041--- /dev/null+++ b/llamafile/server/www/highlight_sql.js@@ -0,0 +1,970 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const SQL_KEYWORDS = new Set([+ 'abort',+ 'abortsession',+ 'abs',+ 'absent',+ 'absolute',+ 'access',+ 'accessible',+ 'access_lock',+ 'account',+ 'acos',+ 'acosh',+ 'action',+ 'add',+ 'add_months',+ 'admin',+ 'after',+ 'aggregate',+ 'alias',+ 'all',+ 'allocate',+ 'allow',+ 'alter',+ 'alterand',+ 'amp',+ 'analyse',+ 'analyze',+ 'and',+ 'ansidate',+ 'any',+ 'any_value',+ 'are',+ 'array',+ 'array_agg',+ 'array_exists',+ 'array_max_cardinality',+ 'as',+ 'asc',+ 'asensitive',+ 'asin',+ 'asinh',+ 'assertion',+ 'associate',+ 'asutime',+ 'asymmetric',+ 'at',+ 'atan',+ 'atan2',+ 'atanh',+ 'atomic',+ 'audit',+ 'authorization',+ 'autoincrement',+ 'aux',+ 'auxiliary',+ 'ave',+ 'average',+ 'avg',+ 'backup',+ 'before',+ 'begin',+ 'begin_frame',+ 'begin_partition',+ 'between',+ 'binary',+ 'both',+ 'breadth',+ 'break',+ 'browse',+ 'bt',+ 'btrim',+ 'bufferpool',+ 'bulk',+ 'but',+ 'by',+ 'call',+ 'called',+ 'capture',+ 'cardinality',+ 'cascade',+ 'cascaded',+ 'case',+ 'casespecific',+ 'case_n',+ 'cast',+ 'catalog',+ 'ccsid',+ 'cd',+ 'ceil',+ 'ceiling',+ 'change',+ 'char2hexint',+ 'characters',+ 'character_length',+ 'chars',+ 'char_length',+ 'check',+ 'checkpoint',+ 'class',+ 'classifier',+ 'clob',+ 'clone',+ 'close',+ 'cluster',+ 'clustered',+ 'cm',+ 'coalesce',+ 'collate',+ 'collation',+ 'collect',+ 'collection',+ 'collid',+ 'column',+ 'column_value',+ 'comment',+ 'commit',+ 'completion',+ 'compress',+ 'compute',+ 'concat',+ 'concurrently',+ 'condition',+ 'connect',+ 'connection',+ 'constraint',+ 'constraints',+ 'constructor',+ 'contains',+ 'containstable',+ 'content',+ 'continue',+ 'convert',+ 'convert_table_header',+ 'copy',+ 'corr',+ 'corresponding',+ 'cos',+ 'cosh',+ 'count',+ 'covar_pop',+ 'covar_samp',+ 'create',+ 'cross',+ 'cs',+ 'csum',+ 'ct',+ 'cube',+ 'cume_dist',+ 'current',+ 'current_catalog',+ 'current_date',+ 'current_default_transform_group',+ 'current_lc_ctype',+ 'current_path',+ 'current_role',+ 'current_row',+ 'current_schema',+ 'current_server',+ 'current_time',+ 'current_timestamp',+ 'current_timezone',+ 'current_transform_group_for_type',+ 'current_user',+ 'currval',+ 'cursor',+ 'cv',+ 'cycle',+ 'data',+ 'database',+ 'databases',+ 'datablocksize',+ 'dateform',+ 'day',+ 'days',+ 'day_hour',+ 'day_microsecond',+ 'day_minute',+ 'day_second',+ 'dbcc',+ 'dbinfo',+ 'deallocate',+ 'dec',+ 'decfloat',+ 'declare',+ 'default',+ 'deferrable',+ 'deferred',+ 'define',+ 'degrees',+ 'del',+ 'delayed',+ 'delete',+ 'dense_rank',+ 'deny',+ 'depth',+ 'deref',+ 'desc',+ 'describe',+ 'descriptor',+ 'destroy',+ 'destructor',+ 'deterministic',+ 'diagnostic',+ 'diagnostics',+ 'dictionary',+ 'disable',+ 'disabled',+ 'disallow',+ 'disconnect',+ 'disk',+ 'distinct',+ 'distinctrow',+ 'distributed',+ 'div',+ 'do',+ 'document',+ 'domain',+ 'drop',+ 'dssize',+ 'dual',+ 'dump',+ 'dynamic',+ 'each',+ 'echo',+ 'editproc',+ 'element',+ 'else',+ 'elseif',+ 'empty',+ 'enabled',+ 'enclosed',+ 'encoding',+ 'encryption',+ 'end',+ 'end-exec',+ 'ending',+ 'end_frame',+ 'end_partition',+ 'eq',+ 'equals',+ 'erase',+ 'errlvl',+ 'error',+ 'errorfiles',+ 'errortables',+ 'escape',+ 'escaped',+ 'et',+ 'every',+ 'except',+ 'exception',+ 'exclusive',+ 'exec',+ 'execute',+ 'exists',+ 'exit',+ 'exp',+ 'explain',+ 'external',+ 'extract',+ 'fallback',+ 'false',+ 'fastexport',+ 'fenced',+ 'fetch',+ 'fieldproc',+ 'file',+ 'fillfactor',+ 'filter',+ 'final',+ 'first',+ 'first_value',+ 'floor',+ 'for',+ 'force',+ 'foreign',+ 'format',+ 'found',+ 'frame_row',+ 'free',+ 'freespace',+ 'freetext',+ 'freetexttable',+ 'freeze',+ 'from',+ 'full',+ 'fulltext',+ 'function',+ 'fusion',+ 'ge',+ 'general',+ 'generated',+ 'get',+ 'give',+ 'global',+ 'go',+ 'goto',+ 'grant',+ 'graphic',+ 'greatest',+ 'group',+ 'grouping',+ 'groups',+ 'gt',+ 'handler',+ 'hash',+ 'hashamp',+ 'hashbakamp',+ 'hashbucket',+ 'hashrow',+ 'having',+ 'help',+ 'high_priority',+ 'hold',+ 'holdlock',+ 'host',+ 'hour',+ 'hours',+ 'hour_microsecond',+ 'hour_minute',+ 'hour_second',+ 'identified',+ 'identity',+ 'identitycol',+ 'identity_insert',+ 'if',+ 'ignore',+ 'ilike',+ 'immediate',+ 'in',+ 'inclusive',+ 'inconsistent',+ 'increment',+ 'index',+ 'indicator',+ 'infile',+ 'inherit',+ 'initial',+ 'initialize',+ 'initially',+ 'initiate',+ 'inner',+ 'inout',+ 'input',+ 'ins',+ 'insensitive',+ 'insert',+ 'instead',+ 'int',+ 'int1',+ 'int2',+ 'int3',+ 'int4',+ 'int8',+ 'integerdate',+ 'intersect',+ 'intersection',+ 'into',+ 'io_after_gtids',+ 'io_before_gtids',+ 'is',+ 'isnull',+ 'isobid',+ 'isolation',+ 'iterate',+ 'jar',+ 'join',+ 'journal',+ 'json',+ 'json_array',+ 'json_arrayagg',+ 'json_exists',+ 'json_object',+ 'json_objectagg',+ 'json_query',+ 'json_scalar',+ 'json_serialize',+ 'json_table',+ 'json_table_primitive',+ 'json_value',+ 'keep',+ 'key',+ 'keys',+ 'kill',+ 'kurtosis',+ 'label',+ 'lag',+ 'language',+ 'large',+ 'last',+ 'last_value',+ 'lateral',+ 'lc_ctype',+ 'le',+ 'lead',+ 'leading',+ 'least',+ 'leave',+ 'left',+ 'less',+ 'level',+ 'like',+ 'like_regex',+ 'limit',+ 'linear',+ 'lineno',+ 'lines',+ 'listagg',+ 'ln',+ 'load',+ 'loading',+ 'local',+ 'locale',+ 'localtime',+ 'localtimestamp',+ 'locator',+ 'locators',+ 'lock',+ 'locking',+ 'lockmax',+ 'locksize',+ 'log',+ 'log10',+ 'logging',+ 'logon',+ 'long',+ 'longblob',+ 'longtext',+ 'loop',+ 'lower',+ 'low_priority',+ 'lpad',+ 'lt',+ 'ltrim',+ 'macro',+ 'maintained',+ 'map',+ 'master_bind',+ 'master_ssl_verify_server_cert',+ 'match',+ 'matches',+ 'match_number',+ 'match_recognize',+ 'materialized',+ 'mavg',+ 'max',+ 'maxextents',+ 'maximum',+ 'maxvalue',+ 'mcharacters',+ 'mdiff',+ 'member',+ 'merge',+ 'method',+ 'microsecond',+ 'microseconds',+ 'middleint',+ 'min',+ 'mindex',+ 'minimum',+ 'minus',+ 'minute',+ 'minutes',+ 'minute_microsecond',+ 'minute_second',+ 'mlinreg',+ 'mload',+ 'mlslabel',+ 'mod',+ 'mode',+ 'modifies',+ 'modify',+ 'module',+ 'monitor',+ 'monresource',+ 'monsession',+ 'month',+ 'months',+ 'msubstr',+ 'msum',+ 'multiset',+ 'named',+ 'names',+ 'national',+ 'natural',+ 'nchar',+ 'nclob',+ 'ne',+ 'nested_table_id',+ 'new',+ 'new_table',+ 'next',+ 'nextval',+ 'no',+ 'noaudit',+ 'nocheck',+ 'nocompress',+ 'nonclustered',+ 'none',+ 'normalize',+ 'not',+ 'notnull',+ 'nowait',+ 'no_write_to_binlog',+ 'nth_value',+ 'ntile',+ 'null',+ 'nullif',+ 'nullifzero',+ 'nulls',+ 'numparts',+ 'obid',+ 'object',+ 'objects',+ 'occurrences_regex',+ 'octet_length',+ 'of',+ 'off',+ 'offline',+ 'offset',+ 'offsets',+ 'old',+ 'old_table',+ 'omit',+ 'on',+ 'one',+ 'online',+ 'only',+ 'open',+ 'opendatasource',+ 'openquery',+ 'openrowset',+ 'openxml',+ 'operation',+ 'optimization',+ 'optimize',+ 'optimizer_costs',+ 'option',+ 'optionally',+ 'or',+ 'order',+ 'ordinality',+ 'organization',+ 'out',+ 'outer',+ 'outfile',+ 'output',+ 'over',+ 'overlaps',+ 'overlay',+ 'override',+ 'package',+ 'pad',+ 'padded',+ 'parameter',+ 'parameters',+ 'part',+ 'partial',+ 'partition',+ 'partitioned',+ 'partitioning',+ 'password',+ 'path',+ 'pattern',+ 'pctfree',+ 'per',+ 'percent',+ 'percentile_cont',+ 'percentile_disc',+ 'percent_rank',+ 'period',+ 'perm',+ 'permanent',+ 'piecesize',+ 'pivot',+ 'placing',+ 'plan',+ 'portion',+ 'position',+ 'position_regex',+ 'postfix',+ 'power',+ 'precedes',+ 'prefix',+ 'preorder',+ 'prepare',+ 'preserve',+ 'prevval',+ 'primary',+ 'print',+ 'prior',+ 'priqty',+ 'private',+ 'privileges',+ 'proc',+ 'procedure',+ 'profile',+ 'program',+ 'proportional',+ 'protection',+ 'psid',+ 'ptf',+ 'public',+ 'purge',+ 'qualified',+ 'qualify',+ 'quantile',+ 'query',+ 'queryno',+ 'radians',+ 'raiserror',+ 'random',+ 'range',+ 'range_n',+ 'rank',+ 'raw',+ 'read',+ 'reads',+ 'readtext',+ 'read_write',+ 'reconfigure',+ 'recursive',+ 'ref',+ 'references',+ 'referencing',+ 'refresh',+ 'regexp',+ 'regr_avgx',+ 'regr_avgy',+ 'regr_count',+ 'regr_intercept',+ 'regr_r2',+ 'regr_slope',+ 'regr_sxx',+ 'regr_sxy',+ 'regr_syy',+ 'relative',+ 'release',+ 'rename',+ 'repeat',+ 'replace',+ 'replication',+ 'repoverride',+ 'request',+ 'require',+ 'resignal',+ 'resource',+ 'restart',+ 'restore',+ 'restrict',+ 'result',+ 'result_set_locator',+ 'resume',+ 'ret',+ 'retrieve',+ 'return',+ 'returning',+ 'returns',+ 'revalidate',+ 'revert',+ 'revoke',+ 'right',+ 'rights',+ 'rlike',+ 'role',+ 'rollback',+ 'rollforward',+ 'rollup',+ 'round_ceiling',+ 'round_down',+ 'round_floor',+ 'round_half_down',+ 'round_half_even',+ 'round_half_up',+ 'round_up',+ 'routine',+ 'row',+ 'rowcount',+ 'rowguidcol',+ 'rowid',+ 'rownum',+ 'rows',+ 'rowset',+ 'row_number',+ 'rpad',+ 'rule',+ 'run',+ 'running',+ 'sample',+ 'sampleid',+ 'save',+ 'savepoint',+ 'schema',+ 'schemas',+ 'scope',+ 'scratchpad',+ 'scroll',+ 'search',+ 'second',+ 'seconds',+ 'second_microsecond',+ 'secqty',+ 'section',+ 'security',+ 'securityaudit',+ 'seek',+ 'sel',+ 'select',+ 'semantickeyphrasetable',+ 'semanticsimilaritydetailstable',+ 'semanticsimilaritytable',+ 'sensitive',+ 'separator',+ 'sequence',+ 'session',+ 'session_user',+ 'set',+ 'setresrate',+ 'sets',+ 'setsessrate',+ 'setuser',+ 'share',+ 'show',+ 'shutdown',+ 'signal',+ 'similar',+ 'simple',+ 'sin',+ 'sinh',+ 'size',+ 'skew',+ 'skip',+ 'some',+ 'soundex',+ 'source',+ 'space',+ 'spatial',+ 'specific',+ 'specifictype',+ 'spool',+ 'sql',+ 'sqlexception',+ 'sqlstate',+ 'sqltext',+ 'sqlwarning',+ 'sql_big_result',+ 'sql_calc_found_rows',+ 'sql_small_result',+ 'sqrt',+ 'ss',+ 'ssl',+ 'standard',+ 'start',+ 'starting',+ 'startup',+ 'state',+ 'statement',+ 'static',+ 'statistics',+ 'stay',+ 'stddev_pop',+ 'stddev_samp',+ 'stepinfo',+ 'stogroup',+ 'stored',+ 'stores',+ 'straight_join',+ 'string_cs',+ 'structure',+ 'style',+ 'submultiset',+ 'subscriber',+ 'subset',+ 'substr',+ 'substring',+ 'substring_regex',+ 'succeeds',+ 'successful',+ 'sum',+ 'summary',+ 'suspend',+ 'symmetric',+ 'synonym',+ 'sysdate',+ 'system',+ 'system_time',+ 'system_user',+ 'systimestamp',+ 'table',+ 'tablesample',+ 'tablespace',+ 'tan',+ 'tanh',+ 'tbl_cs',+ 'temporary',+ 'terminate',+ 'terminated',+ 'textsize',+ 'than',+ 'then',+ 'threshold',+ 'timezone_hour',+ 'timezone_minute',+ 'title',+ 'to',+ 'top',+ 'trace',+ 'trailing',+ 'tran',+ 'transaction',+ 'translate',+ 'translate_chk',+ 'translate_regex',+ 'translation',+ 'treat',+ 'trigger',+ 'trim',+ 'trim_array',+ 'true',+ 'truncate',+ 'try_convert',+ 'tsequal',+ 'type',+ 'uc',+ 'uescape',+ 'uid',+ 'undefined',+ 'under',+ 'undo',+ 'union',+ 'unique',+ 'unknown',+ 'unlock',+ 'unnest',+ 'unpivot',+ 'unsigned',+ 'until',+ 'upd',+ 'update',+ 'updatetext',+ 'upper',+ 'uppercase',+ 'usage',+ 'use',+ 'user',+ 'using',+ 'utc_date',+ 'utc_time',+ 'utc_timestamp',+ 'validate',+ 'validproc',+ 'value',+ 'values',+ 'value_of',+ 'varbinary',+ 'varbyte',+ 'varchar2',+ 'varcharacter',+ 'vargraphic',+ 'variable',+ 'variadic',+ 'variant',+ 'var_pop',+ 'var_samp',+ 'vcat',+ 'verbose',+ 'versioning',+ 'view',+ 'virtual',+ 'volatile',+ 'volumes',+ 'wait',+ 'waitfor',+ 'when',+ 'whenever',+ 'where',+ 'while',+ 'width_bucket',+ 'window',+ 'with',+ 'within',+ 'within_group',+ 'without',+ 'wlm',+ 'work',+ 'write',+ 'writetext',+ 'xmlcast',+ 'xmlexists',+ 'xmlnamespaces',+ 'xor',+ 'year',+ 'years',+ 'year_month',+ 'zerofill',+ 'zeroifnull',+ 'zone',+]);++const SQL_TYPES = new Set([+ 'bigint',+ 'bigserial',+ 'bit',+ 'blob',+ 'boolean',+ 'byte',+ 'byteint',+ 'bytes',+ 'char',+ 'character',+ 'date',+ 'datetime',+ 'decimal',+ 'double',+ 'float',+ 'float4',+ 'float8',+ 'integer',+ 'interval',+ 'mediumblob',+ 'mediumint',+ 'mediumtext',+ 'native',+ 'number',+ 'numeric',+ 'precision',+ 'real',+ 'serial',+ 'smallint',+ 'smallserial',+ 'text',+ 'time',+ 'timestamp',+ 'tinyblob',+ 'tinyint',+ 'tinytext',+ 'varchar',+ 'varying',+]);++class HighlightSql extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['sql'] = HighlightSql;diff --git a/llamafile/server/www/highlight_swift.js b/llamafile/server/www/highlight_swift.jsnew file mode 100644index 00000000..153b45eb--- /dev/null+++ b/llamafile/server/www/highlight_swift.js@@ -0,0 +1,1632 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const SWIFT_KEYWORDS = new Set([+ 'Any',+ 'Protocol',+ 'Self',+ 'Sendable',+ 'Type',+ '_BridgeObject',+ '_Class',+ '_NativeClass',+ '_NativeRefCountedObject',+ '_PackageDescription',+ '_RefCountedObject',+ '_Trivial',+ '_TrivialAtMost',+ '_TrivialStride',+ '_UnknownLayout',+ '__consuming',+ '__owned',+ '__setter_access',+ '__shared',+ '_alignment',+ '_backDeploy',+ '_borrow',+ '_borrowing',+ '_cdecl',+ '_compilerInitialized',+ '_const',+ '_consuming',+ '_documentation',+ '_dynamicReplacement',+ '_effects',+ '_expose',+ '_forward',+ '_implements',+ '_linear',+ '_local',+ '_modify',+ '_move',+ '_mutating',+ '_noMetadata',+ '_nonSendable',+ '_objcImplementation',+ '_objcRuntimeName',+ '_opaqueReturnTypeOf',+ '_optimize',+ '_originallyDefinedIn',+ '_private',+ '_projectedValueProperty',+ '_read',+ '_semantics',+ '_specialize',+ '_spi',+ '_spi_available',+ '_swift_native_objc_runtime_base',+ '_typeEraser',+ '_unavailableFromAsync',+ '_underlyingVersion',+ '_version',+ 'accesses',+ 'actor',+ 'addressWithNativeOwner',+ 'addressWithOwner',+ 'any',+ 'as',+ 'assignment',+ 'associatedtype',+ 'associativity',+ 'async',+ 'attached',+ 'autoclosure',+ 'availability',+ 'available',+ 'await',+ 'backDeployed',+ 'before',+ 'block',+ 'borrowing',+ 'break',+ 'cType',+ 'canImport',+ 'case',+ 'catch',+ 'class',+ 'compiler',+ 'consume',+ 'consuming',+ 'continue',+ 'convenience',+ 'convention',+ 'copy',+ 'default',+ 'defer',+ 'deinit',+ 'dependsOn',+ 'deprecated',+ 'derivative',+ 'didSet',+ 'differentiable',+ 'discard',+ 'distributed',+ 'do',+ 'dynamic',+ 'each',+ 'else',+ 'enum',+ 'escaping',+ 'exclusivity',+ 'exported',+ 'extension',+ 'fallthrough',+ 'file',+ 'fileprivate',+ 'final',+ 'for',+ 'forward',+ 'freestanding',+ 'func',+ 'get',+ 'guard',+ 'higherThan',+ 'if',+ 'import',+ 'in',+ 'indirect',+ 'infix',+ 'init',+ 'initializes',+ 'inline',+ 'inout',+ 'internal',+ 'introduced',+ 'is',+ 'isolated',+ 'kind',+ 'lazy',+ 'left',+ 'let',+ 'line',+ 'linear',+ 'lowerThan',+ 'macro',+ 'message',+ 'metadata',+ 'modify',+ 'module',+ 'mutableAddressWithNativeOwner',+ 'mutableAddressWithOwner',+ 'mutating',+ 'noDerivative',+ 'noasync',+ 'noescape',+ 'none',+ 'nonisolated',+ 'nonmutating',+ 'objc',+ 'obsoleted',+ 'of',+ 'open',+ 'operator',+ 'optional',+ 'override',+ 'package',+ 'postfix',+ 'precedencegroup',+ 'preconcurrency',+ 'prefix',+ 'private',+ 'protocol',+ 'public',+ 'read',+ 'reasync',+ 'renamed',+ 'repeat',+ 'required',+ 'rethrows',+ 'retroactive',+ 'return',+ 'reverse',+ 'right',+ 'safe',+ 'scoped',+ 'self',+ 'sending',+ 'set',+ 'some',+ 'sourceFile',+ 'spi',+ 'spiModule',+ 'static',+ 'struct',+ 'subscript',+ 'super',+ 'swift',+ 'switch',+ 'target',+ 'then',+ 'throw',+ 'throws',+ 'transpose',+ 'try',+ 'typealias',+ 'unavailable',+ 'unchecked',+ 'unowned',+ 'unsafe',+ 'unsafeAddress',+ 'unsafeMutableAddress',+ 'var',+ 'visibility',+ 'weak',+ 'where',+ 'while',+ 'willSet',+ 'witness_method',+ 'wrt',+ 'yield',+]);++const SWIFT_BUILTINS = new Set([+ 'abs',+ 'assert',+ 'assertionFailure',+ 'debugPrint',+ 'dump',+ 'fatalError',+ 'getVaList',+ 'isKnownUniquelyReferenced',+ 'max',+ 'min',+ 'numericCast',+ 'precondition',+ 'preconditionFailure',+ 'print',+ 'readLine',+ 'repeatElement',+ 'sequence',+ 'stride',+ 'swap',+ 'transcode',+ 'type',+ 'unsafeBitCast',+ 'unsafeDowncast',+ 'withExtendedLifetime',+ 'withUnsafeBytes',+ 'withUnsafeMutableBytes',+ 'withUnsafeMutablePointer',+ 'withUnsafePointer',+ 'withVaList',+ 'withoutActuallyEscaping',+ 'zip',+]);++const SWIFT_CONSTANTS = new Set([+ 'false',+ 'nil',+ 'true',+]);++const SWIFT_TYPES = new Set([+ 'ASCII',+ 'AcceptPolicy',+ 'ActivationType',+ 'ActivityOptions',+ 'AddingOptions',+ 'AdditiveArithmetic',+ 'AffineTransform',+ 'AllCases',+ 'AncestorRepresentation',+ 'Any',+ 'AnyBidirectionalCollection',+ 'AnyClass',+ 'AnyCollection',+ 'AnyHashable',+ 'AnyIndex',+ 'AnyIterator',+ 'AnyKeyPath',+ 'AnyObject',+ 'AnyRandomAccessCollection',+ 'AnySequence',+ 'Array',+ 'ArrayLiteralElement',+ 'ArraySlice',+ 'AuthChallengeDisposition',+ 'AutoreleasingUnsafeMutablePointer',+ 'BackgroundTaskCancelledReason',+ 'Base64DecodingOptions',+ 'Base64EncodingOptions',+ 'Behavior',+ 'BidirectionalCollection',+ 'BinaryFloatingPoint',+ 'BinaryInteger',+ 'BiquadFunctions',+ 'BlockOperation',+ 'Body',+ 'BookmarkCreationOptions',+ 'BookmarkFileCreationOptions',+ 'BookmarkResolutionOptions',+ 'Bool',+ 'BooleanLiteralType',+ 'Bound',+ 'Bundle',+ 'ByteCountFormatter',+ 'CBool',+ 'CChar',+ 'CChar16',+ 'CChar32',+ 'CDouble',+ 'CFloat',+ 'CGFloat',+ 'CInt',+ 'CLong',+ 'CLongDouble',+ 'CLongLong',+ 'CShort',+ 'CSignedChar',+ 'CUnsignedChar',+ 'CUnsignedInt',+ 'CUnsignedLong',+ 'CUnsignedLongLong',+ 'CUnsignedShort',+ 'CVaListPointer',+ 'CVarArg',+ 'CWideChar',+ 'CachePolicy',+ 'CachedURLResponse',+ 'CalculationError',+ 'Calendar',+ 'CanonicalCombiningClass',+ 'CaseIterable',+ 'CenterType',+ 'Change',+ 'Character',+ 'CharacterSet',+ 'CheckingType',+ 'Child',+ 'Children',+ 'CloseCode',+ 'ClosedRange',+ 'CocoaError',+ 'Codable',+ 'Code',+ 'CodeUnit',+ 'CodingKey',+ 'CodingUserInfoKey',+ 'Collection',+ 'CollectionDifference',+ 'CollectionOfOne',+ 'CommandLine',+ 'Comparable',+ 'Comparator',+ 'CompareOptions',+ 'ComparisonResult',+ 'CompletionHandler',+ 'Component',+ 'CompressionAlgorithm',+ 'ContentKind',+ 'Context',+ 'ContiguousArray',+ 'CountStyle',+ 'CountableClosedRange',+ 'CountablePartialRangeFrom',+ 'CountableRange',+ 'CustomDebugStringConvertible',+ 'CustomLeafReflectable',+ 'CustomNSError',+ 'CustomPlaygroundDisplayConvertible',+ 'CustomReflectable',+ 'CustomStringConvertible',+ 'DFTFunctions',+ 'DTDKind',+ 'Data',+ 'DataDecodingStrategy',+ 'DataEncodingStrategy',+ 'DataTaskPublisher',+ 'Date',+ 'DateComponents',+ 'DateComponentsFormatter',+ 'DateDecodingStrategy',+ 'DateEncodingStrategy',+ 'DateFormatter',+ 'DateInterval',+ 'DateIntervalFormatter',+ 'DateTimeStyle',+ 'Deallocator',+ 'Decimal',+ 'Decodable',+ 'Decoder',+ 'DecodingError',+ 'DecodingFailurePolicy',+ 'DefaultIndices',+ 'DefaultStringInterpolation',+ 'DelayedRequestDisposition',+ 'Dictionary',+ 'DictionaryIndex',+ 'DictionaryIterator',+ 'DictionaryLiteral',+ 'Dimension',+ 'DirectoryEnumerationOptions',+ 'DirectoryEnumerator',+ 'DisplayStyle',+ 'Distance',+ 'DistributedNotificationCenter',+ 'DocumentAttributeKey',+ 'DocumentReadingOptionKey',+ 'DocumentType',+ 'Double',+ 'DrawingOptions',+ 'DropFirstSequence',+ 'DropWhileSequence',+ 'Element',+ 'Elements',+ 'EmptyCollection',+ 'Encodable',+ 'EncodedScalar',+ 'Encoder',+ 'Encoding',+ 'EncodingConversionOptions',+ 'EncodingError',+ 'EnergyFormatter',+ 'EnumeratedIterator',+ 'EnumeratedSequence',+ 'EnumerationOptions',+ 'Equatable',+ 'Error',+ 'ErrorCode',+ 'ErrorPointer',+ 'Event',+ 'Exponent',+ 'ExpressibleByArrayLiteral',+ 'ExpressibleByBooleanLiteral',+ 'ExpressibleByDictionaryLiteral',+ 'ExpressibleByExtendedGraphemeClusterLiteral',+ 'ExpressibleByFloatLiteral',+ 'ExpressibleByIntegerLiteral',+ 'ExpressibleByNilLiteral',+ 'ExpressibleByStringInterpolation',+ 'ExpressibleByStringLiteral',+ 'ExpressibleByUnicodeScalarLiteral',+ 'ExpressionType',+ 'ExtendedGraphemeClusterLiteralType',+ 'ExtendedGraphemeClusterType',+ 'ExternalEntityResolvingPolicy',+ 'Failure',+ 'FileAttributeKey',+ 'FileAttributeType',+ 'FileHandle',+ 'FileManager',+ 'FileManagerDelegate',+ 'FileOperationKind',+ 'FileProtectionType',+ 'FileWrapper',+ 'FixedWidthInteger',+ 'FlattenCollection',+ 'FlattenSequence',+ 'Float',+ 'Float32',+ 'Float64',+ 'Float80',+ 'FloatLiteralType',+ 'FloatingPoint',+ 'FloatingPointClassification',+ 'FloatingPointRoundingRule',+ 'FloatingPointSign',+ 'Formatter',+ 'ForwardParser',+ 'GeneralCategory',+ 'HMCharacteristicPropertySupportsEvent',+ 'HTTPCookie',+ 'HTTPCookiePropertyKey',+ 'HTTPCookieStorage',+ 'HTTPCookieStringPolicy',+ 'HTTPURLResponse',+ 'Hashable',+ 'Hasher',+ 'Host',+ 'ISO8601DateFormatter',+ 'Identifier',+ 'Index',+ 'IndexDistance',+ 'IndexPath',+ 'IndexSet',+ 'IndexingIterator',+ 'Indices',+ 'Input',+ 'InputStream',+ 'InsertionPosition',+ 'Int',+ 'Int16',+ 'Int32',+ 'Int64',+ 'Int8',+ 'IntegerLiteralType',+ 'ItemReplacementOptions',+ 'Iterator',+ 'IteratorProtocol',+ 'IteratorSequence',+ 'JSONDecoder',+ 'JSONEncoder',+ 'JSONSerialization',+ 'JoinedSequence',+ 'Key',+ 'KeyDecodingStrategy',+ 'KeyEncodingStrategy',+ 'KeyPath',+ 'KeyValuePairs',+ 'KeyedDecodingContainer',+ 'KeyedDecodingContainerProtocol',+ 'KeyedEncodingContainer',+ 'KeyedEncodingContainerProtocol',+ 'Keys',+ 'Kind',+ 'LanguageDirection',+ 'LazyCollection',+ 'LazyCollectionProtocol',+ 'LazyDropWhileCollection',+ 'LazyDropWhileSequence',+ 'LazyFilterCollection',+ 'LazyFilterSequence',+ 'LazyMapCollection',+ 'LazyMapSequence',+ 'LazyPrefixWhileCollection',+ 'LazyPrefixWhileSequence',+ 'LazySequence',+ 'LazySequenceProtocol',+ 'LengthFormatter',+ 'LoadHandler',+ 'Locale',+ 'LocalizedError',+ 'LogicalType',+ 'LosslessStringConvertible',+ 'MachError',+ 'Magnitude',+ 'ManagedBuffer',+ 'ManagedBufferPointer',+ 'MaskStorage',+ 'MassFormatter',+ 'MatchingFlags',+ 'MatchingOptions',+ 'MatchingPolicy',+ 'Measurement',+ 'MeasurementFormatter',+ 'MemoryLayout',+ 'Message',+ 'MessagePort',+ 'Mirror',+ 'MirrorPath',+ 'Mode',+ 'Modifier',+ 'MultipathServiceType',+ 'MutabilityOptions',+ 'MutableCollection',+ 'MutableURLRequest',+ 'NSASCIIStringEncoding',+ 'NSAffineTransform',+ 'NSAffineTransformStruct',+ 'NSAppleEventDescriptor',+ 'NSAppleEventManager',+ 'NSAppleEventTimeOutDefault',+ 'NSAppleEventTimeOutNone',+ 'NSAppleScript',+ 'NSArchiver',+ 'NSArgumentEvaluationScriptError',+ 'NSArgumentsWrongScriptError',+ 'NSArray',+ 'NSAssertionHandler',+ 'NSAssertionHandlerKey',+ 'NSAttributedString',+ 'NSBackgroundActivityScheduler',+ 'NSBinarySearchingOptions',+ 'NSBuddhistCalendar',+ 'NSBundleErrorMaximum',+ 'NSBundleErrorMinimum',+ 'NSBundleExecutableArchitectureI386',+ 'NSBundleExecutableArchitecturePPC',+ 'NSBundleExecutableArchitecturePPC64',+ 'NSBundleExecutableArchitectureX86_64',+ 'NSBundleOnDemandResourceExceededMaximumSizeError',+ 'NSBundleOnDemandResourceInvalidTagError',+ 'NSBundleOnDemandResourceOutOfSpaceError',+ 'NSBundleResourceRequest',+ 'NSBundleResourceRequestLoadingPriorityUrgent',+ 'NSCache',+ 'NSCacheDelegate',+ 'NSCalendar',+ 'NSCannotCreateScriptCommandError',+ 'NSCharacterSet',+ 'NSChineseCalendar',+ 'NSClassDescription',+ 'NSCloneCommand',+ 'NSCloseCommand',+ 'NSCloudSharingConflictError',+ 'NSCloudSharingErrorMaximum',+ 'NSCloudSharingErrorMinimum',+ 'NSCloudSharingNetworkFailureError',+ 'NSCloudSharingNoPermissionError',+ 'NSCloudSharingOtherError',+ 'NSCloudSharingQuotaExceededError',+ 'NSCloudSharingTooManyParticipantsError',+ 'NSCocoaErrorDomain',+ 'NSCoder',+ 'NSCoderErrorMaximum',+ 'NSCoderErrorMinimum',+ 'NSCoderInvalidValueError',+ 'NSCoderReadCorruptError',+ 'NSCoderValueNotFoundError',+ 'NSCoding',+ 'NSCollectionChangeType',+ 'NSCollectorDisabledOption',+ 'NSComparisonPredicate',+ 'NSCompoundPredicate',+ 'NSCompressionErrorMaximum',+ 'NSCompressionErrorMinimum',+ 'NSCompressionFailedError',+ 'NSCondition',+ 'NSConditionLock',+ 'NSContainerSpecifierError',+ 'NSCopying',+ 'NSCountCommand',+ 'NSCountedSet',+ 'NSCreateCommand',+ 'NSData',+ 'NSDataDetector',+ 'NSDate',+ 'NSDateComponentUndefined',+ 'NSDateComponents',+ 'NSDateInterval',+ 'NSDebugDescriptionErrorKey',+ 'NSDecimalMaxSize',+ 'NSDecimalNoScale',+ 'NSDecimalNumber',+ 'NSDecimalNumberBehaviors',+ 'NSDecimalNumberHandler',+ 'NSDecompressionFailedError',+ 'NSDeleteCommand',+ 'NSDictionary',+ 'NSDiscardableContent',+ 'NSDistributedLock',+ 'NSEdgeInsets',+ 'NSEdgeInsetsZero',+ 'NSEnumerationOptions',+ 'NSEnumerator',+ 'NSError',+ 'NSErrorDomain',+ 'NSErrorFailingURLStringKey',+ 'NSErrorPointer',+ 'NSException',+ 'NSExceptionName',+ 'NSExecutableArchitectureMismatchError',+ 'NSExecutableErrorMaximum',+ 'NSExecutableErrorMinimum',+ 'NSExecutableLinkError',+ 'NSExecutableLoadError',+ 'NSExecutableNotLoadableError',+ 'NSExecutableRuntimeMismatchError',+ 'NSExistsCommand',+ 'NSExpression',+ 'NSExtensionContext',+ 'NSExtensionItem',+ 'NSExtensionItemAttachmentsKey',+ 'NSExtensionItemAttributedContentTextKey',+ 'NSExtensionItemAttributedTitleKey',+ 'NSExtensionItemsAndErrorsKey',+ 'NSExtensionJavaScriptFinalizeArgumentKey',+ 'NSExtensionJavaScriptPreprocessingResultsKey',+ 'NSExtensionRequestHandling',+ 'NSFastEnumeration',+ 'NSFastEnumerationIterator',+ 'NSFastEnumerationState',+ 'NSFeatureUnsupportedError',+ 'NSFileAccessIntent',+ 'NSFileCoordinator',+ 'NSFileErrorMaximum',+ 'NSFileErrorMinimum',+ 'NSFileHandleNotificationDataItem',+ 'NSFileHandleNotificationFileHandleItem',+ 'NSFileHandleNotificationMonitorModes',+ 'NSFileLockingError',+ 'NSFileManagerUnmountBusyError',+ 'NSFileManagerUnmountDissentingProcessIdentifierErrorKey',+ 'NSFileManagerUnmountUnknownError',+ 'NSFileNoSuchFileError',+ 'NSFilePathErrorKey',+ 'NSFilePresenter',+ 'NSFileProviderService',+ 'NSFileProviderServiceName',+ 'NSFileReadCorruptFileError',+ 'NSFileReadInapplicableStringEncodingError',+ 'NSFileReadInvalidFileNameError',+ 'NSFileReadNoPermissionError',+ 'NSFileReadNoSuchFileError',+ 'NSFileReadTooLargeError',+ 'NSFileReadUnknownError',+ 'NSFileReadUnknownStringEncodingError',+ 'NSFileReadUnsupportedSchemeError',+ 'NSFileSecurity',+ 'NSFileVersion',+ 'NSFileWriteFileExistsError',+ 'NSFileWriteInapplicableStringEncodingError',+ 'NSFileWriteInvalidFileNameError',+ 'NSFileWriteNoPermissionError',+ 'NSFileWriteOutOfSpaceError',+ 'NSFileWriteUnknownError',+ 'NSFileWriteUnsupportedSchemeError',+ 'NSFileWriteVolumeReadOnlyError',+ 'NSFormattingError',+ 'NSFormattingErrorMaximum',+ 'NSFormattingErrorMinimum',+ 'NSFoundationVersionNumber',+ 'NSGetCommand',+ 'NSGrammarCorrections',+ 'NSGrammarRange',+ 'NSGrammarUserDescription',+ 'NSGregorianCalendar',+ 'NSHPUXOperatingSystem',+ 'NSHashEnumerator',+ 'NSHashTable',+ 'NSHashTableCallBacks',+ 'NSHashTableOptions',+ 'NSHebrewCalendar',+ 'NSHelpAnchorErrorKey',+ 'NSISO2022JPStringEncoding',+ 'NSISO8601Calendar',+ 'NSISOLatin1StringEncoding',+ 'NSISOLatin2StringEncoding',+ 'NSIndexPath',+ 'NSIndexSet',+ 'NSIndexSetIterator',+ 'NSIndexSpecifier',+ 'NSIndianCalendar',+ 'NSIntMapKeyCallBacks',+ 'NSIntMapValueCallBacks',+ 'NSIntegerHashCallBacks',+ 'NSIntegerMapKeyCallBacks',+ 'NSIntegerMapValueCallBacks',+ 'NSInternalScriptError',+ 'NSInternalSpecifierError',+ 'NSInvalidIndexSpecifierError',+ 'NSIslamicCalendar',+ 'NSIslamicCivilCalendar',+ 'NSItemProvider',+ 'NSItemProviderFileOptions',+ 'NSItemProviderPreferredImageSizeKey',+ 'NSItemProviderReading',+ 'NSItemProviderRepresentationVisibility',+ 'NSItemProviderWriting',+ 'NSJapaneseCalendar',+ 'NSJapaneseEUCStringEncoding',+ 'NSKeySpecifierEvaluationScriptError',+ 'NSKeyValueChange',+ 'NSKeyValueChangeKey',+ 'NSKeyValueObservation',+ 'NSKeyValueObservedChange',+ 'NSKeyValueObservingCustomization',+ 'NSKeyValueObservingOptions',+ 'NSKeyValueOperator',+ 'NSKeyValueSetMutationKind',+ 'NSKeyValueValidationError',+ 'NSKeyedArchiveRootObjectKey',+ 'NSKeyedArchiver',+ 'NSKeyedArchiverDelegate',+ 'NSKeyedUnarchiver',+ 'NSKeyedUnarchiverDelegate',+ 'NSLinguisticTag',+ 'NSLinguisticTagScheme',+ 'NSLinguisticTagger',+ 'NSLinguisticTaggerUnit',+ 'NSLoadedClasses',+ 'NSLocale',+ 'NSLocalizedDescriptionKey',+ 'NSLocalizedFailureErrorKey',+ 'NSLocalizedFailureReasonErrorKey',+ 'NSLocalizedRecoveryOptionsErrorKey',+ 'NSLocalizedRecoverySuggestionErrorKey',+ 'NSLock',+ 'NSLocking',+ 'NSLogicalTest',+ 'NSMACHOperatingSystem',+ 'NSMacOSRomanStringEncoding',+ 'NSMachErrorDomain',+ 'NSMachPort',+ 'NSMachPortDelegate',+ 'NSMapEnumerator',+ 'NSMapTable',+ 'NSMapTableCopyIn',+ 'NSMapTableKeyCallBacks',+ 'NSMapTableObjectPointerPersonality',+ 'NSMapTableOptions',+ 'NSMapTableStrongMemory',+ 'NSMapTableValueCallBacks',+ 'NSMapTableWeakMemory',+ 'NSMeasurement',+ 'NSMetadataItem',+ 'NSMetadataItemAcquisitionMakeKey',+ 'NSMetadataItemAcquisitionModelKey',+ 'NSMetadataItemAlbumKey',+ 'NSMetadataItemAltitudeKey',+ 'NSMetadataItemApertureKey',+ 'NSMetadataItemAppleLoopDescriptorsKey',+ 'NSMetadataItemAppleLoopsKeyFilterTypeKey',+ 'NSMetadataItemAppleLoopsLoopModeKey',+ 'NSMetadataItemAppleLoopsRootKeyKey',+ 'NSMetadataItemApplicationCategoriesKey',+ 'NSMetadataItemAttributeChangeDateKey',+ 'NSMetadataItemAudiencesKey',+ 'NSMetadataItemAudioBitRateKey',+ 'NSMetadataItemAudioChannelCountKey',+ 'NSMetadataItemAudioEncodingApplicationKey',+ 'NSMetadataItemAudioSampleRateKey',+ 'NSMetadataItemAudioTrackNumberKey',+ 'NSMetadataItemAuthorAddressesKey',+ 'NSMetadataItemAuthorEmailAddressesKey',+ 'NSMetadataItemAuthorsKey',+ 'NSMetadataItemBitsPerSampleKey',+ 'NSMetadataItemCFBundleIdentifierKey',+ 'NSMetadataItemCameraOwnerKey',+ 'NSMetadataItemCityKey',+ 'NSMetadataItemCodecsKey',+ 'NSMetadataItemColorSpaceKey',+ 'NSMetadataItemCommentKey',+ 'NSMetadataItemComposerKey',+ 'NSMetadataItemContactKeywordsKey',+ 'NSMetadataItemContentCreationDateKey',+ 'NSMetadataItemContentModificationDateKey',+ 'NSMetadataItemContentTypeKey',+ 'NSMetadataItemContentTypeTreeKey',+ 'NSMetadataItemContributorsKey',+ 'NSMetadataItemCopyrightKey',+ 'NSMetadataItemCountryKey',+ 'NSMetadataItemCoverageKey',+ 'NSMetadataItemCreatorKey',+ 'NSMetadataItemDateAddedKey',+ 'NSMetadataItemDeliveryTypeKey',+ 'NSMetadataItemDescriptionKey',+ 'NSMetadataItemDirectorKey',+ 'NSMetadataItemDisplayNameKey',+ 'NSMetadataItemDownloadedDateKey',+ 'NSMetadataItemDueDateKey',+ 'NSMetadataItemDurationSecondsKey',+ 'NSMetadataItemEXIFGPSVersionKey',+ 'NSMetadataItemEXIFVersionKey',+ 'NSMetadataItemEditorsKey',+ 'NSMetadataItemEmailAddressesKey',+ 'NSMetadataItemEncodingApplicationsKey',+ 'NSMetadataItemExecutableArchitecturesKey',+ 'NSMetadataItemExecutablePlatformKey',+ 'NSMetadataItemExposureModeKey',+ 'NSMetadataItemExposureProgramKey',+ 'NSMetadataItemExposureTimeSecondsKey',+ 'NSMetadataItemExposureTimeStringKey',+ 'NSMetadataItemFNumberKey',+ 'NSMetadataItemFSContentChangeDateKey',+ 'NSMetadataItemFSCreationDateKey',+ 'NSMetadataItemFSNameKey',+ 'NSMetadataItemFSSizeKey',+ 'NSMetadataItemFinderCommentKey',+ 'NSMetadataItemFlashOnOffKey',+ 'NSMetadataItemFocalLength35mmKey',+ 'NSMetadataItemFocalLengthKey',+ 'NSMetadataItemFontsKey',+ 'NSMetadataItemGPSAreaInformationKey',+ 'NSMetadataItemGPSDOPKey',+ 'NSMetadataItemGPSDateStampKey',+ 'NSMetadataItemGPSDestBearingKey',+ 'NSMetadataItemGPSDestDistanceKey',+ 'NSMetadataItemGPSDestLatitudeKey',+ 'NSMetadataItemGPSDestLongitudeKey',+ 'NSMetadataItemGPSDifferentalKey',+ 'NSMetadataItemGPSMapDatumKey',+ 'NSMetadataItemGPSMeasureModeKey',+ 'NSMetadataItemGPSProcessingMethodKey',+ 'NSMetadataItemGPSStatusKey',+ 'NSMetadataItemGPSTrackKey',+ 'NSMetadataItemGenreKey',+ 'NSMetadataItemHasAlphaChannelKey',+ 'NSMetadataItemHeadlineKey',+ 'NSMetadataItemISOSpeedKey',+ 'NSMetadataItemIdentifierKey',+ 'NSMetadataItemImageDirectionKey',+ 'NSMetadataItemInformationKey',+ 'NSMetadataItemInstantMessageAddressesKey',+ 'NSMetadataItemInstructionsKey',+ 'NSMetadataItemIsApplicationManagedKey',+ 'NSMetadataItemIsGeneralMIDISequenceKey',+ 'NSMetadataItemIsLikelyJunkKey',+ 'NSMetadataItemIsUbiquitousKey',+ 'NSMetadataItemKeySignatureKey',+ 'NSMetadataItemKeywordsKey',+ 'NSMetadataItemKindKey',+ 'NSMetadataItemLanguagesKey',+ 'NSMetadataItemLastUsedDateKey',+ 'NSMetadataItemLatitudeKey',+ 'NSMetadataItemLayerNamesKey',+ 'NSMetadataItemLensModelKey',+ 'NSMetadataItemLongitudeKey',+ 'NSMetadataItemLyricistKey',+ 'NSMetadataItemMaxApertureKey',+ 'NSMetadataItemMediaTypesKey',+ 'NSMetadataItemMeteringModeKey',+ 'NSMetadataItemMusicalGenreKey',+ 'NSMetadataItemMusicalInstrumentCategoryKey',+ 'NSMetadataItemMusicalInstrumentNameKey',+ 'NSMetadataItemNamedLocationKey',+ 'NSMetadataItemNumberOfPagesKey',+ 'NSMetadataItemOrganizationsKey',+ 'NSMetadataItemOrientationKey',+ 'NSMetadataItemOriginalFormatKey',+ 'NSMetadataItemOriginalSourceKey',+ 'NSMetadataItemPageHeightKey',+ 'NSMetadataItemPageWidthKey',+ 'NSMetadataItemParticipantsKey',+ 'NSMetadataItemPathKey',+ 'NSMetadataItemPerformersKey',+ 'NSMetadataItemPhoneNumbersKey',+ 'NSMetadataItemPixelCountKey',+ 'NSMetadataItemPixelHeightKey',+ 'NSMetadataItemPixelWidthKey',+ 'NSMetadataItemProducerKey',+ 'NSMetadataItemProfileNameKey',+ 'NSMetadataItemProjectsKey',+ 'NSMetadataItemPublishersKey',+ 'NSMetadataItemRecipientAddressesKey',+ 'NSMetadataItemRecipientEmailAddressesKey',+ 'NSMetadataItemRecipientsKey',+ 'NSMetadataItemRecordingDateKey',+ 'NSMetadataItemRecordingYearKey',+ 'NSMetadataItemRedEyeOnOffKey',+ 'NSMetadataItemResolutionHeightDPIKey',+ 'NSMetadataItemResolutionWidthDPIKey',+ 'NSMetadataItemRightsKey',+ 'NSMetadataItemSecurityMethodKey',+ 'NSMetadataItemSpeedKey',+ 'NSMetadataItemStarRatingKey',+ 'NSMetadataItemStateOrProvinceKey',+ 'NSMetadataItemStreamableKey',+ 'NSMetadataItemSubjectKey',+ 'NSMetadataItemTempoKey',+ 'NSMetadataItemTextContentKey',+ 'NSMetadataItemThemeKey',+ 'NSMetadataItemTimeSignatureKey',+ 'NSMetadataItemTimestampKey',+ 'NSMetadataItemTitleKey',+ 'NSMetadataItemTotalBitRateKey',+ 'NSMetadataItemURLKey',+ 'NSMetadataItemVersionKey',+ 'NSMetadataItemVideoBitRateKey',+ 'NSMetadataItemWhereFromsKey',+ 'NSMetadataItemWhiteBalanceKey',+ 'NSMetadataQuery',+ 'NSMetadataQueryAccessibleUbiquitousExternalDocumentsScope',+ 'NSMetadataQueryAttributeValueTuple',+ 'NSMetadataQueryDelegate',+ 'NSMetadataQueryIndexedLocalComputerScope',+ 'NSMetadataQueryIndexedNetworkScope',+ 'NSMetadataQueryLocalComputerScope',+ 'NSMetadataQueryNetworkScope',+ 'NSMetadataQueryResultContentRelevanceAttribute',+ 'NSMetadataQueryResultGroup',+ 'NSMetadataQueryUbiquitousDataScope',+ 'NSMetadataQueryUbiquitousDocumentsScope',+ 'NSMetadataQueryUpdateAddedItemsKey',+ 'NSMetadataQueryUpdateChangedItemsKey',+ 'NSMetadataQueryUpdateRemovedItemsKey',+ 'NSMetadataQueryUserHomeScope',+ 'NSMetadataUbiquitousItemContainerDisplayNameKey',+ 'NSMetadataUbiquitousItemDownloadRequestedKey',+ 'NSMetadataUbiquitousItemDownloadingErrorKey',+ 'NSMetadataUbiquitousItemDownloadingStatusCurrent',+ 'NSMetadataUbiquitousItemDownloadingStatusDownloaded',+ 'NSMetadataUbiquitousItemDownloadingStatusKey',+ 'NSMetadataUbiquitousItemDownloadingStatusNotDownloaded',+ 'NSMetadataUbiquitousItemHasUnresolvedConflictsKey',+ 'NSMetadataUbiquitousItemIsDownloadedKey',+ 'NSMetadataUbiquitousItemIsDownloadingKey',+ 'NSMetadataUbiquitousItemIsExternalDocumentKey',+ 'NSMetadataUbiquitousItemIsSharedKey',+ 'NSMetadataUbiquitousItemIsUploadedKey',+ 'NSMetadataUbiquitousItemIsUploadingKey',+ 'NSMetadataUbiquitousItemPercentDownloadedKey',+ 'NSMetadataUbiquitousItemPercentUploadedKey',+ 'NSMetadataUbiquitousItemURLInLocalContainerKey',+ 'NSMetadataUbiquitousItemUploadingErrorKey',+ 'NSMetadataUbiquitousSharedItemCurrentUserPermissionsKey',+ 'NSMetadataUbiquitousSharedItemCurrentUserRoleKey',+ 'NSMetadataUbiquitousSharedItemMostRecentEditorNameComponentsKey',+ 'NSMetadataUbiquitousSharedItemOwnerNameComponentsKey',+ 'NSMetadataUbiquitousSharedItemPermissionsReadOnly',+ 'NSMetadataUbiquitousSharedItemPermissionsReadWrite',+ 'NSMetadataUbiquitousSharedItemRoleOwner',+ 'NSMetadataUbiquitousSharedItemRoleParticipant',+ 'NSMiddleSpecifier',+ 'NSMoveCommand',+ 'NSMutableArray',+ 'NSMutableAttributedString',+ 'NSMutableCharacterSet',+ 'NSMutableCopying',+ 'NSMutableData',+ 'NSMutableDictionary',+ 'NSMutableIndexSet',+ 'NSMutableOrderedSet',+ 'NSMutableSet',+ 'NSMutableString',+ 'NSMutableURLRequest',+ 'NSNEXTSTEPStringEncoding',+ 'NSNameSpecifier',+ 'NSNoScriptError',+ 'NSNoSpecifierError',+ 'NSNoTopLevelContainersSpecifierError',+ 'NSNonLossyASCIIStringEncoding',+ 'NSNonOwnedPointerHashCallBacks',+ 'NSNonOwnedPointerMapKeyCallBacks',+ 'NSNonOwnedPointerMapValueCallBacks',+ 'NSNonOwnedPointerOrNullMapKeyCallBacks',+ 'NSNonRetainedObjectHashCallBacks',+ 'NSNonRetainedObjectMapKeyCallBacks',+ 'NSNonRetainedObjectMapValueCallBacks',+ 'NSNotFound',+ 'NSNotification',+ 'NSNotificationDeliverImmediately',+ 'NSNotificationPostToAllSessions',+ 'NSNull',+ 'NSNumber',+ 'NSOSF1OperatingSystem',+ 'NSOSStatusErrorDomain',+ 'NSObject',+ 'NSObjectHashCallBacks',+ 'NSObjectMapKeyCallBacks',+ 'NSObjectMapValueCallBacks',+ 'NSObjectProtocol',+ 'NSOpenStepUnicodeReservedBase',+ 'NSOperationNotSupportedForKeyException',+ 'NSOperationNotSupportedForKeyScriptError',+ 'NSOperationNotSupportedForKeySpecifierError',+ 'NSOrderedSet',+ 'NSOrthography',+ 'NSOwnedObjectIdentityHashCallBacks',+ 'NSOwnedPointerHashCallBacks',+ 'NSOwnedPointerMapKeyCallBacks',+ 'NSOwnedPointerMapValueCallBacks',+ 'NSPOSIXErrorDomain',+ 'NSPersianCalendar',+ 'NSPersonNameComponentDelimiter',+ 'NSPersonNameComponentFamilyName',+ 'NSPersonNameComponentGivenName',+ 'NSPersonNameComponentKey',+ 'NSPersonNameComponentMiddleName',+ 'NSPersonNameComponentNickname',+ 'NSPersonNameComponentPrefix',+ 'NSPersonNameComponentSuffix',+ 'NSPersonNameComponents',+ 'NSPoint',+ 'NSPointerArray',+ 'NSPointerFunctions',+ 'NSPointerToStructHashCallBacks',+ 'NSPositionalSpecifier',+ 'NSPredicate',+ 'NSPropertyListErrorMaximum',+ 'NSPropertyListErrorMinimum',+ 'NSPropertyListReadCorruptError',+ 'NSPropertyListReadStreamError',+ 'NSPropertyListReadUnknownVersionError',+ 'NSPropertyListWriteInvalidError',+ 'NSPropertyListWriteStreamError',+ 'NSPropertySpecifier',+ 'NSProprietaryStringEncoding',+ 'NSProtocolChecker',+ 'NSProxy',+ 'NSPurgeableData',+ 'NSQuitCommand',+ 'NSRandomSpecifier',+ 'NSRange',+ 'NSRangeSpecifier',+ 'NSReceiverEvaluationScriptError',+ 'NSReceiversCantHandleCommandScriptError',+ 'NSRecoveryAttempterErrorKey',+ 'NSRect',+ 'NSRecursiveLock',+ 'NSRegularExpression',+ 'NSRelativeSpecifier',+ 'NSRepublicOfChinaCalendar',+ 'NSRequiredArgumentsMissingScriptError',+ 'NSSaveOptions',+ 'NSScannedOption',+ 'NSScriptClassDescription',+ 'NSScriptCoercionHandler',+ 'NSScriptCommand',+ 'NSScriptCommandDescription',+ 'NSScriptExecutionContext',+ 'NSScriptObjectSpecifier',+ 'NSScriptSuiteRegistry',+ 'NSScriptWhoseTest',+ 'NSSecureCoding',+ 'NSSet',+ 'NSSetCommand',+ 'NSShiftJISStringEncoding',+ 'NSSize',+ 'NSSolarisOperatingSystem',+ 'NSSortDescriptor',+ 'NSSortOptions',+ 'NSSpecifierTest',+ 'NSSpellServer',+ 'NSSpellServerDelegate',+ 'NSStreamSOCKSErrorDomain',+ 'NSStreamSocketSSLErrorDomain',+ 'NSString',+ 'NSStringEncodingErrorKey',+ 'NSSunOSOperatingSystem',+ 'NSSwappedDouble',+ 'NSSwappedFloat',+ 'NSSymbolStringEncoding',+ 'NSTextCheckingAllCustomTypes',+ 'NSTextCheckingAllSystemTypes',+ 'NSTextCheckingAllTypes',+ 'NSTextCheckingKey',+ 'NSTextCheckingResult',+ 'NSTextCheckingTypes',+ 'NSTextWritingDirection',+ 'NSTimeIntervalSince1970',+ 'NSTimeZone',+ 'NSTypeIdentifierAddressText',+ 'NSTypeIdentifierDateText',+ 'NSTypeIdentifierPhoneNumberText',+ 'NSTypeIdentifierTransitInformationText',+ 'NSURL',+ 'NSURLAuthenticationMethodClientCertificate',+ 'NSURLAuthenticationMethodDefault',+ 'NSURLAuthenticationMethodHTMLForm',+ 'NSURLAuthenticationMethodHTTPBasic',+ 'NSURLAuthenticationMethodHTTPDigest',+ 'NSURLAuthenticationMethodNTLM',+ 'NSURLAuthenticationMethodNegotiate',+ 'NSURLAuthenticationMethodServerTrust',+ 'NSURLComponents',+ 'NSURLConnection',+ 'NSURLConnectionDataDelegate',+ 'NSURLConnectionDelegate',+ 'NSURLConnectionDownloadDelegate',+ 'NSURLCredentialStorageRemoveSynchronizableCredentials',+ 'NSURLDownload',+ 'NSURLDownloadDelegate',+ 'NSURLErrorAppTransportSecurityRequiresSecureConnection',+ 'NSURLErrorBackgroundSessionInUseByAnotherProcess',+ 'NSURLErrorBackgroundSessionRequiresSharedContainer',+ 'NSURLErrorBackgroundSessionWasDisconnected',+ 'NSURLErrorBackgroundTaskCancelledReasonKey',+ 'NSURLErrorBadServerResponse',+ 'NSURLErrorBadURL',+ 'NSURLErrorCallIsActive',+ 'NSURLErrorCancelled',+ 'NSURLErrorCancelledReasonBackgroundUpdatesDisabled',+ 'NSURLErrorCancelledReasonInsufficientSystemResources',+ 'NSURLErrorCancelledReasonUserForceQuitApplication',+ 'NSURLErrorCannotCloseFile',+ 'NSURLErrorCannotConnectToHost',+ 'NSURLErrorCannotCreateFile',+ 'NSURLErrorCannotDecodeContentData',+ 'NSURLErrorCannotDecodeRawData',+ 'NSURLErrorCannotFindHost',+ 'NSURLErrorCannotLoadFromNetwork',+ 'NSURLErrorCannotMoveFile',+ 'NSURLErrorCannotOpenFile',+ 'NSURLErrorCannotParseResponse',+ 'NSURLErrorCannotRemoveFile',+ 'NSURLErrorCannotWriteToFile',+ 'NSURLErrorClientCertificateRejected',+ 'NSURLErrorClientCertificateRequired',+ 'NSURLErrorDNSLookupFailed',+ 'NSURLErrorDataLengthExceedsMaximum',+ 'NSURLErrorDataNotAllowed',+ 'NSURLErrorDomain',+ 'NSURLErrorDownloadDecodingFailedMidStream',+ 'NSURLErrorDownloadDecodingFailedToComplete',+ 'NSURLErrorFailingURLErrorKey',+ 'NSURLErrorFailingURLPeerTrustErrorKey',+ 'NSURLErrorFailingURLStringErrorKey',+ 'NSURLErrorFileDoesNotExist',+ 'NSURLErrorFileIsDirectory',+ 'NSURLErrorFileOutsideSafeArea',+ 'NSURLErrorHTTPTooManyRedirects',+ 'NSURLErrorInternationalRoamingOff',+ 'NSURLErrorKey',+ 'NSURLErrorNetworkConnectionLost',+ 'NSURLErrorNetworkUnavailableReasonKey',+ 'NSURLErrorNoPermissionsToReadFile',+ 'NSURLErrorNotConnectedToInternet',+ 'NSURLErrorRedirectToNonExistentLocation',+ 'NSURLErrorRequestBodyStreamExhausted',+ 'NSURLErrorResourceUnavailable',+ 'NSURLErrorSecureConnectionFailed',+ 'NSURLErrorServerCertificateHasBadDate',+ 'NSURLErrorServerCertificateHasUnknownRoot',+ 'NSURLErrorServerCertificateNotYetValid',+ 'NSURLErrorServerCertificateUntrusted',+ 'NSURLErrorTimedOut',+ 'NSURLErrorUnknown',+ 'NSURLErrorUnsupportedURL',+ 'NSURLErrorUserAuthenticationRequired',+ 'NSURLErrorUserCancelledAuthentication',+ 'NSURLErrorZeroByteResource',+ 'NSURLFileScheme',+ 'NSURLHandle',+ 'NSURLProtectionSpaceFTP',+ 'NSURLProtectionSpaceFTPProxy',+ 'NSURLProtectionSpaceHTTP',+ 'NSURLProtectionSpaceHTTPProxy',+ 'NSURLProtectionSpaceHTTPS',+ 'NSURLProtectionSpaceHTTPSProxy',+ 'NSURLProtectionSpaceSOCKSProxy',+ 'NSURLQueryItem',+ 'NSURLRequest',+ 'NSURLSessionDownloadTaskResumeData',+ 'NSURLSessionTransferSizeUnknown',+ 'NSUTF16BigEndianStringEncoding',+ 'NSUTF16LittleEndianStringEncoding',+ 'NSUTF16StringEncoding',+ 'NSUTF32BigEndianStringEncoding',+ 'NSUTF32LittleEndianStringEncoding',+ 'NSUTF32StringEncoding',+ 'NSUTF8StringEncoding',+ 'NSUUID',+ 'NSUbiquitousFileErrorMaximum',+ 'NSUbiquitousFileErrorMinimum',+ 'NSUbiquitousFileNotUploadedDueToQuotaError',+ 'NSUbiquitousFileUbiquityServerNotAvailable',+ 'NSUbiquitousFileUnavailableError',+ 'NSUbiquitousKeyValueStore',+ 'NSUbiquitousKeyValueStoreAccountChange',+ 'NSUbiquitousKeyValueStoreChangeReasonKey',+ 'NSUbiquitousKeyValueStoreChangedKeysKey',+ 'NSUbiquitousKeyValueStoreInitialSyncChange',+ 'NSUbiquitousKeyValueStoreQuotaViolationChange',+ 'NSUbiquitousKeyValueStoreServerChange',+ 'NSUnarchiver',+ 'NSUncaughtExceptionHandler',+ 'NSUndefinedDateComponent',+ 'NSUnderlineStyle',+ 'NSUnderlyingErrorKey',+ 'NSUndoCloseGroupingRunLoopOrdering',+ 'NSUndoManagerGroupIsDiscardableKey',+ 'NSUnicodeStringEncoding',+ 'NSUniqueIDSpecifier',+ 'NSUnknownKeyScriptError',+ 'NSUnknownKeySpecifierError',+ 'NSUserActivity',+ 'NSUserActivityConnectionUnavailableError',+ 'NSUserActivityDelegate',+ 'NSUserActivityErrorMaximum',+ 'NSUserActivityErrorMinimum',+ 'NSUserActivityHandoffFailedError',+ 'NSUserActivityHandoffUserInfoTooLargeError',+ 'NSUserActivityPersistentIdentifier',+ 'NSUserActivityRemoteApplicationTimedOutError',+ 'NSUserActivityTypeBrowsingWeb',+ 'NSUserAppleScriptTask',+ 'NSUserAutomatorTask',+ 'NSUserCancelledError',+ 'NSUserNotification',+ 'NSUserNotificationAction',+ 'NSUserNotificationCenter',+ 'NSUserNotificationCenterDelegate',+ 'NSUserNotificationDefaultSoundName',+ 'NSUserScriptTask',+ 'NSUserUnixTask',+ 'NSValidationErrorMaximum',+ 'NSValidationErrorMinimum',+ 'NSValue',+ 'NSValueTransformerName',+ 'NSWhoseSpecifier',+ 'NSWindows95OperatingSystem',+ 'NSWindowsCP1250StringEncoding',+ 'NSWindowsCP1251StringEncoding',+ 'NSWindowsCP1252StringEncoding',+ 'NSWindowsCP1253StringEncoding',+ 'NSWindowsCP1254StringEncoding',+ 'NSWindowsNTOperatingSystem',+ 'NSWrapCalendarComponents',+ 'NSWritingDirectionFormatType',+ 'NSXPCConnection',+ 'NSXPCConnectionErrorMaximum',+ 'NSXPCConnectionErrorMinimum',+ 'NSXPCConnectionInterrupted',+ 'NSXPCConnectionInvalid',+ 'NSXPCConnectionReplyInvalid',+ 'NSXPCInterface',+ 'NSXPCListener',+ 'NSXPCListenerDelegate',+ 'NSXPCListenerEndpoint',+ 'NSXPCProxyCreating',+ 'NS_BigEndian',+ 'NS_LittleEndian',+ 'NS_UnknownByteOrder',+ 'Name',+ 'NameStyle',+ 'NetService',+ 'NetServiceBrowser',+ 'NetServiceBrowserDelegate',+ 'NetServiceDelegate',+ 'NetworkServiceType',+ 'NetworkUnavailableReason',+ 'Never',+ 'NonConformingFloatDecodingStrategy',+ 'NonConformingFloatEncodingStrategy',+ 'Notification',+ 'NotificationCenter',+ 'NotificationCoalescing',+ 'NotificationQueue',+ 'NumberFormatter',+ 'NumberRepresentation',+ 'Numeric',+ 'NumericType',+ 'ObjectIdentifier',+ 'ObservableObject',+ 'OpaquePointer',+ 'OperatingSystemVersion',+ 'Operation',+ 'OperationQueue',+ 'Operator',+ 'OptionSet',+ 'Optional',+ 'Options',+ 'Output',+ 'OutputFormatting',+ 'OutputStream',+ 'POSIXError',+ 'PadPosition',+ 'ParseResult',+ 'Parser',+ 'PartialKeyPath',+ 'PartialRangeFrom',+ 'PartialRangeThrough',+ 'PartialRangeUpTo',+ 'Persistence',+ 'PersonNameComponents',+ 'PersonNameComponentsFormatter',+ 'Pipe',+ 'PlaygroundQuickLook',+ 'Pointee',+ 'Port',+ 'PortDelegate',+ 'PortMessage',+ 'PostingStyle',+ 'PreferredPresentationStyle',+ 'PrefixSequence',+ 'Process',+ 'ProcessInfo',+ 'Progress',+ 'ProgressKind',+ 'ProgressReporting',+ 'ProgressUserInfoKey',+ 'Properties',+ 'PropertyKey',+ 'PropertyListDecoder',+ 'PropertyListEncoder',+ 'PropertyListFormat',+ 'PropertyListSerialization',+ 'Published',+ 'Publisher',+ 'PublishingHandler',+ 'QualityOfService',+ 'QueuePriority',+ 'RandomAccessCollection',+ 'RandomNumberGenerator',+ 'Range',+ 'RangeExpression',+ 'RangeReplaceableCollection',+ 'RangeView',+ 'RawExponent',+ 'RawRepresentable',+ 'RawSignificand',+ 'RawValue',+ 'ReadOptions',+ 'ReadingOptions',+ 'RecoverableError',+ 'ReferenceConvertible',+ 'ReferenceType',+ 'ReferenceWritableKeyPath',+ 'Regions',+ 'RelativePosition',+ 'Repeated',+ 'RepeatedTimePolicy',+ 'ReplacingOptions',+ 'ResourceFetchType',+ 'ResponseDisposition',+ 'Result',+ 'ReverseParser',+ 'ReversedCollection',+ 'RoundingMode',+ 'RunLoop',+ 'SIMD',+ 'SIMD16',+ 'SIMD16Storage',+ 'SIMD2',+ 'SIMD2Storage',+ 'SIMD3',+ 'SIMD32',+ 'SIMD32Storage',+ 'SIMD4',+ 'SIMD4Storage',+ 'SIMD64',+ 'SIMD64Storage',+ 'SIMD8',+ 'SIMD8Storage',+ 'SIMDMask',+ 'SIMDMaskScalar',+ 'SIMDScalar',+ 'SIMDStorage',+ 'Scalar',+ 'Scanner',+ 'SchedulerOptions',+ 'SchedulerTimeType',+ 'SearchDirection',+ 'SearchOptions',+ 'SearchPathDirectory',+ 'SearchPathDomainMask',+ 'SendOptions',+ 'Sequence',+ 'Set',+ 'SetAlgebra',+ 'SetIndex',+ 'SetIterator',+ 'SignedInteger',+ 'SignedNumeric',+ 'SingleValueDecodingContainer',+ 'SingleValueEncodingContainer',+ 'Slice',+ 'SocketNativeHandle',+ 'SocketPort',+ 'SpellingState',+ 'State',+ 'StaticString',+ 'Status',+ 'StoragePolicy',+ 'Stream',+ 'StreamDelegate',+ 'StreamNetworkServiceTypeValue',+ 'StreamSOCKSProxyConfiguration',+ 'StreamSOCKSProxyVersion',+ 'StreamSocketSecurityLevel',+ 'Stride',+ 'StrideThrough',+ 'StrideThroughIterator',+ 'StrideTo',+ 'StrideToIterator',+ 'Strideable',+ 'String',+ 'StringEncodingDetectionOptionsKey',+ 'StringInterpolation',+ 'StringInterpolationProtocol',+ 'StringLiteralType',+ 'StringProtocol',+ 'StringTransform',+ 'Style',+ 'SubSequence',+ 'SubelementIdentifier',+ 'Substring',+ 'SuspensionBehavior',+ 'SuspensionID',+ 'SystemRandomNumberGenerator',+ 'TerminationReason',+ 'TestComparisonOperation',+ 'TextEffectStyle',+ 'TextLayoutSectionKey',+ 'TextOutputStream',+ 'TextOutputStreamable',+ 'ThermalState',+ 'Thread',+ 'TimeInterval',+ 'TimeZone',+ 'Timer',+ 'TimerPublisher',+ 'Tuple',+ 'UIItemProviderPresentationSizeProviding',+ 'UInt',+ 'UInt16',+ 'UInt32',+ 'UInt64',+ 'UInt8',+ 'URL',+ 'URLAuthenticationChallenge',+ 'URLAuthenticationChallengeSender',+ 'URLCache',+ 'URLComponents',+ 'URLCredential',+ 'URLCredentialStorage',+ 'URLError',+ 'URLFileProtection',+ 'URLFileResourceType',+ 'URLProtectionSpace',+ 'URLProtocol',+ 'URLProtocolClient',+ 'URLQueryItem',+ 'URLRelationship',+ 'URLRequest',+ 'URLResourceKey',+ 'URLResourceValues',+ 'URLResponse',+ 'URLSession',+ 'URLSessionConfiguration',+ 'URLSessionDataDelegate',+ 'URLSessionDataTask',+ 'URLSessionDelegate',+ 'URLSessionDownloadDelegate',+ 'URLSessionDownloadTask',+ 'URLSessionStreamDelegate',+ 'URLSessionStreamTask',+ 'URLSessionTask',+ 'URLSessionTaskDelegate',+ 'URLSessionTaskMetrics',+ 'URLSessionTaskTransactionMetrics',+ 'URLSessionUploadTask',+ 'URLSessionWebSocketDelegate',+ 'URLSessionWebSocketTask',+ 'URLThumbnailDictionaryItem',+ 'URLUbiquitousItemDownloadingStatus',+ 'URLUbiquitousSharedItemPermissions',+ 'URLUbiquitousSharedItemRole',+ 'UTF16',+ 'UTF16View',+ 'UTF32',+ 'UTF8',+ 'UTF8View',+ 'UUID',+ 'UnboundedRange',+ 'UnboundedRange_',+ 'UndoManager',+ 'UnfoldFirstSequence',+ 'UnfoldSequence',+ 'Unicode',+ 'UnicodeCodec',+ 'UnicodeDecodingResult',+ 'UnicodeScalar',+ 'UnicodeScalarIndex',+ 'UnicodeScalarLiteralType',+ 'UnicodeScalarType',+ 'UnicodeScalarView',+ 'Unit',+ 'UnitAcceleration',+ 'UnitAngle',+ 'UnitArea',+ 'UnitConcentrationMass',+ 'UnitConverter',+ 'UnitConverterLinear',+ 'UnitDispersion',+ 'UnitDuration',+ 'UnitElectricCharge',+ 'UnitElectricCurrent',+ 'UnitElectricPotentialDifference',+ 'UnitElectricResistance',+ 'UnitEnergy',+ 'UnitFrequency',+ 'UnitFuelEfficiency',+ 'UnitIlluminance',+ 'UnitLength',+ 'UnitMass',+ 'UnitOptions',+ 'UnitPower',+ 'UnitPressure',+ 'UnitSpeed',+ 'UnitStyle',+ 'UnitTemperature',+ 'UnitVolume',+ 'Units',+ 'UnitsStyle',+ 'UnkeyedDecodingContainer',+ 'UnkeyedEncodingContainer',+ 'Unmanaged',+ 'UnmountOptions',+ 'UnpublishingHandler',+ 'UnsafeBufferPointer',+ 'UnsafeMutableBufferPointer',+ 'UnsafeMutablePointer',+ 'UnsafeMutableRawBufferPointer',+ 'UnsafeMutableRawPointer',+ 'UnsafePointer',+ 'UnsafeRawBufferPointer',+ 'UnsafeRawPointer',+ 'UnsignedInteger',+ 'UserDefaults',+ 'UserInfoKey',+ 'Value',+ 'ValueTransformer',+ 'Values',+ 'Version',+ 'Void',+ 'VolumeEnumerationOptions',+ 'Words',+ 'WritableKeyPath',+ 'WriteOptions',+ 'WritingOptions',+ 'XMLDTD',+ 'XMLDTDNode',+ 'XMLDocument',+ 'XMLElement',+ 'XMLNode',+ 'XMLParser',+ 'XMLParserDelegate',+ 'ZeroFormattingBehavior',+ 'Zip2Sequence',+ '_AppendKeyPath',+ 'swift',+ 'unichar',+]);++class HighlightSwift extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['swift'] = HighlightSwift;diff --git a/llamafile/server/www/highlight_tcl.js b/llamafile/server/www/highlight_tcl.jsnew file mode 100644index 00000000..6a05a777--- /dev/null+++ b/llamafile/server/www/highlight_tcl.js@@ -0,0 +1,143 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const TCL_KEYWORDS = new Set([+ 'body',+ 'break',+ 'case',+ 'chain',+ 'class',+ 'configbody',+ 'constructor',+ 'continue',+ 'default',+ 'destructor',+ 'else',+ 'elseif',+ 'error',+ 'eval',+ 'exit',+ 'for',+ 'for_array_keys',+ 'for_file',+ 'for_recursive_glob',+ 'foreach',+ 'if',+ 'in',+ 'itcl_class',+ 'loop',+ 'method',+ 'proc',+ 'return',+ 'switch',+ 'then',+ 'uplevel',+ 'while',+]);++const TCL_BUILTINS = new Set([+ 'after',+ 'append',+ 'array',+ 'bgerror',+ 'binary',+ 'catch',+ 'cd',+ 'clock',+ 'close',+ 'concat',+ 'console',+ 'dde',+ 'encoding',+ 'eof',+ 'exec',+ 'expr',+ 'fblocked',+ 'fconfigure',+ 'fcopy',+ 'file',+ 'fileevent',+ 'flush',+ 'format',+ 'gets',+ 'glob',+ 'history',+ 'incr',+ 'info',+ 'interp',+ 'join',+ 'lappend',+ 'lindex',+ 'linsert',+ 'list',+ 'llength',+ 'load',+ 'lrange',+ 'lreplace',+ 'lsort',+ 'namespace',+ 'open',+ 'package',+ 'pid',+ 'puts',+ 'pwd',+ 'read',+ 'regexp',+ 'registry',+ 'regsub',+ 'rename',+ 'scan',+ 'seek',+ 'set',+ 'socket',+ 'source',+ 'split',+ 'string',+ 'subst',+ 'tell',+ 'time',+ 'trace',+ 'unknown',+ 'unset',+ 'vwait',+]);++const TCL_TYPES = new Set([+ 'common',+ 'global',+ 'inherit',+ 'itk_option',+ 'private',+ 'protected',+ 'public',+ 'upvar',+ 'variable',+]);++class HighlightTcl extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['tcl'] = HighlightTcl;diff --git a/llamafile/server/www/highlight_tex.js b/llamafile/server/www/highlight_tex.jsnew file mode 100644index 00000000..7d4398ef--- /dev/null+++ b/llamafile/server/www/highlight_tex.js@@ -0,0 +1,31 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++class HighlightTex extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['latex'] = HighlightTex;+Highlighter.REGISTRY['tex'] = HighlightTex;diff --git a/llamafile/server/www/highlight_txt.js b/llamafile/server/www/highlight_txt.jsnew file mode 100644index 00000000..79552117--- /dev/null+++ b/llamafile/server/www/highlight_txt.js@@ -0,0 +1,30 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++class HighlightTxt extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['txt'] = HighlightTxt;diff --git a/llamafile/server/www/highlight_typescript.js b/llamafile/server/www/highlight_typescript.jsnew file mode 100644index 00000000..f2fa2cbf--- /dev/null+++ b/llamafile/server/www/highlight_typescript.js@@ -0,0 +1,103 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const TYPESCRIPT_KEYWORDS = new Set([+ 'abstract',+ 'as',+ 'async',+ 'await',+ 'break',+ 'case',+ 'catch',+ 'class',+ 'const',+ 'continue',+ 'debugger',+ 'declare',+ 'default',+ 'delete',+ 'do',+ 'else',+ 'enum',+ 'export',+ 'extends',+ 'finally',+ 'for',+ 'from',+ 'function',+ 'get',+ 'if',+ 'implements',+ 'import',+ 'in',+ 'infer',+ 'instanceof',+ 'interface',+ 'is',+ 'keyof',+ 'let',+ 'namespace',+ 'new',+ 'of',+ 'private',+ 'protected',+ 'public',+ 'readonly',+ 'return',+ 'satisfies',+ 'set',+ 'static',+ 'switch',+ 'target',+ 'this',+ 'throw',+ 'try',+ 'type',+ 'typeof',+ 'var',+ 'while',+ 'with',+ 'yield',+]);++const TYPESCRIPT_TYPES = new Set([+ 'any',+ 'bigint',+ 'boolean',+ 'never',+ 'number',+ 'object',+ 'string',+ 'symbol',+ 'unknown',+ 'void',+]);++class HighlightTypescript extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['typescript'] = HighlightTypescript;+Highlighter.REGISTRY['ts'] = HighlightTypescript;diff --git a/llamafile/server/www/highlight_zig.js b/llamafile/server/www/highlight_zig.jsnew file mode 100644index 00000000..91d0abbf--- /dev/null+++ b/llamafile/server/www/highlight_zig.js@@ -0,0 +1,295 @@+// Copyright 2024 Mozilla Foundation+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.++const ZIG_KEYWORDS = new Set([+ 'addrspace',+ 'align',+ 'allowzero',+ 'and',+ 'anyframe',+ 'anytype',+ 'asm',+ 'async',+ 'await',+ 'break',+ 'callconv',+ 'catch',+ 'comptime',+ 'const',+ 'continue',+ 'defer',+ 'else',+ 'enum',+ 'errdefer',+ 'error',+ 'export',+ 'extern',+ 'fn',+ 'for',+ 'if',+ 'inline',+ 'linksection',+ 'noalias',+ 'noinline',+ 'nosuspend',+ 'opaque',+ 'or',+ 'orelse',+ 'packed',+ 'pub',+ 'resume',+ 'return',+ 'struct',+ 'suspend',+ 'switch',+ 'test',+ 'threadlocal',+ 'try',+ 'union',+ 'unreachable',+ 'usingnamespace',+ 'var',+ 'volatile',+ 'while',+]);++const ZIG_BUILTINS = new Set([+ '@abs',+ '@addrSpaceCast',+ '@addWithOverflow',+ '@alignCast',+ '@alignOf',+ '@ArgType',+ '@as',+ '@atomicLoad',+ '@atomicRmw',+ '@atomicStore',+ '@bitCast',+ '@bitOffsetOf',+ '@bitreverse',+ '@bitReverse',+ '@bitSizeOf',+ '@boolToInt',+ '@branchHint',+ '@breakpoint',+ '@bswap',+ '@byteOffsetOf',+ '@bytesToSlice',+ '@byteSwap',+ '@call',+ '@cDefine',+ '@ceil',+ '@cImport',+ '@cInclude',+ '@clz',+ '@cmpxchgStrong',+ '@cmpxchgWeak',+ '@compileError',+ '@compileLog',+ '@constCast',+ '@cos',+ '@ctz',+ '@cUndef',+ '@cVaArg',+ '@cVaCopy',+ '@cVaEnd',+ '@cVaStart',+ '@divExact',+ '@divFloor',+ '@divTrunc',+ '@embedFile',+ '@enumFromInt',+ '@enumToInt',+ '@errorCast',+ '@errorFromInt',+ '@errorName',+ '@errorReturnTrace',+ '@errorToInt',+ '@errSetCast',+ '@exp',+ '@exp2',+ '@export',+ '@extern',+ '@fence',+ '@field',+ '@fieldParentPtr',+ '@FieldType',+ '@floatCast',+ '@floatFromInt',+ '@floatToInt',+ '@floor',+ '@frameAddress',+ '@handle',+ '@hasDecl',+ '@hasField',+ '@import',+ '@inComptime',+ '@inlineCall',+ '@intCast',+ '@intFromBool',+ '@intFromEnum',+ '@intFromError',+ '@intFromFloat',+ '@intFromPtr',+ '@intToEnum',+ '@intToError',+ '@intToFloat',+ '@intToPtr',+ '@IntType',+ '@log',+ '@log10',+ '@log2',+ '@max',+ '@memberCount',+ '@memberName',+ '@memberType',+ '@memcpy',+ '@memset',+ '@min',+ '@mod',+ '@mulAdd',+ '@mulWithOverflow',+ '@newStackCall',+ '@noInlineCall',+ '@offsetOf',+ '@OpaqueType',+ '@panic',+ '@popCount',+ '@prefetch',+ '@ptrCast',+ '@ptrFromInt',+ '@ptrToInt',+ '@reduce',+ '@rem',+ '@returnAddress',+ '@round',+ '@select',+ '@setAlignStack',+ '@setCold',+ '@setEvalBranchQuota',+ '@setFloatMode',+ '@setGlobalLinkage',+ '@setRuntimeSafety',+ '@shlExact',+ '@shlWithOverflow',+ '@shrExact',+ '@shuffle',+ '@sin',+ '@sizeOf',+ '@sliceToBytes',+ '@splat',+ '@sqrt',+ '@src',+ '@subWithOverflow',+ '@tagName',+ '@TagType',+ '@tan',+ '@This',+ '@trap',+ '@trunc',+ '@truncate',+ '@Type',+ '@typeId',+ '@typeInfo',+ '@typeName',+ '@typeOf',+ '@TypeOf',+ '@unionInit',+ '@Vector',+ '@volatileCast',+ '@wasmMemoryGrow',+ '@wasmMemorySize',+ '@workGroupId',+ '@workGroupSize',+ '@workItemId',+]);++const ZIG_CONSTANTS = new Set([+ 'false',+ 'null',+ 'true',+ 'undefined',+]);++const ZIG_TYPES = new Set([+ 'anyerror',+ 'anyframe',+ 'anyopaque',+ 'anytype',+ 'bool',+ 'c_char',+ 'c_int',+ 'c_long',+ 'c_longdouble',+ 'c_longlong',+ 'c_short',+ 'c_uint',+ 'c_ulong',+ 'c_ulonglong',+ 'c_ushort',+ 'comptime_float',+ 'comptime_int',+ 'error',+ 'f128',+ 'f16',+ 'f32',+ 'f64',+ 'f80',+ 'i128',+ 'i16',+ 'i2',+ 'i29',+ 'i3',+ 'i32',+ 'i4',+ 'i5',+ 'i6',+ 'i64',+ 'i7',+ 'i8',+ 'isize',+ 'noreturn',+ 'type',+ 'u128',+ 'u16',+ 'u2',+ 'u29',+ 'u3',+ 'u32',+ 'u4',+ 'u5',+ 'u6',+ 'u64',+ 'u7',+ 'u8',+ 'usize',+ 'void',+]);++class HighlightZig extends Highlighter {++ constructor(delegate) {+ super(delegate);+ }++ feed(input) {+ this.append(input);+ }++ flush() {+ this.delegate.flush();+ }+}++Highlighter.REGISTRY['zig'] = HighlightZig;diff --git a/llamafile/server/www/index.html b/llamafile/server/www/index.htmlindex f531ab11..949759b0 100644--- a/llamafile/server/www/index.html+++ b/llamafile/server/www/index.html@@ -4,6 +4,7 @@<meta name="viewport" content="width=device-width, initial-scale=1.0"><title>llamafile</title><link rel="stylesheet" href="chatbot.css">+<link rel="stylesheet" href="highlight.css"><div class="chat-container"><div class="chat-header">@@ -27,4 +28,51 @@<button class="send-button" id="send-button">Send</button></div></div>++<script src="ctype.js"></script>+<script src="highlight.js"></script>+<script src="highlight_txt.js"></script>+<script src="highlight_markdown.js"></script>+<script src="highlight_cpp.js"></script>+<script src="highlight_c.js"></script>+<script src="highlight_d.js"></script>+<script src="highlight_cxx.js"></script>+<script src="highlight_ada.js"></script>+<script src="highlight_asm.js"></script>+<script src="highlight_basic.js"></script>+<script src="highlight_cobol.js"></script>+<script src="highlight_csharp.js"></script>+<script src="highlight_css.js"></script>+<script src="highlight_forth.js"></script>+<script src="highlight_fortran.js"></script>+<script src="highlight_go.js"></script>+<script src="highlight_haskell.js"></script>+<script src="highlight_html.js"></script>+<script src="highlight_java.js"></script>+<script src="highlight_js.js"></script>+<script src="highlight_julia.js"></script>+<script src="highlight_kotlin.js"></script>+<script src="highlight_ld.js"></script>+<script src="highlight_lisp.js"></script>+<script src="highlight_lua.js"></script>+<script src="highlight_m4.js"></script>+<script src="highlight_make.js"></script>+<script src="highlight_matlab.js"></script>+<script src="highlight_ocaml.js"></script>+<script src="highlight_pascal.js"></script>+<script src="highlight_perl.js"></script>+<script src="highlight_php.js"></script>+<script src="highlight_python.js"></script>+<script src="highlight_r.js"></script>+<script src="highlight_ruby.js"></script>+<script src="highlight_rust.js"></script>+<script src="highlight_scala.js"></script>+<script src="highlight_shell.js"></script>+<script src="highlight_sql.js"></script>+<script src="highlight_swift.js"></script>+<script src="highlight_tcl.js"></script>+<script src="highlight_tex.js"></script>+<script src="highlight_typescript.js"></script>+<script src="highlight_zig.js"></script>+<script src="chatbot.js"></script>