]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fail if invalid content after "end" in prm
authorTimo Heister <timo.heister@gmail.com>
Sat, 20 Jun 2015 09:31:43 +0000 (05:31 -0400)
committerTimo Heister <timo.heister@gmail.com>
Sat, 20 Jun 2015 09:31:43 +0000 (05:31 -0400)
Instead of ignoring all content after "end" in a prm file, generate a
parser error.

source/base/parameter_handler.cc

index fa519d059dce9f4b7a5c3d65d5a99c8272e2bd68..d25b6f92a523caaa0d186fbeb5367143fdc6bda0 100644 (file)
@@ -2574,6 +2574,18 @@ ParameterHandler::scan_line (std::string         line,
   if ((line.find ("END") == 0) ||
       (line.find ("end") == 0))
     {
+      line.erase (0, 3);
+      while ((line.size() > 0) && (line[0] == ' '))
+        line.erase (0, 1);
+
+      if (line.size()>0)
+        {
+          std::cerr << "Line <" << lineno
+                    << "> of file <" << input_filename
+                    << ">: invalid content after 'end'!" << std::endl;
+          return false;
+        }
+
       if (subsection_path.size() == 0)
         {
           std::cerr << "Line <" << lineno

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.