summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2012-02-17 16:07:28 +0000
committerhallgren <hallgren@chalmers.se>2012-02-17 16:07:28 +0000
commit21f657a64a8e286fd779a0fa4aae799342a0fcce (patch)
tree97796ea7036afd8384fb504580732fa1e2d1c1ea
parentf4466495506b32880c169f3326eacccf771527e3 (diff)
gfse: when uploading/compiling a grammar, automatically upload inherited grammars as well
-rw-r--r--src/www/gfse/cloud2.js14
-rw-r--r--src/www/gfse/editor.js6
2 files changed, 15 insertions, 5 deletions
diff --git a/src/www/gfse/cloud2.js b/src/www/gfse/cloud2.js
index e05d44bc8..8d33315bd 100644
--- a/src/www/gfse/cloud2.js
+++ b/src/www/gfse/cloud2.js
@@ -49,14 +49,18 @@ function old_upload(g) {
}
// Upload the grammar to the server and check it for errors
-function upload(g,cont) {
+function upload_grammars(gs,cont) {
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]);
+ for(var aix in gs) {
+ var g=gs[aix]
+ form[encodeURIComponent(g.basename+".gf")]=show_abstract(g)
+ var cnc=g.concretes
+ for(var i in cnc) {
+ var cname=g.basename+cnc[i].langcode+".gf";
+ form[encodeURIComponent(cname)]=show_concrete(g)(cnc[i]);
+ }
}
ajax_http_post("/cloud",pre+encodeArgs(form),upload3)
}
diff --git a/src/www/gfse/editor.js b/src/www/gfse/editor.js
index 940c3d54b..b630f69ab 100644
--- a/src/www/gfse/editor.js
+++ b/src/www/gfse/editor.js
@@ -1015,6 +1015,12 @@ function defined_funs(g) { return all_defined_funs(g,inherited_gramamrs(g)) }
function inherited_cats(g) {return all_inherited_cats(inherited_grammars(g),{})}
function inherited_funs(g) {return all_inherited_funs(inherited_grammars(g),{})}
+function upload(g,cont) {
+ var gs=inherited_grammars(g);
+ gs.push(g);
+ upload_grammars(gs,cont);
+}
+
// inherited_grammars :: Grammar -> [Grammar]
function inherited_grammars(g) {
// Load the available grammars once