-/** 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();
-}