docs: protected boolean runFirstMatch(List /* <PatternPair> */ pairs) throws Exception {
          MatchResult firstResult = null;
          PatternPair firstPair = null;
          int pairIndex = -1;
  
          ListIterator iter = pairs.listIterator();
          while (iter.hasNext()) {
              PatternPair pair = (PatternPair) iter.next();
              Pattern pattern = pair.getPattern();
  
              // reset input to begining
              input.setCurrentOffset(input.getBeginOffset());
  
              if (matcher.contains(input, pattern)) {
                  MatchResult result = matcher.getMatch();
                  if (firstResult == null || result.beginOffset(0) < firstResult.beginOffset(0)) {
                      firstResult = result;
                      firstPair = pair;
                      pairIndex = iter.previousIndex(); // TODO confirm this
                  }
              }
          }
  
          if (firstResult == null)
              return false; // didn't find anything
  
          // Found something
          //input's offset are illegal at this phase
          //input.setCurrentOffset(input.getBeginOffset());
          logger.trace("Using a result for " + firstPair.getPattern().getPattern());
          ExpectState state = prepareClosure(pairIndex, firstResult);
          Closure closure = firstPair.getClosure();
  
          try {
              if (closure != null)
                  closure.run(state);
          } catch (Exception e) {
              throw e;
          } finally {
              g_state = state;
          }
          return true;
      }