#include <tokenizer.hpp>
Definition at line 61 of file tokenizer.hpp.
◆ myint
◆ Tokenizer()
Tokenizer::Tokenizer |
( |
std::vector< TOKEN_DEF > & |
tokendefs | ) |
|
|
inline |
Definition at line 156 of file tokenizer.hpp.
159 {
160 }
const std::vector< TOKEN_DEF > & m_tokendefs
static std::regex CompileMultiRegex(const std::vector< TOKEN_DEF > &tokendefs)
◆ CompileMultiRegex()
static std::regex Tokenizer::CompileMultiRegex |
( |
const std::vector< TOKEN_DEF > & |
tokendefs | ) |
|
|
inlinestatic |
Definition at line 115 of file tokenizer.hpp.
116 {
117 std::string combinedString;
118
119 if (tokendefs.size() == 0)
120 {
121 return std::regex();
122 }
123
124
125 for (auto def : tokendefs)
126 {
127 size_t found = -1;
128
129
132 {
133 throw "invalid count!\n";
134 }
135 }
136
137
138 combinedString = "(?:" + tokendefs[0].RegExString + ")";
139 for (
size_t i = 1;
i < tokendefs.size();
i++)
140 {
141 combinedString +=
"|(?:" + tokendefs[
i].RegExString +
")";
142 }
143
144 return std::regex(combinedString, std::regex_constants::icase);
145 }
GLuint GLuint GLsizei count
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static unsigned int count_captures(const std::string &exp)
◆ count_captures()
Definition at line 70 of file tokenizer.hpp.
71 {
72 bool in_char_group = false;
73 unsigned int count = 0;
74
75 for (
size_t i = 0;
i <
exp.size();
i++)
76 {
78
79
81 {
83 continue;
84 }
85
86 if (in_char_group)
87 {
89 {
90 in_char_group = false;
91 }
92 continue;
93 }
94
96 {
97 in_char_group = true;
98 continue;
99 }
100
102 {
103 if (
exp[
i + 1] !=
'?')
104 {
106 }
107 }
108 }
109
111 }
Referenced by CompileMultiRegex().
◆ match() [1/2]
TOKEN_REF Tokenizer::match |
( |
std::smatch & |
matches, |
|
|
const std::string & |
str |
|
) |
| const |
|
inline |
◆ match() [2/2]
TOKEN_REF Tokenizer::match |
( |
std::smatch & |
matches, |
|
|
const std::string & |
str, |
|
|
size_t |
startpos |
|
) |
| const |
|
inline |
Definition at line 167 of file tokenizer.hpp.
168 {
169 const std::string::const_iterator
first =
str.cbegin() + startpos;
170 const std::string::const_iterator
last =
str.cend();
171
172
174 {
175 return TOKEN_REF{ static_cast<unsigned int>(startpos), 0, -1 };
176 }
177
179
180
182 {
183 throw "Failed to match\n";
184 }
185
187
188
190 {
191 throw "Failed to match at current position!\n";
192 }
193
194
196 {
198 {
199 unsigned int len =
static_cast<unsigned int>(
matches.length(
i));
201 return TOKEN_REF{
static_cast<unsigned int>(startpos),
len,
type};
202 }
203 }
204
205
206 throw "Something went wrong!\n";
207 }
GLuint GLuint GLsizei GLenum type
◆ m_re
const std::regex Tokenizer::m_re |
◆ m_tokendefs
The documentation for this struct was generated from the following file: