diff --git a/packages/mondo/mondo.mjs b/packages/mondo/mondo.mjs index ff0b6741e..d7c90139f 100644 --- a/packages/mondo/mondo.mjs +++ b/packages/mondo/mondo.mjs @@ -17,7 +17,7 @@ export class MondoParser { open_seq: /^\[/, close_seq: /^\]/, number: /^-?[0-9]*\.?[0-9]+/, // before pipe! - op: /^[*/:]|^\.{2}/, // * / : .. + op: /^[*/:!@]|^\.{2}/, // * / : .. pipe: /^\./, stack: /^[,$]/, plain: /^[a-zA-Z0-9-~_^]+/, diff --git a/packages/mondough/mondough.mjs b/packages/mondough/mondough.mjs index 857a9f000..d442a0262 100644 --- a/packages/mondough/mondough.mjs +++ b/packages/mondough/mondough.mjs @@ -21,14 +21,22 @@ strudelScope.leaf = (token, scope) => { strudelScope.call = (fn, args, name) => { const [pat, ...rest] = args; - if (!['seq', 'cat', 'stack', ':', '..'].includes(name)) { + if (!['seq', 'cat', 'stack', ':', '..', '!', '@'].includes(name)) { args = [...rest, pat]; } + if (name === 'seq') { + return stepcat(...args).setSteps(1); + } + if (name === 'cat') { + return stepcat(...args).pace(1); + } return fn(...args); }; strudelScope['*'] = fast; strudelScope['/'] = slow; +strudelScope['!'] = (pat, n) => pat.extend(n); +strudelScope['@'] = (pat, n) => pat.expand(n); // : operator const tail = (pat, friend) => pat.fmap((a) => (b) => (Array.isArray(a) ? [...a, b] : [a, b])).appLeft(friend);