mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
gfse: recognize Predef categories Int, Float and String
but don't show them in the startcat menu.
This commit is contained in:
@@ -366,7 +366,7 @@ function draw_startcat(g) {
|
|||||||
function opt(cat) { return option(cat,cat); }
|
function opt(cat) { return option(cat,cat); }
|
||||||
var opts = g.extends && g.extends.length>0 ? [opt("-")] : [];
|
var opts = g.extends && g.extends.length>0 ? [opt("-")] : [];
|
||||||
var dc=defined_cats(g);
|
var dc=defined_cats(g);
|
||||||
for(var cat in dc) opts.push(opt(cat));
|
for(var cat in dc) if(dc[cat]!="Predef") opts.push(opt(cat));
|
||||||
var m = node("select",{},opts);
|
var m = node("select",{},opts);
|
||||||
m.value=startcat;
|
m.value=startcat;
|
||||||
m.onchange=function() {
|
m.onchange=function() {
|
||||||
@@ -1096,7 +1096,9 @@ function draw_lins(g,ci) {
|
|||||||
|
|
||||||
function defined_cats(g) { return all_defined_cats(g,inherited_grammars(g)) }
|
function defined_cats(g) { return all_defined_cats(g,inherited_grammars(g)) }
|
||||||
function defined_funs(g) { return all_defined_funs(g,inherited_gramamrs(g)) }
|
function defined_funs(g) { return all_defined_funs(g,inherited_gramamrs(g)) }
|
||||||
function inherited_cats(g) {return all_inherited_cats(inherited_grammars(g),{})}
|
function inherited_cats(g) {
|
||||||
|
return all_inherited_cats(inherited_grammars(g),predefined_cats())
|
||||||
|
}
|
||||||
function inherited_funs(g) {return all_inherited_funs(inherited_grammars(g),{})}
|
function inherited_funs(g) {return all_inherited_funs(inherited_grammars(g),{})}
|
||||||
|
|
||||||
function upload(g,cont) {
|
function upload(g,cont) {
|
||||||
|
|||||||
@@ -29,18 +29,24 @@ type Lhs = String -- name and type of oper,
|
|||||||
type Term = String -- arbitrary GF term (not parsed by the editor)
|
type Term = String -- arbitrary GF term (not parsed by the editor)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// locally_defined_cats :: Grammar -> {Cat=>Bool} -> {Cat=>Bool} // destr upd
|
// locally_defined_cats :: Grammar -> {Cat=>ModId} -> {Cat=>ModId} // destr upd
|
||||||
function locally_defined_cats(g,dc) {
|
function locally_defined_cats(g,dc) {
|
||||||
with(g.abstract)
|
with(g.abstract)
|
||||||
for(var i in cats) dc[cats[i]]=g.basename;
|
for(var i in cats) dc[cats[i]]=g.basename;
|
||||||
return dc;
|
return dc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// all_defined_cats :: Grammar -> [Grammar] -> {Cat=>Bool}
|
// predefined_cats :: () -> {Cat=>ModId}
|
||||||
function all_defined_cats(g,igs) {
|
function predefined_cats() {
|
||||||
return all_inherited_cats(igs,locally_defined_cats(g,{}))
|
var pd = "Predef"
|
||||||
|
return { "Int":pd, "Float":pd, "String":pd}
|
||||||
}
|
}
|
||||||
// all_inherited_cats :: [Grammar] -> {Cat=>Bool} -> {Cat=>Bool} // destr upd
|
|
||||||
|
// all_defined_cats :: Grammar -> [Grammar] -> {Cat=>ModId}
|
||||||
|
function all_defined_cats(g,igs) {
|
||||||
|
return all_inherited_cats(igs,locally_defined_cats(g,predefined_cats()))
|
||||||
|
}
|
||||||
|
// all_inherited_cats :: [Grammar] -> {Cat=>ModId} -> {Cat=>ModId} // destr upd
|
||||||
function all_inherited_cats(igs,dc) {
|
function all_inherited_cats(igs,dc) {
|
||||||
for(var i in igs) dc=locally_defined_cats(igs[i],dc)
|
for(var i in igs) dc=locally_defined_cats(igs[i],dc)
|
||||||
return dc;
|
return dc;
|
||||||
|
|||||||
Reference in New Issue
Block a user