1) Fixed issue #215: Escaping Strings
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / model / StringMatcher.java
index 797be51..e264301 100644 (file)
@@ -77,21 +77,21 @@ public class StringMatcher {
         *            if true, wild cards and their escape sequences are ignored
         *            (everything is taken literally).
         */
-       public StringMatcher(String pattern, boolean ignoreCase,
-                       boolean ignoreWildCards) {
-               if (pattern == null)
-                       throw new IllegalArgumentException();
-               fIgnoreCase = ignoreCase;
-               fIgnoreWildCards = ignoreWildCards;
-               fPattern = pattern;
-               fLength = pattern.length();
-
-               if (fIgnoreWildCards) {
-                       parseNoWildCards();
-               } else {
-                       parseWildCards();
-               }
-       }
+//     public StringMatcher(String pattern, boolean ignoreCase,
+//                     boolean ignoreWildCards) {
+//             if (pattern == null)
+//                     throw new IllegalArgumentException();
+//             fIgnoreCase = ignoreCase;
+//             fIgnoreWildCards = ignoreWildCards;
+//             fPattern = pattern;
+//             fLength = pattern.length();
+//
+//             if (fIgnoreWildCards) {
+//                     parseNoWildCards();
+//             } else {
+//                     parseWildCards();
+//             }
+//     }
 
        /**
         * Find the first occurrence of the pattern between
@@ -107,46 +107,46 @@ public class StringMatcher {
         * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc"
         * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned
         */
-       public StringMatcher.Position find(String text, int start, int end) {
-               if (text == null)
-                       throw new IllegalArgumentException();
-
-               int tlen = text.length();
-               if (start < 0)
-                       start = 0;
-               if (end > tlen)
-                       end = tlen;
-               if (end < 0 || start >= end)
-                       return null;
-               if (fLength == 0)
-                       return new Position(start, start);
-               if (fIgnoreWildCards) {
-                       int x = posIn(text, start, end);
-                       if (x < 0)
-                               return null;
-                       return new Position(x, x + fLength);
-               }
-
-               int segCount = fSegments.length;
-               if (segCount == 0)// pattern contains only '*'(s)
-                       return new Position(start, end);
-
-               int curPos = start;
-               int matchStart = -1;
-               int i;
-               for (i = 0; i < segCount && curPos < end; ++i) {
-                       String current = fSegments[i];
-                       int nextMatch = regExpPosIn(text, curPos, end, current);
-                       if (nextMatch < 0)
-                               return null;
-                       if (i == 0)
-                               matchStart = nextMatch;
-                       curPos = nextMatch + current.length();
-               }
-               if (i < segCount)
-                       return null;
-               return new Position(matchStart, curPos);
-       }
+//     public StringMatcher.Position find(String text, int start, int end) {
+//             if (text == null)
+//                     throw new IllegalArgumentException();
+//
+//             int tlen = text.length();
+//             if (start < 0)
+//                     start = 0;
+//             if (end > tlen)
+//                     end = tlen;
+//             if (end < 0 || start >= end)
+//                     return null;
+//             if (fLength == 0)
+//                     return new Position(start, start);
+//             if (fIgnoreWildCards) {
+//                     int x = posIn(text, start, end);
+//                     if (x < 0)
+//                             return null;
+//                     return new Position(x, x + fLength);
+//             }
+//
+//             int segCount = fSegments.length;
+//             if (segCount == 0)// pattern contains only '*'(s)
+//                     return new Position(start, end);
+//
+//             int curPos = start;
+//             int matchStart = -1;
+//             int i;
+//             for (i = 0; i < segCount && curPos < end; ++i) {
+//                     String current = fSegments[i];
+//                     int nextMatch = regExpPosIn(text, curPos, end, current);
+//                     if (nextMatch < 0)
+//                             return null;
+//                     if (i == 0)
+//                             matchStart = nextMatch;
+//                     curPos = nextMatch + current.length();
+//             }
+//             if (i < segCount)
+//                     return null;
+//             return new Position(matchStart, curPos);
+//     }
 
        /**
         * match the given <code>text</code> with the pattern
@@ -329,24 +329,24 @@ public class StringMatcher {
         * @return the starting index in the text of the pattern , or -1 if not
         *         found
         */
-       protected int posIn(String text, int start, int end) {// no wild card in
-                                                                                                                       // pattern
-               int max = end - fLength;
-
-               if (!fIgnoreCase) {
-                       int i = text.indexOf(fPattern, start);
-                       if (i == -1 || i > max)
-                               return -1;
-                       return i;
-               }
-
-               for (int i = start; i <= max; ++i) {
-                       if (text.regionMatches(true, i, fPattern, 0, fLength))
-                               return i;
-               }
-
-               return -1;
-       }
+//     protected int posIn(String text, int start, int end) {// no wild card in
+//                                                                                                                     // pattern
+//             int max = end - fLength;
+//
+//             if (!fIgnoreCase) {
+//                     int i = text.indexOf(fPattern, start);
+//                     if (i == -1 || i > max)
+//                             return -1;
+//                     return i;
+//             }
+//
+//             for (int i = start; i <= max; ++i) {
+//                     if (text.regionMatches(true, i, fPattern, 0, fLength))
+//                             return i;
+//             }
+//
+//             return -1;
+//     }
 
        /**
         * @param <code>text</code>, a simple regular expression that may only