Ejemplo n.º 1
0
/**
 * Returns the next value in a CSV as a float.
 */
static TCHAR* ParseFloatCsv( TCHAR* Stream, float* OutValue )
{
    check( Stream != NULL );
    check( OutValue != NULL );

    const TCHAR* Token = Stream;
    Stream = ParseUntil( Stream, TEXT(',') );
    *OutValue = FCString::Atof( Token );

    return Stream;
}
Ejemplo n.º 2
0
static void ParseStatement (scontext_t owner)
{
	if (StatementIndex == MAX_STATEMENT_DEPTH)
	{
		PR_ParseError("statement overflow");
	}
	ContextHistory[StatementIndex++] = owner;

	if (TK_CHECK(TK_LBRACE))
	{
		ContextLevel += EnterContext[owner];
		do
		{
			ParseStatement(owner);
		} while (!TK_CHECK(TK_RBRACE));

		ContextLevel -= EnterContext[owner];
		StatementIndex--;
		return;
	}

	if (TK_CHECK(TK_SEMICOLON))
	{
		StatementIndex--;
		return;
	}
	if (LX_CheckFetch("return"))
	{
		ParseReturn();
		StatementIndex--;
		return;
	}
	if (LX_CheckFetch("loop"))
	{
		ParseLoop();
		StatementIndex--;
		return;
	}
	if (LX_CheckFetch("while"))
	{
		ParseWhile();
		StatementIndex--;
		return;
	}
	if (LX_CheckFetch("until"))
	{
		ParseUntil();
		StatementIndex--;
		return;
	}
	if (LX_CheckFetch("do"))
	{
		ParseDo();
		StatementIndex--;
		return;
	}
	if (LX_CheckFetch("switch"))
	{
		ParseSwitch();
		StatementIndex--;
		return;
	}
	if (LX_CheckFetch("case"))
	{
		if (owner != SCONTEXT_SWITCH)
		{
			PR_ParseError("misplaced case");
		}
		ParseCase();
		StatementIndex--;
		return;
	}
	if (LX_CheckFetch("break"))
	{
		if (BreakAncestor() == false)
		{
			PR_ParseError("misplaced break");
		}
		ParseBreak();
		StatementIndex--;
		return;
	}
	if (LX_CheckFetch("continue"))
	{
		if (ContinueAncestor() == false)
		{
			PR_ParseError("misplaced continue");
		}
		ParseContinue();
		StatementIndex--;
		return;
	}
	if (LX_CheckFetch("default"))
	{
		ParseDefault();
		StatementIndex--;
		return;
	}
	if (LX_CheckFetch("thinktime"))
	{
		ParseThinktime();
		StatementIndex--;
		return;
	}
	if (LX_CheckFetch("local"))
	{
		ParseLocalDefs();
		StatementIndex--;
		return;
	}
	if (LX_Check("float") || LX_Check("vector")
		|| LX_Check("entity") || LX_Check("string")
		|| LX_Check("void"))
	{
		ParseLocalDefs();
		StatementIndex--;
		return;
	}
	if (LX_CheckFetch("if"))
	{
		ParseIf();
		StatementIndex--;
		return;
	}

	EX_Expression(TOP_PRIORITY);
	LX_Require(";");
	StatementIndex--;
}