Skip to content

Distribute and run LLMs with a single file.

Add BASIC syntax highlighting

Justine Tunneye17a6de471f2
diff --git a/llamafile/high.cpp b/llamafile/high.cpp
index 77fbd0a0..9c2e9d78 100644
--- a/llamafile/high.cpp
+++ b/llamafile/high.cpp
@@ -16,6 +16,7 @@
// limitations under the License.
#include "highlight.h"
+#include "string.h"
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -47,13 +48,6 @@ static std::string extname(const std::string_view path) {
return std::string(name.substr(dot_pos + 1));
}
-std::string tolower(const std::string_view &s) {
- std::string b;
- for (char c : s)
- b += tolower(c);
- return b;
-}
-
int main(int argc, char *argv[]) {
// process flags
diff --git a/llamafile/highlight.cpp b/llamafile/highlight.cpp
index 11fe2934..4f543508 100644
--- a/llamafile/highlight.cpp
+++ b/llamafile/highlight.cpp
@@ -178,5 +178,15 @@ Highlight *Highlight::create(const std::string_view &lang) {
lang == "gmakefile")
return new HighlightMake;
+ if (lang == "vb" || //
+ lang == "vba" || //
+ lang == "vbs" || //
+ lang == "bas" || //
+ lang == "basic" || //
+ lang == "vb.net" || //
+ lang == "qbasic" || //
+ lang == "freebasic")
+ return new HighlightBasic;
+
return nullptr;
}
diff --git a/llamafile/highlight.h b/llamafile/highlight.h
index 66c9556f..e9930137 100644
--- a/llamafile/highlight.h
+++ b/llamafile/highlight.h
@@ -48,6 +48,8 @@
#define HI_QUALIFIER "\033[35m" // magenta
#define HI_IMMEDIATE "\033[36m" // cyan
#define HI_REGISTER "\033[1;35m" // bold magenta
+#define HI_DATE "\033[33m" // yellow
+#define HI_DIRECTIVE "\033[1;31m" // bold red
typedef const char *is_keyword_f(const char *, size_t);
@@ -114,6 +116,10 @@ is_keyword_f is_keyword_make;
is_keyword_f is_keyword_make_builtin;
is_keyword_f is_keyword_asm_prefix;
is_keyword_f is_keyword_asm_qualifier;
+is_keyword_f is_keyword_basic;
+is_keyword_f is_keyword_basic_type;
+is_keyword_f is_keyword_basic_builtin;
+is_keyword_f is_keyword_basic_constant;
}
class Highlight {
@@ -555,3 +561,16 @@ class HighlightAsm : public Highlight {
bool is_first_thing_on_line_ = true;
std::string word_;
};
+
+class HighlightBasic : public Highlight {
+ public:
+ HighlightBasic();
+ ~HighlightBasic() override;
+ void feed(std::string *result, std::string_view input) override;
+ void flush(std::string *result) override;
+
+ private:
+ int t_ = 0;
+ bool bol_ = true;
+ std::string word_;
+};
diff --git a/llamafile/highlight_ada.cpp b/llamafile/highlight_ada.cpp
index 47c1ce6e..6f157b59 100644
--- a/llamafile/highlight_ada.cpp
+++ b/llamafile/highlight_ada.cpp
@@ -92,12 +92,10 @@ void HighlightAda::feed(std::string *r, std::string_view input) {
break;
case COMMENT:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_asm.cpp b/llamafile/highlight_asm.cpp
index 8a3f07ab..6e098022 100644
--- a/llamafile/highlight_asm.cpp
+++ b/llamafile/highlight_asm.cpp
@@ -362,16 +362,6 @@ void HighlightAsm::feed(std::string *r, std::string_view input) {
}
break;
- case SLASH_SLASH:
- if (c == '\n') {
- *r += HI_RESET;
- append_wchar(r, c);
- t_ = NORMAL;
- } else {
- append_wchar(r, c);
- }
- break;
-
case SLASH_STAR:
append_wchar(r, c);
if (c == '*')
@@ -390,12 +380,11 @@ void HighlightAsm::feed(std::string *r, std::string_view input) {
Comment:
case COMMENT:
+ case SLASH_SLASH:
+ append_wchar(r, c);
if (c == '\n') {
*r += HI_RESET;
- *r += '\n';
t_ = NORMAL;
- } else {
- append_wchar(r, c);
}
break;
diff --git a/llamafile/highlight_basic.cpp b/llamafile/highlight_basic.cpp
new file mode 100644
index 00000000..3701ce6d
--- /dev/null
+++ b/llamafile/highlight_basic.cpp
@@ -0,0 +1,198 @@
+// -*- 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.
+
+#include "highlight.h"
+#include "string.h"
+#include <ctype.h>
+
+// beginner's all-purpose symbolic instruction code
+//
+// this syntax highlighter aims to support a blended dialect of
+//
+// - basic
+// - visual basic
+// - visual basic .net
+//
+// doing that requires extra keywords
+
+enum {
+ NORMAL,
+ WORD,
+ LINENO,
+ DQUOTE,
+ COMMENT,
+ DIRECTIVE,
+};
+
+HighlightBasic::HighlightBasic() {
+}
+
+HighlightBasic::~HighlightBasic() {
+}
+
+void HighlightBasic::feed(std::string *r, std::string_view input) {
+ int c;
+ for (size_t i = 0; i < input.size(); ++i) {
+ c = input[i] & 255;
+ switch (t_) {
+
+ Normal:
+ case NORMAL:
+ if (!isascii(c) || isalpha(c) || c == '_') {
+ t_ = WORD;
+ word_ += c;
+ } else if (c == '\'') {
+ t_ = COMMENT;
+ *r += HI_COMMENT;
+ *r += '\'';
+ } else if (c == '"') {
+ t_ = DQUOTE;
+ *r += HI_STRING;
+ *r += '"';
+ } else if (c == '#' && bol_) {
+ t_ = DIRECTIVE;
+ *r += HI_DIRECTIVE;
+ *r += '#';
+ } else if (isdigit(c) && bol_) {
+ *r += HI_LINENO;
+ *r += c;
+ t_ = LINENO;
+ } else {
+ *r += c;
+ }
+ break;
+
+ case WORD:
+ if (!isascii(c) || isalnum(c) || c == '_') {
+ word_ += c;
+ } else {
+ if (is_keyword_basic(word_.data(), word_.size())) {
+ if (tolower(word_) == "rem") {
+ *r += HI_COMMENT;
+ *r += word_;
+ t_ = COMMENT;
+ word_.clear();
+ goto Comment;
+ } else {
+ *r += HI_KEYWORD;
+ *r += word_;
+ *r += HI_RESET;
+ }
+ } else if (is_keyword_basic_type(word_.data(), word_.size())) {
+ *r += HI_TYPE;
+ *r += word_;
+ *r += HI_RESET;
+ } else if (is_keyword_basic_builtin(word_.data(), word_.size())) {
+ *r += HI_BUILTIN;
+ *r += word_;
+ *r += HI_RESET;
+ } else if (is_keyword_basic_constant(word_.data(), word_.size())) {
+ *r += HI_CONSTANT;
+ *r += word_;
+ *r += HI_RESET;
+ } else {
+ *r += word_;
+ }
+ word_.clear();
+ t_ = NORMAL;
+ goto Normal;
+ }
+ break;
+
+ case DQUOTE:
+ *r += c;
+ if (c == '"' || c == '\n') {
+ *r += HI_RESET;
+ t_ = NORMAL;
+ }
+ break;
+
+ case LINENO:
+ if (isdigit(c)) {
+ *r += c;
+ } else {
+ *r += HI_RESET;
+ t_ = NORMAL;
+ goto Normal;
+ }
+ break;
+
+ Comment:
+ case COMMENT:
+ case DIRECTIVE:
+ *r += c;
+ if (c == '\n') {
+ *r += HI_RESET;
+ t_ = NORMAL;
+ } else {
+ }
+ break;
+
+ default:
+ __builtin_unreachable();
+ }
+ if (bol_) {
+ if (!isspace(c))
+ bol_ = false;
+ } else {
+ if (c == '\n')
+ bol_ = true;
+ }
+ }
+}
+
+void HighlightBasic::flush(std::string *r) {
+ switch (t_) {
+ case WORD:
+ if (is_keyword_basic(word_.data(), word_.size())) {
+ if (tolower(word_) == "rem") {
+ *r += HI_KEYWORD;
+ *r += word_;
+ *r += HI_RESET;
+ } else {
+ *r += HI_KEYWORD;
+ *r += word_;
+ *r += HI_RESET;
+ }
+ } else if (is_keyword_basic_type(word_.data(), word_.size())) {
+ *r += HI_TYPE;
+ *r += word_;
+ *r += HI_RESET;
+ } else if (is_keyword_basic_builtin(word_.data(), word_.size())) {
+ *r += HI_BUILTIN;
+ *r += word_;
+ *r += HI_RESET;
+ } else if (is_keyword_basic_constant(word_.data(), word_.size())) {
+ *r += HI_CONSTANT;
+ *r += word_;
+ *r += HI_RESET;
+ } else {
+ *r += word_;
+ }
+ word_.clear();
+ break;
+ case LINENO:
+ case DQUOTE:
+ case COMMENT:
+ case DIRECTIVE:
+ *r += HI_RESET;
+ break;
+ default:
+ break;
+ }
+ t_ = NORMAL;
+}
diff --git a/llamafile/highlight_c.cpp b/llamafile/highlight_c.cpp
index 6047f297..9652ef4e 100644
--- a/llamafile/highlight_c.cpp
+++ b/llamafile/highlight_c.cpp
@@ -165,12 +165,10 @@ void HighlightC::feed(std::string *r, std::string_view input) {
break;
case SLASH_SLASH:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_c_test.cpp b/llamafile/highlight_c_test.cpp
index e4cdc2c4..227baf46 100644
--- a/llamafile/highlight_c_test.cpp
+++ b/llamafile/highlight_c_test.cpp
@@ -57,7 +57,7 @@ int main(int argc, char *argv[]) {
test("", "");
test("vola", "");
test("tile ", ""s + HI_KEYWORD + "volatile" + HI_RESET + " ");
- test("yo // hi\nthere ", "yo "s + HI_COMMENT + "// hi" + HI_RESET + "\nthere ");
+ test("yo // hi\nthere ", "yo "s + HI_COMMENT + "// hi\n" + HI_RESET + "there ");
testf("// sup", ""s + HI_COMMENT + "// sup" + HI_RESET);
test("yo /* hi */ there ", "yo "s + HI_COMMENT + "/* hi */" + HI_RESET + " there ");
testf("yo /* hi */ there", "yo "s + HI_COMMENT + "/* hi */" + HI_RESET + " there");
diff --git a/llamafile/highlight_cobol.cpp b/llamafile/highlight_cobol.cpp
index 3ff29382..ae45317e 100644
--- a/llamafile/highlight_cobol.cpp
+++ b/llamafile/highlight_cobol.cpp
@@ -19,6 +19,8 @@
#include <ctype.h>
+// COmmon Business-Oriented Language
+
enum {
NORMAL,
WORD,
@@ -115,12 +117,10 @@ void HighlightCobol::feed(std::string *r, std::string_view input) {
break;
case COMMENT:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_csharp.cpp b/llamafile/highlight_csharp.cpp
index 88e89c4b..2e84ca6c 100644
--- a/llamafile/highlight_csharp.cpp
+++ b/llamafile/highlight_csharp.cpp
@@ -124,12 +124,10 @@ void HighlightCsharp::feed(std::string *r, std::string_view input) {
break;
case SLASH_SLASH:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_fortran.cpp b/llamafile/highlight_fortran.cpp
index 12322c20..d7284b4f 100644
--- a/llamafile/highlight_fortran.cpp
+++ b/llamafile/highlight_fortran.cpp
@@ -123,12 +123,10 @@ void HighlightFortran::feed(std::string *r, std::string_view input) {
break;
case COMMENT:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_go.cpp b/llamafile/highlight_go.cpp
index 64aa5612..0686edf2 100644
--- a/llamafile/highlight_go.cpp
+++ b/llamafile/highlight_go.cpp
@@ -109,12 +109,10 @@ void HighlightGo::feed(std::string *r, std::string_view input) {
break;
case SLASH_SLASH:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_haskell.cpp b/llamafile/highlight_haskell.cpp
index 1120b122..212d51b8 100644
--- a/llamafile/highlight_haskell.cpp
+++ b/llamafile/highlight_haskell.cpp
@@ -185,12 +185,10 @@ void HighlightHaskell::feed(std::string *r, std::string_view input) {
break;
case HYPHEN_HYPHEN:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_java.cpp b/llamafile/highlight_java.cpp
index 545ae481..fd14dbeb 100644
--- a/llamafile/highlight_java.cpp
+++ b/llamafile/highlight_java.cpp
@@ -111,12 +111,10 @@ void HighlightJava::feed(std::string *r, std::string_view input) {
break;
case SLASH_SLASH:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += '\n';
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_js.cpp b/llamafile/highlight_js.cpp
index fa4d236a..7d40a477 100644
--- a/llamafile/highlight_js.cpp
+++ b/llamafile/highlight_js.cpp
@@ -152,12 +152,10 @@ void HighlightJs::feed(std::string *r, std::string_view input) {
break;
case SLASH_SLASH:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_lisp.cpp b/llamafile/highlight_lisp.cpp
index abcc9f6e..c9ed8eea 100644
--- a/llamafile/highlight_lisp.cpp
+++ b/llamafile/highlight_lisp.cpp
@@ -118,12 +118,10 @@ void HighlightLisp::feed(std::string *r, std::string_view input) {
break;
case COMMENT:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_lua.cpp b/llamafile/highlight_lua.cpp
index fa95127b..07488a43 100644
--- a/llamafile/highlight_lua.cpp
+++ b/llamafile/highlight_lua.cpp
@@ -109,12 +109,10 @@ void HighlightLua::feed(std::string *r, std::string_view input) {
break;
case COMMENT:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_m4.cpp b/llamafile/highlight_m4.cpp
index 06f323b1..7dbc1942 100644
--- a/llamafile/highlight_m4.cpp
+++ b/llamafile/highlight_m4.cpp
@@ -94,12 +94,10 @@ void HighlightM4::feed(std::string *r, std::string_view input) {
Comment:
case COMMENT:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += '\n';
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_make.cpp b/llamafile/highlight_make.cpp
index 702f8e2c..152aae78 100644
--- a/llamafile/highlight_make.cpp
+++ b/llamafile/highlight_make.cpp
@@ -182,12 +182,10 @@ void HighlightMake::feed(std::string *r, std::string_view input) {
break;
case COMMENT:
+ append_wchar(r, c);
if (c == '\n') {
*r += HI_RESET;
- *r += '\n';
t_ = NORMAL;
- } else {
- append_wchar(r, c);
}
break;
diff --git a/llamafile/highlight_pascal.cpp b/llamafile/highlight_pascal.cpp
index f9c33e33..eceb3535 100644
--- a/llamafile/highlight_pascal.cpp
+++ b/llamafile/highlight_pascal.cpp
@@ -19,6 +19,15 @@
#include <ctype.h>
+// syntax highlighting for pascal (european c)
+//
+// this syntax highlighter aims to support a blended dialect of
+//
+// - pascal
+// - delphi
+//
+// doing that requires extra keywords
+
enum {
NORMAL,
WORD,
@@ -73,7 +82,7 @@ void HighlightPascal::feed(std::string *r, std::string_view input) {
Word:
case WORD:
- if (!isascii(c) || isalpha(c) || isdigit(c) || c == '_') {
+ if (!isascii(c) || isalnum(c) || c == '_') {
word_ += c;
} else {
if (is_keyword_pascal(word_.data(), word_.size())) {
@@ -110,12 +119,10 @@ void HighlightPascal::feed(std::string *r, std::string_view input) {
break;
case SLASH_SLASH:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_perl.cpp b/llamafile/highlight_perl.cpp
index 9c3f4c1a..1c5cf356 100644
--- a/llamafile/highlight_perl.cpp
+++ b/llamafile/highlight_perl.cpp
@@ -311,12 +311,10 @@ void HighlightPerl::feed(std::string *r, std::string_view input) {
break;
case COMMENT:
+ append_wchar(r, c);
if (c == '\n') {
*r += HI_RESET;
- append_wchar(r, c);
t_ = NORMAL;
- } else {
- append_wchar(r, c);
}
break;
diff --git a/llamafile/highlight_php.cpp b/llamafile/highlight_php.cpp
index 564ab7d6..b5eb699b 100644
--- a/llamafile/highlight_php.cpp
+++ b/llamafile/highlight_php.cpp
@@ -123,12 +123,10 @@ void HighlightPhp::feed(std::string *r, std::string_view input) {
break;
case SLASH_SLASH:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_python.cpp b/llamafile/highlight_python.cpp
index 61582909..54ec6e0f 100644
--- a/llamafile/highlight_python.cpp
+++ b/llamafile/highlight_python.cpp
@@ -94,12 +94,10 @@ void HighlightPython::feed(std::string *r, std::string_view input) {
break;
case COM:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_python_test.cpp b/llamafile/highlight_python_test.cpp
index 143bb8b9..0c5f0787 100644
--- a/llamafile/highlight_python_test.cpp
+++ b/llamafile/highlight_python_test.cpp
@@ -57,7 +57,7 @@ int main(int argc, char *argv[]) {
test("", "");
test("d", "");
test("ef ", ""s + HI_KEYWORD + "def" + HI_RESET + " ");
- test("yo # hi\nthere ", "yo "s + HI_COMMENT + "# hi" + HI_RESET + "\nthere ");
+ test("yo # hi\nthere ", "yo "s + HI_COMMENT + "# hi\n" + HI_RESET + "there ");
testf("# sup", ""s + HI_COMMENT + "# sup" + HI_RESET);
testf("de", "de");
testf("def", ""s + HI_KEYWORD + "def" + HI_RESET);
diff --git a/llamafile/highlight_ruby.cpp b/llamafile/highlight_ruby.cpp
index 82a8bed7..49101efa 100644
--- a/llamafile/highlight_ruby.cpp
+++ b/llamafile/highlight_ruby.cpp
@@ -409,12 +409,10 @@ void HighlightRuby::feed(std::string *r, std::string_view input) {
break;
case COMMENT:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_rust.cpp b/llamafile/highlight_rust.cpp
index 5d7640b1..20bd8076 100644
--- a/llamafile/highlight_rust.cpp
+++ b/llamafile/highlight_rust.cpp
@@ -117,12 +117,10 @@ void HighlightRust::feed(std::string *r, std::string_view input) {
break;
case SLASH_SLASH:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_shell.cpp b/llamafile/highlight_shell.cpp
index 303291c8..ba72ec29 100644
--- a/llamafile/highlight_shell.cpp
+++ b/llamafile/highlight_shell.cpp
@@ -173,12 +173,10 @@ void HighlightShell::feed(std::string *r, std::string_view input) {
break;
case COMMENT:
+ append_wchar(r, c);
if (c == '\n') {
*r += HI_RESET;
- append_wchar(r, c);
t_ = NORMAL;
- } else {
- append_wchar(r, c);
}
break;
diff --git a/llamafile/highlight_sql.cpp b/llamafile/highlight_sql.cpp
index f4ee8015..c3bccd8b 100644
--- a/llamafile/highlight_sql.cpp
+++ b/llamafile/highlight_sql.cpp
@@ -156,12 +156,10 @@ void HighlightSql::feed(std::string *r, std::string_view input) {
break;
case HYPHEN_HYPHEN:
+ *r += c;
if (c == '\n') {
*r += HI_RESET;
- *r += c;
t_ = NORMAL;
- } else {
- *r += c;
}
break;
diff --git a/llamafile/highlight_tcl.cpp b/llamafile/highlight_tcl.cpp
index ccaa0788..47a7b164 100644
--- a/llamafile/highlight_tcl.cpp
+++ b/llamafile/highlight_tcl.cpp
@@ -146,12 +146,10 @@ void HighlightTcl::feed(std::string *r, std::string_view input) {
break;
case COMMENT:
+ append_wchar(r, c);
if (c == '\n') {
*r += HI_RESET;
- append_wchar(r, c);
t_ = NORMAL;
- } else {
- append_wchar(r, c);
}
break;
diff --git a/llamafile/highlight_test.cpp b/llamafile/highlight_test.cpp
index f4229900..9b58676f 100644
--- a/llamafile/highlight_test.cpp
+++ b/llamafile/highlight_test.cpp
@@ -30,6 +30,7 @@
const char *const kLanguages[] = {
"ada", //
"asm", //
+ "basic", //
"c", //
"c#", //
"c++", //
@@ -65,21 +66,11 @@ const char *const kLanguages[] = {
"zig", //
};
-int rand32(void) {
- /* Knuth, D.E., "The Art of Computer Programming," Vol 2,
- Seminumerical Algorithms, Third Edition, Addison-Wesley, 1998,
- p. 106 (line 26) & p. 108 */
- static unsigned long long lcg = 1;
- lcg *= 6364136223846793005;
- lcg += 1442695040888963407;
- return lcg >> 32;
-}
-
std::string generate_random_string(int n) {
std::string s;
s.reserve(n);
for (int i = 0; i < n; ++i)
- s += CHARSET[rand32() % (sizeof(CHARSET) - 1)];
+ s += CHARSET[rand() % (sizeof(CHARSET) - 1)];
return s;
}
diff --git a/llamafile/highlight_zig.cpp b/llamafile/highlight_zig.cpp
index 1f21d378..483e1d72 100644
--- a/llamafile/highlight_zig.cpp
+++ b/llamafile/highlight_zig.cpp
@@ -121,13 +121,12 @@ void HighlightZig::feed(std::string *r, std::string_view input) {
}
break;
+ case SLASH_SLASH:
case BACKSLASH_BACKSLASH:
+ append_wchar(r, c);
if (c == '\n') {
*r += HI_RESET;
- append_wchar(r, c);
t_ = NORMAL;
- } else {
- append_wchar(r, c);
}
break;
@@ -143,16 +142,6 @@ void HighlightZig::feed(std::string *r, std::string_view input) {
}
break;
- case SLASH_SLASH:
- if (c == '\n') {
- *r += HI_RESET;
- append_wchar(r, c);
- t_ = NORMAL;
- } else {
- append_wchar(r, c);
- }
- break;
-
case QUOTE:
append_wchar(r, c);
if (c == '\'') {
diff --git a/llamafile/is_keyword_basic.c b/llamafile/is_keyword_basic.c
new file mode 100644
index 00000000..8925a05a
--- /dev/null
+++ b/llamafile/is_keyword_basic.c
@@ -0,0 +1,699 @@
+/* ANSI-C code produced by gperf version 3.1 */
+/* Command-line: gperf --output-file=llamafile/is_keyword_basic.c llamafile/is_keyword_basic.gperf */
+/* Computed positions: -k'1-3,5' */
+
+#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
+ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
+ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
+ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
+ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
+ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
+ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
+ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
+ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
+ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
+ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
+ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
+ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
+ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
+ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
+ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
+ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
+ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
+ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
+ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
+ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
+ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
+/* The character set is not based on ISO-646. */
+#error "gperf generated tables don't work with this execution character set. Please report a bug to <[email protected]>."
+#endif
+
+#line 1 "llamafile/is_keyword_basic.gperf"
+
+#include <string.h>
+#include <libc/str/tab.h>
+#define GPERF_DOWNCASE
+
+#define TOTAL_KEYWORDS 145
+#define MIN_WORD_LENGTH 2
+#define MAX_WORD_LENGTH 15
+#define MIN_HASH_VALUE 2
+#define MAX_HASH_VALUE 415
+/* maximum key range = 414, duplicates = 0 */
+
+#ifndef GPERF_DOWNCASE
+#define GPERF_DOWNCASE 1
+static unsigned char gperf_downcase[256] =
+ {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
+ 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
+ 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
+ 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
+ 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
+ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+ 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
+ 255
+ };
+#endif
+
+#ifndef GPERF_CASE_STRNCMP
+#define GPERF_CASE_STRNCMP 1
+static int
+gperf_case_strncmp (register const char *s1, register const char *s2, register size_t n)
+{
+ for (; n > 0;)
+ {
+ unsigned char c1 = gperf_downcase[(unsigned char)*s1++];
+ unsigned char c2 = gperf_downcase[(unsigned char)*s2++];
+ if (c1 != 0 && c1 == c2)
+ {
+ n--;
+ continue;
+ }
+ return (int)c1 - (int)c2;
+ }
+ return 0;
+}
+#endif
+
+#ifdef __GNUC__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static unsigned int
+hash (register const char *str, register size_t len)
+{
+ static const unsigned short asso_values[] =
+ {
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 45, 95, 120, 35, 5,
+ 45, 90, 65, 5, 0, 0, 175, 35, 10, 0,
+ 70, 416, 0, 25, 5, 50, 45, 210, 5, 125,
+ 0, 416, 416, 416, 416, 416, 416, 45, 95, 120,
+ 35, 5, 45, 90, 65, 5, 0, 0, 175, 35,
+ 10, 0, 70, 416, 0, 25, 5, 50, 45, 210,
+ 5, 125, 0, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+ 416, 416, 416, 416, 416, 416, 416
+ };
+ register unsigned int hval = len;
+
+ switch (hval)
+ {
+ default:
+ hval += asso_values[(unsigned char)str[4]+1];
+ /*FALLTHROUGH*/
+ case 4:
+ case 3:
+ hval += asso_values[(unsigned char)str[2]];
+ /*FALLTHROUGH*/
+ case 2:
+ hval += asso_values[(unsigned char)str[1]];
+ /*FALLTHROUGH*/
+ case 1:
+ hval += asso_values[(unsigned char)str[0]];
+ break;
+ }
+ return hval;
+}
+
+const char *
+is_keyword_basic (register const char *str, register size_t len)
+{
+ struct stringpool_t
+ {
+ char stringpool_str2[sizeof("Or")];
+ char stringpool_str7[sizeof("To")];
+ char stringpool_str8[sizeof("Xor")];
+ char stringpool_str12[sizeof("On")];
+ char stringpool_str14[sizeof("Trim")];
+ char stringpool_str16[sizeof("OrElse")];
+ char stringpool_str17[sizeof("In")];
+ char stringpool_str18[sizeof("Not")];
+ char stringpool_str19[sizeof("Exit")];
+ char stringpool_str20[sizeof("RTrim")];
+ char stringpool_str24[sizeof("Next")];
+ char stringpool_str29[sizeof("NotInheritable")];
+ char stringpool_str32[sizeof("Is")];
+ char stringpool_str34[sizeof("Stop")];
+ char stringpool_str35[sizeof("Error")];
+ char stringpool_str37[sizeof("Do")];
+ char stringpool_str38[sizeof("Set")];
+ char stringpool_str39[sizeof("Step")];
+ char stringpool_str41[sizeof("Return")];
+ char stringpool_str42[sizeof("Me")];
+ char stringpool_str43[sizeof("REM")];
+ char stringpool_str44[sizeof("MIRR")];
+ char stringpool_str46[sizeof("Resume")];
+ char stringpool_str47[sizeof("Of")];
+ char stringpool_str48[sizeof("For")];
+ char stringpool_str52[sizeof("If")];
+ char stringpool_str53[sizeof("End")];
+ char stringpool_str54[sizeof("Interface")];
+ char stringpool_str55[sizeof("ReDim")];
+ char stringpool_str56[sizeof("Friend")];
+ char stringpool_str58[sizeof("Out")];
+ char stringpool_str64[sizeof("Attribute")];
+ char stringpool_str69[sizeof("Enum")];
+ char stringpool_str72[sizeof("As")];
+ char stringpool_str73[sizeof("Mod")];
+ char stringpool_str74[sizeof("Structure")];
+ char stringpool_str78[sizeof("Dim")];
+ char stringpool_str79[sizeof("Then")];
+ char stringpool_str80[sizeof("Throw")];
+ char stringpool_str81[sizeof("Static")];
+ char stringpool_str84[sizeof("Overrides")];
+ char stringpool_str85[sizeof("DirectCast")];
+ char stringpool_str86[sizeof("Overridable")];
+ char stringpool_str89[sizeof("NPer")];
+ char stringpool_str93[sizeof("And")];
+ char stringpool_str94[sizeof("Overloads")];
+ char stringpool_str95[sizeof("IsNot")];
+ char stringpool_str99[sizeof("GoTo")];
+ char stringpool_str100[sizeof("Erase")];
+ char stringpool_str102[sizeof("Finally")];
+ char stringpool_str103[sizeof("Get")];
+ char stringpool_str104[sizeof("Namespace")];
+ char stringpool_str105[sizeof("RaiseEvent")];
+ char stringpool_str107[sizeof("GetType")];
+ char stringpool_str110[sizeof("Event")];
+ char stringpool_str111[sizeof("Module")];
+ char stringpool_str113[sizeof("Inherits")];
+ char stringpool_str121[sizeof("MustInherit")];
+ char stringpool_str122[sizeof("Partial")];
+ char stringpool_str123[sizeof("Property")];
+ char stringpool_str124[sizeof("Protected")];
+ char stringpool_str125[sizeof("GetXMLNamespace")];
+ char stringpool_str128[sizeof("ReadOnly")];
+ char stringpool_str129[sizeof("Statement")];
+ char stringpool_str132[sizeof("AndAlso")];
+ char stringpool_str133[sizeof("Try")];
+ char stringpool_str134[sizeof("Narrowing")];
+ char stringpool_str135[sizeof("ParamArray")];
+ char stringpool_str137[sizeof("Default")];
+ char stringpool_str138[sizeof("Continue")];
+ char stringpool_str139[sizeof("CInt")];
+ char stringpool_str142[sizeof("Imports")];
+ char stringpool_str145[sizeof("EndIf")];
+ char stringpool_str150[sizeof("Using")];
+ char stringpool_str151[sizeof("Option")];
+ char stringpool_str153[sizeof("Optional")];
+ char stringpool_str154[sizeof("CStr")];
+ char stringpool_str159[sizeof("CSng")];
+ char stringpool_str162[sizeof("Handles")];
+ char stringpool_str163[sizeof("Function")];
+ char stringpool_str164[sizeof("CDec")];
+ char stringpool_str165[sizeof("Implements")];
+ char stringpool_str166[sizeof("NameOf")];
+ char stringpool_str169[sizeof("AddressOf")];
+ char stringpool_str173[sizeof("Sub")];
+ char stringpool_str174[sizeof("Each")];
+ char stringpool_str177[sizeof("Private")];
+ char stringpool_str178[sizeof("Operator")];
+ char stringpool_str179[sizeof("Loop")];
+ char stringpool_str180[sizeof("Catch")];
+ char stringpool_str184[sizeof("Like")];
+ char stringpool_str185[sizeof("Const")];
+ char stringpool_str186[sizeof("Shared")];
+ char stringpool_str188[sizeof("Let")];
+ char stringpool_str190[sizeof("Constraint")];
+ char stringpool_str192[sizeof("MustOverride")];
+ char stringpool_str194[sizeof("Case")];
+ char stringpool_str195[sizeof("LTrim")];
+ char stringpool_str203[sizeof("SyncLock")];
+ char stringpool_str204[sizeof("Type")];
+ char stringpool_str209[sizeof("Else")];
+ char stringpool_str210[sizeof("MacID")];
+ char stringpool_str211[sizeof("ElseIf")];
+ char stringpool_str212[sizeof("Shadows")];
+ char stringpool_str219[sizeof("CObj")];
+ char stringpool_str220[sizeof("AddHandler")];
+ char stringpool_str221[sizeof("Public")];
+ char stringpool_str224[sizeof("With")];
+ char stringpool_str228[sizeof("New")];
+ char stringpool_str229[sizeof("Wend")];
+ char stringpool_str230[sizeof("CUInt")];
+ char stringpool_str232[sizeof("TryCast")];
+ char stringpool_str235[sizeof("Alias")];
+ char stringpool_str239[sizeof("NotOverridable")];
+ char stringpool_str240[sizeof("GoSub")];
+ char stringpool_str241[sizeof("CShort")];
+ char stringpool_str244[sizeof("MacScript")];
+ char stringpool_str246[sizeof("Select")];
+ char stringpool_str250[sizeof("CDate")];
+ char stringpool_str254[sizeof("CDbl")];
+ char stringpool_str255[sizeof("CBool")];
+ char stringpool_str258[sizeof("Widening")];
+ char stringpool_str262[sizeof("Declare")];
+ char stringpool_str263[sizeof("RemoveHandler")];
+ char stringpool_str266[sizeof("MyBase")];
+ char stringpool_str269[sizeof("WriteOnly")];
+ char stringpool_str272[sizeof("CUShort")];
+ char stringpool_str275[sizeof("WithEvents")];
+ char stringpool_str276[sizeof("TypeOf")];
+ char stringpool_str278[sizeof("Lib")];
+ char stringpool_str284[sizeof("When")];
+ char stringpool_str288[sizeof("Delegate")];
+ char stringpool_str296[sizeof("CSByte")];
+ char stringpool_str300[sizeof("CType")];
+ char stringpool_str305[sizeof("ByVal")];
+ char stringpool_str309[sizeof("CLng")];
+ char stringpool_str315[sizeof("ByRef")];
+ char stringpool_str330[sizeof("While")];
+ char stringpool_str335[sizeof("CChar")];
+ char stringpool_str344[sizeof("Call")];
+ char stringpool_str350[sizeof("Class")];
+ char stringpool_str366[sizeof("Global")];
+ char stringpool_str382[sizeof("MyClass")];
+ char stringpool_str390[sizeof("CByte")];
+ char stringpool_str415[sizeof("CULng")];
+ };
+ static const struct stringpool_t stringpool_contents =
+ {
+ "Or",
+ "To",
+ "Xor",
+ "On",
+ "Trim",
+ "OrElse",
+ "In",
+ "Not",
+ "Exit",
+ "RTrim",
+ "Next",
+ "NotInheritable",
+ "Is",
+ "Stop",
+ "Error",
+ "Do",
+ "Set",
+ "Step",
+ "Return",
+ "Me",
+ "REM",
+ "MIRR",
+ "Resume",
+ "Of",
+ "For",
+ "If",
+ "End",
+ "Interface",
+ "ReDim",
+ "Friend",
+ "Out",
+ "Attribute",
+ "Enum",
+ "As",
+ "Mod",
+ "Structure",
+ "Dim",
+ "Then",
+ "Throw",
+ "Static",
+ "Overrides",
+ "DirectCast",
+ "Overridable",
+ "NPer",
+ "And",
+ "Overloads",
+ "IsNot",
+ "GoTo",
+ "Erase",
+ "Finally",
+ "Get",
+ "Namespace",
+ "RaiseEvent",
+ "GetType",
+ "Event",
+ "Module",
+ "Inherits",
+ "MustInherit",
+ "Partial",
+ "Property",
+ "Protected",
+ "GetXMLNamespace",
+ "ReadOnly",
+ "Statement",
+ "AndAlso",
+ "Try",
+ "Narrowing",
+ "ParamArray",
+ "Default",
+ "Continue",
+ "CInt",
+ "Imports",
+ "EndIf",
+ "Using",
+ "Option",
+ "Optional",
+ "CStr",
+ "CSng",
+ "Handles",
+ "Function",
+ "CDec",
+ "Implements",
+ "NameOf",
+ "AddressOf",
+ "Sub",
+ "Each",
+ "Private",
+ "Operator",
+ "Loop",
+ "Catch",
+ "Like",
+ "Const",
+ "Shared",
+ "Let",
+ "Constraint",
+ "MustOverride",
+ "Case",
+ "LTrim",
+ "SyncLock",
+ "Type",
+ "Else",
+ "MacID",
+ "ElseIf",
+ "Shadows",
+ "CObj",
+ "AddHandler",
+ "Public",
+ "With",
+ "New",
+ "Wend",
+ "CUInt",
+ "TryCast",
+ "Alias",
+ "NotOverridable",
+ "GoSub",
+ "CShort",
+ "MacScript",
+ "Select",
+ "CDate",
+ "CDbl",
+ "CBool",
+ "Widening",
+ "Declare",
+ "RemoveHandler",
+ "MyBase",
+ "WriteOnly",
+ "CUShort",
+ "WithEvents",
+ "TypeOf",
+ "Lib",
+ "When",
+ "Delegate",
+ "CSByte",
+ "CType",
+ "ByVal",
+ "CLng",
+ "ByRef",
+ "While",
+ "CChar",
+ "Call",
+ "Class",
+ "Global",
+ "MyClass",
+ "CByte",
+ "CULng"
+ };
+ #define stringpool ((const char *) &stringpool_contents)
+ static const int wordlist[] =
+ {
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str2,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str7,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str8,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str12,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str14,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str16,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str17,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str18,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str19,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str20,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str24,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str29,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str32,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str34,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str35,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str37,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str38,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str39,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str41,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str42,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str43,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str44,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str46,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str47,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str48,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str52,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str53,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str54,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str55,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str56,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str58,
+ -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str64,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str69,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str72,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str73,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str74,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str78,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str79,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str80,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str81,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str84,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str85,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str86,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str89,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str93,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str94,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str95,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str99,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str100,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str102,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str103,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str104,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str105,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str107,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str110,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str111,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str113,
+ -1, -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str121,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str122,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str123,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str124,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str125,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str128,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str129,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str132,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str133,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str134,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str135,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str137,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str138,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str139,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str142,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str145,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str150,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str151,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str153,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str154,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str159,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str162,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str163,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str164,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str165,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str166,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str169,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str173,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str174,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str177,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str178,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str179,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str180,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str184,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str185,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str186,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str188,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str190,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str192,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str194,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str195,
+ -1, -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str203,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str204,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str209,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str210,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str211,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str212,
+ -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str219,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str220,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str221,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str224,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str228,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str229,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str230,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str232,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str235,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str239,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str240,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str241,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str244,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str246,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str250,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str254,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str255,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str258,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str262,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str263,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str266,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str269,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str272,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str275,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str276,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str278,
+ -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str284,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str288,
+ -1, -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str296,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str300,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str305,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str309,
+ -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str315,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str330,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str335,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str344,
+ -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str350,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str366,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str382,
+ -1, -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str390,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str415
+ };
+
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
+ {
+ register unsigned int key = hash (str, len);
+
+ if (key <= MAX_HASH_VALUE)
+ {
+ register int o = wordlist[key];
+ if (o >= 0)
+ {
+ register const char *s = o + stringpool;
+
+ if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strncmp (str, s, len) && s[len] == '\0')
+ return s;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/llamafile/is_keyword_basic.gperf b/llamafile/is_keyword_basic.gperf
new file mode 100644
index 00000000..f21d4386
--- /dev/null
+++ b/llamafile/is_keyword_basic.gperf
@@ -0,0 +1,162 @@
+%{
+#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_basic
+%%
+#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
diff --git a/llamafile/is_keyword_basic_builtin.c b/llamafile/is_keyword_basic_builtin.c
new file mode 100644
index 00000000..0efeeb67
--- /dev/null
+++ b/llamafile/is_keyword_basic_builtin.c
@@ -0,0 +1,587 @@
+/* ANSI-C code produced by gperf version 3.1 */
+/* Command-line: gperf --output-file=llamafile/is_keyword_basic_builtin.c llamafile/is_keyword_basic_builtin.gperf */
+/* Computed positions: -k'1-2,5,$' */
+
+#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
+ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
+ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
+ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
+ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
+ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
+ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
+ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
+ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
+ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
+ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
+ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
+ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
+ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
+ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
+ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
+ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
+ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
+ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
+ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
+ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
+ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
+/* The character set is not based on ISO-646. */
+#error "gperf generated tables don't work with this execution character set. Please report a bug to <[email protected]>."
+#endif
+
+#line 1 "llamafile/is_keyword_basic_builtin.gperf"
+
+#include <string.h>
+#include <libc/str/tab.h>
+#define GPERF_DOWNCASE
+
+#define TOTAL_KEYWORDS 113
+#define MIN_WORD_LENGTH 2
+#define MAX_WORD_LENGTH 13
+#define MIN_HASH_VALUE 10
+#define MAX_HASH_VALUE 325
+/* maximum key range = 316, duplicates = 0 */
+
+#ifndef GPERF_DOWNCASE
+#define GPERF_DOWNCASE 1
+static unsigned char gperf_downcase[256] =
+ {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
+ 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
+ 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
+ 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
+ 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
+ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+ 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
+ 255
+ };
+#endif
+
+#ifndef GPERF_CASE_STRNCMP
+#define GPERF_CASE_STRNCMP 1
+static int
+gperf_case_strncmp (register const char *s1, register const char *s2, register size_t n)
+{
+ for (; n > 0;)
+ {
+ unsigned char c1 = gperf_downcase[(unsigned char)*s1++];
+ unsigned char c2 = gperf_downcase[(unsigned char)*s2++];
+ if (c1 != 0 && c1 == c2)
+ {
+ n--;
+ continue;
+ }
+ return (int)c1 - (int)c2;
+ }
+ return 0;
+}
+#endif
+
+#ifdef __GNUC__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static unsigned int
+hash (register const char *str, register size_t len)
+{
+ static const unsigned short asso_values[] =
+ {
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 65, 50, 80, 15, 25,
+ 10, 32, 95, 50, 0, 70, 90, 22, 25, 100,
+ 10, 70, 5, 15, 0, 40, 60, 15, 12, 120,
+ 326, 326, 326, 326, 326, 326, 326, 65, 50, 80,
+ 15, 25, 10, 32, 95, 50, 0, 70, 90, 22,
+ 25, 100, 10, 70, 5, 15, 0, 40, 60, 15,
+ 12, 120, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 326, 326
+ };
+ register unsigned int hval = len;
+
+ switch (hval)
+ {
+ default:
+ hval += asso_values[(unsigned char)str[4]];
+ /*FALLTHROUGH*/
+ case 4:
+ case 3:
+ case 2:
+ hval += asso_values[(unsigned char)str[1]+1];
+ /*FALLTHROUGH*/
+ case 1:
+ hval += asso_values[(unsigned char)str[0]];
+ break;
+ }
+ return hval + asso_values[(unsigned char)str[len - 1]];
+}
+
+const char *
+is_keyword_basic_builtin (register const char *str, register size_t len)
+{
+ struct stringpool_t
+ {
+ char stringpool_str10[sizeof("Right")];
+ char stringpool_str15[sizeof("Timer")];
+ char stringpool_str20[sizeof("Reset")];
+ char stringpool_str23[sizeof("Dir")];
+ char stringpool_str24[sizeof("Sqrt")];
+ char stringpool_str25[sizeof("Fix")];
+ char stringpool_str27[sizeof("FilePut")];
+ char stringpool_str28[sizeof("Sqr")];
+ char stringpool_str29[sizeof("Time")];
+ char stringpool_str30[sizeof("Print")];
+ char stringpool_str33[sizeof("FilePutObject")];
+ char stringpool_str34[sizeof("Read")];
+ char stringpool_str37[sizeof("SetAttr")];
+ char stringpool_str38[sizeof("Pmt")];
+ char stringpool_str39[sizeof("Join")];
+ char stringpool_str40[sizeof("Mid")];
+ char stringpool_str43[sizeof("Sin")];
+ char stringpool_str44[sizeof("Sign")];
+ char stringpool_str48[sizeof("EOF")];
+ char stringpool_str49[sizeof("FileGet")];
+ char stringpool_str50[sizeof("Round")];
+ char stringpool_str53[sizeof("Now")];
+ char stringpool_str54[sizeof("GetAttr")];
+ char stringpool_str55[sizeof("FileGetObject")];
+ char stringpool_str58[sizeof("IsObject")];
+ char stringpool_str62[sizeof("FileDateTime")];
+ char stringpool_str63[sizeof("Str")];
+ char stringpool_str67[sizeof("IsError")];
+ char stringpool_str68[sizeof("FreeFile")];
+ char stringpool_str71[sizeof("Second")];
+ char stringpool_str73[sizeof("DoEvents")];
+ char stringpool_str76[sizeof("WeekdayName")];
+ char stringpool_str78[sizeof("Tan")];
+ char stringpool_str81[sizeof("IsDate")];
+ char stringpool_str83[sizeof("DatePart")];
+ char stringpool_str84[sizeof("PPmt")];
+ char stringpool_str85[sizeof("Write")];
+ char stringpool_str87[sizeof("PV")];
+ char stringpool_str88[sizeof("FileAttr")];
+ char stringpool_str89[sizeof("WriteLine")];
+ char stringpool_str90[sizeof("Split")];
+ char stringpool_str91[sizeof("Format")];
+ char stringpool_str93[sizeof("DDB")];
+ char stringpool_str94[sizeof("Date")];
+ char stringpool_str98[sizeof("DateDiff")];
+ char stringpool_str99[sizeof("Seek")];
+ char stringpool_str101[sizeof("GetObject")];
+ char stringpool_str103[sizeof("TAB")];
+ char stringpool_str104[sizeof("Left")];
+ char stringpool_str106[sizeof("IsMissing")];
+ char stringpool_str108[sizeof("Cos")];
+ char stringpool_str110[sizeof("UCase")];
+ char stringpool_str112[sizeof("Replace")];
+ char stringpool_str113[sizeof("LOF")];
+ char stringpool_str115[sizeof("StrReverse")];
+ char stringpool_str118[sizeof("Oct")];
+ char stringpool_str120[sizeof("Hex")];
+ char stringpool_str123[sizeof("Rnd")];
+ char stringpool_str124[sizeof("FileClose")];
+ char stringpool_str128[sizeof("Len")];
+ char stringpool_str129[sizeof("FileWidth")];
+ char stringpool_str132[sizeof("FileLen")];
+ char stringpool_str133[sizeof("Atn")];
+ char stringpool_str134[sizeof("Atan")];
+ char stringpool_str135[sizeof("Log")];
+ char stringpool_str138[sizeof("Chr")];
+ char stringpool_str139[sizeof("Year")];
+ char stringpool_str140[sizeof("MsgBox")];
+ char stringpool_str143[sizeof("FileOpen")];
+ char stringpool_str144[sizeof("Partition")];
+ char stringpool_str148[sizeof("Asc")];
+ char stringpool_str149[sizeof("LineInput")];
+ char stringpool_str152[sizeof("DateAdd")];
+ char stringpool_str153[sizeof("Int")];
+ char stringpool_str155[sizeof("Input")];
+ char stringpool_str158[sizeof("Exp")];
+ char stringpool_str159[sizeof("DateValue")];
+ char stringpool_str160[sizeof("LCase")];
+ char stringpool_str161[sizeof("MonthName")];
+ char stringpool_str162[sizeof("Environ")];
+ char stringpool_str163[sizeof("Abs")];
+ char stringpool_str164[sizeof("Kill")];
+ char stringpool_str165[sizeof("InStr")];
+ char stringpool_str166[sizeof("UBound")];
+ char stringpool_str167[sizeof("Weekday")];
+ char stringpool_str168[sizeof("SPC")];
+ char stringpool_str170[sizeof("InputBox")];
+ char stringpool_str172[sizeof("StrComp")];
+ char stringpool_str174[sizeof("Lock")];
+ char stringpool_str176[sizeof("Choose")];
+ char stringpool_str177[sizeof("Command")];
+ char stringpool_str180[sizeof("DateSerial")];
+ char stringpool_str182[sizeof("IsArray")];
+ char stringpool_str183[sizeof("Loc")];
+ char stringpool_str187[sizeof("IsEmpty")];
+ char stringpool_str188[sizeof("Day")];
+ char stringpool_str189[sizeof("Randomize")];
+ char stringpool_str193[sizeof("InputString")];
+ char stringpool_str201[sizeof("CurDir")];
+ char stringpool_str203[sizeof("Val")];
+ char stringpool_str208[sizeof("Switch")];
+ char stringpool_str215[sizeof("CallByName")];
+ char stringpool_str216[sizeof("LBound")];
+ char stringpool_str218[sizeof("FileCopy")];
+ char stringpool_str222[sizeof("StrConv")];
+ char stringpool_str223[sizeof("InStrRev")];
+ char stringpool_str227[sizeof("Month")];
+ char stringpool_str236[sizeof("IsNull")];
+ char stringpool_str250[sizeof("Shell")];
+ char stringpool_str252[sizeof("QBColor")];
+ char stringpool_str262[sizeof("VarType")];
+ char stringpool_str296[sizeof("Unlock")];
+ char stringpool_str325[sizeof("Array")];
+ };
+ static const struct stringpool_t stringpool_contents =
+ {
+ "Right",
+ "Timer",
+ "Reset",
+ "Dir",
+ "Sqrt",
+ "Fix",
+ "FilePut",
+ "Sqr",
+ "Time",
+ "Print",
+ "FilePutObject",
+ "Read",
+ "SetAttr",
+ "Pmt",
+ "Join",
+ "Mid",
+ "Sin",
+ "Sign",
+ "EOF",
+ "FileGet",
+ "Round",
+ "Now",
+ "GetAttr",
+ "FileGetObject",
+ "IsObject",
+ "FileDateTime",
+ "Str",
+ "IsError",
+ "FreeFile",
+ "Second",
+ "DoEvents",
+ "WeekdayName",
+ "Tan",
+ "IsDate",
+ "DatePart",
+ "PPmt",
+ "Write",
+ "PV",
+ "FileAttr",
+ "WriteLine",
+ "Split",
+ "Format",
+ "DDB",
+ "Date",
+ "DateDiff",
+ "Seek",
+ "GetObject",
+ "TAB",
+ "Left",
+ "IsMissing",
+ "Cos",
+ "UCase",
+ "Replace",
+ "LOF",
+ "StrReverse",
+ "Oct",
+ "Hex",
+ "Rnd",
+ "FileClose",
+ "Len",
+ "FileWidth",
+ "FileLen",
+ "Atn",
+ "Atan",
+ "Log",
+ "Chr",
+ "Year",
+ "MsgBox",
+ "FileOpen",
+ "Partition",
+ "Asc",
+ "LineInput",
+ "DateAdd",
+ "Int",
+ "Input",
+ "Exp",
+ "DateValue",
+ "LCase",
+ "MonthName",
+ "Environ",
+ "Abs",
+ "Kill",
+ "InStr",
+ "UBound",
+ "Weekday",
+ "SPC",
+ "InputBox",
+ "StrComp",
+ "Lock",
+ "Choose",
+ "Command",
+ "DateSerial",
+ "IsArray",
+ "Loc",
+ "IsEmpty",
+ "Day",
+ "Randomize",
+ "InputString",
+ "CurDir",
+ "Val",
+ "Switch",
+ "CallByName",
+ "LBound",
+ "FileCopy",
+ "StrConv",
+ "InStrRev",
+ "Month",
+ "IsNull",
+ "Shell",
+ "QBColor",
+ "VarType",
+ "Unlock",
+ "Array"
+ };
+ #define stringpool ((const char *) &stringpool_contents)
+ static const int wordlist[] =
+ {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str10,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str15,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str20,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str23,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str24,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str25,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str27,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str28,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str29,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str30,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str33,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str34,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str37,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str38,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str39,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str40,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str43,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str44,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str48,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str49,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str50,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str53,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str54,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str55,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str58,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str62,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str63,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str67,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str68,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str71,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str73,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str76,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str78,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str81,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str83,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str84,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str85,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str87,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str88,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str89,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str90,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str91,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str93,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str94,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str98,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str99,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str101,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str103,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str104,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str106,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str108,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str110,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str112,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str113,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str115,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str118,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str120,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str123,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str124,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str128,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str129,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str132,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str133,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str134,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str135,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str138,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str139,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str140,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str143,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str144,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str148,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str149,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str152,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str153,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str155,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str158,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str159,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str160,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str161,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str162,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str163,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str164,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str165,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str166,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str167,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str168,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str170,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str172,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str174,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str176,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str177,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str180,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str182,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str183,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str187,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str188,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str189,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str193,
+ -1, -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str201,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str203,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str208,
+ -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str215,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str216,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str218,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str222,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str223,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str227,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str236,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str250,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str252,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str262,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str296,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str325
+ };
+
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
+ {
+ register unsigned int key = hash (str, len);
+
+ if (key <= MAX_HASH_VALUE)
+ {
+ register int o = wordlist[key];
+ if (o >= 0)
+ {
+ register const char *s = o + stringpool;
+
+ if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strncmp (str, s, len) && s[len] == '\0')
+ return s;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/llamafile/is_keyword_basic_builtin.gperf b/llamafile/is_keyword_basic_builtin.gperf
new file mode 100644
index 00000000..fe2f264d
--- /dev/null
+++ b/llamafile/is_keyword_basic_builtin.gperf
@@ -0,0 +1,125 @@
+%{
+#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_basic_builtin
+%%
+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
diff --git a/llamafile/is_keyword_basic_constant.c b/llamafile/is_keyword_basic_constant.c
new file mode 100644
index 00000000..d0ca0999
--- /dev/null
+++ b/llamafile/is_keyword_basic_constant.c
@@ -0,0 +1,547 @@
+/* ANSI-C code produced by gperf version 3.1 */
+/* Command-line: gperf --output-file=llamafile/is_keyword_basic_constant.c llamafile/is_keyword_basic_constant.gperf */
+/* Computed positions: -k'3-4,8,$' */
+
+#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
+ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
+ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
+ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
+ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
+ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
+ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
+ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
+ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
+ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
+ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
+ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
+ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
+ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
+ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
+ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
+ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
+ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
+ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
+ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
+ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
+ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
+/* The character set is not based on ISO-646. */
+#error "gperf generated tables don't work with this execution character set. Please report a bug to <[email protected]>."
+#endif
+
+#line 1 "llamafile/is_keyword_basic_constant.gperf"
+
+#include <string.h>
+#include <libc/str/tab.h>
+#define GPERF_DOWNCASE
+
+#define TOTAL_KEYWORDS 105
+#define MIN_WORD_LENGTH 4
+#define MAX_WORD_LENGTH 21
+#define MIN_HASH_VALUE 8
+#define MAX_HASH_VALUE 230
+/* maximum key range = 223, duplicates = 0 */
+
+#ifndef GPERF_DOWNCASE
+#define GPERF_DOWNCASE 1
+static unsigned char gperf_downcase[256] =
+ {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
+ 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
+ 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
+ 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
+ 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
+ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+ 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
+ 255
+ };
+#endif
+
+#ifndef GPERF_CASE_STRNCMP
+#define GPERF_CASE_STRNCMP 1
+static int
+gperf_case_strncmp (register const char *s1, register const char *s2, register size_t n)
+{
+ for (; n > 0;)
+ {
+ unsigned char c1 = gperf_downcase[(unsigned char)*s1++];
+ unsigned char c2 = gperf_downcase[(unsigned char)*s2++];
+ if (c1 != 0 && c1 == c2)
+ {
+ n--;
+ continue;
+ }
+ return (int)c1 - (int)c2;
+ }
+ return 0;
+}
+#endif
+
+#ifdef __GNUC__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static unsigned int
+hash (register const char *str, register size_t len)
+{
+ static const unsigned char asso_values[] =
+ {
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 0,
+ 25, 5, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 5, 30, 90, 75, 0,
+ 25, 50, 70, 0, 0, 105, 10, 0, 10, 5,
+ 25, 5, 30, 0, 30, 35, 50, 75, 110, 5,
+ 231, 231, 231, 231, 231, 231, 231, 5, 30, 90,
+ 75, 0, 25, 50, 70, 0, 0, 105, 10, 0,
+ 10, 5, 25, 5, 30, 0, 30, 35, 50, 75,
+ 110, 5, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231
+ };
+ register unsigned int hval = len;
+
+ switch (hval)
+ {
+ default:
+ hval += asso_values[(unsigned char)str[7]];
+ /*FALLTHROUGH*/
+ case 7:
+ case 6:
+ case 5:
+ case 4:
+ hval += asso_values[(unsigned char)str[3]];
+ /*FALLTHROUGH*/
+ case 3:
+ hval += asso_values[(unsigned char)str[2]];
+ break;
+ }
+ return hval + asso_values[(unsigned char)str[len - 1]];
+}
+
+const char *
+is_keyword_basic_constant (register const char *str, register size_t len)
+{
+ struct stringpool_t
+ {
+ char stringpool_str8[sizeof("vbSingle")];
+ char stringpool_str10[sizeof("vbYes")];
+ char stringpool_str12[sizeof("vbEmpty")];
+ char stringpool_str13[sizeof("vbSystem")];
+ char stringpool_str15[sizeof("False")];
+ char stringpool_str16[sizeof("vbMinimizedFocus")];
+ char stringpool_str17[sizeof("vbYesNo")];
+ char stringpool_str18[sizeof("vbMinimizedNoFocus")];
+ char stringpool_str19[sizeof("vbSimplifiedChinese")];
+ char stringpool_str21[sizeof("vbMaximizedFocus")];
+ char stringpool_str23[sizeof("vbMonday")];
+ char stringpool_str24[sizeof("vbNo")];
+ char stringpool_str25[sizeof("vbLongTime")];
+ char stringpool_str28[sizeof("vbSystemModal")];
+ char stringpool_str29[sizeof("vbNewLine")];
+ char stringpool_str30[sizeof("vbLongDate")];
+ char stringpool_str33[sizeof("vbInformation")];
+ char stringpool_str35[sizeof("vbSet")];
+ char stringpool_str36[sizeof("vbFirstJan1")];
+ char stringpool_str37[sizeof("vbFalse")];
+ char stringpool_str38[sizeof("vbNormalFocus")];
+ char stringpool_str39[sizeof("True")];
+ char stringpool_str40[sizeof("vbNormalNoFocus")];
+ char stringpool_str41[sizeof("vbByte")];
+ char stringpool_str42[sizeof("vbRetry")];
+ char stringpool_str43[sizeof("vbNormal")];
+ char stringpool_str45[sizeof("vbLet")];
+ char stringpool_str46[sizeof("vbUseSystem")];
+ char stringpool_str47[sizeof("vbArray")];
+ char stringpool_str48[sizeof("vbTextCompare")];
+ char stringpool_str49[sizeof("vbInteger")];
+ char stringpool_str50[sizeof("vbBinaryCompare")];
+ char stringpool_str52[sizeof("vbUserDefinedType")];
+ char stringpool_str53[sizeof("vbSunday")];
+ char stringpool_str55[sizeof("vbReadOnly")];
+ char stringpool_str58[sizeof("vbIgnore")];
+ char stringpool_str59[sizeof("vbBoolean")];
+ char stringpool_str60[sizeof("vbQuestion")];
+ char stringpool_str61[sizeof("vbNull")];
+ char stringpool_str63[sizeof("vbVolume")];
+ char stringpool_str64[sizeof("vbLf")];
+ char stringpool_str65[sizeof("vbFirstFourDays")];
+ char stringpool_str66[sizeof("vbTrue")];
+ char stringpool_str68[sizeof("vbGeneralDate")];
+ char stringpool_str70[sizeof("vbTab")];
+ char stringpool_str71[sizeof("vbLong")];
+ char stringpool_str72[sizeof("vbAbort")];
+ char stringpool_str73[sizeof("vbFriday")];
+ char stringpool_str76[sizeof("vbHide")];
+ char stringpool_str78[sizeof("vbLinguisticCasing")];
+ char stringpool_str81[sizeof("vbWide")];
+ char stringpool_str83[sizeof("vbAbortRetryIgnore")];
+ char stringpool_str84[sizeof("vbTuesday")];
+ char stringpool_str85[sizeof("vbGet")];
+ char stringpool_str86[sizeof("vbDate")];
+ char stringpool_str88[sizeof("vbDouble")];
+ char stringpool_str90[sizeof("vbHiragana")];
+ char stringpool_str91[sizeof("vbWednesday")];
+ char stringpool_str94[sizeof("vbArchive")];
+ char stringpool_str95[sizeof("vbSaturday")];
+ char stringpool_str97[sizeof("vbProperCase")];
+ char stringpool_str98[sizeof("vbHidden")];
+ char stringpool_str99[sizeof("vbDecimal")];
+ char stringpool_str101[sizeof("vbDefaultButton1")];
+ char stringpool_str102[sizeof("vbUseDefault")];
+ char stringpool_str103[sizeof("vbObject")];
+ char stringpool_str104[sizeof("vbVariant")];
+ char stringpool_str106[sizeof("vbDefaultButton3")];
+ char stringpool_str108[sizeof("vbObjectError")];
+ char stringpool_str110[sizeof("vbTraditionalChinese")];
+ char stringpool_str111[sizeof("vbShortTime")];
+ char stringpool_str115[sizeof("vbFormFeed")];
+ char stringpool_str116[sizeof("vbLowerCase")];
+ char stringpool_str118[sizeof("vbYesNoCancel")];
+ char stringpool_str121[sizeof("vbDirectory")];
+ char stringpool_str123[sizeof("vbCancel")];
+ char stringpool_str126[sizeof("vbDefaultButton2")];
+ char stringpool_str128[sizeof("vbOKOnly")];
+ char stringpool_str130[sizeof("vbKatakana")];
+ char stringpool_str133[sizeof("vbExclamation")];
+ char stringpool_str137[sizeof("vbNullString")];
+ char stringpool_str138[sizeof("vbString")];
+ char stringpool_str143[sizeof("vbRetryCancel")];
+ char stringpool_str146[sizeof("vbBack")];
+ char stringpool_str147[sizeof("vbMsgBoxHelp")];
+ char stringpool_str148[sizeof("vbApplicationModal")];
+ char stringpool_str150[sizeof("vbCurrency")];
+ char stringpool_str151[sizeof("vbCrLf")];
+ char stringpool_str153[sizeof("vbMsgBoxRight")];
+ char stringpool_str154[sizeof("vbCr")];
+ char stringpool_str155[sizeof("vbNullChar")];
+ char stringpool_str156[sizeof("vbShortDate")];
+ char stringpool_str157[sizeof("Nothing")];
+ char stringpool_str158[sizeof("vbMethod")];
+ char stringpool_str160[sizeof("vbUseSystemDayOfWeek")];
+ char stringpool_str161[sizeof("vbUpperCase")];
+ char stringpool_str170[sizeof("vbFirstFullWeek")];
+ char stringpool_str173[sizeof("vbNarrow")];
+ char stringpool_str178[sizeof("vbMsgBoxRtlReading")];
+ char stringpool_str183[sizeof("vbVerticalTab")];
+ char stringpool_str190[sizeof("vbThursday")];
+ char stringpool_str206[sizeof("vbMsgBoxSetForeground")];
+ char stringpool_str219[sizeof("vbOK")];
+ char stringpool_str220[sizeof("vbOKCancel")];
+ char stringpool_str230[sizeof("vbCritical")];
+ };
+ static const struct stringpool_t stringpool_contents =
+ {
+ "vbSingle",
+ "vbYes",
+ "vbEmpty",
+ "vbSystem",
+ "False",
+ "vbMinimizedFocus",
+ "vbYesNo",
+ "vbMinimizedNoFocus",
+ "vbSimplifiedChinese",
+ "vbMaximizedFocus",
+ "vbMonday",
+ "vbNo",
+ "vbLongTime",
+ "vbSystemModal",
+ "vbNewLine",
+ "vbLongDate",
+ "vbInformation",
+ "vbSet",
+ "vbFirstJan1",
+ "vbFalse",
+ "vbNormalFocus",
+ "True",
+ "vbNormalNoFocus",
+ "vbByte",
+ "vbRetry",
+ "vbNormal",
+ "vbLet",
+ "vbUseSystem",
+ "vbArray",
+ "vbTextCompare",
+ "vbInteger",
+ "vbBinaryCompare",
+ "vbUserDefinedType",
+ "vbSunday",
+ "vbReadOnly",
+ "vbIgnore",
+ "vbBoolean",
+ "vbQuestion",
+ "vbNull",
+ "vbVolume",
+ "vbLf",
+ "vbFirstFourDays",
+ "vbTrue",
+ "vbGeneralDate",
+ "vbTab",
+ "vbLong",
+ "vbAbort",
+ "vbFriday",
+ "vbHide",
+ "vbLinguisticCasing",
+ "vbWide",
+ "vbAbortRetryIgnore",
+ "vbTuesday",
+ "vbGet",
+ "vbDate",
+ "vbDouble",
+ "vbHiragana",
+ "vbWednesday",
+ "vbArchive",
+ "vbSaturday",
+ "vbProperCase",
+ "vbHidden",
+ "vbDecimal",
+ "vbDefaultButton1",
+ "vbUseDefault",
+ "vbObject",
+ "vbVariant",
+ "vbDefaultButton3",
+ "vbObjectError",
+ "vbTraditionalChinese",
+ "vbShortTime",
+ "vbFormFeed",
+ "vbLowerCase",
+ "vbYesNoCancel",
+ "vbDirectory",
+ "vbCancel",
+ "vbDefaultButton2",
+ "vbOKOnly",
+ "vbKatakana",
+ "vbExclamation",
+ "vbNullString",
+ "vbString",
+ "vbRetryCancel",
+ "vbBack",
+ "vbMsgBoxHelp",
+ "vbApplicationModal",
+ "vbCurrency",
+ "vbCrLf",
+ "vbMsgBoxRight",
+ "vbCr",
+ "vbNullChar",
+ "vbShortDate",
+ "Nothing",
+ "vbMethod",
+ "vbUseSystemDayOfWeek",
+ "vbUpperCase",
+ "vbFirstFullWeek",
+ "vbNarrow",
+ "vbMsgBoxRtlReading",
+ "vbVerticalTab",
+ "vbThursday",
+ "vbMsgBoxSetForeground",
+ "vbOK",
+ "vbOKCancel",
+ "vbCritical"
+ };
+ #define stringpool ((const char *) &stringpool_contents)
+ static const int wordlist[] =
+ {
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str8,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str10,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str12,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str13,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str15,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str16,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str17,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str18,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str19,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str21,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str23,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str24,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str25,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str28,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str29,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str30,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str33,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str35,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str36,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str37,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str38,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str39,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str40,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str41,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str42,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str43,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str45,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str46,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str47,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str48,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str49,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str50,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str52,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str53,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str55,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str58,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str59,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str60,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str61,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str63,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str64,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str65,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str66,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str68,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str70,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str71,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str72,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str73,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str76,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str78,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str81,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str83,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str84,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str85,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str86,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str88,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str90,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str91,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str94,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str95,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str97,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str98,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str99,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str101,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str102,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str103,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str104,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str106,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str108,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str110,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str111,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str115,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str116,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str118,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str121,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str123,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str126,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str128,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str130,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str133,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str137,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str138,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str143,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str146,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str147,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str148,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str150,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str151,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str153,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str154,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str155,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str156,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str157,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str158,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str160,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str161,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str170,
+ -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str173,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str178,
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str183,
+ -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str190,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str206,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str219,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str220,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str230
+ };
+
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
+ {
+ register unsigned int key = hash (str, len);
+
+ if (key <= MAX_HASH_VALUE)
+ {
+ register int o = wordlist[key];
+ if (o >= 0)
+ {
+ register const char *s = o + stringpool;
+
+ if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strncmp (str, s, len) && s[len] == '\0')
+ return s;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/llamafile/is_keyword_basic_constant.gperf b/llamafile/is_keyword_basic_constant.gperf
new file mode 100644
index 00000000..b45164e4
--- /dev/null
+++ b/llamafile/is_keyword_basic_constant.gperf
@@ -0,0 +1,117 @@
+%{
+#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_basic_constant
+%%
+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
diff --git a/llamafile/is_keyword_basic_type.c b/llamafile/is_keyword_basic_type.c
new file mode 100644
index 00000000..1740f278
--- /dev/null
+++ b/llamafile/is_keyword_basic_type.c
@@ -0,0 +1,219 @@
+/* ANSI-C code produced by gperf version 3.1 */
+/* Command-line: gperf --output-file=llamafile/is_keyword_basic_type.c llamafile/is_keyword_basic_type.gperf */
+/* Computed positions: -k'2' */
+
+#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
+ && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
+ && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
+ && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
+ && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
+ && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
+ && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
+ && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
+ && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
+ && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
+ && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
+ && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
+ && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
+ && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
+ && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
+ && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
+ && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
+ && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
+ && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
+ && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
+ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
+ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
+/* The character set is not based on ISO-646. */
+#error "gperf generated tables don't work with this execution character set. Please report a bug to <[email protected]>."
+#endif
+
+#line 1 "llamafile/is_keyword_basic_type.gperf"
+
+#include <string.h>
+#include <libc/str/tab.h>
+#define GPERF_DOWNCASE
+
+#define TOTAL_KEYWORDS 17
+#define MIN_WORD_LENGTH 4
+#define MAX_WORD_LENGTH 8
+#define MIN_HASH_VALUE 4
+#define MAX_HASH_VALUE 26
+/* maximum key range = 23, duplicates = 0 */
+
+#ifndef GPERF_DOWNCASE
+#define GPERF_DOWNCASE 1
+static unsigned char gperf_downcase[256] =
+ {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
+ 122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
+ 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
+ 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
+ 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
+ 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
+ 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
+ 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+ 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+ 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
+ 255
+ };
+#endif
+
+#ifndef GPERF_CASE_STRNCMP
+#define GPERF_CASE_STRNCMP 1
+static int
+gperf_case_strncmp (register const char *s1, register const char *s2, register size_t n)
+{
+ for (; n > 0;)
+ {
+ unsigned char c1 = gperf_downcase[(unsigned char)*s1++];
+ unsigned char c2 = gperf_downcase[(unsigned char)*s2++];
+ if (c1 != 0 && c1 == c2)
+ {
+ n--;
+ continue;
+ }
+ return (int)c1 - (int)c2;
+ }
+ return 0;
+}
+#endif
+
+#ifdef __GNUC__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static unsigned int
+hash (register const char *str, register size_t len)
+{
+ static const unsigned char asso_values[] =
+ {
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 10, 10, 27, 27, 15,
+ 27, 27, 5, 5, 27, 27, 0, 27, 5, 0,
+ 27, 27, 27, 20, 15, 27, 27, 27, 27, 15,
+ 27, 27, 27, 27, 27, 27, 27, 10, 10, 27,
+ 27, 15, 27, 27, 5, 5, 27, 27, 0, 27,
+ 5, 0, 27, 27, 27, 20, 15, 27, 27, 27,
+ 27, 15, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 27, 27
+ };
+ return len + asso_values[(unsigned char)str[1]];
+}
+
+const char *
+is_keyword_basic_type (register const char *str, register size_t len)
+{
+ struct stringpool_t
+ {
+ char stringpool_str4[sizeof("Long")];
+ char stringpool_str5[sizeof("ULong")];
+ char stringpool_str6[sizeof("Double")];
+ char stringpool_str7[sizeof("Boolean")];
+ char stringpool_str9[sizeof("Char")];
+ char stringpool_str10[sizeof("Short")];
+ char stringpool_str11[sizeof("Single")];
+ char stringpool_str12[sizeof("Integer")];
+ char stringpool_str13[sizeof("UInteger")];
+ char stringpool_str14[sizeof("Date")];
+ char stringpool_str15[sizeof("SByte")];
+ char stringpool_str16[sizeof("Object")];
+ char stringpool_str17[sizeof("Variant")];
+ char stringpool_str19[sizeof("Byte")];
+ char stringpool_str21[sizeof("String")];
+ char stringpool_str22[sizeof("Decimal")];
+ char stringpool_str26[sizeof("UShort")];
+ };
+ static const struct stringpool_t stringpool_contents =
+ {
+ "Long",
+ "ULong",
+ "Double",
+ "Boolean",
+ "Char",
+ "Short",
+ "Single",
+ "Integer",
+ "UInteger",
+ "Date",
+ "SByte",
+ "Object",
+ "Variant",
+ "Byte",
+ "String",
+ "Decimal",
+ "UShort"
+ };
+ #define stringpool ((const char *) &stringpool_contents)
+ static const int wordlist[] =
+ {
+ -1, -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str4,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str5,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str6,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str7,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str9,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str10,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str11,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str12,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str13,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str14,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str15,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str16,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str17,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str19,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str21,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str22,
+ -1, -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str26
+ };
+
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
+ {
+ register unsigned int key = hash (str, len);
+
+ if (key <= MAX_HASH_VALUE)
+ {
+ register int o = wordlist[key];
+ if (o >= 0)
+ {
+ register const char *s = o + stringpool;
+
+ if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strncmp (str, s, len) && s[len] == '\0')
+ return s;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/llamafile/is_keyword_basic_type.gperf b/llamafile/is_keyword_basic_type.gperf
new file mode 100644
index 00000000..5f25db77
--- /dev/null
+++ b/llamafile/is_keyword_basic_type.gperf
@@ -0,0 +1,29 @@
+%{
+#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_basic_type
+%%
+Boolean
+Byte
+Char
+Date
+Decimal
+Double
+Integer
+Long
+Object
+SByte
+Short
+Single
+String
+UInteger
+ULong
+UShort
+Variant
diff --git a/llamafile/is_keyword_cobol.c b/llamafile/is_keyword_cobol.c
index 71912a70..9aca7941 100644
--- a/llamafile/is_keyword_cobol.c
+++ b/llamafile/is_keyword_cobol.c
@@ -102,7 +102,7 @@ hash (register const char *str, register size_t len)
1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818,
1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818,
1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818,
- 1818, 1818, 0, 1818, 1818, 1818, 1818, 1818, 1818, 1818,
+ 1818, 1818, 5, 1818, 1818, 1818, 1818, 1818, 1818, 1818,
1818, 1818, 1818, 1818, 1818, 423, 1818, 1818, 1818, 0,
30, 15, 35, 10, 1818, 1818, 1818, 1818, 1818, 1818,
1818, 1818, 1818, 1818, 1818, 50, 455, 105, 15, 5,
@@ -496,8 +496,8 @@ is_keyword_cobol (register const char *str, register size_t len)
char stringpool_str875[sizeof("DYNAMIC")];
char stringpool_str877[sizeof("METHOD-ID")];
char stringpool_str878[sizeof("CORRESPONDING")];
- char stringpool_str879[sizeof("JUSTIFIED\011 ")];
char stringpool_str881[sizeof("DIVISION")];
+ char stringpool_str883[sizeof("JUSTIFIED ")];
char stringpool_str887[sizeof("SHIFT-IN")];
char stringpool_str894[sizeof("ALPHANUMERIC-EDITED")];
char stringpool_str897[sizeof("SORT-FILE-SIZE")];
@@ -917,8 +917,8 @@ is_keyword_cobol (register const char *str, register size_t len)
"DYNAMIC",
"METHOD-ID",
"CORRESPONDING",
- "JUSTIFIED\011 ",
"DIVISION",
+ "JUSTIFIED ",
"SHIFT-IN",
"ALPHANUMERIC-EDITED",
"SORT-FILE-SIZE",
@@ -1530,10 +1530,11 @@ is_keyword_cobol (register const char *str, register size_t len)
-1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str877,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str878,
- (int)(size_t)&((struct stringpool_t *)0)->stringpool_str879,
- -1,
+ -1, -1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str881,
- -1, -1, -1, -1, -1,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str883,
+ -1, -1, -1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str887,
-1, -1, -1, -1, -1, -1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str894,
diff --git a/llamafile/is_keyword_cobol.gperf b/llamafile/is_keyword_cobol.gperf
index e95d4850..c5030a63 100644
--- a/llamafile/is_keyword_cobol.gperf
+++ b/llamafile/is_keyword_cobol.gperf
@@ -207,7 +207,7 @@ INVALID
INVOKE
IS
JUST
-JUSTIFIED
+JUSTIFIED
KANJI
KEY
LABEL
diff --git a/llamafile/is_keyword_php.c b/llamafile/is_keyword_php.c
index c1c4269b..5c573f5b 100644
--- a/llamafile/is_keyword_php.c
+++ b/llamafile/is_keyword_php.c
@@ -39,8 +39,8 @@
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 51
#define MIN_HASH_VALUE 2
-#define MAX_HASH_VALUE 165
-/* maximum key range = 164, duplicates = 0 */
+#define MAX_HASH_VALUE 135
+/* maximum key range = 134, duplicates = 0 */
#ifndef GPERF_DOWNCASE
#define GPERF_DOWNCASE 1
@@ -99,32 +99,32 @@ hash (register const char *str, register size_t len)
{
static const unsigned char asso_values[] =
{
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 30, 20, 20, 10, 10,
- 40, 5, 0, 0, 166, 166, 35, 95, 35, 55,
- 35, 0, 40, 0, 0, 80, 10, 85, 5, 115,
- 166, 166, 166, 166, 166, 30, 166, 30, 20, 20,
- 10, 10, 40, 5, 0, 0, 166, 166, 35, 95,
- 35, 55, 35, 0, 40, 0, 0, 80, 10, 85,
- 5, 115, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 5, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 5, 166, 166, 166, 166, 166, 166, 166, 166, 166,
- 166, 166, 166, 166, 166, 166
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 30, 20, 20, 10, 10,
+ 40, 0, 0, 0, 136, 136, 35, 75, 35, 55,
+ 35, 10, 70, 0, 0, 15, 50, 55, 15, 55,
+ 136, 136, 136, 136, 136, 30, 136, 30, 20, 20,
+ 10, 10, 40, 0, 0, 0, 136, 136, 35, 75,
+ 35, 55, 35, 10, 70, 0, 0, 15, 50, 55,
+ 15, 55, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 5, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 0, 136, 136, 136, 136, 136, 136, 136, 136, 136,
+ 136, 136, 136, 136, 136, 136
};
register unsigned int hval = len;
@@ -162,7 +162,9 @@ is_keyword_php (register const char *str, register size_t len)
char stringpool_str25[sizeof("endif")];
char stringpool_str26[sizeof("elseif")];
char stringpool_str27[sizeof("extends")];
+ char stringpool_str28[sizeof("use")];
char stringpool_str29[sizeof("endswitch")];
+ char stringpool_str30[sizeof("unset")];
char stringpool_str32[sizeof("as")];
char stringpool_str34[sizeof("case")];
char stringpool_str35[sizeof("trait")];
@@ -174,16 +176,14 @@ is_keyword_php (register const char *str, register size_t len)
char stringpool_str43[sizeof("and")];
char stringpool_str45[sizeof("catch")];
char stringpool_str47[sizeof("__DIR__")];
- char stringpool_str48[sizeof("xor")];
char stringpool_str50[sizeof("empty")];
- char stringpool_str52[sizeof("private")];
- char stringpool_str53[sizeof("var")];
char stringpool_str55[sizeof("class")];
char stringpool_str57[sizeof("or")];
+ char stringpool_str58[sizeof("try")];
+ char stringpool_str59[sizeof("goto")];
char stringpool_str60[sizeof("const")];
char stringpool_str62[sizeof("include")];
char stringpool_str63[sizeof("continue")];
- char stringpool_str64[sizeof("goto")];
char stringpool_str65[sizeof("break")];
char stringpool_str66[sizeof("endfor")];
char stringpool_str67[sizeof("include_once")];
@@ -195,38 +195,38 @@ is_keyword_php (register const char *str, register size_t len)
char stringpool_str78[sizeof("__FILE__")];
char stringpool_str79[sizeof("eval")];
char stringpool_str80[sizeof("implements")];
- char stringpool_str81[sizeof("__TRAIT__\011\011")];
- char stringpool_str83[sizeof("for")];
- char stringpool_str86[sizeof("global")];
+ char stringpool_str81[sizeof("global")];
+ char stringpool_str83[sizeof("endwhile")];
+ char stringpool_str86[sizeof("__\360\235\224\245\360\235\224\236\360\235\224\251\360\235\224\261_\360\235\224\240\360\235\224\254\360\235\224\252\360\235\224\255\360\235\224\246\360\235\224\251\360\235\224\242\360\235\224\257")];
char stringpool_str87[sizeof("default")];
- char stringpool_str88[sizeof("readonly")];
- char stringpool_str91[sizeof("__\360\235\224\245\360\235\224\236\360\235\224\251\360\235\224\261_\360\235\224\240\360\235\224\254\360\235\224\252\360\235\224\255\360\235\224\246\360\235\224\251\360\235\224\242\360\235\224\257")];
- char stringpool_str93[sizeof("use")];
+ char stringpool_str88[sizeof("xor")];
+ char stringpool_str91[sizeof("return")];
+ char stringpool_str92[sizeof("private")];
+ char stringpool_str93[sizeof("new")];
char stringpool_str94[sizeof("__CLASS__")];
- char stringpool_str95[sizeof("unset")];
+ char stringpool_str95[sizeof("while")];
char stringpool_str96[sizeof("public")];
- char stringpool_str97[sizeof("foreach")];
+ char stringpool_str97[sizeof("__FUNCTION__")];
char stringpool_str98[sizeof("callable")];
char stringpool_str99[sizeof("protected")];
- char stringpool_str100[sizeof("throw")];
+ char stringpool_str100[sizeof("match")];
+ char stringpool_str102[sizeof("require")];
char stringpool_str103[sizeof("function")];
- char stringpool_str105[sizeof("array")];
+ char stringpool_str105[sizeof("yield")];
+ char stringpool_str107[sizeof("require_once")];
char stringpool_str108[sizeof("__NAMESPACE__")];
+ char stringpool_str109[sizeof("__TRAIT__")];
char stringpool_str110[sizeof("final")];
char stringpool_str112[sizeof("finally")];
- char stringpool_str113[sizeof("endwhile")];
+ char stringpool_str113[sizeof("for")];
char stringpool_str115[sizeof("clone")];
- char stringpool_str118[sizeof("try")];
- char stringpool_str120[sizeof("match")];
- char stringpool_str123[sizeof("new")];
- char stringpool_str125[sizeof("while")];
- char stringpool_str126[sizeof("return")];
- char stringpool_str127[sizeof("require")];
- char stringpool_str132[sizeof("require_once")];
- char stringpool_str145[sizeof("__METHOD__")];
- char stringpool_str149[sizeof("namespace")];
- char stringpool_str162[sizeof("__FUNCTION__")];
- char stringpool_str165[sizeof("yield")];
+ char stringpool_str118[sizeof("readonly")];
+ char stringpool_str123[sizeof("var")];
+ char stringpool_str125[sizeof("__METHOD__")];
+ char stringpool_str127[sizeof("foreach")];
+ char stringpool_str129[sizeof("namespace")];
+ char stringpool_str130[sizeof("throw")];
+ char stringpool_str135[sizeof("array")];
};
static const struct stringpool_t stringpool_contents =
{
@@ -243,7 +243,9 @@ is_keyword_php (register const char *str, register size_t len)
"endif",
"elseif",
"extends",
+ "use",
"endswitch",
+ "unset",
"as",
"case",
"trait",
@@ -255,16 +257,14 @@ is_keyword_php (register const char *str, register size_t len)
"and",
"catch",
"__DIR__",
- "xor",
"empty",
- "private",
- "var",
"class",
"or",
+ "try",
+ "goto",
"const",
"include",
"continue",
- "goto",
"break",
"endfor",
"include_once",
@@ -276,38 +276,38 @@ is_keyword_php (register const char *str, register size_t len)
"__FILE__",
"eval",
"implements",
- "__TRAIT__\011\011",
- "for",
"global",
- "default",
- "readonly",
+ "endwhile",
"__\360\235\224\245\360\235\224\236\360\235\224\251\360\235\224\261_\360\235\224\240\360\235\224\254\360\235\224\252\360\235\224\255\360\235\224\246\360\235\224\251\360\235\224\242\360\235\224\257",
- "use",
+ "default",
+ "xor",
+ "return",
+ "private",
+ "new",
"__CLASS__",
- "unset",
+ "while",
"public",
- "foreach",
+ "__FUNCTION__",
"callable",
"protected",
- "throw",
+ "match",
+ "require",
"function",
- "array",
+ "yield",
+ "require_once",
"__NAMESPACE__",
+ "__TRAIT__",
"final",
"finally",
- "endwhile",
+ "for",
"clone",
- "try",
- "match",
- "new",
- "while",
- "return",
- "require",
- "require_once",
+ "readonly",
+ "var",
"__METHOD__",
+ "foreach",
"namespace",
- "__FUNCTION__",
- "yield"
+ "throw",
+ "array"
};
#define stringpool ((const char *) &stringpool_contents)
static const int wordlist[] =
@@ -332,9 +332,10 @@ is_keyword_php (register const char *str, register size_t len)
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str25,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str26,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str27,
- -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str28,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str29,
- -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str30,
+ -1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str32,
-1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str34,
@@ -351,22 +352,19 @@ is_keyword_php (register const char *str, register size_t len)
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str45,
-1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str47,
- (int)(size_t)&((struct stringpool_t *)0)->stringpool_str48,
- -1,
+ -1, -1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str50,
- -1,
- (int)(size_t)&((struct stringpool_t *)0)->stringpool_str52,
- (int)(size_t)&((struct stringpool_t *)0)->stringpool_str53,
- -1,
+ -1, -1, -1, -1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str55,
-1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str57,
- -1, -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str58,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str59,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str60,
-1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str62,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str63,
- (int)(size_t)&((struct stringpool_t *)0)->stringpool_str64,
+ -1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str65,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str66,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str67,
@@ -391,7 +389,7 @@ is_keyword_php (register const char *str, register size_t len)
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str88,
-1, -1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str91,
- -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str92,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str93,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str94,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str95,
@@ -400,13 +398,15 @@ is_keyword_php (register const char *str, register size_t len)
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str98,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str99,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str100,
- -1, -1,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str102,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str103,
-1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str105,
- -1, -1,
- (int)(size_t)&((struct stringpool_t *)0)->stringpool_str108,
-1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str107,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str108,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str109,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str110,
-1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str112,
@@ -415,26 +415,17 @@ is_keyword_php (register const char *str, register size_t len)
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str115,
-1, -1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str118,
- -1,
- (int)(size_t)&((struct stringpool_t *)0)->stringpool_str120,
- -1, -1,
+ -1, -1, -1, -1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str123,
-1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str125,
- (int)(size_t)&((struct stringpool_t *)0)->stringpool_str126,
+ -1,
(int)(size_t)&((struct stringpool_t *)0)->stringpool_str127,
+ -1,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str129,
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str130,
-1, -1, -1, -1,
- (int)(size_t)&((struct stringpool_t *)0)->stringpool_str132,
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1,
- (int)(size_t)&((struct stringpool_t *)0)->stringpool_str145,
- -1, -1, -1,
- (int)(size_t)&((struct stringpool_t *)0)->stringpool_str149,
- -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1,
- (int)(size_t)&((struct stringpool_t *)0)->stringpool_str162,
- -1, -1,
- (int)(size_t)&((struct stringpool_t *)0)->stringpool_str165
+ (int)(size_t)&((struct stringpool_t *)0)->stringpool_str135
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
diff --git a/llamafile/is_keyword_php.gperf b/llamafile/is_keyword_php.gperf
index 577d2c16..c3f94229 100644
--- a/llamafile/is_keyword_php.gperf
+++ b/llamafile/is_keyword_php.gperf
@@ -17,7 +17,7 @@ __FUNCTION__
__LINE__
__METHOD__
__NAMESPACE__
-__TRAIT__
+__TRAIT__
__π”₯π”žπ”©π”±_𝔠𝔬π”ͺ𝔭𝔦𝔩𝔒𝔯
abstract
and
diff --git a/llamafile/string.cpp b/llamafile/string.cpp
index c988dfa0..b032094d 100644
--- a/llamafile/string.cpp
+++ b/llamafile/string.cpp
@@ -19,6 +19,13 @@
#include <cosmo.h>
+std::string tolower(const std::string_view &s) {
+ std::string b;
+ for (char c : s)
+ b += tolower(c);
+ return b;
+}
+
void append_wchar(std::string *r, wchar_t c) {
if (isascii(c)) {
*r += c;
diff --git a/llamafile/string.h b/llamafile/string.h
index 227100ab..1a6a46ca 100644
--- a/llamafile/string.h
+++ b/llamafile/string.h
@@ -18,4 +18,5 @@
#pragma once
#include <string>
+std::string tolower(const std::string_view &);
void append_wchar(std::string *, wchar_t);