#include <xtl_op_impl.h>
Public Member Functions | |
template<typename SubstrT > | |
size_t | bang_find (SubstrT &edge_) |
Implements repeatable search evaluation for sequence operator, starting at the upper boundary of the parseable substring. | |
template<typename SubstrT > | |
size_t | find (SubstrT &edge_) |
Implements search evaluation for the sequence operator, starting at the upper boundary of the parseable substring. | |
template<typename SubstrT > | |
size_t | match (SubstrT &edge_) |
Implements match evaluation for the sequence operator, starting at the upper boundary of the parseable substring. | |
xtl_opbinplus (Left_exprT const &lhs_expr_, Right_exprT const &rhs_expr_) | |
Constructs and initializes the object. |
Left_exprT | specifies type of left-hand-side grammar expression object, determined by the C++ compiler at compile time. | |
Right_exprT | specifies type of right-hand-side grammar expression object, determined by the C++ compiler at compile time. |
Definition at line 1393 of file xtl_op_impl.h.
cttl_impl::xtl_opbinplus< Left_exprT, Right_exprT >::xtl_opbinplus | ( | Left_exprT const & | lhs_expr_, | |
Right_exprT const & | rhs_expr_ | |||
) |
Constructs and initializes the object.
Left_exprT | specifies type of left-hand-side grammar expression object, determined by the C++ compiler at compile time. | |
Right_exprT | specifies type of right-hand-side grammar expression object, determined by the C++ compiler at compile time. |
lhs_expr_ | immutable reference to left-hand-side grammar expression object. | |
rhs_expr_ | immutable reference to right-hand-side grammar expression object. |
Definition at line 1416 of file xtl_op_impl.h.
size_t cttl_impl::xtl_opbinplus< Left_exprT, Right_exprT >::bang_find | ( | SubstrT & | edge_ | ) |
Implements repeatable search evaluation for sequence operator, starting at the upper boundary of the parseable substring.
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 according to the size of the matched sequence.SubstrT::string_T::npos
, indicating that the evaluation algorithm has failed. Definition at line 1538 of file xtl_op_impl.h.
01539 { 01540 // !!L+R_ 01541 CTTL_TRACE_LEVEL_BANG( ';' ); 01542 typename SubstrT::offset_guard_T saved_first_offset( edge_.first ); 01543 typename SubstrT::offset_guard_T match_lhs_offset( edge_.first, SubstrT::string_T::npos ); 01544 // if this offset stops progressing, we must bail out of infinite loop: 01545 typename SubstrT::offset_guard_T iteration_offset( edge_.first, SubstrT::string_T::npos ); 01546 01547 while ( ( match_lhs_offset = this->m_expr_lhs.bang_find( edge_ ) ) != SubstrT::string_T::npos ) { 01548 if ( this->m_expr_rhs.match( edge_ ) != SubstrT::string_T::npos ) 01549 return match_lhs_offset; 01550 01551 if ( iteration_offset == edge_.first.offset() ) { 01552 CTTL_TRACE_TEXT( ';', "!!(R1+R2): search made no progress: bailing out" ); 01553 break; // second, third, etc., iteration hasn't made any progress: bail out 01554 } 01555 01556 iteration_offset = edge_.first.offset(); 01557 } 01558 01559 // restore substring 01560 edge_.first.offset( saved_first_offset ); 01561 return SubstrT::string_T::npos; 01562 }
size_t cttl_impl::xtl_opbinplus< Left_exprT, Right_exprT >::find | ( | SubstrT & | edge_ | ) |
Implements search evaluation for the sequence operator, starting at the upper boundary of the parseable substring.
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 according to the size of the matched sequence.SubstrT::string_T::npos
, indicating that the evaluation algorithm has failed. Definition at line 1494 of file xtl_op_impl.h.
01495 { 01496 // !L+R_ 01497 CTTL_TRACE_LEVEL_FIND( ';' ); 01498 typename SubstrT::offset_guard_T saved_first_offset( edge_.first ); 01499 typename SubstrT::offset_guard_T match_lhs_offset( edge_.first, this->m_expr_lhs.find( edge_ ) ); 01500 01501 if ( 01502 ( match_lhs_offset != SubstrT::string_T::npos ) 01503 && 01504 ( this->m_expr_rhs.match( edge_ ) != SubstrT::string_T::npos ) 01505 ) 01506 return match_lhs_offset; 01507 01508 edge_.first.offset( saved_first_offset ); // restore substring 01509 return SubstrT::string_T::npos; 01510 }
size_t cttl_impl::xtl_opbinplus< Left_exprT, Right_exprT >::match | ( | SubstrT & | edge_ | ) |
Implements match evaluation for the sequence operator, starting at the upper boundary of the parseable substring.
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 according to the size of the matched sequence.SubstrT::string_T::npos
, indicating that the evaluation algorithm has failed. Definition at line 1448 of file xtl_op_impl.h.
01449 { 01450 // L+R_ relaxed sequence 01451 // if L succeeds, and R fails, substring needs to be restored 01452 CTTL_TRACE_LEVEL_MATCH( ';' ); 01453 typename SubstrT::offset_guard_T saved_first_offset( edge_.first ); 01454 typename SubstrT::offset_guard_T match_lhs_offset( edge_.first, this->m_expr_lhs.match( edge_ ) ); 01455 01456 if ( 01457 ( match_lhs_offset != SubstrT::string_T::npos ) 01458 && 01459 ( this->m_expr_rhs.match( edge_ ) != SubstrT::string_T::npos ) 01460 ) 01461 return match_lhs_offset; 01462 01463 // restore substring 01464 edge_.first.offset( saved_first_offset ); 01465 return SubstrT::string_T::npos; 01466 }