From 21f657a64a8e286fd779a0fa4aae799342a0fcce Mon Sep 17 00:00:00 2001 From: hallgren Date: Fri, 17 Feb 2012 16:07:28 +0000 Subject: [PATCH] gfse: when uploading/compiling a grammar, automatically upload inherited grammars as well --- src/www/gfse/cloud2.js | 14 +++++++++----- src/www/gfse/editor.js | 6 ++++++ 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