Compiler [cpp]: Reduced code duplication somewhat. Add a flags argument to find_end_of_string() and join it and find_end_of_string2().