Module: sems
Branch: master
Commit: acb81d5a8ff27460a94c0aed40ec41b47163a346
URL: 
https://github.com/sems-server/sems/commit/acb81d5a8ff27460a94c0aed40ec41b47163a346

Author: Stefan Sayer <stefan.sa...@googlemail.com>
Committer: Stefan Sayer <stefan.sa...@googlemail.com>
Date: 2015-06-09T00:27:18+02:00

dsm: another way for writing comments: lines starting with # (hash)

---

Modified: apps/dsm/DSMStateDiagramCollection.cpp
Modified: doc/dsm/dsm_syntax.txt

---

Diff:  
https://github.com/sems-server/sems/commit/acb81d5a8ff27460a94c0aed40ec41b47163a346.diff
Patch: 
https://github.com/sems-server/sems/commit/acb81d5a8ff27460a94c0aed40ec41b47163a346.patch

---

diff --git a/apps/dsm/DSMStateDiagramCollection.cpp 
b/apps/dsm/DSMStateDiagramCollection.cpp
index 79c5ff0..749d223 100644
--- a/apps/dsm/DSMStateDiagramCollection.cpp
+++ b/apps/dsm/DSMStateDiagramCollection.cpp
@@ -50,11 +50,11 @@ bool DSMStateDiagramCollection::readFile(const string& 
filename, const string& n
   while (ifs.good() && !ifs.eof()) {
     string r;
     getline(ifs, r);
-    // skip comments
+    // skip comments: lines starting with -- or #
     size_t fpos  = r.find_first_not_of(" \t");
     if (fpos != string::npos) {
-      if (r.length() > fpos+1 &&
-         r.substr(fpos, 2) == "--")
+      if ((r.length() > fpos+1 && r.substr(fpos, 2) == "--") ||
+         ((r.length() >= fpos+1 && r.substr(fpos, 1) == "#" && r.substr(fpos, 
8) != "#include") ))
        continue;
 
       if (r.length() > fpos+1 && 
diff --git a/doc/dsm/dsm_syntax.txt b/doc/dsm/dsm_syntax.txt
index c3124f1..8b0411e 100644
--- a/doc/dsm/dsm_syntax.txt
+++ b/doc/dsm/dsm_syntax.txt
@@ -4,6 +4,8 @@ DSM quick reference
 Syntax
 ======
 -- comment
+# also comment
+
 #include "script.dsm"
 #include "/path/to/anotherscript.dsm"
 import(mod_name);

_______________________________________________
Semsdev mailing list
Semsdev@lists.iptel.org
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to