private static int findOpenBrace(CharSequence text, int offset) {
    for (int i = offset - 1; i > 0; i--) {
      char c = text.charAt(i);
      if (c == '{' && text.charAt(i - 1) == '$') return i + 1;
      if (!Character.isLetterOrDigit(c) && c != '.') return -1;
    }
    return -1;
  }
private static int findOpenBrace(CharSequence text, int offset)