cttl::policy_space< flag_cpp_comments > Struct Template Reference

Space policy specialization to skip white space characters combined with C and C++ style comments. More...

#include <policy.h>

Inheritance diagram for cttl::policy_space< flag_cpp_comments >:

cttl::policy_default cttl::policy_space< flag_greedy|flag_cpp_comments >

List of all members.

Static Public Member Functions

static size_t comment (const_edge< policy_default, CTTL_STD_STRING > &substr_)
 Defines CTTL grammar production rule matching C and C++ comments.
template<typename SubstrT >
static size_t match (SubstrT &substr_)
 Defines CTTL grammar production rule to evaluate grammar expression matching white space characters combined with C and C++ comments.
static size_t space_and_comment (const_edge< policy_default, CTTL_STD_STRING > &substr_)
 Defines CTTL grammar production rule matching white space characters combined with C and C++ comments.


Detailed Description

template<>
struct cttl::policy_space< flag_cpp_comments >

Space policy specialization to skip white space characters combined with C and C++ style comments.

Remarks:
This is ungreedy version of the corresponding space policy.

Definition at line 836 of file policy.h.


Member Function Documentation

static size_t cttl::policy_space< flag_cpp_comments >::comment ( const_edge< policy_default, CTTL_STD_STRING > &  substr_  )  [static]

Defines CTTL grammar production rule matching C and C++ comments.

Parameters:
substr_ references parseable substring.
Returns:
absolute position of the substring upper boundary after expression is evaluated.

Definition at line 931 of file policy.h.

00932     {
00933         typedef const_edge< policy_default, CTTL_STD_STRING >::char_T char_T;
00934         return (
00935             begin( char_T( '/' ) )
00936             +
00937             (
00938                 ( symbol( char_T( '/' ) ) + symbol( char_T( '/' ) ) + !begin( symbol( char_T( '\n' ) ) | end() ) )
00939                 |
00940                 ( symbol( char_T( '/' ) ) + symbol( char_T( '*' ) ) + !!( symbol( char_T( '*' ) ) + symbol( char_T( '/' ) ) ) )
00941             )
00942         ).match( substr_ );
00943     }

template<typename SubstrT >
static size_t cttl::policy_space< flag_cpp_comments >::match ( SubstrT &  substr_  )  [static]

Defines CTTL grammar production rule to evaluate grammar expression matching white space characters combined with C and C++ comments.

Template Parameters:
SubstrT specifies type of the parseable substring, such as cttl::const_edge or cttl::edge.
Parameters:
substr_ references parseable substring.
Returns:
absolute position of the substring upper boundary after expression that matches white space is evaluated.
Postcondition:
The function must
  • always succeed
  • return a valid offset within the specified substring.
Remarks:
This implementation is ungreedy.

Reimplemented from cttl::policy_default.

Reimplemented in cttl::policy_space< flag_greedy|flag_cpp_comments >.

Definition at line 864 of file policy.h.

00865     {
00866         CTTL_TRACE_SILENT( true );
00867         size_t ungreedy_offset = substr_.first.offset();
00868         (
00869             true ^ rule( policy_space< flag_cpp_comments >::space_and_comment )
00870 
00871         ).match( substr_ );
00872 
00873         // policy_space is ungreedy:
00874         return ungreedy_offset;
00875     }

static size_t cttl::policy_space< flag_cpp_comments >::space_and_comment ( const_edge< policy_default, CTTL_STD_STRING > &  substr_  )  [static]

Defines CTTL grammar production rule matching white space characters combined with C and C++ comments.

Parameters:
substr_ references parseable substring.
Returns:
absolute position of the substring upper boundary after expression is evaluated.

Definition at line 888 of file policy.h.

00889     {
00890         return (
00891             (
00892                 entity( isspace )
00893                 +
00894                 (
00895                     (
00896                         rule( policy_space< flag_cpp_comments >::comment )
00897                         +
00898                         rule( policy_space< flag_cpp_comments >::space_and_comment )
00899                     )
00900                     |
00901                     begin( true )
00902                 )
00903             )
00904             |
00905             (
00906                 rule( policy_space< flag_cpp_comments >::comment )
00907                 +
00908                 (
00909                     rule( policy_space< flag_cpp_comments >::space_and_comment )
00910                     |
00911                     begin( true )
00912                 )
00913             )
00914             |
00915             begin( true )
00916 
00917         ).match( substr_ );
00918     }


The documentation for this struct was generated from the following file:

Generated on Sun Aug 23 13:43:45 2009 for Common Text Transformation Library by  doxygen 1.5.9