text reader passes tests

This commit is contained in:
2026-08-04 14:22:57 -06:00
parent fa511520c6
commit 897e155b0e
6 changed files with 406 additions and 162 deletions
+5 -5
View File
@@ -15,15 +15,15 @@ namespace spider {
/** @brief Indicates if the token composition successfully matched the input boundary. */
bool success = false;
optional<std::string_view> tag;
optional<std::string_view> tag = {};
/**
* @brief Holds the deep-copied UTF-32 matching substring upon victory.
* @note Returns empty when success is false.
*/
std::u32string match;
std::u32string match = U"";
vector<TokenResult> child;
vector<TokenResult> child = {};
};
@@ -61,7 +61,7 @@ namespace spider {
std::vector<std::unique_ptr<Token>> arena;
// Deduplication caches
std::unordered_map<std::string, const Token*> lit_cache;
std::unordered_map<std::string, Token*> lit_cache;
public:
@@ -238,7 +238,7 @@ namespace spider {
public:
TagToken(const Token* t, std::string_view tag, bool doflatten = false);
TagToken(const Token* t, std::string_view tag, bool doflatten);
TokenResult test(TextReader& ctx) const override;