[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] patch for bug 61002
|
Patch has been submitted in bugzilla, and is also attached here.
Thanks,
Tim Dossett
$ diff -u "org.eclipse.cdt.managedbuilder.ui\orig_BuildSettingsBlock.java" "org.eclipse.cdt.managedbuilder.ui\src\org\ecli
pse\cdt\managedbuilder\internal\ui\BuildSettingsBlock.java"
--- org.eclipse.cdt.managedbuilder.ui\orig_BuildSettingsBlock.java 2006-08-01 14:17:15.549018800 -0500
+++ org.eclipse.cdt.managedbuilder.ui\src\org\eclipse\cdt\managedbuilder\internal\ui\BuildSettingsBlock.java 2006-08-01
14:22:25.137017600 -0500
@@ -472,63 +472,8 @@
// The flags and targets are anything not in the command
String arguments = rawCommand.substring(actualCommand.length());
-
- // If there aren't any, we can stop
- if (arguments.length() == 0) {
- return result.toString().trim();
- }
-
- String[] tokens = arguments.trim().split("\\s"); //$NON-NLS-1$
- /*
- * Cases to consider
- * --<flag> Sensible, modern single flag. Add to result and continue.
- * -<flags> Flags in single token, add to result and stop
- * -<flag_with_arg> ARG Flag with argument. Add next token if valid arg.
- * -<mixed_flags> ARG Mix of flags, one takes arg. Add next token if valid arg.
- * -<flag_with_arg>ARG Corrupt case where next token should be arg but isn't
- * -<flags> [target].. Flags with no args, another token, add flags and stop.
- */
- Pattern flagPattern = Pattern.compile("C|f|I|j|l|O|W"); //$NON-NLS-1$
- // Look for a '-' followed by 1 or more flags with no args and exactly 1 that expects args
- Pattern mixedFlagWithArg = Pattern.compile("-[^CfIjloW]*[CfIjloW]{1}.+"); //$NON-NLS-1$
- for (int i = 0; i < tokens.length; ++i) {
- String currentToken = tokens[i];
- if (currentToken.startsWith("--")) { //$NON-NLS-1$
- result.append(currentToken);
- result.append(" "); //$NON-NLS-1$
- } else if (currentToken.startsWith("-")) { //$NON-NLS-1$
- // Is there another token
- if (i + 1 >= tokens.length) {
- //We are done
- result.append(currentToken);
- } else {
- String nextToken = tokens[i + 1];
- // Are we expecting arguments
- Matcher flagMatcher = flagPattern.matcher(currentToken);
- if (!flagMatcher.find()) {
- // Evalutate whether the next token should be added normally
- result.append(currentToken);
- result.append(" "); //$NON-NLS-1$
- } else {
- // Look for the case where there is no space between flag and arg
- if (mixedFlagWithArg.matcher(currentToken).matches()) {
- // Add this single token and keep going
- result.append(currentToken);
- result.append(" "); //$NON-NLS-1$
- } else {
- // Add this token and the next one right now
- result.append(currentToken);
- result.append(" "); //$NON-NLS-1$
- result.append(nextToken);
- result.append(" "); //$NON-NLS-1$
- // Skip the next token the next time through, though
- ++i;
- }
- }
- }
- }
- }
+ result.append(arguments);
return result.toString().trim();
}