2005-08-04 22:42:30 +02:00
|
|
|
#ifndef ARABICA_XPATHIC_XPATH_AST_HPP
|
|
|
|
#define ARABICA_XPATHIC_XPATH_AST_HPP
|
|
|
|
|
|
|
|
#include <boost/spirit/core.hpp>
|
|
|
|
#include <boost/spirit/tree/ast.hpp>
|
|
|
|
|
2005-08-17 14:28:20 +02:00
|
|
|
#include "xpath_ast_ids.hpp"
|
|
|
|
|
2005-08-04 22:42:30 +02:00
|
|
|
namespace Arabica
|
|
|
|
{
|
|
|
|
namespace XPath
|
|
|
|
{
|
2005-08-22 17:59:57 +02:00
|
|
|
namespace impl
|
|
|
|
{
|
2005-08-04 22:42:30 +02:00
|
|
|
|
2005-09-25 22:09:49 +02:00
|
|
|
template<class string_adaptor>
|
2005-08-19 19:20:06 +02:00
|
|
|
class types
|
|
|
|
{
|
|
|
|
public:
|
2005-09-25 22:09:49 +02:00
|
|
|
typedef typename string_adaptor::const_iterator str_iter_t;
|
2005-08-19 19:20:06 +02:00
|
|
|
typedef boost::spirit::tree_match<str_iter_t> tree_match_t;
|
|
|
|
typedef typename tree_match_t::tree_iterator node_iter_t;
|
|
|
|
typedef boost::spirit::tree_parse_info<str_iter_t> tree_info_t;
|
|
|
|
}; // types
|
|
|
|
|
2005-09-25 22:09:49 +02:00
|
|
|
template<class string_adaptor>
|
|
|
|
long getNodeId(typename types<string_adaptor>::node_iter_t const& node)
|
2005-08-17 14:28:20 +02:00
|
|
|
{
|
|
|
|
return static_cast<long>(node->value.id().to_long());
|
|
|
|
} // getNodeId
|
|
|
|
|
2005-09-25 22:09:49 +02:00
|
|
|
template<class string_adaptor>
|
|
|
|
typename types<string_adaptor>::node_iter_t& skipWhitespace(typename types<string_adaptor>::node_iter_t& node)
|
2005-08-17 14:28:20 +02:00
|
|
|
{
|
2005-09-25 22:09:49 +02:00
|
|
|
while(getNodeId<string_adaptor>(node) == impl::S_id)
|
2005-08-17 14:28:20 +02:00
|
|
|
++node;
|
|
|
|
return node;
|
|
|
|
} // skipWhitespace
|
2005-08-04 22:42:30 +02:00
|
|
|
|
2005-08-22 17:59:57 +02:00
|
|
|
} // namespace impl
|
2005-08-04 22:42:30 +02:00
|
|
|
} // namespace XPath
|
|
|
|
} // namespace Arabica
|
|
|
|
#endif
|