Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

policy_default Struct Reference

#include <const_edge.h>

Inheritance diagram for policy_default:

Inheritance graph
[legend]
List of all members.

Detailed Description

Provides default implementation for CTTL white space policy.

Remarks:
All user-defined policy classes should directly or indirectly derive from this class.
See also:

Definition at line 54 of file const_edge.h.

Public Types

typedef policy_default strict_policy_T
 Defines type of strict policy for grammar evaluations in strict mode.

Public Member Functions

template<typename StringT>
StringT region_difference (StringT const &str_, size_t first_offset_, size_t second_offset_)
 Returns substring pointed by two offsets, but excludes defined invalid ranges.

Static Public Member Functions

template<typename UniverseT>
size_t match (UniverseT &universe_)
 Defines production rule function to evaluate grammar expression describing white space.
template<typename UniverseT>
bool lower_bound (size_t, UniverseT &)
 Moves upper boundary of the parseable universe outside of any region that was specified by the user.
size_t lower_bound (size_t offset_, size_t)
 Computes lower boundary of the region provided by the user, if specified offset_ intersects with one of the client regions.
void region_adjust (size_t, int)
 Adjusts map of regions accordingly to the specified position and delta.
void region_insert (size_t, size_t)
 Creates new region.
void region_erase (size_t, size_t)
 Erases region(s).


Member Typedef Documentation

typedef policy_default strict_policy_T
 

Defines type of strict policy for grammar evaluations in strict mode.

For more information, see strict universe overview.

C++ type designated as strict policy type must provide a default constructor. The strict policy is always constructed as a static member of the strict universe using the default constructor, and therefore, the strict policy must have stateless implementation.

Definition at line 66 of file const_edge.h.


Member Function Documentation

size_t lower_bound size_t  offset_,
size_t 
[inline, static]
 

Computes lower boundary of the region provided by the user, if specified offset_ intersects with one of the client regions.

UniverseT
Template parameter specifying type of the parseable universe. Can be either cttl::const_edge or cttl::edge.
Parameters:
offset_ specifies base offset to check against existing client regions.
Postcondition:
If no intersection is found, or if no client regions exist, the function returns unchanged offset_.

Definition at line 157 of file const_edge.h.

bool lower_bound size_t  ,
UniverseT & 
[inline, static]
 

Moves upper boundary of the parseable universe outside of any region that was specified by the user.

UniverseT
Template parameter specifying type of the parseable universe. Can be either cttl::const_edge or cttl::edge.
Returns:
true if offset is adjusted, false otherwise.
Precondition:
specified offset is not the same as the universe_.first.offset().
Postcondition:
If this function returns true, the universe_.first cttl::node must be relocated to the boundary position that was found, even if the universe length should become negative. Therefore, the caller must always check for negative universe length condition upon return.

Definition at line 137 of file const_edge.h.

size_t match UniverseT &  universe_  )  [inline, static]
 

Defines production rule function to evaluate grammar expression describing white space.

UniverseT
Template parameter specifying type of the parseable universe. Can be either cttl::const_edge or cttl::edge.
Parameters:
universe_ reference to the parseable universe.
Returns:
absolute position of the universe upper boundary after white space expression has been evaluated.
Postcondition:
The match() function must always succeed and supposed to return a valid offset within specified universe of discourse.
Remarks:
Default policy supports strict grammar evaluation of the user input. The implementation of method match is empty, therefore, it does no white space recognition. During grammar evaluation, the lexer implementation invokes match() function of the white space policy class, giving it a chance to modify upper boundary of the universe accordingly to the definition of white space. If match() function returns position before the white space, its behavior is described as non-greedy white space evaluation. On the other hand, if the function returns position immediately after the white space, the behavior is greedy. Non-greedy evaluations consume white space symbols, but offer capability to backtrack to the original position if necessary. The greedy version, on the other hand, consumes white space and suggests newly modified offset for future backtracking attempts.

Reimplemented in policy_space< flag_follow_space >, policy_space< flag_greedy|flag_follow_space >, policy_space< flag_cpp_comments >, and policy_space< flag_greedy|flag_cpp_comments >.

Definition at line 109 of file const_edge.h.


The documentation for this struct was generated from the following file:
Generated on Thu Nov 2 17:44:58 2006 for Common Text Transformation Library by  doxygen 1.3.9.1