Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
internal::GenericRegex< Encoding, Allocator > Class Template Reference

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

#include <regex.h>

Classes

struct  Frag
 
struct  Range
 
struct  State
 

Public Types

typedef Encoding::Ch Ch
 
typedef Encoding EncodingType
 

Public Member Functions

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

Private Types

enum  Operator {
  kZeroOrOne, kZeroOrMore, kOneOrMore, kConcatenation,
  kAlternation, kLeftParenthesis
}
 

Private Member Functions

SizeType Append (SizeType l1, SizeType l2)
 
template<typename InputStream >
bool CharacterEscape (DecodedStream< InputStream, Encoding > &ds, unsigned *escapedCodepoint)
 
void CloneTopOperand (Stack< Allocator > &operandStack)
 
bool Eval (Stack< Allocator > &operandStack, Operator op)
 
bool EvalQuantifier (Stack< Allocator > &operandStack, unsigned n, unsigned m)
 
RangeGetRange (SizeType index)
 
const RangeGetRange (SizeType index) const
 
StateGetState (SizeType index)
 
const StateGetState (SizeType index) const
 
void ImplicitConcatenation (Stack< Allocator > &atomCountStack, Stack< Allocator > &operatorStack)
 
SizeType NewRange (unsigned codepoint)
 
SizeType NewState (SizeType out, SizeType out1, unsigned codepoint)
 
template<typename InputStream >
void Parse (DecodedStream< InputStream, Encoding > &ds)
 
template<typename InputStream >
bool ParseRange (DecodedStream< InputStream, Encoding > &ds, SizeType *range)
 
template<typename InputStream >
bool ParseUnsigned (DecodedStream< InputStream, Encoding > &ds, unsigned *u)
 
void Patch (SizeType l, SizeType s)
 
void PushOperand (Stack< Allocator > &operandStack, unsigned codepoint)
 

Static Private Member Functions

static SizeType Min (SizeType a, SizeType b)
 

Private Attributes

bool anchorBegin_
 
bool anchorEnd_
 
SizeType rangeCount_
 
Stack< Allocator > ranges_
 
SizeType root_
 
SizeType stateCount_
 
Stack< Allocator > states_
 

Static Private Attributes

static const unsigned kAnyCharacterClass = 0xFFFFFFFF
 For '.'. More...
 
static const unsigned kInfinityQuantifier = ~0u
 
static const unsigned kRangeCharacterClass = 0xFFFFFFFE
 
static const unsigned kRangeNegationFlag = 0x80000000
 

Friends

template<typename , typename >
class GenericRegexSearch
 

Detailed Description

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

Regular expression engine with subset of ECMAscript grammar.

Supported regular expression syntax:

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 116 of file regex.h.

Member Typedef Documentation

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

Definition at line 119 of file regex.h.

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

Definition at line 118 of file regex.h.

Member Enumeration Documentation

template<typename Encoding , typename Allocator = CrtAllocator>
enum internal::GenericRegex::Operator
private
Enumerator
kZeroOrOne 
kZeroOrMore 
kOneOrMore 
kConcatenation 
kAlternation 
kLeftParenthesis 

Definition at line 138 of file regex.h.

Constructor & Destructor Documentation

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

Definition at line 122 of file regex.h.

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

Definition at line 131 of file regex.h.

Member Function Documentation

template<typename Encoding , typename Allocator = CrtAllocator>
SizeType internal::GenericRegex< Encoding, Allocator >::Append ( SizeType  l1,
SizeType  l2 
)
inlineprivate

Definition at line 341 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
template<typename InputStream >
bool internal::GenericRegex< Encoding, Allocator >::CharacterEscape ( DecodedStream< InputStream, Encoding > &  ds,
unsigned *  escapedCodepoint 
)
inlineprivate

Definition at line 559 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
void internal::GenericRegex< Encoding, Allocator >::CloneTopOperand ( Stack< Allocator > &  operandStack)
inlineprivate

Definition at line 451 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
bool internal::GenericRegex< Encoding, Allocator >::Eval ( Stack< Allocator > &  operandStack,
Operator  op 
)
inlineprivate

Definition at line 356 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
bool internal::GenericRegex< Encoding, Allocator >::EvalQuantifier ( Stack< Allocator > &  operandStack,
unsigned  n,
unsigned  m 
)
inlineprivate

