docs: public static List<Mapping> parse(String path) {
  
          //
          if (path.equals("/")) {
              path = "";
          } else if (path.length() > 0 && path.charAt(0) != '/') {
              path = "/" + path;
          }
          if (path.length() > 1 && path.endsWith("/")) {
              if (path.endsWith("//")) {
                  throw new IllegalArgumentException("invalid path '" + path
                          + "' : don't end with more than one '/'");
              }
              path = path.substring(0, path.length() - 1);
          }
  
          if (path.length() == 0) {
              return Collections.emptyList();
          }
  
          List<Mapping> mappings = new ArrayList<Mapping>(8);
  
          //
  
          char[] chars = new char[path.length()];
          path.getChars(0, path.length(), chars, 0);
          int paramBegin = -1;
          int paramNameEnd = -1;
          int constantBegin = -1;
          int bracketDeep = 0; // > 0 表示要把{}视为普通括号
          boolean startsWithBracket = true;
          for (int i = 0; i < chars.length; i++) {
              switch (chars[i]) {
                  case '$':
                      if (i + 1 >= chars.length) {
                          throw new IllegalArgumentException(//
                                  "invalid string '" + path + "', don't end with '$'");
                      }
                      // 针对constains$name的"constains"的
                      if (constantBegin >= 0) {
                          mappings.add(createConstantMapping(path, constantBegin, i));
                          constantBegin = -1;
                      }
                      // 针对$name$xyz的"$name"的
                      if (paramBegin >= 0) {
                          mappings.add(createRegexMapping(path, paramBegin, paramNameEnd, i));
                          paramBegin = -1;
                          paramNameEnd = -1;
                      }
                      if (chars[i + 1] != '{') {
                          paramBegin = i + 1;
                          bracketDeep = 1;
                          startsWithBracket = false;
                      }
                      break;
                  case '{':
                      if (bracketDeep++ > 0) { //++在后
                          break;
                      }
                      if (paramBegin < 0) {
                          paramBegin = i + 1;
                      }
                      // 针对$name{xyz}的"$name"的
                      else {
                          mappings.add(createRegexMapping(path, paramBegin, paramNameEnd, i));
                          paramBegin = -1;
                          paramNameEnd = -1;
                      }
                      // 针对constains{name}的"constains"的
                      if (constantBegin >= 0) {
                          mappings.add(createConstantMapping(path, constantBegin, i));
                          constantBegin = -1;
                      }
                      break;
                  case ':':
                      if (paramBegin < 0) {
                          throw new IllegalArgumentException(//
                                  "invalid string '" + path + "', wrong ':' at position " + i);
                      } else if (paramNameEnd > 0) {
                          throw new IllegalArgumentException(//
                                  "invalid string '" + path + "', duplicated ':' at position " + i);
                      } else {
                          paramNameEnd = i;
                      }
                      break;
                  case '}':
                      if (--bracketDeep > 0) { // --在前
                          break;
                      }
                      if (paramBegin < 0) {
                          throw new IllegalArgumentException(//
                                  "invalid string '" + path + "', wrong '}' at position " + i);
                      } else {
                          mappings.add(createRegexMapping(path, paramBegin, paramNameEnd, i));
                          paramBegin = -1;
                          paramNameEnd = -1;
                      }
                      break;
                  case '/':
                      if (paramBegin < 0) {
                          if (constantBegin >= 0) {
                              mappings.add(createConstantMapping(path, constantBegin, i));
                          }
                          constantBegin = i;
                          break;
                      } else if (bracketDeep == 0 || (bracketDeep == 1 && !startsWithBracket)) {
                          mappings.add(createRegexMapping(path, paramBegin, paramNameEnd, i));
                          paramBegin = -1;
                          constantBegin = i;
                          paramNameEnd = -1;
                          bracketDeep = 0;
                          break;
                      }
  
                  default:
                      if (constantBegin == -1 && paramBegin == -1) {
                          constantBegin = i;
                      }
                      break;
              }
          }
          if (constantBegin >= 0) {
              mappings.add(createConstantMapping(path, constantBegin, chars.length));
              constantBegin = -1;
          }
          if (paramBegin >= 0) {
              mappings.add(createRegexMapping(path, paramBegin, paramNameEnd, chars.length));
              paramBegin = -1;
              paramNameEnd = -1;
          }
          return mappings;
      }