0313565610
Complete redo of data store Introduces live queries and live templates
21 lines
559 B
TypeScript
21 lines
559 B
TypeScript
import { SysCallMapping } from "../../plugos/system.ts";
|
|
import { parse } from "../markdown_parser/parse_tree.ts";
|
|
import type { ParseTree } from "$sb/lib/tree.ts";
|
|
import { languageFor } from "../languages.ts";
|
|
|
|
export function languageSyscalls(): SysCallMapping {
|
|
return {
|
|
"language.parseLanguage": (
|
|
_ctx,
|
|
language: string,
|
|
code: string,
|
|
): ParseTree => {
|
|
const lang = languageFor(language);
|
|
if (!lang) {
|
|
throw new Error(`Unknown language ${language}`);
|
|
}
|
|
return parse(lang, code);
|
|
},
|
|
};
|
|
}
|