Compare Lao chunkers
Compares two different ways to chunk Lao text
by hippietrail
JavaScript
var laoChunker = (function() {
/*
* Generated by PEG.js 0.8.0.
*
* http://pegjs.majda.cz/
*/
function peg$subclass(child, parent) {
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor();
}
function SyntaxError(message, expected, found, offset, line, column) {
this.message = message;
this.expected = expected;
this.found = found;
this.offset = offset;
this.line = line;
this.column = column;
this.name = "SyntaxError";
}
peg$subclass(SyntaxError, Error);
function parse(input) {
var options = arguments.length > 1 ? arguments[1] : {},
peg$FAILED = {},
peg$startRuleFunctions = { everything: peg$parseeverything },
peg$startRuleFunction = peg$parseeverything,
peg$c0 = peg$FAILED,
peg$c1 = function(l, r) {
return [l].concat(r);
},
peg$c2 = function(l) {
return [l];
},
peg$c3 = /^[\u0EC0\u0EC1\u0EC2\u0EC3\u0EC4]/,
peg$c4 = { type: "class", value: "[\\u0EC0\\u0EC1\\u0EC2\\u0EC3\\u0EC4]", description: "[\\u0EC0\\u0EC1\\u0EC2\\u0EC3\\u0EC4]" },
peg$c5 = [],
peg$c6 = /^[\u0E80-\u0EAF\u0EB1-\u0EBD\u0EC6-\u0EFF]/,
peg$c7 = { type: "class", value: "[\\u0E80-\\u0EAF\\u0EB1-\\u0EBD\\u0EC6-\\u0EFF]", description: "[\\u0E80-\\u0EAF\\u0EB1-\\u0EBD\\u0EC6-\\u0EFF]" },
peg$c8 = /^[\u0EB0]/,
peg$c9 = { type: "class", value: "[\\u0EB0]", description: "[\\u0EB0]" },
peg$c10 = function(left, mid, right) {
return left + mid + right;
},
peg$c11 = function(lv, rest) {
return lv + rest;
},
peg$c12 = function(stuff, end) {
return stuff + end;
},
peg$c13 = /^[^\u0E80-\u0EFF]/,
peg$c14 = { type: "class", value: "[^\\u0E80-\\u0EFF]", description: "[^\\u0E80-\\u0EFF]" },
...