diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-12-27 09:08:30 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-12-27 09:08:30 -0800 |
commit | 7be07a6bc84b383dcf78b990a99e3d6370bd5741 (patch) | |
tree | fb84675df8b136c7c366894a0bc20b1b11833d5c /linkify | |
parent | d3de3187133361a56c2cb3e8aa7f5edd6f2ebbb5 (diff) | |
download | mu-7be07a6bc84b383dcf78b990a99e3d6370bd5741.tar.gz |
3719 - cross-link Mu waypoints to their location
Diffstat (limited to 'linkify')
-rw-r--r-- | linkify/003linkify.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/linkify/003linkify.cc b/linkify/003linkify.cc index 40eec81d..8f97a1d7 100644 --- a/linkify/003linkify.cc +++ b/linkify/003linkify.cc @@ -18,7 +18,6 @@ // single definition but there's still multiple overloads (say I defined // 'clear()' on some type, and it's already defined on STL classes) // - ctags misses some symbols in layered code -// - Mu's before/after blocks should point to the location of their labels struct syminfo { string filename; @@ -40,12 +39,28 @@ bool starts_with(const string& s, const string& pat) { return b == pat.end(); } +void encode_some_html_entities(string& s) { + std::string::size_type pos = 0; + while (true) { + pos = s.find_first_of("<>", pos); + if (pos == std::string::npos) break; + std::string replacement; + switch (s.at(pos)) { + case '<': replacement = "<"; break; + case '>': replacement = ">"; break; + } + s.replace(pos, 1, replacement); + pos += replacement.size(); + }; +} + void read_tags(const string& filename, map<string, syminfo>& info) { ifstream in(filename); //& cerr << "reading " << filename << '\n'; string dummy; while (has_data(in)) { string symbol; in >> symbol; + encode_some_html_entities(symbol); //& cerr << symbol << '\n'; if (info.find(symbol) != info.end()) { info[symbol].line_num = -1; |