Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
internal::GenericRegex< Encoding, Allocator > Class Template Reference

Regular expression engine with subset of ECMAscript grammar. More...

#include <regex.h>

Public Types

typedef Encoding EncodingType
 
typedef Encoding::Ch Ch
 

Public Member Functions

 GenericRegex (const Ch *source, Allocator *allocator=0)
 
 ~GenericRegex ()
 
bool IsValid () const
 

Friends

template<typename , typename >
class GenericRegexSearch
 

Detailed Description

template<typename Encoding, typename Allocator = CrtAllocator>
class internal::GenericRegex< Encoding, Allocator >

Supported regular expression syntax:

  • ab Concatenation
  • a|b Alternation
  • a? Zero or one
  • a* Zero or more
  • a+ One or more
  • a{3} Exactly 3 times
  • a{3,} At least 3 times
  • a{3,5} 3 to 5 times
  • (ab) Grouping
  • ^a At the beginning
  • a$ At the end
  • . Any character
  • [abc] Character classes
  • [a-c] Character class range
  • [a-z0-9_] Character class combination
  • [^abc] Negated character classes
  • [^a-c] Negated character class range
  • [] Backspace (U+0008)
  • \| \\ ... Escape characters
  • \f Form feed (U+000C)
  • \n Line feed (U+000A)
  • \r Carriage return (U+000D)
  • \t Tab (U+0009)
  • \v Vertical tab (U+000B)
Note
This is a Thompson NFA engine, implemented with reference to Cox, Russ. "Regular Expression Matching Can Be Simple And Fast (but is slow in Java, Perl, PHP, Python, Ruby,...).", https://swtch.com/~rsc/regexp/regexp1.html

Definition at line 114 of file regex.h.

Member Typedef Documentation

◆ Ch

template<typename Encoding , typename Allocator = CrtAllocator>
Encoding::Ch internal::GenericRegex< Encoding, Allocator >::Ch

Definition at line 117 of file regex.h.

◆ EncodingType

template<typename Encoding , typename Allocator = CrtAllocator>
Encoding internal::GenericRegex< Encoding, Allocator >::EncodingType

Definition at line 116 of file regex.h.

Constructor & Destructor Documentation

◆ GenericRegex()

template<typename Encoding , typename Allocator = CrtAllocator>
internal::GenericRegex< Encoding, Allocator >::GenericRegex ( const Ch * source,
Allocator * allocator = 0 )
inline

Definition at line 120 of file regex.h.

120 :
121 ownAllocator_(allocator ? 0 : RAPIDJSON_NEW(Allocator)()), allocator_(allocator ? allocator : ownAllocator_),
122 states_(allocator_, 256), ranges_(allocator_, 256), root_(kRegexInvalidState), stateCount_(), rangeCount_(),
123 anchorBegin_(), anchorEnd_()
124 {
126 DecodedStream<GenericStringStream<Encoding>, Encoding> ds(ss);
127 Parse(ds);
128 }
Concept for allocating, resizing and freeing memory block.
Concept for encoding of Unicode characters.
static const Segment ds(Segment::ds)
static const Segment ss(Segment::ss)
const CharType(& source)[N]
Definition pointer.h:1204
#define RAPIDJSON_NEW(TypeName)
! customization point for global new
Definition rapidjson.h:627
Read-only string stream.
Definition stream.h:154

◆ ~GenericRegex()

template<typename Encoding , typename Allocator = CrtAllocator>
internal::GenericRegex< Encoding, Allocator >::~GenericRegex ( )
inline

Definition at line 130 of file regex.h.

131 {
132 RAPIDJSON_DELETE(ownAllocator_);
133 }
#define RAPIDJSON_DELETE(x)
! customization point for global delete
Definition rapidjson.h:631

Member Function Documentation

◆ IsValid()

template<typename Encoding , typename Allocator = CrtAllocator>
bool internal::GenericRegex< Encoding, Allocator >::IsValid ( ) const
inline

Definition at line 135 of file regex.h.

135 {
136 return root_ != kRegexInvalidState;
137 }

Friends And Related Symbol Documentation

◆ GenericRegexSearch

template<typename Encoding , typename Allocator = CrtAllocator>
template<typename , typename >
friend class GenericRegexSearch
friend

Definition at line 118 of file regex.h.


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