Doxygen
|
Class representing a token in the compiled regular expression token stream. More...
Public Types | |
enum class | Kind : uint16_t { End = 0x0000 , WhiteSpace = 0x1001 , Digit = 0x1002 , Alpha = 0x1003 , AlphaNum = 0x1004 , CharClass = 0x2001 , NegCharClass = 0x2002 , BeginOfLine = 0x4001 , EndOfLine = 0x4002 , BeginOfWord = 0x4003 , EndOfWord = 0x4004 , BeginCapture = 0x4005 , EndCapture = 0x4006 , Any = 0x4007 , Star = 0x4008 , Optional = 0x4009 , Character = 0x8000 } |
The kind of token. More... | |
Public Member Functions | |
const char * | kindStr () const |
returns a string representation of the tokens kind (useful for debugging). | |
PToken () | |
Creates a token of kind 'End'. | |
PToken (Kind k) | |
Creates a token of the given kind k. | |
PToken (char c) | |
Create a token for an ASCII character. | |
PToken (uint16_t v) | |
Create a token for a byte of an UTF-8 character. | |
PToken (uint16_t from, uint16_t to) | |
Create a token representing a range from one character from to another character to. | |
void | setValue (uint16_t value) |
Sets the value for a token. | |
Kind | kind () const |
Returns the kind of the token. | |
uint16_t | from () const |
Returns the 'from' part of the character range. | |
uint16_t | to () const |
Returns the 'to' part of the character range. | |
uint16_t | value () const |
Returns the value for this token. | |
char | asciiValue () const |
Returns the value for this token as a ASCII character. | |
bool | isRange () const |
Returns true iff this token represents a range of characters. | |
bool | isCharClass () const |
Returns true iff this token is a positive or negative character class. | |
Private Attributes | |
uint32_t | m_rep |
Class representing a token in the compiled regular expression token stream.
A token has a kind and an optional value whose meaning depends on the kind. It is also possible to store a (from,to) character range in a token.
|
strong |
The kind of token.
Ranges per bit mask:
0x00FF
from part of a range, except for 0x0000
which is the End marker0x1FFF
built-in ranges0x2FFF
user defined ranges0x4FFF
special operations0x8000
literal character Enumerator | |
---|---|
End | |
WhiteSpace | |
Digit | |
Alpha | |
AlphaNum | |
CharClass | |
NegCharClass | |
BeginOfLine | |
EndOfLine | |
BeginOfWord | |
EndOfWord | |
BeginCapture | |
EndCapture | |
Any | |
Star | |
Optional | |
Character |
Definition at line 70 of file regex.cpp.
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
Create a token representing a range from one character from to another character to.
Definition at line 138 of file regex.cpp.
|
inline |
Returns the value for this token as a ASCII character.
Definition at line 156 of file regex.cpp.
References m_rep.
Referenced by reg::Ex::Private::compile(), reg::Ex::match(), and reg::Ex::Private::matchAt().
|
inline |
|
inline |
Returns true iff this token is a positive or negative character class.
Definition at line 162 of file regex.cpp.
References CharClass, kind(), and NegCharClass.
Referenced by reg::Ex::Private::matchAt().
|
inline |
|
inline |
Returns the kind of the token.
Definition at line 144 of file regex.cpp.
References m_rep.
Referenced by reg::Ex::Private::compile(), isCharClass(), reg::Ex::match(), and reg::Ex::Private::matchAt().
|
inline |
returns a string representation of the tokens kind (useful for debugging).
Definition at line 92 of file regex.cpp.
References Alpha, AlphaNum, Any, BeginCapture, BeginOfLine, BeginOfWord, Character, CharClass, Digit, End, EndCapture, EndOfLine, EndOfWord, m_rep, NegCharClass, Optional, Star, and WhiteSpace.
Referenced by reg::Ex::Private::matchAt().
|
inline |
|
inline |
|
inline |
Returns the value for this token.
Definition at line 153 of file regex.cpp.
References m_rep.
Referenced by reg::Ex::Private::compile(), reg::Ex::Private::matchAt(), and setValue().
|
private |