diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-04-17 12:13:49 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-04-17 12:13:49 -0700 |
commit | 5b0a415f113d00478f5a306988bbcdbd35d99094 (patch) | |
tree | 8af8df8874489e64bc39c83b1b6e3b7c67acdc52 /cpp/tangle/030tangle.cc | |
parent | 2199940af170456929a3c4fe4d07d25afea6ae55 (diff) | |
download | mu-5b0a415f113d00478f5a306988bbcdbd35d99094.tar.gz |
1078 - better line numbers
Skip tangle comments inside tangle rather than in the makefile.
Diffstat (limited to 'cpp/tangle/030tangle.cc')
-rw-r--r-- | cpp/tangle/030tangle.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cpp/tangle/030tangle.cc b/cpp/tangle/030tangle.cc index adbf925b..896e8f3e 100644 --- a/cpp/tangle/030tangle.cc +++ b/cpp/tangle/030tangle.cc @@ -1,3 +1,7 @@ +// Reorder a file based on directives starting with ':(' (tangle directives). +// Insert #line directives to preserve line numbers in the original. +// Clear lines starting with '//:' (tangle comments). + #include<assert.h> #include<sys/param.h> @@ -28,6 +32,10 @@ void tangle(istream& in, list<string>& out) { else out.push_back(curr_line); } + for (list<string>::iterator p = out.begin(); p != out.end(); ++p) { + if (starts_with(*p, "//:")) + p->clear(); // leave the empty lines around so as to not mess up #line numbers + } trace_all("tangle", out); } |