[yoda-svn] yoda: Write YODA annotations in YAML with a --- YAML break-line....

YODA Mercurial yoda at projects.hepforge.org
Sat Sep 16 23:30:01 BST 2017


details:   https://yoda.hepforge.org/hg/yoda/rev/0559b1079bbb
branches:  
changeset: 1400:0559b1079bbb
user:      Andy Buckley <andy at insectnation.org>
date:      Sat Sep 16 23:15:43 2017 +0100
description:
Write YODA annotations in YAML with a --- YAML break-line.  Add YODA format version annotation, at version 2, and update YODA reader to use version info and multiline YAML EOF marker.

diffs (truncated from 303 to 50 lines):

--- a/ChangeLog	Fri Sep 15 23:19:22 2017 +0100
+++ b/ChangeLog	Sat Sep 16 23:15:43 2017 +0100
@@ -1,3 +1,10 @@
+2017-09-16  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Add YODA format version annotation, at version 2, and update
+	YODA reader to use version info and multiline YAML EOF marker.
+
+	* Write YODA annotations in YAML with a --- YAML break-line.
+
 2017-09-14  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Enable compressed writing from Python.
--- a/src/ReaderYODA.cc	Fri Sep 15 23:19:22 2017 +0100
+++ b/src/ReaderYODA.cc	Sat Sep 16 23:15:43 2017 +0100
@@ -130,19 +130,27 @@
 
     // Loop over all lines of the input file
     aistringstream aiss;
+    bool in_anns = false;
+    string fmt = "1";
+    //int nfmt = 1;
     while (Utils::getline(stream, s)) {
       nline += 1;
 
-      // Trim the line
-      Utils::itrim(s);
 
-      // Ignore blank lines
-      if (s.empty()) continue;
+      // CLEAN LINES IF NOT IN ANNOTATION MODE
+      if (!in_anns) {
+        // Trim the line
+        Utils::itrim(s);
 
-      // Ignore comments (whole-line only, without indent, and still allowed for compatibility on BEGIN/END lines)
-      if (s.find("#") == 0 && s.find("BEGIN") == string::npos && s.find("END") == string::npos) continue;
+        // Ignore blank lines
+        if (s.empty()) continue;
 
-      // Now the context-sensitive part
+        // Ignore comments (whole-line only, without indent, and still allowed for compatibility on BEGIN/END lines)
+        if (s.find("#") == 0 && s.find("BEGIN") == string::npos && s.find("END") == string::npos) continue;
+      }
+
+
+      // STARTING A NEW CONTEXT
       if (context == NONE) {
 
         // We require a BEGIN line to start a context


More information about the yoda-svn mailing list