From: <bl...@us...> - 2003-05-02 06:22:28
|
Update of /cvsroot/cpptool/rfta/include/rfta/parser In directory sc8-pr-cvs1:/tmp/cvs-serv5042/include/rfta/parser Modified Files: ParserTools.h Log Message: * added support for nested constant in case ( case X::value:). * added ParserTools::makeComposite() to create composite skip policy Index: ParserTools.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/parser/ParserTools.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ParserTools.h 29 Apr 2003 09:46:09 -0000 1.6 --- ParserTools.h 2 May 2003 06:22:26 -0000 1.7 *************** *** 149,153 **** struct SkipBalancingBracePolicy { - static void handleSkip( Xtl::CStringEnumerator &enumerator ) { --- 149,152 ---- *************** *** 161,166 **** --- 160,216 ---- findNextBalanced( ++enumerator, ')', '(' ); } + }; + + + struct SkipScopeOperatorPolicy + { + static void handleSkip( Xtl::CStringEnumerator &enumerator ) + { + if ( enumerator[0] == ':' && enumerator[1] == ':' ) + enumerator += 2; + } + + static void handleSkip( Xtl::CStringBackEnumerator &enumerator ) + { + if ( enumerator[0] == ':' && enumerator[-1] == ':' ) + enumerator += 2; + } + }; + + + template<typename Policy1 + ,typename Policy2> + struct Skip2Policy + { + Skip2Policy( Policy1 policy1, Policy2 policy2 ) + : policy1_( policy1 ) + , policy2_( policy2 ) + { + } + + void handleSkip( Xtl::CStringEnumerator &enumerator ) const + { + policy1_.handleSkip( enumerator ); + policy2_.handleSkip( enumerator ); + } + + void handleSkip( Xtl::CStringBackEnumerator &enumerator ) const + { + policy1_.handleSkip( enumerator ); + policy2_.handleSkip( enumerator ); + } + Policy1 policy1_; + Policy2 policy2_; }; + + + template<typename Policy1 + ,typename Policy2> + Skip2Policy<Policy1,Policy2> + makePolicy( Policy1 policy1, Policy2 policy2 ) + { + return Skip2Policy<Policy1,Policy2>( policy1, policy2 ); + } bool RFTAPARSER_API tryReadIdentifier( Xtl::CStringEnumerator &enumerator, Xtl::CStringView& identifier ); |