code: public int expect(String pattern, Closure handler) throws MalformedPatternException, Exception {
          logger.trace("Searching for '" + pattern + "' in the reader stream and executing Closure " + handler + " if found");
          PatternPair match = new GlobMatch(pattern, handler);
          List<Match> list = new ArrayList<>();
          list.add(match);
          return expect(list);
      }
docs: Attempts to detect the provided pattern and executes the provided
  {@link Closure} if it is detected.
  @param pattern the pattern to find in the reader stream
  @param handler the handler to execute if the pattern is found
  @return the number of times the pattern is found,
  or an error code
  @throws MalformedPatternException if the pattern is invalid
  @throws Exception if a generic error is encountered while
  processing the {@link Closure}