Skip to content

Commit 9626f3c

Browse files
committed
mondo add % for pace
1 parent 432e8dc commit 9626f3c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/mondo/mondo.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class MondoParser {
1717
open_seq: /^\[/,
1818
close_seq: /^\]/,
1919
number: /^-?[0-9]*\.?[0-9]+/, // before pipe!
20-
op: /^[*/:!@]|^\.{2}/, // * / : ..
20+
op: /^[*/:!@%]|^\.{2}/, // * / : ! @ % ..
2121
pipe: /^\./,
2222
stack: /^[,$]/,
2323
plain: /^[a-zA-Z0-9-~_^]+/,

packages/mondough/mondough.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ strudelScope.leaf = (token, scope) => {
2121

2222
strudelScope.call = (fn, args, name) => {
2323
const [pat, ...rest] = args;
24-
if (!['seq', 'cat', 'stack', ':', '..', '!', '@'].includes(name)) {
24+
if (!['seq', 'cat', 'stack', ':', '..', '!', '@', '%'].includes(name)) {
2525
args = [...rest, pat];
2626
}
2727
if (name === 'seq') {
@@ -37,6 +37,7 @@ strudelScope['*'] = fast;
3737
strudelScope['/'] = slow;
3838
strudelScope['!'] = (pat, n) => pat.extend(n);
3939
strudelScope['@'] = (pat, n) => pat.expand(n);
40+
strudelScope['%'] = (pat, n) => pat.pace(n);
4041

4142
// : operator
4243
const tail = (pat, friend) => pat.fmap((a) => (b) => (Array.isArray(a) ? [...a, b] : [a, b])).appLeft(friend);

0 commit comments

Comments
 (0)