@@ -2834,6 +2834,7 @@ void CConfig::SetConfig_Parsing(char case_filename[MAX_STRING_SIZE]) {
28342834
28352835 int err_count = 0 ; // How many errors have we found in the config file
28362836 int max_err_count = 30 ; // Maximum number of errors to print before stopping
2837+ int line_count = 1 ;
28372838
28382839 map<string, bool > included_options;
28392840
@@ -2848,13 +2849,34 @@ void CConfig::SetConfig_Parsing(char case_filename[MAX_STRING_SIZE]) {
28482849 throw (1 );
28492850 }
28502851
2852+ PrintingToolbox::trim (text_line);
2853+
2854+
2855+ /* --- Check if there is a line continuation character at the end of the current line.
2856+ * If yes, read until there is a line without one or a comment. If there is a statement after a cont. char
2857+ * throw an error. ---*/
2858+
2859+ while (text_line.back () == ' \\ ' ){
2860+ string tmp;
2861+ getline (case_file, tmp);
2862+ line_count++;
2863+ if (tmp.find_first_of (' =' ) != string::npos){
2864+ errorString.append (" Line " + to_string (line_count) + " : Statement found after continuation character.\n " );
2865+ }
2866+ PrintingToolbox::trim (tmp);
2867+ if (tmp.front () != ' %' ){
2868+ text_line = PrintingToolbox::split (text_line, ' \\ ' )[0 ];
2869+ text_line += " " + tmp;
2870+ }
2871+ }
2872+
28512873 if (TokenizeString (text_line, option_name, option_value)) {
28522874
28532875 /* --- See if it's a python option ---*/
28542876
28552877 if (option_map.find (option_name) == option_map.end ()) {
28562878 string newString;
2857- newString.append (option_name);
2879+ newString.append (" Line " + to_string (line_count) + " " + option_name);
28582880 newString.append (" : invalid option name" );
28592881 newString.append (" . Check current SU2 options in config_template.cfg." );
28602882 newString.append (" \n " );
@@ -2870,7 +2892,7 @@ void CConfig::SetConfig_Parsing(char case_filename[MAX_STRING_SIZE]) {
28702892
28712893 if (included_options.find (option_name) != included_options.end ()) {
28722894 string newString;
2873- newString.append (option_name);
2895+ newString.append (" Line " + to_string (line_count) + " " + option_name);
28742896 newString.append (" : option appears twice" );
28752897 newString.append (" \n " );
28762898 errorString.append (newString);
@@ -2893,6 +2915,7 @@ void CConfig::SetConfig_Parsing(char case_filename[MAX_STRING_SIZE]) {
28932915 err_count++;
28942916 }
28952917 }
2918+ line_count++;
28962919 }
28972920
28982921 /* --- See if there were any errors parsing the config file ---*/
0 commit comments