#include <xtl_primary.h>
Public Member Functions | |
template<typename SubstrT > | |
size_t | internal_find (SubstrT &edge_) |
Implements search evaluation grammar evaluation algorithm. | |
template<typename SubstrT > | |
size_t | internal_match (SubstrT &edge_) |
Implements match evaluation grammar evaluation algorithm. | |
xtl_iswhat_first (iswhat_T iswhat_) | |
Constructs and initializes the object. |
Definition at line 1129 of file xtl_primary.h.
cttl_impl::xtl_iswhat_first::xtl_iswhat_first | ( | iswhat_T | iswhat_ | ) |
size_t cttl_impl::xtl_iswhat_first::internal_find | ( | SubstrT & | edge_ | ) |
Implements search evaluation grammar evaluation algorithm.
SubstrT | specifies type of the parseable substring. Can be either cttl::const_edge or cttl::edge . |
edge_ | reference to the parseable substring. |
edge_
parameter, is consumed accordingly to the size of the matched symbol: // 1. The ending position of the matched symbol is set: edge_.first.offset( end_offset ); // 2. Starting position of the matched symbol is returned: return begin_offset;
SubstrT::string_T::npos
, indicating that the evaluation algorithm has failed. Definition at line 1224 of file xtl_primary.h.
01225 { 01226 typename SubstrT::string_T const& str = edge_.parent(); 01227 typename SubstrT::string_T::const_iterator it = str.begin() + edge_.first.offset(); 01228 01229 // find starting position 01230 it = std::find_if( it, str.end(), m_iswhat ); 01231 if ( it == str.end() ) { 01232 CTTL_TRACE_TEXT_RESULT( false, 'F', xtl_trace_grammar::cttl_trace_iswhat( m_iswhat ) ); 01233 return SubstrT::string_T::npos; 01234 } 01235 01236 size_t new_offset = std::distance( str.begin(), it ); 01237 // set find ending position: 01238 // at least one character in this entity is present 01239 edge_.first.offset( new_offset + 1 ); 01240 CTTL_TRACE_TEXT_RESULT( true, 'F', xtl_trace_grammar::cttl_trace_iswhat( m_iswhat ) ); 01241 return new_offset; 01242 }
size_t cttl_impl::xtl_iswhat_first::internal_match | ( | SubstrT & | edge_ | ) |
Implements match evaluation grammar evaluation algorithm.
SubstrT | specifies type of the parseable substring. Can be either cttl::const_edge or cttl::edge . |
edge_ | reference to the parseable substring. |
edge_
parameter, is consumed accordingly to the size of the matched symbol: // 1. The ending position of the matched symbol is set: edge_.first.offset( end_offset ); // 2. Starting position of the matched symbol is returned: return begin_offset;
SubstrT::string_T::npos
, indicating that the evaluation algorithm has failed. Definition at line 1177 of file xtl_primary.h.
01178 { 01179 if ( m_iswhat( edge_.parent()[ edge_.first.offset() ] ) ) { 01180 // successful match 01181 // set match starting position 01182 size_t match_offset = edge_.first.offset(); 01183 // ending position: 01184 // at least one character in this entity is present 01185 edge_.first.offset( edge_.first.offset() + 1 ); 01186 CTTL_TRACE_TEXT_RESULT( true, 'F', xtl_trace_grammar::cttl_trace_iswhat( m_iswhat ) ); 01187 return match_offset; 01188 } 01189 CTTL_TRACE_TEXT_RESULT( false, 'F', xtl_trace_grammar::cttl_trace_iswhat( m_iswhat ) ); 01190 return SubstrT::string_T::npos; 01191 }