@@ -0,0 +1,2511 @@
+/*-%0A * Copyright (c) 2012 Red Hat, Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.fedoraproject.maven.utils;%0A%0Aimport java.util.regex.Pattern;%0A%0Apublic class GlobUtils%0A%7B%0A    private static final String specialChars = %22()%7B%7D.,?*+%7C%3C=%3E!%22;%0A%0A    public static String glob2re( String glob )%0A    %7B%0A        StringBuilder re = new StringBuilder();%0A        boolean escape = false;%0A        int level = 0;%0A%0A        re.append( '%5E' );%0A%0A        for ( char ch : glob.toCharArray() )%0A        %7B%0A            if ( escape )%0A            %7B%0A                if ( specialChars.indexOf( ch ) %3E= 0 )%0A                    re.append( '%5C%5C' );%0A                re.append( ch );%0A                escape = false;%0A            %7D%0A            else if ( ch == '%5C%5C' )%0A            %7B%0A                escape = true;%0A            %7D%0A            else if ( ch == '%7B' )%0A            %7B%0A                level++;%0A                re.append( '(' );%0A            %7D%0A            else if ( ch == '%7D' && level %3E 0 )%0A            %7B%0A                re.append( ')' );%0A                level--;%0A            %7D%0A            else if ( ch == ',' && level %3E 0 )%0A            %7B%0A                re.append( '%7C' );%0A            %7D%0A            else if ( ch == '?' )%0A            %7B%0A                re.append( '.' );%0A            %7D%0A            else if ( ch == '*' )%0A            %7B%0A                re.append( '.' );%0A                re.append( '*' );%0A            %7D%0A            else%0A            %7B%0A                if ( specialChars.indexOf( ch ) %3E= 0 )%0A                    re.append( '%5C%5C' );%0A                re.append( ch );%0A            %7D%0A        %7D%0A%0A        if ( escape )%0A            throw new Error( %22Excape sequence ends prematurely%22 );%0A        if ( level != 0 )%0A            throw new Error( %22Alternative not closed%22 );%0A%0A        re.append( '$' );%0A        return re.toString();%0A    %7D%0A%0A    public static Pattern glob2pattern( String glob )%0A    %7B%0A        if ( glob == null )%0A            return Pattern.compile( %22%22 );%0A        return Pattern.compile( glob2re( glob ) );%0A    %7D%0A%7D%0A

Implement GlobUtils