Verified Commit 5f07816c authored by Camil Staps's avatar Camil Staps 🚀

Add language report documentation for other builtins

parent a0aad04f
......@@ -19,17 +19,17 @@ import CloogleDB
builtin_functions :: [(Location, FunctionEntry)]
builtin_functions
= [ ( Builtin "if"
= [ ( Builtin "if" [CLR 5 "3.4.2" "_Toc311798001"]
, {zero & fe_type=Just $ Func [Type "Bool" [], Var "a", Var "a"] (Var "a") []}
)
, ( Builtin "dynamic"
, ( Builtin "dynamic" [CLR 10 "8.1" "_Toc311798076"]
, {zero & fe_type=Just $ Func [Var "a"] (Type "Dynamic" []) [Instance "TC" [Var "a"]]}
)
]
builtin_classes :: [(Location, ClassEntry)]
builtin_classes
= [ ( Builtin "TC"
= [ ( Builtin "TC" [CLR 10 "8.1.4" "_Toc311798080"]
, { ce_vars=["v"]
, ce_context=[]
, ce_documentation=Nothing
......@@ -42,7 +42,7 @@ builtin_classes
builtin_types :: [(Location, TypeDefEntry)]
builtin_types
= [ ( Builtin "Bool"
= [ ( Builtin "Bool" [CLR 6 "4.1" "_Toc311798017"]
, { deft
& tde_typedef.td_name = "Bool"
, tde_typedef.td_rhs = TDRCons False
......@@ -51,14 +51,14 @@ builtin_types
]
}
)
, ( Builtin "Int", { deft & tde_typedef.td_name = "Int" } )
, ( Builtin "Real", { deft & tde_typedef.td_name = "Real" } )
, ( Builtin "Char", { deft & tde_typedef.td_name = "Char" } )
, ( Builtin "String", { deft & tde_typedef.td_name = "String",
, ( Builtin "Int" [CLR 6 "4.1" "_Toc311798017"], {deft & tde_typedef.td_name = "Int"})
, ( Builtin "Real" [CLR 6 "4.1" "_Toc311798017"], {deft & tde_typedef.td_name = "Real"})
, ( Builtin "Char" [CLR 6 "4.1" "_Toc311798017"], {deft & tde_typedef.td_name = "Char"})
, ( Builtin "String" [CLR 6 "4.7" "_Toc311798037"], {deft & tde_typedef.td_name = "String",
tde_typedef.td_rhs = TDRSynonym (Type "_#Array" [Type "Char" []]) } )
, ( Builtin "Dynamic", { deft & tde_typedef.td_name = "Dynamic" } )
, ( Builtin "File", { deft & tde_typedef.td_name = "File" } )
, ( Builtin "World", { deft & tde_typedef.td_name = "World",
, ( Builtin "Dynamic" [CLR 10 "8" "_Toc311798077"], {deft & tde_typedef.td_name = "Dynamic"})
, ( Builtin "File" [CLR 6 "4.7" "_Toc311798037"], {deft & tde_typedef.td_name = "File"})
, ( Builtin "World" [CLR 6 "4.7" "_Toc311798037"], {deft & tde_typedef.td_name = "World",
tde_typedef.td_uniq = True } )
: lists
]
......@@ -69,13 +69,11 @@ where
lists = [make_list kind spine \\ kind <- [[], ['#'], ['!'], ['|']], spine <- [[], ['!']] | kind <> ['|'] || spine <> ['!']]
where
make_list :: [Char] [Char] -> (Location, TypeDefEntry)
make_list k s = (Builtin higherorder,
make_list k s = (Builtin higherorder [CLR 6 "4.2" "_Toc311798019"],
{ deft
& tde_typedef.td_name = toString (['_':k] ++ ['List'] ++ s)
, tde_typedef.td_args = [Var "a"]
, tde_doc = Just $ TypeDoc (Just $ "A" + kind + spine + " list.\n\n" + description) ["The type of the list elements."] Nothing
// , syntax_doc_locations = [CLR 6 "4.2" "_Toc311798019"]
// , syntax_examples = map (EXs "Function" "macro") ["f :: " <+ lista <+ " -> a", "ints = " <+ listints]
})
where
higherorder = toString (['[':k] ++ s` ++ [']'])
......
Subproject commit 4ab43ae83d028153296dbdfb29224626ade29eab
Subproject commit 6b1321a537abec27a211b59aed4ecec57f4b2ba6
......@@ -343,7 +343,7 @@ function getResults(str, libs, include_builtins, include_core, include_apps, pag
'<a href="' + iclUrl + '" target="_blank">icl' + iclLine + '</a>)';
if ('builtin' in basic && basic['builtin'])
basicText = [['Clean core. The actual implementation may differ. For documentation, see the Clean language report.']];
basicText = [['Clean core. The actual implementation may differ.']];
var toggler = '';
if (hidden.length > 0) {
......@@ -370,6 +370,21 @@ function getResults(str, libs, include_builtins, include_core, include_apps, pag
var meta = [];
var hidden = [];
if ('langrep_documentation' in basic &&
basic['langrep_documentation'].length > 0) {
var doc = 'See the language report: ';
for (var i in basic['langrep_documentation']) {
var loc = basic['langrep_documentation'][i];
if (i != 0)
doc += '; ';
doc += '<a target="_blank" ' +
'href="/doc/#' + loc.clr_file + ';jump=' + loc.clr_heading + '">' +
loc.clr_section + '</a>';
}
doc += '.';
meta.push(doc);
}
if ('documentation' in basic)
meta.push(markupDocumentation(basic['documentation']));
......@@ -514,20 +529,6 @@ function getResults(str, libs, include_builtins, include_core, include_apps, pag
highlightFunction('import ' + basic['modul']));
case 'SyntaxResult':
var urls = '';
if (extra['syntax_doc_location'].length > 0) {
urls += ' (';
for (var i in extra['syntax_doc_location']) {
var loc = extra['syntax_doc_location'][i][1];
if (i != 0)
urls += '; ';
urls += '<a target="_blank" ' +
'href="/doc/#' + loc.clr_file + ';jump=' + loc.clr_heading + '">' +
'Section ' + loc.clr_section + ' of the Language report v' + loc.clr_version + '</a>';
}
urls += ')';
}
var toggler = '';
if (extra['syntax_examples'].length > 0) {
toggler = '<div class="toggler" title="More details" onclick="toggle(this)">' +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment