summaryrefslogtreecommitdiff
path: root/src/www/gfse/gf_abs.js
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2011-11-02 16:54:22 +0000
committerhallgren <hallgren@chalmers.se>2011-11-02 16:54:22 +0000
commit312e602dfe69fc6d391d58d715fccad6c1ed1023 (patch)
tree9fab05948c36ce7a1804405eb8c273da2a6b897c /src/www/gfse/gf_abs.js
parent5856098f2f71dc443cf6412443d6b3efbcb8efb8 (diff)
gfse: supply information about what's defined in the exampe language to the server functions for example-based grammar writing
Diffstat (limited to 'src/www/gfse/gf_abs.js')
-rw-r--r--src/www/gfse/gf_abs.js11
1 files changed, 11 insertions, 0 deletions
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<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;