console.log();
console.log('Demonstrate the `split()` function.');
console.log('It is roughly equivalent to the JavaScript string `String.split(regex[, limit])` function.');
console.log();
console.log(` grammar: ${exp.source}`);
restr = exp.split(str);
console.log(' : split into characters');
console.log(` input: ${str}`);
console.log(` split: [${restr}]`);
restr = exp.split(str, 3);
console.log();
console.log(' : limit to 3 matched phrases');
console.log(` input: ${str}`);
console.log(` split: [${restr}]`);
str = undefined;
restr = exp.split(str);
console.log();
console.log(' : no input');
console.log(` input: ${str}`);
console.log(` split: [${restr}]`);
console.log(` length: [${restr.length}]`);
str = 'abcxyz';
grammar = 'rule = "d"\n';
exp = new ApgExp(grammar, flags);
restr = exp.split(str);
console.log();
console.log(' : no matches');
console.log(` input: ${str}`);
console.log(` split: [${restr}]`);
} catch (e) {
console.log(`EXCEPTION: ${e.message}`);
}
})();