sqlparser/sqlparser.cpp
// Get next token from the input
Get next token from the input
Get next token from the input
Token* SqlParser::GetNextToken()
{
	while(_push_back_token != NULL)
	{
		Token *token = _push_back_token;
		_push_back_token = token->next;
		if(token->IsBlank() == true || token->type == TOKEN_COMMENT)
			continue;
		return token;
	}
	Token *token = new Token();
	bool exists = false;
	while(true)
	{
		if(_next_start == NULL || _remain_size <= 0)
		{
			delete token;
			return NULL;
		}
		SkipSpaceTokens();
		exists = GetWordToken(token);
		if(exists == true)
			break;
		exists = GetSingleCharToken(token);
		if(exists == true)
			break;
	}
	return token;
}
Token * SqlParser :: GetNextToken ( ) { while ( _push_back_token != NULL ) { Token * token = _push_back_token ; _push_back_token = token -> next ; if ( token -> IsBlank ( ) == true || token -> type == TOKEN_COMMENT ) continue ; return token ; } Token * token = new Token ( ) ; bool exists = false ; while ( true ) { if ( _next_start == NULL || _remain_size <= 0 ) { delete token ; return NULL ; } SkipSpaceTokens ( ) ; exists = GetWordToken ( token ) ; if ( exists == true ) break ; exists = GetSingleCharToken ( token ) ; if ( exists == true ) break ; } return token ; }
Get next token from the input
Get next token from the input
// Check push back tokens first // Multiple tokens can be push back // Check for a word first as it can start with special symbol such as _ @ // Check for a single char token