lib: improve error checking

This commit is contained in:
Dirk-Jan C. Binnema
2026-03-07 15:50:15 +02:00
committed by Seth Ladygo
parent 45b9722040
commit e6e852b7e0
2 changed files with 9 additions and 4 deletions

View File

@ -148,11 +148,15 @@ matcher(Sexp& tokens, ParseContext& ctx)
if (!fields.empty()) {
Sexp vals{};
vals.add(or_sym);
for (auto&& field: fields)
for (auto&& field: fields) {
if (!second(val))
continue;
if (auto&& phrase{phrasify(field, *second(val))}; phrase)
vals.add(std::move(*phrase));
else
vals.add(Sexp{Sexp::Symbol{field.name}, Sexp{*second(val)}});
vals.add(Sexp{Sexp::Symbol{field.name},
Sexp{*second(val)}});
}
val = std::move(vals);
}