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

Allocator * allocator_
 
bool anchorBegin_
 
bool anchorEnd_
 
Allocator * ownAllocator_
 
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 115 of file regex.h.

Member Typedef Documentation

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

Definition at line 118 of file regex.h.

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

Definition at line 117 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 142 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 137 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 339 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 562 of file regex.h.

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

Definition at line 455 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 353 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 413 of file regex.h.

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

Definition at line 185 of file regex.h.

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

Definition at line 190 of file regex.h.

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

Definition at line 175 of file regex.h.

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

Definition at line 180 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 332 of file regex.h.

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

Definition at line 139 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 453 of file regex.h.

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

Definition at line 554 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 318 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 196 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 487 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 474 of file regex.h.

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

Definition at line 346 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 327 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>
Allocator* internal::GenericRegex< Encoding, Allocator >::allocator_
private

Definition at line 603 of file regex.h.

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

Definition at line 613 of file regex.h.

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

Definition at line 614 of file regex.h.

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

For '.'.

Definition at line 151 of file regex.h.

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

Definition at line 610 of file regex.h.

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

Definition at line 152 of file regex.h.

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

Definition at line 153 of file regex.h.

template<typename Encoding, typename Allocator = CrtAllocator>
Allocator* internal::GenericRegex< Encoding, Allocator >::ownAllocator_
private

Definition at line 602 of file regex.h.

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

Definition at line 608 of file regex.h.

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

Definition at line 605 of file regex.h.

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

Definition at line 606 of file regex.h.

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

Definition at line 607 of file regex.h.

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

Definition at line 604 of file regex.h.


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


livox_ros_driver
Author(s): Livox Dev Team
autogenerated on Mon Mar 15 2021 02:40:46