Skip to content

Commit

Permalink
Clean up KRead
Browse files Browse the repository at this point in the history
  • Loading branch information
Baltoli committed Oct 24, 2023
1 parent 5f4298c commit 4afe42f
Showing 1 changed file with 15 additions and 28 deletions.
43 changes: 15 additions & 28 deletions kernel/src/main/java/org/kframework/parser/KRead.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<String> 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<String> 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());
Expand Down

0 comments on commit 4afe42f

Please sign in to comment.