Definition at line 410 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
Range& internal::GenericRegex< Encoding, Allocator >::GetRange ( SizeType  index)
inlineprivate

Definition at line 181 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
const Range& internal::GenericRegex< Encoding, Allocator >::GetRange ( SizeType  index) const
inlineprivate

Definition at line 186 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
State& internal::GenericRegex< Encoding, Allocator >::GetState ( SizeType  index)
inlineprivate

Definition at line 171 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
const State& internal::GenericRegex< Encoding, Allocator >::GetState ( SizeType  index) const
inlineprivate

Definition at line 176 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
void internal::GenericRegex< Encoding, Allocator >::ImplicitConcatenation ( Stack< Allocator > &  atomCountStack,
Stack< Allocator > &  operatorStack 
)
inlineprivate

Definition at line 335 of file regex.h.

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

Definition at line 133 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
static SizeType internal::GenericRegex< Encoding, Allocator >::Min ( SizeType  a,
SizeType  b 
)
inlinestaticprivate

Definition at line 449 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
SizeType internal::GenericRegex< Encoding, Allocator >::NewRange ( unsigned  codepoint)
inlineprivate

Definition at line 551 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
SizeType internal::GenericRegex< Encoding, Allocator >::NewState ( SizeType  out,
SizeType  out1,
unsigned  codepoint 
)
inlineprivate

Definition at line 321 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
template<typename InputStream >
void internal::GenericRegex< Encoding, Allocator >::Parse ( DecodedStream< InputStream, Encoding > &  ds)
inlineprivate

Definition at line 192 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
template<typename InputStream >
bool internal::GenericRegex< Encoding, Allocator >::ParseRange ( DecodedStream< InputStream, Encoding > &  ds,
SizeType range 
)
inlineprivate

Definition at line 481 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
template<typename InputStream >
bool internal::GenericRegex< Encoding, Allocator >::ParseUnsigned ( DecodedStream< InputStream, Encoding > &  ds,
unsigned *  u 
)
inlineprivate

Definition at line 467 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
void internal::GenericRegex< Encoding, Allocator >::Patch ( SizeType  l,
SizeType  s 
)
inlineprivate

Definition at line 349 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
void internal::GenericRegex< Encoding, Allocator >::PushOperand ( Stack< Allocator > &  operandStack,
unsigned  codepoint 
)
inlineprivate

Definition at line 330 of file regex.h.

Friends And Related Function Documentation

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

Definition at line 120 of file regex.h.

Member Data Documentation

template<typename Encoding , typename Allocator = CrtAllocator>
bool internal::GenericRegex< Encoding, Allocator >::anchorBegin_
private

Definition at line 596 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
bool internal::GenericRegex< Encoding, Allocator >::anchorEnd_
private

Definition at line 597 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
const unsigned internal::GenericRegex< Encoding, Allocator >::kAnyCharacterClass = 0xFFFFFFFF
staticprivate

For '.'.

Definition at line 147 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
const unsigned internal::GenericRegex< Encoding, Allocator >::kInfinityQuantifier = ~0u
staticprivate

Definition at line 593 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
const unsigned internal::GenericRegex< Encoding, Allocator >::kRangeCharacterClass = 0xFFFFFFFE
staticprivate

Definition at line 148 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
const unsigned internal::GenericRegex< Encoding, Allocator >::kRangeNegationFlag = 0x80000000
staticprivate

Definition at line 149 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
SizeType internal::GenericRegex< Encoding, Allocator >::rangeCount_
private

Definition at line 591 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
Stack<Allocator> internal::GenericRegex< Encoding, Allocator >::ranges_
private

Definition at line 588 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
SizeType internal::GenericRegex< Encoding, Allocator >::root_
private

Definition at line 589 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
SizeType internal::GenericRegex< Encoding, Allocator >::stateCount_
private

Definition at line 590 of file regex.h.

template<typename Encoding , typename Allocator = CrtAllocator>
Stack<Allocator> internal::GenericRegex< Encoding, Allocator >::states_
private

Definition at line 587 of file regex.h.


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


choreo_rapidjson
Author(s):
autogenerated on Thu Jul 18 2019 03:59:10