diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-12-27 11:14:54 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-12-27 11:14:54 -0800 |
commit | 68d228801f6521c6098ef5897fb8970bda9d424e (patch) | |
tree | 694c5818e72caf43226d8621b8b775c59a8e9977 /linkify | |
parent | 76a56bc9123e5372a008bc64c3da72f45d09c4d3 (diff) | |
download | mu-68d228801f6521c6098ef5897fb8970bda9d424e.tar.gz |
3721
Switching my comment header for commented-out-code back after dropping Kakoune.
Diffstat (limited to 'linkify')
-rw-r--r-- | linkify/003linkify.cc | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/linkify/003linkify.cc b/linkify/003linkify.cc index 8f97a1d7..3bb77401 100644 --- a/linkify/003linkify.cc +++ b/linkify/003linkify.cc @@ -56,12 +56,12 @@ void encode_some_html_entities(string& s) { void read_tags(const string& filename, map<string, syminfo>& info) { ifstream in(filename); -//& cerr << "reading " << filename << '\n'; +//? cerr << "reading " << filename << '\n'; string dummy; while (has_data(in)) { string symbol; in >> symbol; encode_some_html_entities(symbol); -//& cerr << symbol << '\n'; +//? cerr << symbol << '\n'; if (info.find(symbol) != info.end()) { info[symbol].line_num = -1; info[symbol].filename.clear(); @@ -72,13 +72,13 @@ void read_tags(const string& filename, map<string, syminfo>& info) { in >> info[symbol].filename; } getline(in, dummy); // skip rest of line -//& cerr << symbol << ": " << info[symbol].filename << ':' << info[symbol].line_num << '\n'; +//? cerr << symbol << ": " << info[symbol].filename << ':' << info[symbol].line_num << '\n'; } in.close(); } void replace_tags_in_file(const string& filename, const map<string, syminfo>& info) { -//& cerr << info.size() << " symbols\n"; +//? cerr << info.size() << " symbols\n"; ifstream in(filename); ofstream out(filename+".out"); while (has_data(in)) { @@ -96,26 +96,26 @@ void replace_tags_in_file(const string& filename, const map<string, syminfo>& in in2 >> std::noskipws; while (has_data(in2)) { if (isspace(in2.peek())) { -//& cerr << "space\n"; +//? cerr << "space\n"; char c; in2 >> c; out << c; } // within a line, send straight through all characters inside '<..>' else if (in2.peek() == '<') { -//& cerr << "tag\n"; +//? cerr << "tag\n"; char c = '\0'; while (in2 >> c) { -//& cerr << "span: " << c << '\n'; +//? cerr << "span: " << c << '\n'; out << c; if (c == '>') break; } -//& cerr << "end tag\n"; +//? cerr << "end tag\n"; } else { // send straight through all characters inside strings (handling escapes) char c = in2.get(); if (c == '"') { -//& cerr << "string\n"; +//? cerr << "string\n"; out << c; while (in2 >> c) { out << c; @@ -128,7 +128,7 @@ void replace_tags_in_file(const string& filename, const map<string, syminfo>& in } } else if (c == '\'') { -//& cerr << "character\n"; +//? cerr << "character\n"; out << c; while (in2 >> c) { out << c; @@ -142,18 +142,18 @@ void replace_tags_in_file(const string& filename, const map<string, syminfo>& in } // send straight through any characters after '//' (comments) else if (c == '#') { -//& cerr << "comment\n"; +//? cerr << "comment\n"; out << c; while (in2 >> c) out << c; } // send straight through any characters after '//' (comments) else if (c == '/' && in2.peek() == '/') { -//& cerr << "comment\n"; +//? cerr << "comment\n"; out << c; while (in2 >> c) out << c; } else { -//& cerr << "rest\n"; +//? cerr << "rest\n"; if (c == ',' || c == ':') { out << c; continue; @@ -169,21 +169,21 @@ void replace_tags_in_file(const string& filename, const map<string, syminfo>& in } string symbol = out2.str(); if (symbol == "equal" || symbol == "index" || symbol == "put-index" || symbol == "length") { -//& cerr << " blacklisted\n"; +//? cerr << " blacklisted\n"; out << symbol; } else if (info.find(symbol) == info.end()) { -//& cerr << " no info\n"; +//? cerr << " no info\n"; out << symbol; } else { const syminfo& s = info.find(symbol)->second; if (s.filename.empty()) { -//& cerr << " empty info\n"; +//? cerr << " empty info\n"; out << symbol; } else { -//& cerr << " link\n"; +//? cerr << " link\n"; out << "<a href='" << s.filename << ".html#L" << s.line_num << "'>" << symbol << "</a>"; } } |