Give clearer names to template parameters

This commit is contained in:
Rangi
2025-10-08 14:52:34 -04:00
parent 711fba5e35
commit 23b9039716
13 changed files with 118 additions and 102 deletions

View File

@@ -38,8 +38,8 @@ struct Charmap {
};
// Traverse the trie depth-first to derive the character mappings in definition order
template<typename F>
bool forEachChar(Charmap const &charmap, F callback) {
template<typename CallbackFnT>
bool forEachChar(Charmap const &charmap, CallbackFnT callback) {
// clang-format off: nested initializers
for (std::stack<std::pair<size_t, std::string>> prefixes({{0, ""}}); !prefixes.empty();) {
// clang-format on

View File

@@ -816,8 +816,8 @@ static int nextChar() {
return peek();
}
template<typename P>
static int skipChars(P predicate) {
template<typename PredicateFnT>
static int skipChars(PredicateFnT predicate) {
int c = peek();
while (predicate(c)) {
c = nextChar();
@@ -2281,8 +2281,8 @@ yy::parser::symbol_type yylex() {
}
}
template<typename F>
static Capture makeCapture(char const *name, F callback) {
template<typename CallbackFnT>
static Capture makeCapture(char const *name, CallbackFnT callback) {
// Due to parser internals, it reads the EOL after the expression before calling this.
// Thus, we don't need to keep one in the buffer afterwards.
// The following assumption checks that.

View File

@@ -57,8 +57,10 @@
yy::parser::symbol_type yylex(); // Provided by lexer.cpp
template <typename N, typename S>
static auto handleSymbolByType(std::string const &symName, N numCallback, S strCallback) {
template<typename NumCallbackFnT, typename StrCallbackFnT>
static auto handleSymbolByType(
std::string const &symName, NumCallbackFnT numCallback, StrCallbackFnT strCallback
) {
if (Symbol *sym = sym_FindScopedSymbol(symName); sym && sym->type == SYM_EQUS) {
return strCallback(*sym->getEqus());
} else {