sqlparser/sqlparser.cpp
// Create a token from the current position until a new line
Create a token from the current position until a new line
Create a token from the current position until a new line
Token* SqlParser::GetNextUntilNewlineToken()
{
	const char *start = _next_start;
	const char *cur = start;
	size_t len = 0;
	while(_remain_size > 0)
	{
		if(*cur == '\r' || *cur == '\n')
			break;
		_next_start++;
		_remain_size--;
		cur++;
		len++;
	}
	if(len == 0)
		return NULL;
	Token *token = new Token();
	token->type = TOKEN_COMMENT;
	token->chr = 0;
	token->wchr = 0;
	token->str = start;
	token->wstr = NULL;
	token->len = len;
	token->remain_size = _remain_size;
	_tokens.Add(token);
	return token;	
}
Token * SqlParser :: GetNextUntilNewlineToken ( ) { const char * start = _next_start ; const char * cur = start ; size_t len = 0 ; while ( _remain_size > 0 ) { if ( * cur == ' \r ' || * cur == ' \n ' ) break ; _next_start ++ ; _remain_size -- ; cur ++ ; len ++ ; } if ( len == 0 ) return NULL ; Token * token = new Token ( ) ; token -> type = TOKEN_COMMENT ; token -> chr = 0 ; token -> wchr = 0 ; token -> str = start ; token -> wstr = NULL ; token -> len = len ; token -> remain_size = _remain_size ; _tokens . Add ( token ) ; return token ; }
Create a token from the current position until a new line
Create a token from the current position until a new line
// Go until the end of line