diff --git a/lib/c_tokenizer.cpp b/lib/c_tokenizer.cpp index 7ccadf277..458bace9f 100644 --- a/lib/c_tokenizer.cpp +++ b/lib/c_tokenizer.cpp @@ -1241,6 +1241,7 @@ enum p_st process_cmnt_type_1(options* opts, shared_st* shared_st, cmnt_type_1_s shared_st->res_cur_pos += copy_length; + // TODO: Check if the copy can be prevented as in the outer check for non-cmd comments // The extra space is due to the removal of '*/', this is relevant because the // comment can be in the middle of the query. if (*(shared_st->res_cur_pos - 1 ) != ' ' && shared_st->res_cur_pos != res_final_pos) { @@ -1254,6 +1255,20 @@ enum p_st process_cmnt_type_1(options* opts, shared_st* shared_st, cmnt_type_1_s c_t_1_st->cur_cmd_cmnt_len = 0; } + // TODO: Related to previous TODO. Remember this is a relatively new change in the current code + // not at the beginning and previous char is not ' ' + if ( + shared_st->res_init_pos != shared_st->res_cur_pos && shared_st->res_cur_pos != res_final_pos && + *shared_st->res_cur_pos != ' ' && *(shared_st->res_cur_pos-1) != ' ' + ) { + *shared_st->res_cur_pos++ = ' '; + } else if ( + shared_st->res_init_pos != shared_st->res_cur_pos && shared_st->res_cur_pos != res_final_pos && + *shared_st->res_cur_pos == ' ' + ) { + shared_st->res_cur_pos++; + } + // if there were no space we have imposed it shared_st->prev_char = ' '; // back to main shared_st->query parsing state