[yoda-svn] yoda: Further improvements to handling leading *multiple* # mark...

YODA Mercurial yoda at projects.hepforge.org
Sat Sep 19 23:30:02 BST 2015


details:   https://yoda.hepforge.org/hg/yoda/rev/3ede0f180cb9
branches:  
changeset: 1133:3ede0f180cb9
user:      Andy Buckley <andy at insectnation.org>
date:      Sat Sep 19 23:15:04 2015 +0100
description:
Further improvements to handling leading *multiple* # marks on YODA format BEGIN lines.

diffs (38 lines):

--- a/ChangeLog	Fri Sep 11 19:05:57 2015 +0100
+++ b/ChangeLog	Sat Sep 19 23:15:04 2015 +0100
@@ -1,3 +1,8 @@
+2015-09-19  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Further improvements to handling leading *multiple* # marks on
+	YODA format BEGIN lines.
+
 2015-09-11  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Version 1.5.2 release.
--- a/src/ReaderYODA.cc	Fri Sep 11 19:05:57 2015 +0100
+++ b/src/ReaderYODA.cc	Sat Sep 19 23:15:04 2015 +0100
@@ -72,8 +72,8 @@
           throw ReadError(ss.str());
         }
 
-        // Remove a (possibly non-space-separated) leading # if necessary
-        if (s.find("#") == 0) s = Utils::trim(s.substr(1));
+        // Remove leading #s from the BEGIN line if necessary
+        while (s.find("#") == 0) s = Utils::trim(s.substr(1));
 
         // Split into parts
         vector<string> parts;
@@ -81,8 +81,11 @@
         while (iss >> tmp) parts.push_back(tmp);
 
         // Extract context from BEGIN type
-        if (parts.size() < 2 || parts[0] != "BEGIN")
-          throw ReadError("Unexpected BEGIN line structure in YODA format parsing: '" + s + "'");
+        if (parts.size() < 2 || parts[0] != "BEGIN") {
+          stringstream ss;
+          ss << "Unexpected BEGIN line structure when BEGIN expected: '" << s << "' on line " << nline;
+          throw ReadError(ss.str());
+        }
 
         // Second part is the context name
         const string ctxstr = parts[1];


More information about the yoda-svn mailing list