mondo add % for pace
This commit is contained in:
parent
432e8dcccc
commit
9626f3cc9a
2 changed files with 3 additions and 2 deletions
|
|
@ -17,7 +17,7 @@ export class MondoParser {
|
||||||
open_seq: /^\[/,
|
open_seq: /^\[/,
|
||||||
close_seq: /^\]/,
|
close_seq: /^\]/,
|
||||||
number: /^-?[0-9]*\.?[0-9]+/, // before pipe!
|
number: /^-?[0-9]*\.?[0-9]+/, // before pipe!
|
||||||
op: /^[*/:!@]|^\.{2}/, // * / : ..
|
op: /^[*/:!@%]|^\.{2}/, // * / : ! @ % ..
|
||||||
pipe: /^\./,
|
pipe: /^\./,
|
||||||
stack: /^[,$]/,
|
stack: /^[,$]/,
|
||||||
plain: /^[a-zA-Z0-9-~_^]+/,
|
plain: /^[a-zA-Z0-9-~_^]+/,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ strudelScope.leaf = (token, scope) => {
|
||||||
|
|
||||||
strudelScope.call = (fn, args, name) => {
|
strudelScope.call = (fn, args, name) => {
|
||||||
const [pat, ...rest] = args;
|
const [pat, ...rest] = args;
|
||||||
if (!['seq', 'cat', 'stack', ':', '..', '!', '@'].includes(name)) {
|
if (!['seq', 'cat', 'stack', ':', '..', '!', '@', '%'].includes(name)) {
|
||||||
args = [...rest, pat];
|
args = [...rest, pat];
|
||||||
}
|
}
|
||||||
if (name === 'seq') {
|
if (name === 'seq') {
|
||||||
|
|
@ -37,6 +37,7 @@ strudelScope['*'] = fast;
|
||||||
strudelScope['/'] = slow;
|
strudelScope['/'] = slow;
|
||||||
strudelScope['!'] = (pat, n) => pat.extend(n);
|
strudelScope['!'] = (pat, n) => pat.extend(n);
|
||||||
strudelScope['@'] = (pat, n) => pat.expand(n);
|
strudelScope['@'] = (pat, n) => pat.expand(n);
|
||||||
|
strudelScope['%'] = (pat, n) => pat.pace(n);
|
||||||
|
|
||||||
// : operator
|
// : operator
|
||||||
const tail = (pat, friend) => pat.fmap((a) => (b) => (Array.isArray(a) ? [...a, b] : [a, b])).appLeft(friend);
|
const tail = (pat, friend) => pat.fmap((a) => (b) => (Array.isArray(a) ? [...a, b] : [a, b])).appLeft(friend);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue