Skip to content

Commit

Permalink
Allow to parse spirv code from ui (#730)
Browse files Browse the repository at this point in the history
Co-authored-by: Hernan Ponce de Leon <[email protected]>
  • Loading branch information
hernanponcedeleon and hernan-poncedeleon authored Sep 12, 2024
1 parent 951f326 commit ee0ebed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public Program parse(String raw, String path, String format, String cflags) thro
case "ll" -> {
return new ParserLlvm().parse(CharStreams.fromString(raw));
}
case "spv.dis" -> {
return new ParserSpirv().parse(CharStreams.fromString(raw));
}
case "litmus" -> {
return getConcreteLitmusParser(raw.toUpperCase()).parse(CharStreams.fromString(raw));
}
Expand Down
2 changes: 1 addition & 1 deletion ui/src/main/java/com/dat3m/ui/editor/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void actionPerformed(ActionEvent event) {
if (chooser.showOpenDialog(null) == APPROVE_OPTION) {
String path = chooser.getSelectedFile().getPath();
loadedPath = path.substring(0, path.lastIndexOf('/') + 1);
String format = path.substring(path.lastIndexOf('.') + 1).trim();
String format = path.endsWith("spv.dis") ? "spv.dis" : path.substring(path.indexOf('.') + 1).trim();
if (allowedFormats.contains(format)) {
loadedFormat = format;
notifyListeners();
Expand Down
2 changes: 1 addition & 1 deletion ui/src/main/java/com/dat3m/ui/editor/EditorsPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class EditorsPane {

private final ImmutableMap<EditorCode, Editor> editors = ImmutableMap.of(
EditorCode.PROGRAM, new Editor(EditorCode.PROGRAM, new RSyntaxTextArea(), "litmus", "c", "ll"),
EditorCode.PROGRAM, new Editor(EditorCode.PROGRAM, new RSyntaxTextArea(), "litmus", "c", "ll", "spv.dis"),
EditorCode.TARGET_MM, new Editor(EditorCode.TARGET_MM, new RSyntaxTextArea(), "cat")
);

Expand Down

0 comments on commit ee0ebed

Please sign in to comment.