From: David Wells Date: Thu, 15 Sep 2016 12:16:32 +0000 (-0400) Subject: Number continuation lines with their first line. X-Git-Tag: v8.5.0-rc1~626^2~9 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f3fdf06c064465f94b0b61c6c74fd0c49a96b8b;p=dealii.git Number continuation lines with their first line. Since a continuation line in a parameter file consists of several lines concatenated by trailing '\'s, use the first line number when printing error messages to make things a bit clearer. --- diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index 75ced58783..937869c49f 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -1616,12 +1616,18 @@ bool ParameterHandler::read_input (std::istream &input, std::string input_line; std::string fully_concatenated_line; bool is_concatenated = false; + // Maintain both the current line number and the current logical line + // number, where the latter refers to the line number where (possibly) the + // current line continuation started. unsigned int current_line_n = 0; + unsigned int current_logical_line_n = 0; bool status = true; while (std::getline (input, input_line)) { ++current_line_n; + if (!is_concatenated) + current_logical_line_n = current_line_n; // Trim the whitespace at the ends of the line here instead of in // scan_line. This makes the continuation line logic a lot simpler. input_line = Utilities::trim (input_line); @@ -1658,7 +1664,7 @@ bool ParameterHandler::read_input (std::istream &input, if (!is_concatenated) { - status &= scan_line (fully_concatenated_line, filename, current_line_n); + status &= scan_line (fully_concatenated_line, filename, current_logical_line_n); fully_concatenated_line.clear(); } }