diff --git a/src/lib/text-template.hpp b/src/lib/text-template.hpp index 4c735c30c..990fbfc64 100644 --- a/src/lib/text-template.hpp +++ b/src/lib/text-template.hpp @@ -137,7 +137,38 @@ namespace lib { const regex ACCEPT_MARKUP { MATCH_ESCAPE+"|"+MATCH_FIELD , regex::ECMAScript|regex::optimize }; - // Sub-Matches: 1 = ESCAPE; 2 = ELSE; 3 = END; 4 = LOGIC; 5 = KEY; + // Sub-Matches: 1 = ESCAPE; 2 = ELSE; 3 = END; 4 = LOGIC; 5 = KEY; + + struct TagSyntax + { + enum Keyword{ ESCAPE + , KEYID + , IF + , END_IF + , FOR + , END_FOR + , ELSE + }; + Keyword syntaxCase{ESCAPE}; + StrView lead; + StrView key; + }; + + inline auto + parse (string input) + { + auto classify = [pre=size_t(0)] + (smatch mat) mutable -> TagSyntax + { + REQUIRE (not mat.empty()); + StrView lead{}; //////////////////////////////OOO find a way to move that along trailing + if (mat[1].matched) + return TagSyntax{TagSyntax::ESCAPE,lead}; + }; + util::RegexSearchIter parser{input, ACCEPT_MARKUP}; +// return explore(parser) ///////////////////////////OOO find out why this is not forward-iterable +// .transform(classify); + } } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 502ed7a27..97d12de04 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -113031,11 +113031,19 @@ std::cout << tmpl.render({"what", "World"}) << s - - + + + + + + + + + +