Beispiel #1
0
int TCOD_lex_parse_until_token_type(TCOD_lex_t *lex,int tokenType)
{
	int token;
    token = TCOD_lex_parse(lex);
    if ( token == TCOD_LEX_ERROR ) return token;
    while ( token != TCOD_LEX_EOF )
    {
        if ( token == tokenType )
            return token;
	    token = TCOD_lex_parse(lex);
	    if ( token == TCOD_LEX_ERROR ) return token;
    }
    return token;
}
Beispiel #2
0
int TCOD_lex_parse_until_token_value(TCOD_lex_t *lex, const char *tokenValue)
{
	int token;
    token = TCOD_lex_parse(lex);
    if ( token == TCOD_LEX_ERROR ) return token;
    while ( token != TCOD_LEX_EOF )
    {
        if ( strcmp( lex->tok, tokenValue ) == 0
			|| ( ( lex->flags & TCOD_LEX_FLAG_NOCASE ) && strcasecmp(lex->tok, tokenValue ) == 0 ) )
            return token;
	    token = TCOD_lex_parse(lex);
	    if ( token == TCOD_LEX_ERROR ) return token;
    }
    return token;
}
Beispiel #3
0
int TCODLex::parse()
{
	return TCOD_lex_parse((TCOD_lex_t *)data);
}
Beispiel #4
0
bool TCOD_lex_expect_token_value(TCOD_lex_t *lex,int token_type, const char *token_value)
{
	TCOD_lex_parse(lex);
	return (token_type == lex->token_type && strcmp(lex->tok, token_value) == 0 );
}
Beispiel #5
0
bool TCOD_lex_expect_token_type(TCOD_lex_t *lex,int token_type)
{
	return (TCOD_lex_parse(lex) == token_type);
}