diff options
Diffstat (limited to 'src/editor')
| -rw-r--r-- | src/editor/simple/editor.js | 2 | ||||
| -rw-r--r-- | src/editor/simple/example_based.js | 24 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/editor/simple/editor.js b/src/editor/simple/editor.js index 1a3dabf92..a2ddc80b3 100644 --- a/src/editor/simple/editor.js +++ b/src/editor/simple/editor.js @@ -790,7 +790,7 @@ function draw_lins(g,ci) { if(!msg) { if(f.template) conc.lins.push({fun:f.fun,args:f.args,lin:s}); - else f.lin=s; + else { f.lin=s; f.eb_lin=null; } reload_grammar(g); } cont(msg); diff --git a/src/editor/simple/example_based.js b/src/editor/simple/example_based.js index 20c9d2ade..f38f657c7 100644 --- a/src/editor/simple/example_based.js +++ b/src/editor/simple/example_based.js @@ -20,7 +20,7 @@ function exb_state(g,ci) { return "("+lincat.cat+","+lincat.type+")" } function show_lin(lin) { - return "("+lin.fun+","+lin.lin+")" + return "("+lin.fun+","+(lin.eb_lin||"?")+")" } function show_funs(funs) { return show_list(show_fun,funs) } function show_lincats(lincats) { return show_list(show_lincat,lincats); } @@ -88,11 +88,19 @@ function exb_linbuttons(g,ci,f) { var fun=f.fun; var eb=example_based[ci]; var exb_output; - function fill_example(tree) { - exb_output.innerHTML=""; - if(f.template) conc.lins.push({fun:f.fun,args:f.args,lin:tree}); - else f.lin=s; - ask_possibilities(g,ci) + function fill_example(maybetree) { + var tree=maybetree.Just + if(tree) { + if(f.template) + conc.lins.push({fun:f.fun,args:f.args, + lin:tree[0],eb_lin:tree[1]}); + else { + f.lin=tree[0]; + f.eb_lin=tree[1]; + } + ask_possibilities(g,ci) + } + else exb_output.innerHTML="Bug: no tree found" } function show_example(example){ exb_output.innerHTML=""; @@ -104,7 +112,9 @@ function exb_linbuttons(g,ci,f) { exb_output.innerHTML="..."; //server.parse({from:"ParseEng",cat:cat,input:s},fill_example) exb_call(g,ci,"abstract_example", - {cat:cat,input:s,abstract:example[0]}, + {cat:cat,input:s, + params:"["+f.args.join(",")+"]", + abstract:example[0]}, fill_example) } } |
