also show scheme code in web playground
Some checks failed
Publish Playground / build (push) Has been cancelled
Publish Playground / deploy (push) Has been cancelled

This commit is contained in:
2026-03-21 11:39:29 -07:00
parent 9652903df1
commit f5a9aae070
6 changed files with 99 additions and 26 deletions

View File

@@ -154,6 +154,36 @@ const newtLanguage2: StreamLanguage<State> = StreamLanguage.define({
},
});
export function scheme() {
return new LanguageSupport(schemeLanguage);
}
const schemeLanguage: StreamLanguage<State> = StreamLanguage.define({
startState: () => null,
token(stream, st) {
const keywords = ["define", "let", "case", "cond", "import", "include", "lambda", "else"];
if (stream.eatSpace()) return null;
if (stream.match("--")) {
stream.skipToEnd();
return "comment";
}
if (stream.match(/[0-9A-Za-z!%&*+./:<=>?@^_~-]+/)) {
let word = stream.current();
if (keywords.includes(word)) return "keyword";
return null;
}
// unhandled
stream.next();
return null
},
languageData: {
commentTokens: {
line: ";;",
},
wordChars: "!%&*+-./:<=>?@^_~",
},
});
function newt() {
return new LanguageSupport(newtLanguage2);
}