liquibase-core/src/main/java/liquibase/util/StringUtil.java
private static List<Object> mergeTokens(List<Object> parsedArray, String endDelimiter) {
        if (endDelimiter == null) {
            return parsedArray;
        }

        List<Object> returnList = new ArrayList<>();
        List<String> possibleMerge = new ArrayList<>();
        for (Object obj : parsedArray) {
            if (possibleMerge.size() == 0) {
                if ((obj instanceof String) && endDelimiter.startsWith((String) obj)) {
                    possibleMerge.add((String) obj);
                } else {
                    returnList.add(obj);
                }
            } else {
                String possibleMergeString = StringUtil.join(possibleMerge, "") + obj.toString();
                if (endDelimiter.equals(possibleMergeString)) {
                    returnList.add(possibleMergeString);
                    possibleMerge.clear();
                } else if (endDelimiter.startsWith(possibleMergeString)) {
                    possibleMerge.add(obj.toString());
                } else {
                    returnList.addAll(possibleMerge);
                    returnList.add(obj);
                    possibleMerge.clear();
                }
            }
        }

        return returnList;

    }
private static List<Object> mergeTokens(List<Object> parsedArray, String endDelimiter) {
        if (endDelimiter == null) {
            return parsedArray;
        }

        List<Object> returnList = new ArrayList<>();
        List<String> possibleMerge = new ArrayList<>();
        for (Object obj : parsedArray) {
            if (possibleMerge.size() == 0) {
                if ((obj instanceof String) && endDelimiter.startsWith((String) obj)) {
                    possibleMerge.add((String) obj);
                } else {
                    returnList.add(obj);
                }
            } else {
                String possibleMergeString = StringUtil.join(possibleMerge, "") + obj.toString();
                if (endDelimiter.equals(possibleMergeString)) {
                    returnList.add(possibleMergeString);
                    possibleMerge.clear();
                } else if (endDelimiter.startsWith(possibleMergeString)) {
                    possibleMerge.add(obj.toString());
                } else {
                    returnList.addAll(possibleMerge);
                    returnList.add(obj);
                    possibleMerge.clear();
                }
            }
        }

        return returnList;

    }
private static List < Object > mergeTokens ( List < Object > parsedArray , String endDelimiter ) { if ( endDelimiter == null ) { return parsedArray ; } List < Object > returnList = new ArrayList <> ( ) ; List < String > possibleMerge = new ArrayList <> ( ) ; for ( Object obj : parsedArray ) { if ( possibleMerge . size ( ) == 0 ) { if ( ( obj instanceof String ) && endDelimiter . startsWith ( ( String ) obj ) ) { possibleMerge . add ( ( String ) obj ) ; } else { returnList . add ( obj ) ; } } else { String possibleMergeString = StringUtil . join ( possibleMerge , "" ) + obj . toString ( ) ; if ( endDelimiter . equals ( possibleMergeString ) ) { returnList . add ( possibleMergeString ) ; possibleMerge . clear ( ) ; } else if ( endDelimiter . startsWith ( possibleMergeString ) ) { possibleMerge . add ( obj . toString ( ) ) ; } else { returnList . addAll ( possibleMerge ) ; returnList . add ( obj ) ; possibleMerge . clear ( ) ; } } } return returnList ; }
Delimiters like "//" may span multiple tokens. Look for them and combine them
Delimiters like // may span multiple tokens . Look for them and combine them