Colour the primitive type names too, since only the capitalised ones showed

The rule was "capitalised is a type", which leaves i32 and string looking like
ordinary names in the one position — a signature — where the reader is there
to see the types.
This commit is contained in:
Joseph Ferano 2026-09-12 03:48:30 +07:00
parent a5e0c01224
commit 1d206518cf

View File

@ -1237,6 +1237,8 @@ macro is a function from <code>Form</code> to <code>Form</code>, which needs
"declare declare-c import package let if when unless cond do and or not while " +
"until dotimes match set return some try defer signal error handler-bind " +
"restart-case invoke-restart fn quote defmacro gensym").split(" "));
// Capitalised names are types; these are the ones that are not capitalised.
var TYPES = new Set(("i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 bool string").split(" "));
var TOKEN = /(;[^\n]*)|("(?:\\.|[^"\\])*")|(\\[A-Za-z0-9]+)|(:[A-Za-z][\w?!*<>=+-]*)|(\b0[xX][0-9a-fA-F]+\b|\b\d[\d.]*\b)|([A-Za-z][\w*?!<>=./+-]*)/g;
function esc(s) {
return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@ -1253,7 +1255,8 @@ macro is a function from <code>Form</code> to <code>Form</code>, which needs
if (num) return '<span class="n">' + m + "</span>";
if (word) {
if (FORMS.has(word)) return '<span class="f">' + m + "</span>";
if (/^[A-Z]/.test(word)) return '<span class="t">' + m + "</span>";
if (TYPES.has(word) || /^[A-Z]/.test(word))
return '<span class="t">' + m + "</span>";
}
return m;
});