UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
parse.h
Go to the documentation of this file.
1 
6 /*
7 All original material Copyright (C) 2002-2020 UFO: Alien Invasion.
8 
9 Copyright (C) 1997-2001 Id Software, Inc.
10 
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License
13 as published by the Free Software Foundation; either version 2
14 of the License, or (at your option) any later version.
15 
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 
20 See the GNU General Public License for more details.
21 
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 
26 */
27 
28 #pragma once
29 
30 #include "ufotypes.h"
31 #include "cxx.h"
32 
34  TT_EOF = 0,
36  TT_END_BLOCK = '}',
37  TT_COMMA = ',',
39  TT_END_LIST = ')',
40 
41  TT_CONTENT = 0xFF,
44 };
45 
46 const char* Com_GetToken(const char** data_p);
47 Com_TokenType_t Com_GetType(const char** data_p);
48 Com_TokenType_t Com_NextToken(const char** data_p);
49 
50 const char* Com_Parse(const char** data_p, char* target = nullptr, size_t size = 0, bool replaceWhitespaces = true);
51 int Com_CountTokensInBuffer(const char* buffer);
52 void Com_UnParseLastToken(void);
53 void Com_SkipBlock(const char** text);
54 int Com_GetBlock(const char** text, const char** start);
int Com_GetBlock(const char **text, const char **start)
Get the start and end point of a block in the given text.
Definition: parse.cpp:272
Definition: parse.h:34
Definition: parse.h:37
const char * Com_Parse(const char **data_p, char *target=nullptr, size_t size=0, bool replaceWhitespaces=true)
Com_TokenType_t
Definition: parse.h:33
int Com_CountTokensInBuffer(const char *buffer)
Counts the tokens in the given buffer that the Com_Parse function would extract.
Definition: parse.cpp:80
Com_TokenType_t Com_NextToken(const char **data_p)
Compute the next token.
Definition: parse.cpp:69
void Com_SkipBlock(const char **text)
Skips a block of {} in our script files.
Definition: parse.cpp:253
GLsizei size
Definition: r_gl.h:152
Definition: parse.h:42
void Com_UnParseLastToken(void)
Put back the last token into the parser The next call of Com_Parse will return the same token again...
Definition: parse.cpp:42
Com_TokenType_t Com_GetType(const char **data_p)
Get the current token type.
Definition: parse.cpp:60
const char * Com_GetToken(const char **data_p)
Get the current token value.
Definition: parse.cpp:51
Cross-platform type definitions.