Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions src/web/AyaWeb.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
public class AyaWeb {

private static final StringOut output = new StringOut();

public static void main(String[] args) {

//
// Set up StaticData
//
Expand All @@ -35,10 +35,10 @@ public static void main(String[] args) {
new PrintStream(output.getErrStream()),
null,
new EmptyInputWrapper());

WebFilesystemIO fs = new WebFilesystemIO();
StaticData.FILESYSTEM = fs;

//
// Named Instructions
// Web build only supports a limited set of named instructions
Expand All @@ -47,7 +47,6 @@ public static void main(String[] args) {
WebAvailableNamedInstructionStore wsi = new WebAvailableNamedInstructionStore();
sd.addNamedInstructionStore(wsi);
sd.addNamedInstructionStore(new JSONInstructionStore());
sd.addNamedInstructionStore(new XmlInstructionStore());
sd.addNamedInstructionStore(new DateInstructionStore());
sd.addNamedInstructionStore(new ColorInstructionStore());
sd.addNamedInstructionStore(new LinearAlgebraInstructionStore());
Expand All @@ -59,11 +58,11 @@ public static void main(String[] args) {
StandaloneAya.runIsolated(s, StaticData.IO);
return output.flushOut() + output.flushErr();
});

exportAddFile((path, content) -> ((WebFilesystemIO)(StaticData.FILESYSTEM)).addFile(path, content));

exportListFiles(() -> String.join(",", fs.listFiles()));

exportLint(source -> {
ArrayList<ParserException> errors = StandaloneAya.lint(source);
if (errors.size() > 0) {
Expand All @@ -75,13 +74,13 @@ public static void main(String[] args) {
return "";
}
});

}

//
// Exported Functions
//

@JSBody(params = "runIsolated", script = "main.runIsolated = runIsolated;")
private static native void exportRunIsolated(ExportFunctionRunIsolated fn);

Expand Down Expand Up @@ -114,4 +113,4 @@ interface ExportFunctionListFiles extends JSObject {
@JSFunctor
interface ExportFunctionLint extends JSObject {
String call(String source);
}
}