mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
76070f8da2
* Reoptimized math.min/max/bit32 builtins assuming at least 2 arguments are used (1-2% lift on some benchmarks) * Type errors that mention function types no longer have redundant parenthesis around return type * Luau REPL now supports --compile=remarks which displays the source code with optimization remarks embedded as comments * Builtin calls are slightly faster when called with 1-2 arguments (~1% improvement in some benchmarks)
37 lines
1.3 KiB
C++
37 lines
1.3 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#pragma once
|
|
|
|
#include "Luau/Common.h"
|
|
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
#include <stdarg.h>
|
|
|
|
namespace Luau
|
|
{
|
|
|
|
std::string format(const char* fmt, ...) LUAU_PRINTF_ATTR(1, 2);
|
|
std::string vformat(const char* fmt, va_list args);
|
|
|
|
void formatAppend(std::string& str, const char* fmt, ...) LUAU_PRINTF_ATTR(2, 3);
|
|
void vformatAppend(std::string& ret, const char* fmt, va_list args);
|
|
|
|
std::string join(const std::vector<std::string_view>& segments, std::string_view delimiter);
|
|
std::string join(const std::vector<std::string>& segments, std::string_view delimiter);
|
|
|
|
std::vector<std::string_view> split(std::string_view s, char delimiter);
|
|
|
|
// Computes the Damerau-Levenshtein distance of A and B.
|
|
// https://en.wikipedia.org/wiki/Damerau-Levenshtein_distance#Distance_with_adjacent_transpositions
|
|
size_t editDistance(std::string_view a, std::string_view b);
|
|
|
|
bool startsWith(std::string_view lhs, std::string_view rhs);
|
|
bool equalsLower(std::string_view lhs, std::string_view rhs);
|
|
|
|
size_t hashRange(const char* data, size_t size);
|
|
|
|
std::string escape(std::string_view s, bool escapeForInterpString = false);
|
|
bool isIdentifier(std::string_view s);
|
|
} // namespace Luau
|