mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-06 01:32:50 -06:00
gfse: supply information about what's defined in the exampe language to the server functions for example-based grammar writing
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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<c.length;ix++)
|
||||
if(c[ix].langcode==langcode) return ix
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function rename_category(g,oldcat,newcat) {
|
||||
function rename_cats(cats) {
|
||||
for(var i in cats) if(cats[i]==oldcat) cats[i]=newcat;
|
||||
|
||||
Reference in New Issue
Block a user