gfse&minibar: work in progress on grammar extension fromminibar

This commit is contained in:
hallgren
2012-03-29 17:10:36 +00:00
parent bb44210ff0
commit 7114c59827
4 changed files with 101 additions and 27 deletions

View File

@@ -363,6 +363,7 @@ Input.prototype.show_replacements=function(brackets,parent) {
function browse1(fun_info) {
var fun_type = fun_info.def.split(":")[1];
function browse2(cat_info) {
var extb=null;
function examine_replacement(rfun) {
function browse3(rfun_info) {
var rfun_type=rfun_info.def.split(":")[1];
@@ -370,12 +371,17 @@ Input.prototype.show_replacements=function(brackets,parent) {
t.replace_word(brackets,parent,rfun);
}
if(rfun_type==fun_type)
t.words.appendChild(button(rfun,replace))
t.words.insertBefore(button(rfun,replace),extb);
}
t.browse(rfun,browse3)
}
var ps=cat_info.producers;
clear(t.words);
if(t.options.extend_grammar) {
extb=button("New "+cat+"...",
function() { t.options.extend_grammar(cat,fun_type)})
t.words.appendChild(extb)
}
if(ps)
for(var pi in ps)
if(ps[pi]!=fun) examine_replacement(ps[pi])