Segment readSegement() {
            if (level == 0 && path.length() == 1) {
                if (isDigitFirst(ch)) {
                    int index = ch - '0';
                    return new ArrayAccessSegment(index);
                } else if ((ch >= 'a' && ch <= 'z') || ((ch >= 'A' && ch <= 'Z'))) {
                    return new PropertySegment(Character.toString(ch), false);
                }
            }
            while (!isEOF()) {
                skipWhitespace();

                if (ch == '$') {
                    next();
                    skipWhitespace();
                    if (ch == '?') {
                        return new FilterSegment(
                                (Filter) parseArrayAccessFilter(false));
                    }
                    continue;
                }

                if (ch == '.' || ch == '/') {
                    int c0 = ch;
                    boolean deep = false;
                    next();
                    if (c0 == '.' && ch == '.') {
                        next();
                        deep = true;
                        if (path.length() > pos + 3
                                && ch == '['
                                && path.charAt(pos) == '*'
                                && path.charAt(pos + 1) == ']'
                                && path.charAt(pos + 2) == '.') {
                            next();
                            next();
                            next();
                            next();
                        }
                    }
                    if (ch == '*' || (deep && ch == '[')) {
                        boolean objectOnly = ch == '[';
                        if (!isEOF()) {
                            next();
                        }

                        if (deep) {
                            if (objectOnly) {
                                return WildCardSegment.instance_deep_objectOnly;
                            } else {
                                return WildCardSegment.instance_deep;
                            }
                        } else {
                            return WildCardSegment.instance;
                        }
                    }
                    
                    if (isDigitFirst(ch)) {
                        return parseArrayAccess(false);
                    }

                    String propertyName = readName();
                    if (ch == '(') {
                        next();
                        if (ch == ')') {
                            if (!isEOF()) {
                                next();
                            }

                            if ("size".equals(propertyName) || "length".equals(propertyName)) {
                                return SizeSegment.instance;
                            } else if ("max".equals(propertyName)) {
                                return MaxSegment.instance;
                            } else if ("min".equals(propertyName)) {
                                return MinSegment.instance;
                            } else if ("keySet".equals(propertyName)) {
                                return KeySetSegment.instance;
                            } else if ("type".equals(propertyName)) {
                                return TypeSegment.instance;
                            } else if ("floor".equals(propertyName)) {
                                return FloorSegment.instance;
                            }

                            throw new JSONPathException("not support jsonpath : " + path);
                        }

                        throw new JSONPathException("not support jsonpath : " + path);
                    }

                    return new PropertySegment(propertyName, deep);
                }

                if (ch == '[') {
                    return parseArrayAccess(true);
                }

                if (level == 0) {
                    String propertyName = readName();

                    return new PropertySegment(propertyName, false);
                }

                if (ch == '?') {
                    return new FilterSegment(
                            (Filter) parseArrayAccessFilter(false));
                }

                throw new JSONPathException("not support jsonpath : " + path);
            }

            return null;
        }
@since 1.2.51
@param json
@param path
@return
src/main/java/com/alibaba/fastjson/JSONPath.java