more
This commit is contained in:
@@ -91,7 +91,9 @@ namespace spider {
|
||||
* @brief Constructs a literal rule by transforming a standard UTF-8 string view.
|
||||
* @throws std::runtime_error If incoming character boundaries contain invalid UTF-8 formatting.
|
||||
*/
|
||||
explicit LitToken(std::string_view lit);
|
||||
LitToken(std::string_view lit);
|
||||
|
||||
LitToken(const char* lit);
|
||||
|
||||
/** @brief Direct zero-conversion construction using an existing native UTF-32 literal. */
|
||||
explicit LitToken(std::u32string lit);
|
||||
@@ -104,6 +106,26 @@ namespace spider {
|
||||
TokenResult test(TextReader& ctx) const override;
|
||||
};
|
||||
|
||||
using FnTokenFn = std::function<bool(u32) >;
|
||||
|
||||
/**
|
||||
* @brief Function based token
|
||||
*/
|
||||
class FnToken : public Token {
|
||||
private:
|
||||
|
||||
FnTokenFn fn;
|
||||
|
||||
public:
|
||||
|
||||
FnToken(FnTokenFn chfn);
|
||||
|
||||
public:
|
||||
|
||||
TokenResult test(TextReader& ctx) const override;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Evaluates an unrolled sequence of ordered grammatical rules sequentially (AndToken).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user