Amélioration du parser. On laisse les commentaires comme fait make
This commit is contained in:
parent
87662825fa
commit
2e51ca7491
@ -24,7 +24,7 @@ public class BakefileParser {
|
|||||||
* Regex pour détecter les lignes de commande associées à une target.
|
* Regex pour détecter les lignes de commande associées à une target.
|
||||||
* Format : " gcc -o program program.c" (ligne indentée)
|
* Format : " gcc -o program program.c" (ligne indentée)
|
||||||
*/
|
*/
|
||||||
private static final Pattern COMMAND_PATTERN = Pattern.compile("^\\t(.+?)(?:#.*)?$");
|
private static final Pattern COMMAND_PATTERN = Pattern.compile("^\\t(.+)$");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regex pour détecter les définitions de variables.
|
* Regex pour détecter les définitions de variables.
|
||||||
@ -124,7 +124,7 @@ public class BakefileParser {
|
|||||||
|
|
||||||
commands = new ArrayList<>();
|
commands = new ArrayList<>();
|
||||||
} else if (commandMatcher.matches()) {
|
} else if (commandMatcher.matches()) {
|
||||||
commands.add(commandMatcher.group(1).trim());
|
commands.add(commandMatcher.group(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +152,8 @@ public class BakefileParser {
|
|||||||
for (Map.Entry<String, String> entry : variables.entrySet()) {
|
for (Map.Entry<String, String> entry : variables.entrySet()) {
|
||||||
String key = "$(" + entry.getKey() + ")";
|
String key = "$(" + entry.getKey() + ")";
|
||||||
if (result.contains(key)) {
|
if (result.contains(key)) {
|
||||||
result = result.replace(key, entry.getValue().trim());
|
// Préserver les espaces dans les valeurs des variables
|
||||||
|
result = result.replace(key, entry.getValue());
|
||||||
replaced = true;
|
replaced = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user