code: private void parseNth() {
          // Remove all '+' and spaces.
          String str = argument.replaceAll("\\+|\\s+", "");
          if ("odd".equals(str)) {
              a = 2;
              b = 1;
          } else if ("even".equals(str)) {
              a = 2;
          } else {
              int n = str.indexOf('n');
              if (n != -1) {
                  if (n == 0) {
                      a = 1;
                  } else if (n == 1 && str.charAt(0) == '-') {
                      a = -1;
                  } else {
                      a = Integer.parseInt(str.substring(0, n));
                  }
  
                  if ((n + 1) != str.length()) {
                      b = Integer.parseInt(str.substring(n + 1, str.length()));
                  }
              } else {
                  b = Integer.parseInt(str);
              }
          }
      }
docs: Parse the {@code nth-*} pseudo-class argument.