summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2011-09-13 15:19:16 +0000
committerhallgren <hallgren@chalmers.se>2011-09-13 15:19:16 +0000
commite36af534bf70e719212836c12f133770357cd93b (patch)
treedfb9a42b85266f68ff3f0cf5290c10ecba9262fc /src
parentd394f76e3dc65e190cbdc839cb87d24eee837e96 (diff)
gfse: added grammar cloning
Diffstat (limited to 'src')
-rw-r--r--src/editor/simple/TODO7
-rw-r--r--src/editor/simple/editor.js12
2 files changed, 17 insertions, 2 deletions
diff --git a/src/editor/simple/TODO b/src/editor/simple/TODO
index df64d2b1e..11857594e 100644
--- a/src/editor/simple/TODO
+++ b/src/editor/simple/TODO
@@ -7,7 +7,7 @@
+ Apply function alpha conversion in concrete syntax
+ Change lhs of lins when function type is changed
-- Allow languages other than the ones in the given list to be added
++ Allow languages other than the ones in the given list to be added
+ Export as plain text
+ Allow definitions to be reordered
@@ -24,6 +24,10 @@
- Easy access to compute_concrete from the editor
- Instead of starting with an empty grammar, start a new grammar by copying
an example.
++ Cloning grammars
+- Allow grammars to contain a resoure module. Create the resource module by
+ factoring out common parts of the concrete syntaxes.
+- Integrate example-based concrete syntax construction (using Ramona's tool)
+ compile only the uploaded grammar even if other grammars are present
+ 'flags startcat' is needed for grammars with only one category (since the
@@ -34,3 +38,4 @@
+ Bug! The startcat menu shows the first category by default, but the startcat
flag is actually not set until a selection is made from the menu.
+
diff --git a/src/editor/simple/editor.js b/src/editor/simple/editor.js
index 3b1a9a486..64efd4ab1 100644
--- a/src/editor/simple/editor.js
+++ b/src/editor/simple/editor.js
@@ -37,12 +37,15 @@ function draw_grammar_list() {
editor.appendChild(home)
var gs=ul([]);
function del(i) { return function () { delete_grammar(i); } }
+ function clone(i) { return function (g,b) { clone_grammar(i); } }
for(var i=0;i<local.count;i++) {
var grammar=local.get(i,null);
if(grammar && grammar.basename) {
var link=a(jsurl("open_grammar("+i+")"),[text(grammar.basename)]);
gs.appendChild(
- li([deletable(del(i),link,"Delete this grammar")]))
+ node("li",{"class":"extensible"},
+ [deletable(del(i),link,"Delete this grammar"),
+ more(grammar,clone(i),"Clone this grammar")]))
}
}
if(local.get("count",null)==null)
@@ -80,6 +83,13 @@ function delete_grammar(i) {
}
}
+function clone_grammar(i) {
+ var old=local.get(i);
+ var g={basename:old.basename,abstract:old.abstract,concretes:old.concretes}
+ save_grammar(g);
+ draw_grammar_list();
+}
+
function open_grammar(i) {
var g=local.get(i);
g.index=i;