<<< Lexeme begin(std::set) | Table Of Contents | Lexeme begin(char) >>> |
Common Text Transformation Library http://cttl.sourceforge.net/
Category:
Format:
Algorithm:
Space sensitivity:
Searchability:
Usage example:
#include "cttl/cttl.h" using namespace cttl; int main() { std::wstring inp = L"\x20\t\v"; typedef const_edge< policy_default, std::wstring > substr_T; typedef substr_T::char_T char_T; substr_T substring( inp ); substr_T token = substring; size_t result = token( +( symbol( char_T( ' ' ) ) | symbol( char_T( '\n' ) ) | symbol( char_T( '\r' ) ) | symbol( char_T( '\t' ) ) | symbol( char_T( '\v' ) ) | symbol( char_T( '\f' ) ) ) ).match( substring ); assert( result != std::wstring::npos ); assert( token == inp ); return 0; }
Trace output format:
The trace symbol of single character lexeme includes the matched character, annotated by the "char" label. The code
#define CTTL_TRACE_EVERYTHING #include "cttl/cttl.h" using namespace cttl; int main() { std::string inp = "XYZ"; const_edge<> substring( inp ); const_edge<> token = substring; size_t result = token( symbol( 'X' ) ).match( substring ); assert( result != std::string::npos ); assert( token == "X" ); return 0; }
generates a trace
---------------------@XYZ?{e 0-3 :3:1 -----------------------X@| X 1-3 char -----------------------@X| e 0-1 }
CTTL tracing is not supported when the program is compiled in wide character mode.
Copyright © 1997-2009 Igor Kholodov mailto:cttl@users.sourceforge.net.
Permission to copy and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.
<<< Lexeme begin(std::set) | Table Of Contents | Lexeme begin(char) >>> |