From 312e602dfe69fc6d391d58d715fccad6c1ed1023 Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 2 Nov 2011 16:54:22 +0000 Subject: gfse: supply information about what's defined in the exampe language to the server functions for example-based grammar writing --- src/www/gfse/example_based.js | 4 ++-- src/www/gfse/gf_abs.js | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/www') diff --git a/src/www/gfse/example_based.js b/src/www/gfse/example_based.js index 1bbf17bd4..966dcbecd 100644 --- a/src/www/gfse/example_based.js +++ b/src/www/gfse/example_based.js @@ -51,8 +51,8 @@ function ask_possibilities(g,ci) { if(!conc.example_lang) conc.example_lang=g.concretes[0].langcode; reload_grammar(g); } - - exb_call(g,ci,"possibilities",{},show_poss) + var exci=conc_index(g,conc.example_lang); + exb_call(g,ci,"possibilities",{example_state:exb_state(g,exci)},show_poss) } var parser = { Eng: "ParseEngAbs.pgf", diff --git a/src/www/gfse/gf_abs.js b/src/www/gfse/gf_abs.js index 4efaab89a..ec47b6093 100644 --- a/src/www/gfse/gf_abs.js +++ b/src/www/gfse/gf_abs.js @@ -14,18 +14,29 @@ function defined_funs(g) { return df; } +// Return the type of a named function in the abstract syntax function function_type(g,fun) { with(g.abstract) for(var i in funs) if(funs[i].name==fun) return funs[i].type return null; } +// Return the lincat defined in a given concrete syntax for an abstract category function cat_lincat(conc,cat) { with(conc) for(var i in lincats) if(lincats[i].cat==cat) return lincats[i].type return null; } +// Return the index of the concrete syntax with a given langcode +function conc_index(g,langcode) { + var c=g.concretes; + for(var ix=0;ix