From ac6472a43aaa9eadfd8334cec5e1cf4098680670 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 20 Mar 2025 21:19:21 +0100 Subject: [PATCH] mondo: mondo as minilang (inactive) --- packages/mondough/mondough.mjs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/mondough/mondough.mjs b/packages/mondough/mondough.mjs index 13b0f602f..26c9785e0 100644 --- a/packages/mondough/mondough.mjs +++ b/packages/mondough/mondough.mjs @@ -24,7 +24,6 @@ lib['..'] = range; let runner = new MondoRunner({ call(name, args, scope) { - console.log('call', name, args, scope); const fn = lib[name] || strudelScope[name]; if (!fn) { throw new Error(`[moundough]: unknown function "${name}"`); @@ -60,7 +59,19 @@ export function mondo(code, offset = 0) { return pat.markcss('color: var(--foreground);text-decoration:underline'); } +let getLocations = (code, offset) => runner.parser.get_locations(code, offset); + +export const mondi = (str, offset) => { + const code = `[${str}]`; + return mondo(code, offset); +}; + // tell transpiler how to get locations for mondo`` calls registerLanguage('mondo', { - getLocations: (code, offset) => runner.parser.get_locations(code, offset), + getLocations, }); +// uncomment the following to use mondo as mini notation language +/* registerLanguage('minilang', { + name: 'mondi', + getLocations, +}); */