The docsearch function is now working.

This commit is contained in:
2026-01-14 14:34:54 -05:00
parent 850b4aa43b
commit 03e9928e03
6 changed files with 163 additions and 68 deletions

View File

@@ -200,6 +200,15 @@ bool is_lua_comment(string_view s) {
return s.substr(start, 2) == "--";
}
bool is_lua_function_prototype(string_view s) {
int start = 0;
while ((start < int(s.size())) && ((s[start]==' ') || (s[start]=='\t'))) start++;
s.remove_prefix(start);
if (!has_prefix(s, "function")) return false;
s.remove_prefix(8);
return ((!s.empty()) && (ascii_isspace(s[0])));
}
bool is_whitespace(string_view s) {
for (int i = 0; i < int(s.size()); i++) {
if (!ascii_isspace(s[i])) {
@@ -342,6 +351,12 @@ bool valid_number(string_view s, bool plus, bool minus, bool dec, bool exp) {
return s.empty();
}
bool contains_substring_utf8(string_view haystack, string_view needle)
{
// Case sensitive is easy. Case insensitive is hard.
return haystack.find(needle) != std::string::npos;
}
using UC = UnicodeStuff<eng::string, eng::u16string, eng::u32string>;
int32_t read_codepoint_utf8(string_view &source) { return UC::read_codepoint_utf8(source); }