parse.c File Reference

Shared parsing functions. More...

#include "defines.h"
#include "ufotypes.h"
#include "parse.h"
Include dependency graph for parse.c:

Go to the source code of this file.

Functions

void Com_UnParseLastToken (void)
 Put back the last token into the parser The next call of Com_Parse will return the same token again.
qboolean Com_ParsedTokenIsQuoted (void)
 Check if the last read token is quoted.
void Com_EnableFunctionScriptToken (qboolean enable)
 Enable parsing of token '(', ')' and ','.
const char * Com_Parse (const char *data_p[])
 Parse a token out of a string.

Variables

static char com_token [4096]
static qboolean isUnparsedToken
static qboolean isQuotedToken
static qboolean functionScriptTokenEnabled

Detailed Description

Shared parsing functions.

Definition in file parse.c.


Function Documentation

void Com_EnableFunctionScriptToken ( qboolean  enable  ) 

Enable parsing of token '(', ')' and ','.

Parameters:
enable If true, enable parsing of extra tokens
See also:
Com_Parse

Definition at line 63 of file parse.c.

References functionScriptTokenEnabled.

Referenced by testParserWithFunctionScriptToken(), UFO_InitSuiteParser(), UI_ParseEventProperty(), and UI_ParseFunction().

const char* Com_Parse ( const char *  data_p[]  ) 

Parse a token out of a string.

Parameters:
data_p Pointer to a string which is to be parsed
Precondition:
data_p is expected to be null-terminated
Returns:
The string result of parsing in a string.
Note:
if used to parse a quoted string that needs further parsing the returned string must be copied first, as Com_Parse returns a pointer to a static buffer that it holds. this will be re-used on the next call.
See also:
Com_EParse

Definition at line 79 of file parse.c.

References com_token, data, functionScriptTokenEnabled, isQuotedToken, isUnparsedToken, len, qfalse, and qtrue.

Referenced by AIR_ParseAircraft(), B_ParseBaseTemplate(), B_ParseBuildings(), CL_DownloadUMPMap(), CL_ParseAlienTeam(), CL_ParseCampaign(), CL_ParseCities(), CL_ParseComponents(), CL_ParseCustomSkin(), CL_ParseEventMails(), CL_ParseMapDefinition(), CL_ParseMapParticle(), CL_ParseNations(), CL_ParseParticle(), CL_ParsePtlCmds(), CL_ParseRanks(), CL_ParseResearchableCampaignStates(), CL_ParseResearchedCampaignItems(), CL_ParseSalary(), CL_ParseSequence(), CL_ParseServerInfoMessage(), CL_ParseTipsOfTheDay(), CL_QueryMasterServerThread(), CL_SpawnParseEntitystring(), CM_LoadMap(), Cmd_TokenizeString(), CMod_LoadEntityString(), Com_EParse(), Com_MacroExpandString(), Com_ParseActorModels(), Com_ParseActorNames(), Com_ParseActorSounds(), Com_ParseArmourOrResistance(), Com_ParseCharacterTemplate(), Com_ParseDamageTypes(), Com_ParseEquipment(), Com_ParseFire(), Com_ParseGameTypes(), Com_ParseInventory(), Com_ParseItem(), Com_ParseTeam(), Com_ParseTerrain(), Com_ParseUGVs(), ED_CheckNumericType(), ED_GetFloatVectorFromString(), ED_GetIntVectorFromString(), ED_ParseEdict(), ED_ParseEntities(), ED_ParseType(), ED_ProcessRanges(), FS_NextScriptHeader(), FS_SkipBlock(), G_Say_f(), G_SpawnEntities(), INS_ParseInstallations(), M_ParseMusic(), MSO_ParseCategories(), MSO_ParseSettings(), R_LoadMaterials(), R_LoadObjModelFace(), R_ModBeginLoading(), R_ModLoadAnims(), R_ParseStage(), R_PreprocessShader(), RS_ParseTechnologies(), SV_ParseMapcycle(), SV_ParseUMP(), testParser(), testParserWithEntity(), testParserWithFunctionScriptToken(), testParserWithUnParse(), TUT_ParseTutorials(), UI_BuildRadarImageList(), UI_GetReferenceString(), UI_ParseComponent(), UI_ParseExpression(), UI_ParseFont(), UI_ParseIcon(), UI_ParseUIModel(), UI_ParseValueExpression(), UI_ParseWindow(), and UP_ParseChapters().

qboolean Com_ParsedTokenIsQuoted ( void   ) 

Check if the last read token is quoted.

Returns:
True if the token is quoted
See also:
Com_Parse

Definition at line 53 of file parse.c.

References isQuotedToken.

Referenced by testParser(), testParserWithEntity(), testParserWithFunctionScriptToken(), testParserWithUnParse(), UI_ParseNode(), UI_ParseProperty(), UI_ParseValueExpression(), and UI_ParseWindow().

void Com_UnParseLastToken ( void   ) 

Put back the last token into the parser The next call of Com_Parse will return the same token again.

Note:
Only allow to use it one time
With it, we can't read to file at the same time

Definition at line 43 of file parse.c.

References isUnparsedToken, and qtrue.

Referenced by testParserWithUnParse(), UI_ParseCallAction(), UI_ParseComponent(), UI_ParseExpression(), and UI_ParseSetAction().


Variable Documentation

char com_token[4096] [static]

Definition at line 32 of file parse.c.

Referenced by Cmd_TokenizeString(), and Com_Parse().

Definition at line 35 of file parse.c.

Referenced by Com_EnableFunctionScriptToken(), and Com_Parse().

Definition at line 34 of file parse.c.

Referenced by Com_Parse(), and Com_ParsedTokenIsQuoted().

Definition at line 33 of file parse.c.

Referenced by Com_Parse(), and Com_UnParseLastToken().


Generated by  doxygen 1.6.2