Blob Blame Raw
Index: batch/org/eclipse/jdt/internal/compiler/batch/Main.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java,v
retrieving revision 1.254.4.2
diff -u -r1.254.4.2 Main.java
--- batch/org/eclipse/jdt/internal/compiler/batch/Main.java	20 Oct 2006 14:11:48 -0000	1.254.4.2
+++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java	16 Feb 2007 18:40:23 -0000
@@ -2723,6 +2723,10 @@
 	ArrayList currentRuleSpecs = new ArrayList(defaultSize);
 	StringTokenizer tokenizer = new StringTokenizer(currentPath,
 			File.pathSeparator + "[]", true); //$NON-NLS-1$
+	ArrayList tokens = new ArrayList();
+	while (tokenizer.hasMoreTokens()) {
+		tokens.add(tokenizer.nextToken());
+	}
 	// state machine
 	final int start = 0; 
 	final int readyToClose = 1;
@@ -2737,14 +2741,20 @@
 	// 'path[' 'path1;path2['
 	final int rulesReadyToClose = 6;
 	// 'path[rule' 'path[rule1;rule2'
+	final int bracketOpened = 7;
+	// '.*[.*'
+	final int bracketClosed = 8;
+	// '.*([.*])+'
 	final int error = 99;
 	int state = start;
 	String token = null;
-	while (tokenizer.hasMoreTokens() && state != error) {
-		token = tokenizer.nextToken();
+    int cursor = 0, tokensNb = tokens.size(), bracket = -1;
+    while (cursor < tokensNb && state != error) {
+        token = (String) tokens.get(cursor++);
 		if (token.equals(File.pathSeparator)) {
 			switch (state) {
 			case start:
+	        case bracketOpened:
 				break;
 			case readyToClose:
 			case readyToCloseEndingWithRules:
@@ -2757,14 +2767,21 @@
 			case rulesReadyToClose:
 				state = rulesNeedAnotherRule;
 				break;
+			case bracketClosed:
+				cursor = bracket + 1;
+				state = rulesStart;
+				break;
 			default:
 				state = error;
 			}
 		} else if (token.equals("[")) { //$NON-NLS-1$
 			switch (state) {
 			case readyToClose:
-				state = rulesStart;
+				bracket = cursor - 1;
+			case bracketClosed:
+				state = bracketOpened;
 				break;
+			case bracketOpened:
 			default:
 				state = error;
 			}
@@ -2773,6 +2790,10 @@
 			case rulesReadyToClose:
 				state = readyToCloseEndingWithRules;
 				break;
+			case bracketOpened:
+				state = bracketClosed;
+				break;
+			case bracketClosed:
 			default:
 				state = error;
 			}
@@ -2789,10 +2810,22 @@
 				state = rulesReadyToClose;
 				currentRuleSpecs.add(token);
 				break;
+            case bracketClosed:
+                for (int i = bracket; i < cursor ; i++) {
+                	currentClasspathName += (String) tokens.get(i);
+                }
+			    state = readyToClose;
+			    break;
+			case bracketOpened:
+			    break;
 			default:
 				state = error;
 			}
 		}
+		if (state == bracketClosed && cursor == tokensNb) {
+			cursor = bracket + 1;
+			state = rulesStart;
+		}
 	}
 	switch(state) {
 		case readyToClose:
@@ -2801,6 +2834,8 @@
 			addNewEntry(paths, currentClasspathName, currentRuleSpecs, 
 				customEncoding, isSourceOnly);
 			break;
+        case bracketOpened:
+        case bracketClosed:
 		default :
 			// we go on anyway
 			this.logger.logIncorrectClasspath(currentPath);