1
0
forked from GitHub/gf-core

gfse: stay on the same page when compiling grammars

The link to the minibar (or compiler errors) are now shown below the grammar
on the same page. If you go to the minibar, you only have to press the back
button once to get back to the editor.
Also some output formatting changes in GFServer.hs.
This commit is contained in:
hallgren
2012-02-10 17:26:02 +00:00
parent 6b29296060
commit 73827b9bf7
5 changed files with 49 additions and 16 deletions

View File

@@ -26,7 +26,7 @@ function remove_cloud_grammar(g) {
}
// Upload the grammar to the server and check it for errors
function upload(g) {
function old_upload(g) {
function upload2(dir) {
var form=node("form",{method:"post",action:"/cloud"},
[hidden("dir",dir),hidden("command","make"),
@@ -42,12 +42,34 @@ function upload(g) {
form.submit();
form.parentNode.removeChild(form);
}
function upload3(message) { if(message) alert(message); }
with_dir(upload2)
}
// Upload the grammar to the server and check it for errors
function upload(g) {
function upload2(dir) {
var pre="dir="+encodeURIComponent(dir)
var form= {command:"make"}
form[encodeURIComponent(g.basename+".gf")]=show_abstract(g)
for(var i in g.concretes) {
var cname=g.basename+g.concretes[i].langcode+".gf";
form[encodeURIComponent(cname)]=show_concrete(g)(g.concretes[i]);
}
ajax_http_post("/cloud",pre+encodeArgs(form),upload3)
}
function upload3(message) {
var dst=element("compiler_output")
if(dst) dst.innerHTML=message;
else alert(message);
}
with_dir(upload2)
}
// Upload the grammar to store it in the cloud
function upload_json(cont) {
function upload2(dir,unique_id) {