Distribute and run LLMs with a single file.
C++ cross-platformggufllama-cpplocal-ailocal-inferencelocal-llmopen-source-aisingle-file-executablespeech-to-text
Fix JS regex highlighting issue
Justine Tunneyf5a0bd4f32c1
diff --git a/llamafile/highlight_js.cpp b/llamafile/highlight_js.cppindex 93661962..28bde7ef 100644--- a/llamafile/highlight_js.cpp+++ b/llamafile/highlight_js.cpp@@ -114,6 +114,9 @@ void HighlightJs::feed(std::string *r, std::string_view input) {} else if (c == ')' || c == '}' || c == ']') {expect_ = EXPECT_OPERATOR;lf::append_wchar(r, c);+ } else if (isdigit(c) || c == '.') {+ expect_ = EXPECT_OPERATOR;+ lf::append_wchar(r, c);} else if (ispunct(c)) {expect_ = EXPECT_VALUE;lf::append_wchar(r, c);diff --git a/llamafile/highlight_perl.cpp b/llamafile/highlight_perl.cppindex 2bfbc4fd..5fce0007 100644--- a/llamafile/highlight_perl.cpp+++ b/llamafile/highlight_perl.cpp@@ -236,7 +236,7 @@ void HighlightPerl::feed(std::string *r, std::string_view input) {} else if (ispunct(c)) {expect_ = EXPECT_VALUE;lf::append_wchar(r, c);- } else if (isdigit(c)) {+ } else if (isdigit(c) || c == '.') {expect_ = EXPECT_OPERATOR;lf::append_wchar(r, c);} else {diff --git a/llamafile/highlight_typescript.cpp b/llamafile/highlight_typescript.cppindex 653cda2f..c95ecbee 100644--- a/llamafile/highlight_typescript.cpp+++ b/llamafile/highlight_typescript.cpp@@ -111,7 +111,7 @@ void HighlightTypescript::feed(std::string *r, std::string_view input) {} else if (ispunct(c)) {expect_ = EXPECT_VALUE;lf::append_wchar(r, c);- } else if (isdigit(c)) {+ } else if (isdigit(c) || c == '.') {expect_ = EXPECT_OPERATOR;lf::append_wchar(r, c);} else {