sqlparser/java.cpp
// Create a string literal from a set of tokens (support multi-line strings)
Create a string literal from a set of tokens (support multi-line strings)
Create a string literal from a set of tokens ( support multi - line strings )
void Java::MakeStringLiteral(Token *start, Token *end)
{
	if(start == NULL || end == NULL)
		return;
	Token *cur = start;
	while(cur != NULL && cur != end)
	{
		if(TOKEN_CMPC(cur, '\n'))
		{
			Token *prev = cur;
			if(cur->prev != NULL && TOKEN_CMPC(cur->prev, '\r'))
				prev = cur->prev;
			JAVA_PREPEND(prev, "\" +");
			cur = cur->next;
			while(cur != NULL && cur != end)
			{
				if(TOKEN_CMPC(cur, ' ') || TOKEN_CMPC(cur, '\t') || TOKEN_CMPC(cur, '\r') || TOKEN_CMPC(cur, '\n'))
				{
					cur = cur->next;
					continue;
				}
				JAVA_PREPEND(cur, "\"");
				cur = cur->next;
				break;
			}
		}
		else
			cur = cur->next;
	}
	JAVA_PREPEND(start, "\"");
	JAVA_PREPEND(end, "\"");
}
void Java :: MakeStringLiteral ( Token * start , Token * end ) { if ( start == NULL || end == NULL ) return ; Token * cur = start ; while ( cur != NULL && cur != end ) { if ( TOKEN_CMPC ( cur , ' \n ' ) ) { Token * prev = cur ; if ( cur -> prev != NULL && TOKEN_CMPC ( cur -> prev , ' \r ' ) ) prev = cur -> prev ; JAVA_PREPEND ( prev , " \" " ) ; cur = cur -> next ; while ( cur != NULL && cur != end ) { if ( TOKEN_CMPC ( cur , ' ' ) || TOKEN_CMPC ( cur , ' \t ' ) || TOKEN_CMPC ( cur , ' \r ' ) || TOKEN_CMPC ( cur , ' \n ' ) ) { cur = cur -> next ; continue ; } JAVA_PREPEND ( cur , " \" " ) ; cur = cur -> next ; break ; } } else cur = cur -> next ; } JAVA_PREPEND ( start , " \" " ) ; JAVA_PREPEND ( end , " \" " ) ; }
Create a string literal from a set of tokens (support multi-line strings)
Create a string literal from a set of tokens ( support multi - line strings )
// Find every new line in the string // Handle \r\n on Windows // Terminate the current line // Now find next first non-space token // Start the new line