From 4afe42f34e03242aa41cade8e8660f565c94f237 Mon Sep 17 00:00:00 2001 From: Bruce Collie Date: Tue, 24 Oct 2023 12:55:52 +0100 Subject: [PATCH] Clean up KRead --- .../java/org/kframework/parser/KRead.java | 43 +++++++------------ 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/kernel/src/main/java/org/kframework/parser/KRead.java b/kernel/src/main/java/org/kframework/parser/KRead.java index 867851c956c..92dd93fb5b5 100644 --- a/kernel/src/main/java/org/kframework/parser/KRead.java +++ b/kernel/src/main/java/org/kframework/parser/KRead.java @@ -32,24 +32,12 @@ import javax.json.JsonObject; import javax.json.JsonReader; -public class KRead { - - private final KExceptionManager kem; - private final FileUtil files; - private final InputModes input; - private final GlobalOptions globalOptions; - - public KRead( - KExceptionManager kem, - FileUtil files, - InputModes input, - GlobalOptions globalOptions - ) { - this.kem = kem; - this.files = files; - this.input = input; - this.globalOptions = globalOptions; - } +public record KRead( + KExceptionManager kem, + FileUtil files, + InputModes input, + GlobalOptions globalOptions +) { public String showTokens(Module mod, CompiledDefinition def, String stringToParse, Source source) { return def.showTokens(mod, files, stringToParse, source); @@ -103,16 +91,15 @@ public void createBisonParser(Module mod, Sort sort, File outputFile, boolean gl if (exit != 0) { throw KEMException.internalError("bison returned nonzero exit code: " + exit + "\n"); } - List command = new ArrayList<>(); - command.addAll(Arrays.asList( - Scanner.COMPILER, - "-DK_BISON_PARSER_SORT=" + sort.name(), - files.resolveKInclude("cparser/main.c").getAbsolutePath(), - files.resolveTemp("lex.yy.c").getAbsolutePath(), - files.resolveTemp("parser.tab.c").getAbsolutePath(), - "-iquote", files.resolveTemp(".").getAbsolutePath(), - "-iquote", files.resolveKInclude("cparser").getAbsolutePath(), - "-o", outputFile.getAbsolutePath())); + List command = new ArrayList<>(Arrays.asList( + Scanner.COMPILER, + "-DK_BISON_PARSER_SORT=" + sort.name(), + files.resolveKInclude("cparser/main.c").getAbsolutePath(), + files.resolveTemp("lex.yy.c").getAbsolutePath(), + files.resolveTemp("parser.tab.c").getAbsolutePath(), + "-iquote", files.resolveTemp(".").getAbsolutePath(), + "-iquote", files.resolveKInclude("cparser").getAbsolutePath(), + "-o", outputFile.getAbsolutePath())); if (library) { command.addAll(OS.current().getSharedLibraryCompilerFlags());