code: public static int indexOf(
      Functor<Integer, Integer> symbols, String text, int begin, int end, char target, Functor<Integer, Integer> extra
      ) {
          ArrayDeque<Integer> deque = new ArrayDeque<>();
          while (begin < end) {
              int c = text.charAt(begin);
              if (deque.size() > 0 && c == balance(symbols, deque.peek(), extra)) {
                  deque.pop();
              } else if (balance(symbols, c, extra) > 0) {
                  if (deque.size() == 0 || balance(symbols, deque.peek(), extra) != deque.peek()) deque.push(c);
              } else if (deque.size() == 0 && c == target) {
                  return begin;
              }
              ++begin;
          }
          return -1;
      }
docs: Returns the index within a string of the first occurrence of the specified character, similar to {@code String.indexOf}.
  However, any occurrence of the specified character enclosed between balanced symbols is ignored.
  
  @param symbols an optional functor to provide the complete set of balancing symbols
  @param text a String
  @param begin a begin offset
  @param end an end offset
  @param target the character to search for
  @param extra an optional functor to provide balancing symbols in addition to the standard ones
  @return the index of the character in the string, or -1 if the specified character is not found