docs: public static void main(String[] args) throws IOException {
      int i = 0;
      String charset = "utf-8";
      Pattern parseInsideBegin = null;
      Pattern parseInsideEnd = null;
      StringBuilder optionsSB = new StringBuilder();
      boolean preserveLines = false;
      boolean inputOutputFileList = false;
      boolean dump = false;
      boolean untok = false;
      boolean lowerCase = false;
  
      while (i < args.length && args[i].charAt(0) == '-') {
        if ("-options".equals(args[i])) {
          i++;
          optionsSB.append(',');
          optionsSB.append(args[i]);
        } else if ("-preserveLines".equals(args[i])) {
          optionsSB.append(",tokenizeNLs");
          preserveLines = true;
        } else if ("-lowerCase".equals(args[i])) {
          lowerCase = true;
        } else if ("-dump".equals(args[i])) {
          dump = true;
        } else if ("-ioFileList".equals(args[i])) {
          inputOutputFileList = true;
        } else if ("-encoding".equals(args[i]) && i < args.length - 1) {
          i++;
          charset = args[i];
        } else if ("-parseInside".equals(args[i]) && i < args.length - 1) {
          i++;
          try {
            parseInsideBegin = Pattern.compile("<(?:" + args[i] + ")(?:\\s[^>]*?)?>");
            parseInsideEnd = Pattern.compile("</(?:" + args[i] + ")(?:\\s[^>]*?)?>");
          } catch (Exception e) {
            parseInsideBegin = null;
            parseInsideEnd = null;
          }
        } else if ("-untok".equals(args[i])) {
          untok = true;
        } else if ("-h".equals(args[i]) || "-help".equals(args[i]) || "--help".equals(args[i])) {
          System.err.println("usage: java edu.stanford.nlp.process.PTBTokenizer [options]* filename*");
          System.err.println("  options: -preserveLines|-lowerCase|-dump|-ioFileList|-encoding|-parseInside elementRegex|-options options|-h");
          return;  // exit if they asked for help in options
        } else {
          System.err.println("Unknown option: " + args[i]);
        }
        i++;
      }
  
      ArrayList<String> inputFileList = new ArrayList<String>();
      ArrayList<String> outputFileList = null;
  
      if (inputOutputFileList) {
        outputFileList = new ArrayList<String>();
        for (int j = i; j < args.length; j++) {
          BufferedReader r = new BufferedReader(
            new InputStreamReader(new FileInputStream(args[j]), charset));
          for (String inLine; (inLine = r.readLine()) != null; ) {
            String[] fields = inLine.split("\\s+");
            inputFileList.add(fields[0]);
            if (fields.length > 1) {
              outputFileList.add(fields[1]);
            } else {
              outputFileList.add(fields[0] + ".tok");
            }
          }
          r.close();
        }
      } else {
        inputFileList.addAll(Arrays.asList(args).subList(i, args.length));
      }
  
      if (untok) {
        untok(inputFileList, outputFileList, charset);
      } else {
        tok(inputFileList, outputFileList, charset, parseInsideBegin, parseInsideEnd, optionsSB.toString(), preserveLines, dump, lowerCase);
      }
    }