UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
parse.h
Go to the documentation of this file.
1
5
6
/*
7
All original material Copyright (C) 2002-2025 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
33
enum
Com_TokenType_t
{
34
TT_EOF
= 0,
35
TT_BEGIN_BLOCK
=
'{'
,
36
TT_END_BLOCK
=
'}'
,
37
TT_COMMA
=
','
,
38
TT_BEGIN_LIST
=
'('
,
39
TT_END_LIST
=
')'
,
40
41
TT_CONTENT
= 0xFF,
42
TT_WORD
,
43
TT_QUOTED_WORD
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);
cxx.h
size
voidpf void uLong size
Definition
ioapi.h:42
Com_SkipBlock
void Com_SkipBlock(const char **text)
Skips a block of {} in our script files.
Definition
parse.cpp:253
Com_Parse
const char * Com_Parse(const char **data_p, char *target=nullptr, size_t size=0, bool replaceWhitespaces=true)
Com_GetToken
const char * Com_GetToken(const char **data_p)
Get the current token value.
Definition
parse.cpp:51
Com_TokenType_t
Com_TokenType_t
Definition
parse.h:33
TT_BEGIN_BLOCK
@ TT_BEGIN_BLOCK
Definition
parse.h:35
TT_END_BLOCK
@ TT_END_BLOCK
Definition
parse.h:36
TT_QUOTED_WORD
@ TT_QUOTED_WORD
Definition
parse.h:43
TT_WORD
@ TT_WORD
Definition
parse.h:42
TT_END_LIST
@ TT_END_LIST
Definition
parse.h:39
TT_BEGIN_LIST
@ TT_BEGIN_LIST
Definition
parse.h:38
TT_CONTENT
@ TT_CONTENT
Definition
parse.h:41
TT_EOF
@ TT_EOF
Definition
parse.h:34
TT_COMMA
@ TT_COMMA
Definition
parse.h:37
Com_CountTokensInBuffer
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_UnParseLastToken
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_GetBlock
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
Com_NextToken
Com_TokenType_t Com_NextToken(const char **data_p)
Compute the next token.
Definition
parse.cpp:69
Com_GetType
Com_TokenType_t Com_GetType(const char **data_p)
Get the current token type.
Definition
parse.cpp:60
ufotypes.h
Cross-platform type definitions.
src
shared
parse.h
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.17.0