Warning: session_start(): open(/var/lib/php/sessions/sess_4vlastfl0o30ipjpati7t60fdr, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
p {
serveHttpOpenBrowser(7777);
}
html {
uri = dropPrefix("/", uri);
bool real = uri.startsWith("real/");
if (real) uri = dropPrefix("real/", uri);
S snippetID = #1007528;
if (isSnippetID(uri)) snippetID = fsI(uri);
S code = loadSnippet(snippetID);
L tok = javaTok(code);
new Map links; // token index -> sf snippet ID
new Map explanations; // token index -> explanation text
SS sf = stdFunctions_cached();
for (int i = 1; i < l(tok); i += 2) {
S t = tok.get(i);
S prev = get(tok, i-2);
S next = get(tok, i+2);
if (isIdentifier(t)) {
S id = sf.get(t);
if (id == null) continue;
if (eq(prev, "f") ||
eq(next, "(")
&& (neq(prev, ".")
|| eq(get(tok, i-4), "main") && neq(get(tok, i-6), ".")))
links.put(i, id);
}
if (eq(t, "concept") && isIdentifier(next))
explanations.put(i, "A concept is like a Java class, but persistable");
}
new StringBuilder out;
SS titles = getSnippetTitles(values(links));
for i over tok: {
S t = tok.get(i), id = links.get(i), ex = explanations.get(i);
S enc = htmlencode(t);
out.append(id != null
? ahref(makeLink(real, id), enc,
title := titles.get(fsI(id)))
: ex != null ? span(enc, title := ex, style := "border-bottom: dotted 1px")
: enc);
}
S html = str(out);
if (real) ret html;
ret h3_title("Snippet " + snippetID) + hpre(html);
}
sS makeLink(bool real, S id) {
if (real)
ret longSnippetLink(id);
ret "/" + psI(id);
}