1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Try command rule first.

This commit is contained in:
Alain Magloire 2003-09-09 03:51:15 +00:00
parent 30b346c1a1
commit c6b5dbad42

View file

@ -74,7 +74,19 @@ public class PosixMakefile extends AbstractMakefile {
startLine = endLine + 1; startLine = endLine + 1;
endLine = reader.getLineNumber(); endLine = reader.getLineNumber();
// Strip away any comments. // 1- Try command first, since we do not strip '#' in commands
if (MakefileUtil.isCommand(line)) {
Command cmd = new Command(line);
// The commands are added to a Rule
if (rule != null) {
rule.addCommand(cmd);
rule.setEndLine(endLine);
continue;
}
// If it is not a command give the other rules a chance a fallthrough
}
// 2- Strip away any comments.
int pound = MakefileUtil.indexOfComment(line); int pound = MakefileUtil.indexOfComment(line);
if (pound != -1) { if (pound != -1) {
// Comment. // Comment.
@ -88,7 +100,7 @@ public class PosixMakefile extends AbstractMakefile {
} }
} }
// Empty lines ? // 3- Empty lines ?
if (MakefileUtil.isEmptyLine(line)) { if (MakefileUtil.isEmptyLine(line)) {
// Empty Line. // Empty Line.
Statement stmt = new EmptyLine(); Statement stmt = new EmptyLine();
@ -97,19 +109,7 @@ public class PosixMakefile extends AbstractMakefile {
continue; continue;
} }
// Is this a command ? // 4- Check for inference rule.
if (MakefileUtil.isCommand(line)) {
Command cmd = new Command(line);
// The commands are added to a Rule
if (rule != null) {
rule.addCommand(cmd);
rule.setEndLine(endLine);
continue;
}
// If it is not a command give the other a chance a fallthrough
}
// Check for inference rule.
if (MakefileUtil.isInferenceRule(line)) { if (MakefileUtil.isInferenceRule(line)) {
// Inference Rule // Inference Rule
String tgt; String tgt;
@ -125,7 +125,7 @@ public class PosixMakefile extends AbstractMakefile {
continue; continue;
} }
// Target Rule ? // 5- Target Rule ?
if (MakefileUtil.isTargetRule(line)) { if (MakefileUtil.isTargetRule(line)) {
String[] targets; String[] targets;
String[] reqs = new String[0]; String[] reqs = new String[0];
@ -165,7 +165,7 @@ public class PosixMakefile extends AbstractMakefile {
continue; continue;
} }
// Macro Definiton ? // 6- Macro Definiton ?
if (MakefileUtil.isMacroDefinition(line)) { if (MakefileUtil.isMacroDefinition(line)) {
// MacroDefinition // MacroDefinition
Statement stmt = new MacroDefinition(line); Statement stmt = new MacroDefinition(line);
@ -174,15 +174,23 @@ public class PosixMakefile extends AbstractMakefile {
continue; continue;
} }
// Other type of processing ?
Statement stmt = processLine(line);
if (stmt == null) {
// Should not be here. // Should not be here.
Statement stmt = new BadStatement(line); stmt = new BadStatement(line);
}
stmt.setLines(startLine, endLine); stmt.setLines(startLine, endLine);
addStatement(stmt); addStatement(stmt);
} }
} }
protected Statement processLine(String line) {
return null;
}
public IStatement[] getStatements() { public IStatement[] getStatements() {
return (IStatement[]) statements.toArray(new Statement[0]); return (IStatement[]) statements.toArray(new IStatement[0]);
} }
public IStatement[] getBuiltins() { public IStatement[] getBuiltins() {