mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
be aware of += and :: and :=
This commit is contained in:
parent
f5a40d1db9
commit
013b7794ef
2 changed files with 22 additions and 2 deletions
|
@ -22,7 +22,15 @@ public class MacroDefinition extends Statement implements IMacroDefinition {
|
|||
value = new StringBuffer();
|
||||
int index = line.indexOf('=');
|
||||
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));
|
||||
} else {
|
||||
name = line;
|
||||
|
|
|
@ -50,7 +50,19 @@ public class MakefileUtil {
|
|||
return isTargetRule(line.toCharArray());
|
||||
}
|
||||
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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue