Adds support for reader modes
const noYs = getCurrentReadtable().extend({
key: 'y',
mode: 'terminating', // 'y' will now terminate Identifier parsing effectively acting as a delimiter
action(stream) {
throw Error('y is an invalid character');
}
});
const useZs = getCurrentReadtable().extend({
key: 'z',
mode: 'non-terminating', // 'z' can still be used in Identifiers
action: // ...
});
const colonese = getCurrentReadtable().extend({
key: ':',
mode: 'dispatch', // '#:' will dispatch to action and acting as 'non-terminating'
action: // ...
});
// delegate mode in progress
const twoWaysToAdd = getCurrentReadtable().extend({
key: 'Σ',
mode: '+' // now Σ will return a '+' token,
delegateTable: getCurrentReadtable()
});
I'm currently working on the delegate mode. I'm not sure how useful it's going to be and it does complicate things a bit.
I'm only including it b/c Racket has it. If I can't get it in a day or two I might drop it.