82 const char* text = buffer;
107 const char*
Com_Parse (
const char* data_p[],
char* target,
size_t size,
bool replaceWhitespaces)
135 while ((c = *data) <=
' ') {
144 if (c ==
'/' && data[1] ==
'*') {
147 while (!((data[clen] && data[clen] ==
'*') && (data[clen + 1] && data[clen + 1] ==
'/'))) {
155 if (c ==
'/' && data[1] ==
'/') {
156 while (*data && *data !=
'\n')
166 if (c ==
'\\' && data[0] ==
'n') {
167 if (replaceWhitespaces) {
171 }
else if (c ==
'\\' && data[0] ==
't') {
172 if (replaceWhitespaces) {
177 }
else if (c ==
'\\' && data[0] ==
'\"') {
180 }
else if (c ==
'\"' || !c) {
185 }
else if (c ==
'\0') {
212 if (c ==
'{' || c ==
'}' || c ==
'(' || c ==
')' || c ==
',') {
215 target[len + 1] =
'\0';
234 if (c ==
'{' || c ==
'}' || c ==
'(' || c ==
')' || c ==
',')
261 else if (*token ==
'}')
263 }
while (depth && *text);
279 const char* end = *text - 1;
Shared parsing functions.
int Com_CountTokensInBuffer(const char *buffer)
Counts the tokens in the given buffer that the Com_Parse function would extract.
Defined CONSTANTS (Macros are elsewhere)
static Com_TokenType_t type
static char com_token[4096]
int Com_GetBlock(const char **text, const char **start)
Get the start and end point of a block in the given text.
const char * Com_Parse(const char *data_p[], char *target, size_t size, bool replaceWhitespaces)
Parse a token out of a string.
static bool isUnparsedToken
QGL_EXTERN GLuint GLchar GLuint * len
Com_TokenType_t Com_GetType(const char **data_p)
Get the current token type.
void Com_UnParseLastToken(void)
Put back the last token into the parser The next call of Com_Parse will return the same token again...
GLsizei const GLvoid * data
Com_TokenType_t Com_NextToken(const char **data_p)
Compute the next token.
Cross-platform type definitions.
const char * Com_GetToken(const char **data_p)
Get the current token value.
void Com_SkipBlock(const char **text)
Skips a block of {} in our script files.