Skip to content
Snippets Groups Projects
Verified Commit 6d45d150 authored by Miles Vella's avatar Miles Vella
Browse files

Fix @generated comment in machine file header

parent 3f37c791
No related branches found
No related tags found
No related merge requests found
Pipeline #157643 passed
...@@ -37,6 +37,11 @@ import java.util.stream.Collectors; ...@@ -37,6 +37,11 @@ import java.util.stream.Collectors;
import static de.tla2b.global.TranslationGlobals.VERSION_NUMBER; import static de.tla2b.global.TranslationGlobals.VERSION_NUMBER;
public class Translator { public class Translator {
/**
* This old header looks like the generated pragma which does not parse because of the text following it.
*/
private static final String GENERATED_BY_TLA2B_HEADER_OLD = "/*@ generated by TLA2B ";
private static final String GENERATED_BY_TLA2B_HEADER = "/* @generated by TLA2B "; private static final String GENERATED_BY_TLA2B_HEADER = "/* @generated by TLA2B ";
private String parentPath; private String parentPath;
...@@ -216,7 +221,8 @@ public class Translator { ...@@ -216,7 +221,8 @@ public class Translator {
if (machineFile.exists()) { if (machineFile.exists()) {
try (BufferedReader in = new BufferedReader(new FileReader(machineFile))) { try (BufferedReader in = new BufferedReader(new FileReader(machineFile))) {
String firstLine = in.readLine(); String firstLine = in.readLine();
if (firstLine != null && !firstLine.startsWith(GENERATED_BY_TLA2B_HEADER)) { boolean generatedByTLA2B = firstLine != null && (firstLine.startsWith(GENERATED_BY_TLA2B_HEADER_OLD) || firstLine.startsWith(GENERATED_BY_TLA2B_HEADER));
if (!generatedByTLA2B) {
System.err.println("Error: File " + machineFile.getName() + " already exists" System.err.println("Error: File " + machineFile.getName() + " already exists"
+ " and was not generated by TLA2B.\n" + "Delete or move this file."); + " and was not generated by TLA2B.\n" + "Delete or move this file.");
System.exit(-1); System.exit(-1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment