From ab73c741c24912a0816ad487f28cc47e1f011f2c Mon Sep 17 00:00:00 2001 From: Tommaso Cucinotta Date: Tue, 27 Sep 2011 23:09:31 +0000 Subject: [PATCH] With the move from \regexp{...} to \regexp{...\endregexp{}}, now I'd need a special method to find \endregexp{}}, not merely the closing brace. This is now obsolete, so ok to remove this dead code. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39780 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/lyxfind.cpp | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 75fa19e46e..081fae8ad0 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -565,30 +565,6 @@ string apply_escapes(string s, Escapes const & escape_map) return s; } -#if 0 -// This is not used any longer, but I do not know if we want to delete -// it, since it seems like maybe it might be needed again. -/** Return the position of the closing brace matching the open one at s[pos], - ** or s.size() if not found. - **/ -static size_t find_matching_brace(string const & s, size_t pos) -{ - LASSERT(s[pos] == '{', /* */); - int open_braces = 1; - for (++pos; pos < s.size(); ++pos) { - if (s[pos] == '\\') - ++pos; - else if (s[pos] == '{') - ++open_braces; - else if (s[pos] == '}') { - --open_braces; - if (open_braces == 0) - return pos; - } - } - return s.size(); -} -#endif /// Within \regexp{} apply get_lyx_unescapes() only (i.e., preserve regexp semantics of the string), /// while outside apply get_lyx_unescapes()+get_regexp_escapes(). @@ -611,7 +587,8 @@ string escape_for_regex(string s, bool match_latex) LYXERR(Debug::FIND, "new_pos: " << new_pos); if (new_pos == s.size()) break; - size_t end_pos = s.find("\\endregexp{}}", new_pos + 8); // find_matching_brace(s, new_pos + 7); + // Might fail if \\endregexp{} is preceeded by unexpected stuff (weird escapes) + size_t end_pos = s.find("\\endregexp{}}", new_pos + 8); LYXERR(Debug::FIND, "end_pos: " << end_pos); t = s.substr(new_pos + 8, end_pos - (new_pos + 8)); LYXERR(Debug::FIND, "t in regexp : " << t);