1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

be aware of += and :: and :=

This commit is contained in:
Alain Magloire 2003-09-08 20:10:52 +00:00
parent f5a40d1db9
commit 013b7794ef
2 changed files with 22 additions and 2 deletions

View file

@ -22,7 +22,15 @@ public class MacroDefinition extends Statement implements IMacroDefinition {
value = new StringBuffer(); value = new StringBuffer();
int index = line.indexOf('='); int index = line.indexOf('=');
if (index != -1) { if (index != -1) {
name = line.substring(0, index).trim(); int separator = index;
// Check for "+=", ":="
if (index > 0) {
char c = line.charAt(index - 1);
if (c == ':' || c =='+') {
separator = index -1;
}
}
name = line.substring(0, separator).trim();
value.append(line.substring(index + 1)); value.append(line.substring(index + 1));
} else { } else {
name = line; name = line;

View file

@ -50,7 +50,19 @@ public class MakefileUtil {
return isTargetRule(line.toCharArray()); return isTargetRule(line.toCharArray());
} }
public static boolean isTargetRule(char[] line) { public static boolean isTargetRule(char[] line) {
return indexOf(line, ':') != -1; int colon = indexOf(line, ':');
if (colon != -1) {
colon++;
// Things like := are not targets but :: is
if (colon < line.length) {
char c = line[colon];
if (c == '=') {
return false;
}
}
return true;
}
return false;
} }
public static boolean isCommand(String line) { public static boolean isCommand(String line) {