|
// released into the public domain
// by Christopher Diggins 2004
// http://www.cdiggins.com
#ifndef HTML_TEST_HPP_INCLUDED
#define HTML_TEST_HPP_INCLUDED
namespace html_test
{
using namespace yard;
struct Href_string { static char const* GetString() { return "href"; } };
struct MatchHref : public
re_or3
<
re_and<
MatchChar<'\''>,
re_until<
MatchChar<'\''>
>
>,
re_and<
MatchChar<'"'>,
re_until<
MatchChar<'"'>
>
>,
re_until<
re_or<
MatchWSpace,
MatchChar<'>'>
>
>
>
{ };
struct MatchEq : public
re_and3
<
re_opt<MatchWSpace>,
MatchChar<'='>,
re_opt<MatchWSpace>
>
{ };
struct MatchHrefAttribute : public
re_and3
<
MatchStringNoCase<Href_string>,
MatchEq,
MatchHref
>
{ };
}
template<>
struct yard::Actor<char const*, html_test::MatchHref>
{
static void OnBefore(char const* pos) { }
static void OnFailure(char const* pos) { }
static void OnSuccess(char const* begin, char const* end)
{
std::string s(begin, end - begin);
s = "href = " + s;
puts(s.c_str());
}
};
#endif // #ifndef HTML_TEST_HPP_INCLUDED
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here