jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
<script id='primbody' type='text/x-prim'>div(class='container-fluid') {br/div(class='panel panel-default'){div(class='panel-heading')|Prim|div(class='panel-body')|Natural, fat free, and extensible interface markup for the web.|div(class='panel-footer'){a(href='https://github.com/edge/prim')|Get it now|}}}</script><script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
var jisonlalr = function() {
function Parser() {
this.yy = {}
}
var o = function(t, e, i, s) {
for (i = i || {}, s = t.length; s--; i[t[s]] = e);
return i
}, $V0 = [2, 4],
$V1 = [1, 7],
$V2 = [1, 9],
$V3 = [1, 11],
$V4 = [1, 12],
$V5 = [5, 9, 12, 18, 22, 23],
$V6 = [5, 9, 11, 12, 13, 16, 17, 18, 22, 23],
$V7 = [5, 9, 12, 15, 18, 22, 23],
$V8 = [15, 18],
parser = {
trace: function() {},
yy: {},
symbols_: {
error: 2,
expressions: 3,
root: 4,
EOF: 5,
nodes: 6,
node: 7,
nodebuilder: 8,
code: 9,
rawstring: 10,
lb: 11,
rb: 12,
lp: 13,
attributes: 14,
rp: 15,
raw: 16,
solid: 17,
name: 18,
attribute: 19,
eq: 20,
string: 21,
dstring: 22,
sstring: 23,
$accept: 0,
$end: 1
},
terminals_: {
2: "error",
5: "EOF",
9: "code",
11: "lb",
12: "rb",
13: "lp",
15: "rp",
16: "raw",
17: "solid",
18: "name",
20: "eq",
22: "dstring",
23: "sstring"
},
productions_: [0, [3, 2],
[4, 1],
[6, 2],
[6, 0],
[7, 1],
[7, 1],
[7, 1],
[8, 4],
[8, 4],
[8, 2],
[8, 2],
[8, 1],
[14, 2],
[14, 0],
[19, 3],
[19, 1],
[21, 1],
[21, 1],
[10, 1]
],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, context) {
var $0 = $$.length - 1;
switch (yystate) {
case 1:
return $$[$0 - 1];
case 3:
this.$ = $$[$0 - 1] + $$[$0];
break;
case 4:
case 14:
this.$ = "";
break;
case 5:
this.$ = $$[$0].selfclosing ? "<" + $$[$0].name + $$[$0].attributes + " />" : "<" + $$[$0].name + $$[$0].attributes + ">" + $$[$0].children + "</" + $$[$0].name + ">";
break;
case 6:
if ($$[$0] = $$[$0].trim(), $$[$0].length)
if (context) with(context) this.$ = eval($$[$0]);
else this.$ = eval($$[$0]);
break;
case 8:
this.$ = $$[$0 - 3], this.$.children += $$[$0 - 1];
break;
case 9:
this.$ = $$[$0 - 3], this.$.attributes += $$[$0 - 1];
break;
case 10:
this.$ = $$[$0 - 1], this.$.children += $$[$0];
break;
case 11:
this.$ = $$[$0 - 1], this.$.selfclosing = !0;
break;
case 12:
this.$ = {
name: $$[$0],
children: "",
attributes: "",
selfclosing: !1
};
break;
case 13:
this.$ = $$[$0 - 1] + " " + $$[$0];
break;
case 15:
this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0];
break;
case 19:
this.$ = $$[$0].substring(1, $$[$0].length - 1)
}
},
table: [o([5, 9, 18, 22, 23], $V0, {
3: 1,
4: 2,
6: 3
}), {
1: [3]
}, {
5: [1, 4]
}, {
5: [2, 2],
7: 5,
8: 6,
9: $V1,
10: 8,
18: $V2,
21: 10,
22: $V3,
23: $V4
}, {
1: [2, 1]
},
o($V5, [2, 3]), o($V5, [2, 5], {
11: [1, 13],
13: [1, 14],
16: [1, 15],
17: [1, 16]
}), o($V5, [2, 6]), o($V5, [2, 7]), o($V6, [2, 12]), o($V5, [2, 19]), o($V7, [2, 17]), o($V7, [2, 18]), o([9, 12, 18, 22, 23], $V0, {
6: 17
}), o($V8, [2, 14], {
14: 18
}), o($V6, [2, 10]), o($V6, [2, 11]), {
7: 5,
8: 6,
9: $V1,
10: 8,
12: [1, 19],
18: $V2,
21: 10,
22: $V3,
23: $V4
}, {
15: [1, 20],
18: [1, 22],
19: 21
},
o($V6, [2, 8]), o($V6, [2, 9]), o($V8, [2, 13]), o($V8, [2, 16], {
20: [1, 23]
}), {
21: 24,
22: $V3,
23: $V4
},
o($V8, [2, 15])
],
defaultActions: {
4: [2, 1]
},
parseError: function(t, e) {
if (!e.recoverable) throw new Error(t);
this.trace(t)
},
parse: function(t) {
function e() {
var t;
return t = p.lex() || y, "number" != typeof t && (t = i.symbols_[t] || t), t
}
var i = this,
s = [0],
n = [null],
r = [],
h = this.table,
o = "",
l = 0,
a = 0,
c = 0,
u = 2,
y = 1,
$ = r.slice.call(arguments, 1),
p = Object.create(this.lexer),
g = {
yy: {}
};
for (var f in this.yy) Object.prototype.hasOwnProperty.call(this.yy, f) && (g.yy[f] = this.yy[f]);
p.setInput(t, g.yy), g.yy.lexer = p, g.yy.parser = this, "undefined" == typeof p.yylloc && (p.yylloc = {});
var _ = p.yylloc;
r.push(_);
var m = p.options && p.options.ranges;
this.parseError = "function" == typeof g.yy.parseError ? g.yy.parseError : Object.getPrototypeOf(this).parseError;
for (var d, b, k, x, F, v, V, w, S, E = {};;) {
if (k = s[s.length - 1], this.defaultActions[k] ? x = this.defaultActions[k] : ((null === d || "undefined" == typeof d) && (d = e()), x = h[k] && h[k][d]), "undefined" == typeof x || !x.length || !x[0]) {
var I = "";
S = [];
for (v in h[k]) this.terminals_[v] && v > u && S.push("'" + this.terminals_[v] + "'");
I = p.showPosition ? "Parse error on line " + (l + 1) + ":\n" + p.showPosition() + "\nExpecting " + S.join(", ") + ", got '" + (this.terminals_[d] || d) + "'" : "Parse error on line " + (l + 1) + ": Unexpected " + (d == y ? "end of input" : "'" + (this.terminals_[d] || d) + "'"), this.parseError(I, {
text: p.match,
token: this.terminals_[d] || d,
line: p.yylineno,
loc: _,
expected: S
})
}
if (x[0] instanceof Array && x.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + k + ", token: " + d);
switch (x[0]) {
case 1:
s.push(d), n.push(p.yytext), r.push(p.yylloc), s.push(x[1]), d = null, b ? (d = b, b = null) : (a = p.yyleng, o = p.yytext, l = p.yylineno, _ = p.yylloc, c > 0 && c--);
break;
case 2:
if (V = this.productions_[x[1]][1], E.$ = n[n.length - V], E._$ = {
first_line: r[r.length - (V || 1)].first_line,
last_line: r[r.length - 1].last_line,
first_column: r[r.length - (V || 1)].first_column,
last_column: r[r.length - 1].last_column
}, m && (E._$.range = [r[r.length - (V || 1)].range[0], r[r.length - 1].range[1]]), F = this.performAction.apply(E, [o, a, l, g.yy, x[1], n, r].concat($)), "undefined" != typeof F) return F;
V && (s = s.slice(0, -1 * V * 2), n = n.slice(0, -1 * V), r = r.slice(0, -1 * V)), s.push(this.productions_[x[1]][0]), n.push(E.$), r.push(E._$), w = h[s[s.length - 2]][s[s.length - 1]], s.push(w);
break;
case 3:
return !0
}
}
return !0
}
}, lexer = function() {
var t = {
EOF: 1,
parseError: function(t, e) {
if (!this.yy.parser) throw new Error(t);
this.yy.parser.parseError(t, e)
},
setInput: function(t, e) {
return this.yy = e || this.yy || {}, this._input = t, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this
},
input: function() {
var t = this._input[0];
this.yytext += t, this.yyleng++, this.offset++, this.match += t, this.matched += t;
var e = t.match(/(?:\r\n?|\n).*/g);
return e ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), t
},
unput: function(t) {
var e = t.length,
i = t.split(/(?:\r\n?|\n)/g);
this._input = t + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - e), this.offset -= e;
var s = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), i.length - 1 && (this.yylineno -= i.length - 1);
var n = this.yylloc.range;
return this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: i ? (i.length === s.length ? this.yylloc.first_column : 0) + s[s.length - i.length].length - i[0].length : this.yylloc.first_column - e
}, this.options.ranges && (this.yylloc.range = [n[0], n[0] + this.yyleng - e]), this.yyleng = this.yytext.length, this
},
more: function() {
return this._more = !0, this
},
reject: function() {
return this.options.backtrack_lexer ? (this._backtrack = !0, this) : this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
})
},
less: function(t) {
this.unput(this.match.slice(t))
},
pastInput: function() {
var t = this.matched.substr(0, this.matched.length - this.match.length);
return (t.length > 20 ? "..." : "") + t.substr(-20).replace(/\n/g, "")
},
upcomingInput: function() {
var t = this.match;
return t.length < 20 && (t += this._input.substr(0, 20 - t.length)), (t.substr(0, 20) + (t.length > 20 ? "..." : "")).replace(/\n/g, "")
},
showPosition: function() {
var t = this.pastInput(),
e = new Array(t.length + 1).join("-");
return t + this.upcomingInput() + "\n" + e + "^"
},
test_match: function(t, e) {
var i, s, n;
if (this.options.backtrack_lexer && (n = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
}, this.options.ranges && (n.yylloc.range = this.yylloc.range.slice(0))), s = t[0].match(/(?:\r\n?|\n).*/g), s && (this.yylineno += s.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: s ? s[s.length - 1].length - s[s.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + t[0].length
}, this.yytext += t[0], this.match += t[0], this.matches = t, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(t[0].length), this.matched += t[0], i = this.performAction.call(this, this.yy, this, e, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), i) return i;
if (this._backtrack) {
for (var r in n) this[r] = n[r];
return !1
}
return !1
},
next: function() {
if (this.done) return this.EOF;
this._input || (this.done = !0);
var t, e, i, s;
this._more || (this.yytext = "", this.match = "");
for (var n = this._currentRules(), r = 0; r < n.length; r++)
if (i = this._input.match(this.rules[n[r]]), i && (!e || i[0].length > e[0].length)) {
if (e = i, s = r, this.options.backtrack_lexer) {
if (t = this.test_match(i, n[r]), t !== !1) return t;
if (this._backtrack) {
e = !1;
continue
}
return !1
}
if (!this.options.flex) break
}
return e ? (t = this.test_match(e, n[s]), t !== !1 ? t : !1) : "" === this._input ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
})
},
lex: function() {
var t = this.next();
return t ? t : this.lex()
},
begin: function(t) {
this.conditionStack.push(t)
},
popState: function() {
var t = this.conditionStack.length - 1;
return t > 0 ? this.conditionStack.pop() : this.conditionStack[0]
},
_currentRules: function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules
},
topState: function(t) {
return t = this.conditionStack.length - 1 - Math.abs(t || 0), t >= 0 ? this.conditionStack[t] : "INITIAL"
},
pushState: function(t) {
this.begin(t)
},
stateStackSize: function() {
return this.conditionStack.length
},
options: {},
performAction: function(t, e, i, s) {
switch (i) {
case 0:
break;
case 1:
return 18;
case 2:
return 11;
case 3:
return 12;
case 4:
return 13;
case 5:
return 15;
case 6:
return 20;
case 7:
return 17;
case 8:
this.begin("code"), this.codelevel = 1, this.codebuf = "";
break;
case 9:
this.codebuf += e.yytext;
break;
case 10:
this.begin("code"), this.codelevel++, this.codebuf += e.yytext;
break;
case 11:
if (this.popState(), this.codelevel--, 0 == this.codelevel) return e.yytext = this.codebuf, 9;
this.codebuf += e.yytext;
break;
case 12:
this.begin("raw"), this.rawtext = "";
break;
case 13:
this.rawtext += e.yytext;
break;
case 14:
this.rawtext += "|";
break;
case 15:
this.rawtext += "\\";
break;
case 16:
return this.popState(), e.yytext = this.rawtext, 16;
case 17:
this.begin("dstring"), this.stringtext = '"';
break;
case 18:
this.stringtext += e.yytext;
break;
case 19:
return this.popState(), e.yytext = this.stringtext + e.yytext, 22;
case 20:
this.begin("sstring"), this.stringtext = "'";
break;
case 21:
this.stringtext += e.yytext;
break;
case 22:
return this.popState(), e.yytext = this.stringtext + e.yytext, 23;
case 23:
return 5;
case 24:
return e.yytext
}
},
rules: [/^(?:\s+)/, /^(?:([:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD])(([:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD])|[-\.0-9\u00B7\u0300-\u036F\u203F-\u2040])*)/, /^(?:\{)/, /^(?:\})/, /^(?:\()/, /^(?:\))/, /^(?:=)/, /^(?:\/)/, /^(?:#\{)/, /^(?:[^\{\}]+)/, /^(?:\{)/, /^(?:\})/, /^(?:\|)/, /^(?:[^\\\|]+)/, /^(?:\\\|)/, /^(?:\\)/, /^(?:\|)/, /^(?:")/, /^(?:(\\[\'\"bfnrt]|[^\"\\])+)/, /^(?:")/, /^(?:')/, /^(?:(\\[\'\"bfnrt]|[^\'\\])+)/, /^(?:')/, /^(?:$)/, /^(?:.)/],
conditions: {
code: {
rules: [9, 10, 11],
inclusive: !1
},
raw: {
rules: [13, 14, 15, 16],
inclusive: !1
},
dstring: {
rules: [18, 19],
inclusive: !1
},
sstring: {
rules: [21, 22],
inclusive: !1
},
INITIAL: {
rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 17, 20, 23, 24],
inclusive: !0
}
}
};
return t
}();
return parser.lexer = lexer, Parser.prototype = parser, parser.Parser = Parser, new Parser
}();
peg = prim = function() {
function peg$subclass(e, p) {
function r() {
this.constructor = e
}
r.prototype = p.prototype, e.prototype = new r
}
function SyntaxError(e, p, r, g, $, c) {
this.message = e, this.expected = p, this.found = r, this.offset = g, this.line = $, this.column = c, this.name = "SyntaxError"
}
function parse(input) {
function text() {
return input.substring(peg$reportedPos, peg$currPos)
}
function offset() {
return peg$reportedPos
}
function line() {
return peg$computePosDetails(peg$reportedPos).line
}
function column() {
return peg$computePosDetails(peg$reportedPos).column
}
function expected(e) {
throw peg$buildException(null, [{
type: "other",
description: e
}], peg$reportedPos)
}
function error(e) {
throw peg$buildException(e, null, peg$reportedPos)
}
function peg$computePosDetails(e) {
function p(e, p, r) {
var g, $;
for (g = p; r > g; g++) $ = input.charAt(g), "\n" === $ ? (e.seenCR || e.line++, e.column = 1, e.seenCR = !1) : "\r" === $ || "\u2028" === $ || "\u2029" === $ ? (e.line++, e.column = 1, e.seenCR = !0) : (e.column++, e.seenCR = !1)
}
return peg$cachedPos !== e && (peg$cachedPos > e && (peg$cachedPos = 0, peg$cachedPosDetails = {
line: 1,
column: 1,
seenCR: !1
}), p(peg$cachedPosDetails, peg$cachedPos, e), peg$cachedPos = e), peg$cachedPosDetails
}
function peg$fail(e) {
peg$maxFailPos > peg$currPos || (peg$currPos > peg$maxFailPos && (peg$maxFailPos = peg$currPos, peg$maxFailExpected = []), peg$maxFailExpected.push(e))
}
function peg$buildException(e, p, r) {
function g(e) {
var p = 1;
for (e.sort(function(e, p) {
return e.description < p.description ? -1 : e.description > p.description ? 1 : 0
}); p < e.length;) e[p - 1] === e[p] ? e.splice(p, 1) : p++
}
function $(e, p) {
function r(e) {
function p(e) {
return e.charCodeAt(0).toString(16).toUpperCase()
}
return e.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\x08/g, "\\b").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\f/g, "\\f").replace(/\r/g, "\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(e) {
return "\\x0" + p(e)
}).replace(/[\x10-\x1F\x80-\xFF]/g, function(e) {
return "\\x" + p(e)
}).replace(/[\u0180-\u0FFF]/g, function(e) {
return "\\u0" + p(e)
}).replace(/[\u1080-\uFFFF]/g, function(e) {
return "\\u" + p(e)
})
}
var g, $, c, s = new Array(e.length);
for (c = 0; c < e.length; c++) s[c] = e[c].description;
return g = e.length > 1 ? s.slice(0, -1).join(", ") + " or " + s[e.length - 1] : s[0], $ = p ? '"' + r(p) + '"' : "end of input", "Expected " + g + " but " + $ + " found."
}
var c = peg$computePosDetails(r),
s = r < input.length ? input.charAt(r) : null;
return null !== p && g(p), new SyntaxError(null !== e ? e : $(p, s), p, s, r, c.line, c.column)
}
function peg$parseroot() {
var e, p, r, g;
return e = peg$currPos, p = peg$parse_(), p !== peg$FAILED ? (r = peg$parsenodes(), r !== peg$FAILED ? (g = peg$parse_(), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c1(r), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0), e
}
function peg$parseboundednode() {
var e, p, r, g, $, c;
return e = peg$currPos, p = peg$parsename(), p !== peg$FAILED ? (r = peg$parse_(), r !== peg$FAILED ? (g = peg$parseproperties(), g !== peg$FAILED ? ($ = peg$parse_(), $ !== peg$FAILED ? (c = peg$parsechildren(), c !== peg$FAILED ? (peg$reportedPos = e, p = peg$c2(p, g, c), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0), e === peg$FAILED && (e = peg$currPos, p = peg$parsename(), p !== peg$FAILED ? (r = peg$parse_(), r !== peg$FAILED ? (g = peg$parsechildren(), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c3(p, g), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0), e === peg$FAILED && (e = peg$currPos, p = peg$parsename(), p !== peg$FAILED ? (r = peg$parse_(), r !== peg$FAILED ? (g = peg$parseproperties(), g !== peg$FAILED ? ($ = peg$parse_(), $ !== peg$FAILED ? (47 === input.charCodeAt(peg$currPos) ? (c = peg$c4, peg$currPos++) : (c = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c5)), c !== peg$FAILED ? (peg$reportedPos = e, p = peg$c6(p, g), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0), e === peg$FAILED && (e = peg$currPos, p = peg$parsename(), p !== peg$FAILED ? (r = peg$parse_(), r !== peg$FAILED ? (47 === input.charCodeAt(peg$currPos) ? (g = peg$c4, peg$currPos++) : (g = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c5)), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c7(p), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0), e === peg$FAILED && (e = peg$currPos, p = peg$parsename(), p !== peg$FAILED ? (r = peg$parse_(), r !== peg$FAILED ? (g = peg$parseproperties(), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c8(p, g), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0), e === peg$FAILED && (e = peg$parseevalnode(), e === peg$FAILED && (e = peg$parsetextnode())))))), e
}
function peg$parsetextnode() {
var e, p, r, g;
if (e = peg$currPos, 39 === input.charCodeAt(peg$currPos) ? (p = peg$c9, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c10)), p !== peg$FAILED) {
for (r = [], g = peg$parsesinglequotechar(); g !== peg$FAILED;) r.push(g), g = peg$parsesinglequotechar();
r !== peg$FAILED ? (39 === input.charCodeAt(peg$currPos) ? (g = peg$c9, peg$currPos++) : (g = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c10)), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c12(r), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)
} else peg$currPos = e, e = peg$c0; if (e === peg$FAILED)
if (e = peg$currPos, 34 === input.charCodeAt(peg$currPos) ? (p = peg$c13, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c14)), p !== peg$FAILED) {
for (r = [], g = peg$parsedoublequotechar(); g !== peg$FAILED;) r.push(g), g = peg$parsedoublequotechar();
r !== peg$FAILED ? (34 === input.charCodeAt(peg$currPos) ? (g = peg$c13, peg$currPos++) : (g = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c14)), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c12(r), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)
} else peg$currPos = e, e = peg$c0;
return e
}
function peg$parseevalnode() {
var e, p, r, g, $, c;
if (e = peg$currPos, p = peg$parsehash(), p !== peg$FAILED)
if (r = peg$parse_(), r !== peg$FAILED)
if (123 === input.charCodeAt(peg$currPos) ? (g = peg$c15, peg$currPos++) : (g = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c16)), g !== peg$FAILED) {
for ($ = [], c = peg$parsecodechar(); c !== peg$FAILED;) $.push(c), c = peg$parsecodechar();
$ !== peg$FAILED ? (125 === input.charCodeAt(peg$currPos) ? (c = peg$c17, peg$currPos++) : (c = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c18)), c !== peg$FAILED ? (peg$reportedPos = e, p = peg$c19($), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)
} else peg$currPos = e, e = peg$c0;
else peg$currPos = e, e = peg$c0;
else peg$currPos = e, e = peg$c0;
return e
}
function peg$parsechildren() {
var e, p, r, g, $, c;
if (e = peg$currPos, 123 === input.charCodeAt(peg$currPos) ? (p = peg$c15, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c16)), p !== peg$FAILED ? (r = peg$parse_(), r !== peg$FAILED ? (g = peg$parsenodes(), g !== peg$FAILED ? ($ = peg$parse_(), $ !== peg$FAILED ? (125 === input.charCodeAt(peg$currPos) ? (c = peg$c17, peg$currPos++) : (c = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c18)), c !== peg$FAILED ? (peg$reportedPos = e, p = peg$c1(g), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0), e === peg$FAILED)
if (e = peg$currPos, 124 === input.charCodeAt(peg$currPos) ? (p = peg$c20, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c21)), p !== peg$FAILED) {
for (r = [], g = peg$parsepipechar(); g !== peg$FAILED;) r.push(g), g = peg$parsepipechar();
r !== peg$FAILED ? (124 === input.charCodeAt(peg$currPos) ? (g = peg$c20, peg$currPos++) : (g = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c21)), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c12(r), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)
} else peg$currPos = e, e = peg$c0;
return e
}
function peg$parsenode() {
var e, p;
return e = peg$currPos, p = peg$parsename(), p !== peg$FAILED && (peg$reportedPos = e, p = peg$c22(p)), e = p
}
function peg$parsenodes() {
var e, p, r, g;
return e = peg$currPos, p = peg$parseboundednode(), p !== peg$FAILED ? (r = peg$parse_(), r !== peg$FAILED ? (g = peg$parsenodes(), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c23(p, g), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0), e === peg$FAILED && (e = peg$currPos, p = peg$parsenode(), p !== peg$FAILED ? (r = peg$parse__(), r !== peg$FAILED ? (g = peg$parsenodes(), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c24(p, g), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0), e === peg$FAILED && (e = peg$parseboundednode(), e === peg$FAILED && (e = peg$parsenode(), e === peg$FAILED && (e = peg$parseempty())))), e
}
function peg$parseproperties() {
var e, p, r, g, $, c;
return e = peg$currPos, 40 === input.charCodeAt(peg$currPos) ? (p = peg$c25, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c26)), p !== peg$FAILED ? (r = peg$parse_(), r !== peg$FAILED ? (g = peg$parseattributes(), g !== peg$FAILED ? ($ = peg$parse_(), $ !== peg$FAILED ? (41 === input.charCodeAt(peg$currPos) ? (c = peg$c27, peg$currPos++) : (c = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c28)), c !== peg$FAILED ? (peg$reportedPos = e, p = peg$c29(g), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0), e === peg$FAILED && (e = peg$currPos, 40 === input.charCodeAt(peg$currPos) ? (p = peg$c25, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c26)), p !== peg$FAILED ? (r = peg$parse_(), r !== peg$FAILED ? (41 === input.charCodeAt(peg$currPos) ? (g = peg$c27, peg$currPos++) : (g = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c28)), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c30(), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)), e
}
function peg$parseattributes() {
var e, p, r, g;
return e = peg$currPos, p = peg$parseattribute(), p !== peg$FAILED ? (r = peg$parse__(), r !== peg$FAILED ? (g = peg$parseattributes(), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c31(p, g), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0), e === peg$FAILED && (e = peg$parseattribute()), e
}
function peg$parseattribute() {
var e, p, r, g, $, c;
return e = peg$currPos, p = peg$parsename(), p !== peg$FAILED ? (r = peg$parse_(), r !== peg$FAILED ? (61 === input.charCodeAt(peg$currPos) ? (g = peg$c32, peg$currPos++) : (g = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c33)), g !== peg$FAILED ? ($ = peg$parse_(), $ !== peg$FAILED ? (c = peg$parseattvalue(), c !== peg$FAILED ? (peg$reportedPos = e, p = peg$c34(p, c), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0), e === peg$FAILED && (e = peg$parsename()), e
}
function peg$parseattvalue() {
var e, p, r, g, $, c, s;
if (e = peg$currPos, 39 === input.charCodeAt(peg$currPos) ? (p = peg$c9, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c10)), p !== peg$FAILED) {
for (r = peg$currPos, g = [], $ = peg$currPos, c = peg$currPos, peg$silentFails++, 39 === input.charCodeAt(peg$currPos) ? (s = peg$c9, peg$currPos++) : (s = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c10)), peg$silentFails--, s === peg$FAILED ? c = peg$c35 : (peg$currPos = c, c = peg$c0), c !== peg$FAILED ? (s = peg$parsechar(), s !== peg$FAILED ? (c = [c, s], $ = c) : (peg$currPos = $, $ = peg$c0)) : (peg$currPos = $, $ = peg$c0); $ !== peg$FAILED;) g.push($), $ = peg$currPos, c = peg$currPos, peg$silentFails++, 39 === input.charCodeAt(peg$currPos) ? (s = peg$c9, peg$currPos++) : (s = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c10)), peg$silentFails--, s === peg$FAILED ? c = peg$c35 : (peg$currPos = c, c = peg$c0), c !== peg$FAILED ? (s = peg$parsechar(), s !== peg$FAILED ? (c = [c, s], $ = c) : (peg$currPos = $, $ = peg$c0)) : (peg$currPos = $, $ = peg$c0);
g !== peg$FAILED && (g = input.substring(r, peg$currPos)), r = g, r !== peg$FAILED ? (39 === input.charCodeAt(peg$currPos) ? (g = peg$c9, peg$currPos++) : (g = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c10)), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c36(r), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)
} else peg$currPos = e, e = peg$c0; if (e === peg$FAILED)
if (e = peg$currPos, 34 === input.charCodeAt(peg$currPos) ? (p = peg$c13, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c14)), p !== peg$FAILED) {
for (r = peg$currPos, g = [], $ = peg$currPos, c = peg$currPos, peg$silentFails++, 34 === input.charCodeAt(peg$currPos) ? (s = peg$c13, peg$currPos++) : (s = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c14)), peg$silentFails--, s === peg$FAILED ? c = peg$c35 : (peg$currPos = c, c = peg$c0), c !== peg$FAILED ? (s = peg$parsechar(), s !== peg$FAILED ? (c = [c, s], $ = c) : (peg$currPos = $, $ = peg$c0)) : (peg$currPos = $, $ = peg$c0); $ !== peg$FAILED;) g.push($), $ = peg$currPos, c = peg$currPos, peg$silentFails++, 34 === input.charCodeAt(peg$currPos) ? (s = peg$c13, peg$currPos++) : (s = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c14)), peg$silentFails--, s === peg$FAILED ? c = peg$c35 : (peg$currPos = c, c = peg$c0), c !== peg$FAILED ? (s = peg$parsechar(), s !== peg$FAILED ? (c = [c, s], $ = c) : (peg$currPos = $, $ = peg$c0)) : (peg$currPos = $, $ = peg$c0);
g !== peg$FAILED && (g = input.substring(r, peg$currPos)), r = g, r !== peg$FAILED ? (34 === input.charCodeAt(peg$currPos) ? (g = peg$c13, peg$currPos++) : (g = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c14)), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c37(r), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)
} else peg$currPos = e, e = peg$c0;
return e
}
function peg$parsechar() {
var e;
return peg$c38.test(input.charAt(peg$currPos)) ? (e = input.charAt(peg$currPos), peg$currPos++) : (e = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c39)), e
}
function peg$parsename() {
var e, p, r, g, $;
if (e = peg$currPos, p = peg$currPos, r = peg$parsenamestart(), r !== peg$FAILED) {
for (g = [], $ = peg$parsenamechar(); $ !== peg$FAILED;) g.push($), $ = peg$parsenamechar();
g !== peg$FAILED ? (r = [r, g], p = r) : (peg$currPos = p, p = peg$c0)
} else peg$currPos = p, p = peg$c0;
return p !== peg$FAILED && (p = input.substring(e, peg$currPos)), e = p
}
function peg$parsenamestart() {
var e;
return peg$c40.test(input.charAt(peg$currPos)) ? (e = input.charAt(peg$currPos), peg$currPos++) : (e = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c41)), e
}
function peg$parsenamechar() {
var e;
return e = peg$parsenamestart(), e === peg$FAILED && (peg$c42.test(input.charAt(peg$currPos)) ? (e = input.charAt(peg$currPos), peg$currPos++) : (e = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c43))), e
}
function peg$parseunescape() {
var e, p, r, g;
return 92 === input.charCodeAt(peg$currPos) ? (e = peg$c44, peg$currPos++) : (e = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c45)), e === peg$FAILED && (47 === input.charCodeAt(peg$currPos) ? (e = peg$c4, peg$currPos++) : (e = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c5)), e === peg$FAILED && (e = peg$currPos, 98 === input.charCodeAt(peg$currPos) ? (p = peg$c46, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c47)), p !== peg$FAILED && (peg$reportedPos = e, p = peg$c48()), e = p, e === peg$FAILED && (e = peg$currPos, 102 === input.charCodeAt(peg$currPos) ? (p = peg$c49, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c50)), p !== peg$FAILED && (peg$reportedPos = e, p = peg$c51()), e = p, e === peg$FAILED && (e = peg$currPos, 110 === input.charCodeAt(peg$currPos) ? (p = peg$c52, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c53)), p !== peg$FAILED && (peg$reportedPos = e, p = peg$c54()), e = p, e === peg$FAILED && (e = peg$currPos, 114 === input.charCodeAt(peg$currPos) ? (p = peg$c55, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c56)), p !== peg$FAILED && (peg$reportedPos = e, p = peg$c57()), e = p, e === peg$FAILED && (e = peg$currPos, 116 === input.charCodeAt(peg$currPos) ? (p = peg$c58, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c59)), p !== peg$FAILED && (peg$reportedPos = e, p = peg$c60()), e = p, e === peg$FAILED && (e = peg$currPos, 117 === input.charCodeAt(peg$currPos) ? (p = peg$c61, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c62)), p !== peg$FAILED ? (r = peg$currPos, g = peg$parsehexchar(), g !== peg$FAILED && (g = input.substring(r, peg$currPos)), r = g, r !== peg$FAILED ? (peg$reportedPos = e, p = peg$c63(r), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)))))))), e
}
function peg$parsehexchar() {
var e;
return peg$c64.test(input.charAt(peg$currPos)) ? (e = input.charAt(peg$currPos), peg$currPos++) : (e = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c65)), e
}
function peg$parsesinglequotechar() {
var e, p, r;
return peg$c66.test(input.charAt(peg$currPos)) ? (e = input.charAt(peg$currPos), peg$currPos++) : (e = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c67)), e === peg$FAILED && (e = peg$currPos, p = peg$parseescape(), p !== peg$FAILED ? (39 === input.charCodeAt(peg$currPos) ? (r = peg$c9, peg$currPos++) : (r = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c10)), r === peg$FAILED && (r = peg$parseunescape()), r !== peg$FAILED ? (peg$reportedPos = e, p = peg$c68(r), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)), e
}
function peg$parsedoublequotechar() {
var e, p, r;
return peg$c69.test(input.charAt(peg$currPos)) ? (e = input.charAt(peg$currPos), peg$currPos++) : (e = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c70)), e === peg$FAILED && (e = peg$currPos, p = peg$parseescape(), p !== peg$FAILED ? (34 === input.charCodeAt(peg$currPos) ? (r = peg$c13, peg$currPos++) : (r = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c14)), r === peg$FAILED && (r = peg$parseunescape()), r !== peg$FAILED ? (peg$reportedPos = e, p = peg$c68(r), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)), e
}
function peg$parsepipechar() {
var e, p, r;
return peg$c71.test(input.charAt(peg$currPos)) ? (e = input.charAt(peg$currPos), peg$currPos++) : (e = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c72)), e === peg$FAILED && (e = peg$currPos, p = peg$parseescape(), p !== peg$FAILED ? (124 === input.charCodeAt(peg$currPos) ? (r = peg$c20, peg$currPos++) : (r = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c21)), r === peg$FAILED && (r = peg$parseunescape()), r !== peg$FAILED ? (peg$reportedPos = e, p = peg$c68(r), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0), e === peg$FAILED && (e = peg$parseescape())), e
}
function peg$parsecodechar() {
var e, p, r, g;
if (peg$c73.test(input.charAt(peg$currPos)) ? (e = input.charAt(peg$currPos), peg$currPos++) : (e = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c74)), e === peg$FAILED)
if (e = peg$currPos, 123 === input.charCodeAt(peg$currPos) ? (p = peg$c15, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c16)), p !== peg$FAILED) {
for (r = [], g = peg$parsecodechar(); g !== peg$FAILED;) r.push(g), g = peg$parsecodechar();
r !== peg$FAILED ? (125 === input.charCodeAt(peg$currPos) ? (g = peg$c17, peg$currPos++) : (g = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c18)), g !== peg$FAILED ? (peg$reportedPos = e, p = peg$c75(r), e = p) : (peg$currPos = e, e = peg$c0)) : (peg$currPos = e, e = peg$c0)
} else peg$currPos = e, e = peg$c0;
return e
}
function peg$parsehash() {
var e, p;
return e = peg$currPos, 35 === input.charCodeAt(peg$currPos) ? (p = peg$c76, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c77)), p !== peg$FAILED && (p = input.substring(e, peg$currPos)), e = p
}
function peg$parseescape() {
var e, p;
return e = peg$currPos, 92 === input.charCodeAt(peg$currPos) ? (p = peg$c44, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c45)), p !== peg$FAILED && (p = input.substring(e, peg$currPos)), e = p
}
function peg$parseempty() {
var e, p;
return e = peg$currPos, p = peg$c78, p !== peg$FAILED && (p = input.substring(e, peg$currPos)), e = p
}
function peg$parseline() {
var e, p;
return e = peg$currPos, 10 === input.charCodeAt(peg$currPos) ? (p = peg$c79, peg$currPos++) : (p = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c80)), p !== peg$FAILED && (p = input.substring(e, peg$currPos)), e = p
}
function peg$parse_() {
var e, p, r;
for (e = peg$currPos, p = [], peg$c81.test(input.charAt(peg$currPos)) ? (r = input.charAt(peg$currPos), peg$currPos++) : (r = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c82)); r !== peg$FAILED;) p.push(r), peg$c81.test(input.charAt(peg$currPos)) ? (r = input.charAt(peg$currPos), peg$currPos++) : (r = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c82));
return p !== peg$FAILED && (p = input.substring(e, peg$currPos)), e = p
}
function peg$parse__() {
var e, p, r;
if (e = peg$currPos, p = [], peg$c81.test(input.charAt(peg$currPos)) ? (r = input.charAt(peg$currPos), peg$currPos++) : (r = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c82)), r !== peg$FAILED)
for (; r !== peg$FAILED;) p.push(r), peg$c81.test(input.charAt(peg$currPos)) ? (r = input.charAt(peg$currPos), peg$currPos++) : (r = peg$FAILED, 0 === peg$silentFails && peg$fail(peg$c82));
else p = peg$c0;
return p !== peg$FAILED && (p = input.substring(e, peg$currPos)), e = p
}
var options = arguments.length > 1 ? arguments[1] : {}, peg$FAILED = {}, peg$startRuleFunctions = {
root: peg$parseroot
}, peg$startRuleFunction = peg$parseroot,
peg$c0 = peg$FAILED,
peg$c1 = function(e) {
return e
}, peg$c2 = function(e, p, r) {
return "<" + e + p + ">" + r + "</" + e + ">"
}, peg$c3 = function(e, p) {
return "<" + e + ">" + p + "</" + e + ">"
}, peg$c4 = "/",
peg$c5 = {
type: "literal",
value: "/",
description: '"/"'
}, peg$c6 = function(e, p) {
return "<" + e + p + " />"
}, peg$c7 = function(e) {
return "<" + e + " />"
}, peg$c8 = function(e, p) {
return "<" + e + p + "></" + e + ">"
}, peg$c9 = "'",
peg$c10 = {
type: "literal",
value: "'",
description: '"\'"'
}, peg$c11 = [],
peg$c12 = function(e) {
return e.join("")
}, peg$c13 = '"',
peg$c14 = {
type: "literal",
value: '"',
description: '"\\""'
}, peg$c15 = "{",
peg$c16 = {
type: "literal",
value: "{",
description: '"{"'
}, peg$c17 = "}",
peg$c18 = {
type: "literal",
value: "}",
description: '"}"'
}, peg$c19 = function(code) {
with(context) return eval(code.join(""))
}, peg$c20 = "|",
peg$c21 = {
type: "literal",
value: "|",
description: '"|"'
}, peg$c22 = function(e) {
return "<" + e + "></" + e + ">"
}, peg$c23 = function(e, p) {
return e + p
}, peg$c24 = function(e, p) {
return e + p
}, peg$c25 = "(",
peg$c26 = {
type: "literal",
value: "(",
description: '"("'
}, peg$c27 = ")",
peg$c28 = {
type: "literal",
value: ")",
description: '")"'
}, peg$c29 = function(e) {
return " " + e
}, peg$c30 = function() {
return ""
}, peg$c31 = function(e, p) {
return e + " " + p
}, peg$c32 = "=",
peg$c33 = {
type: "literal",
value: "=",
description: '"="'
}, peg$c34 = function(e, p) {
return e + "=" + p
}, peg$c35 = void 0,
peg$c36 = function(e) {
return "'" + e + "'"
}, peg$c37 = function(e) {
return '"' + e + '"'
}, peg$c38 = /^[\t\n\r -\uD7FF\uE000-\uFFFD]/,
peg$c39 = {
type: "class",
value: "[\\t\\n\\r -\\uD7FF\\uE000-\\uFFFD]",
description: "[\\t\\n\\r -\\uD7FF\\uE000-\\uFFFD]"
}, peg$c40 = /^[:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,
peg$c41 = {
type: "class",
value: "[:A-Z_a-z\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]",
description: "[:A-Z_a-z\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]"
}, peg$c42 = /^[\-.0-9\xB7\u0300-\u036F\u203F-\u2040]/,
peg$c43 = {
type: "class",
value: "[\\-.0-9\\xB7\\u0300-\\u036F\\u203F-\\u2040]",
description: "[\\-.0-9\\xB7\\u0300-\\u036F\\u203F-\\u2040]"
}, peg$c44 = "\\",
peg$c45 = {
type: "literal",
value: "\\",
description: '"\\\\"'
}, peg$c46 = "b",
peg$c47 = {
type: "literal",
value: "b",
description: '"b"'
}, peg$c48 = function() {
return "\b"
}, peg$c49 = "f",
peg$c50 = {
type: "literal",
value: "f",
description: '"f"'
}, peg$c51 = function() {
return "\f"
}, peg$c52 = "n",
peg$c53 = {
type: "literal",
value: "n",
description: '"n"'
}, peg$c54 = function() {
return "\n"
}, peg$c55 = "r",
peg$c56 = {
type: "literal",
value: "r",
description: '"r"'
}, peg$c57 = function() {
return "\r"
}, peg$c58 = "t",
peg$c59 = {
type: "literal",
value: "t",
description: '"t"'
}, peg$c60 = function() {
return " "
}, peg$c61 = "u",
peg$c62 = {
type: "literal",
value: "u",
description: '"u"'
}, peg$c63 = function(e) {
return String.fromCharCode(parseInt(e, 16))
}, peg$c64 = /^[0-9a-f]/i,
peg$c65 = {
type: "class",
value: "[0-9a-f]i",
description: "[0-9a-f]i"
}, peg$c66 = /^[^'\\]/,
peg$c67 = {
type: "class",
value: "[^'\\\\]",
description: "[^'\\\\]"
}, peg$c68 = function(e) {
return e
}, peg$c69 = /^[^"\\]/,
peg$c70 = {
type: "class",
value: '[^"\\\\]',
description: '[^"\\\\]'
}, peg$c71 = /^[^|\\]/,
peg$c72 = {
type: "class",
value: "[^|\\\\]",
description: "[^|\\\\]"
}, peg$c73 = /^[^{}]/,
peg$c74 = {
type: "class",
value: "[^{}]",
description: "[^{}]"
}, peg$c75 = function(e) {
return "{" + e.join("") + "}"
}, peg$c76 = "#",
peg$c77 = {
type: "literal",
value: "#",
description: '"#"'
}, peg$c78 = "",
peg$c79 = "\n",
peg$c80 = {
type: "literal",
value: "\n",
description: '"\\n"'
}, peg$c81 = /^[ \t\r\n\f]/,
peg$c82 = {
type: "class",
value: "[ \\t\\r\\n\\f]",
description: "[ \\t\\r\\n\\f]"
}, peg$currPos = 0,
peg$reportedPos = 0,
peg$cachedPos = 0,
peg$cachedPosDetails = {
line: 1,
column: 1,
seenCR: !1
}, peg$maxFailPos = 0,
peg$maxFailExpected = [],
peg$silentFails = 0,
peg$result;
if ("startRule" in options) {
if (!(options.startRule in peg$startRuleFunctions)) throw new Error("Can't start parsing from rule \"" + options.startRule + '".');
peg$startRuleFunction = peg$startRuleFunctions[options.startRule]
}
var context = arguments[1] || {};
if (peg$result = peg$startRuleFunction(), peg$result !== peg$FAILED && peg$currPos === input.length) return peg$result;
throw peg$result !== peg$FAILED && peg$currPos < input.length && peg$fail({
type: "end",
description: "end of input"
}), peg$buildException(null, peg$maxFailExpected, peg$maxFailPos)
}
return peg$subclass(SyntaxError, Error), {
SyntaxError: SyntaxError,
parse: parse
}
}();
var jisonlr = function() {
function Parser() {
this.yy = {}
}
var o = function(t, e, i, s) {
for (i = i || {}, s = t.length; s--; i[t[s]] = e);
return i
}, $V0 = [5, 9, 18, 22, 23],
$V1 = [2, 4],
$V2 = [2, 3],
$V3 = [2, 5],
$V4 = [2, 6],
$V5 = [2, 7],
$V6 = [5, 9, 11, 13, 16, 17, 18, 22, 23],
$V7 = [2, 12],
$V8 = [2, 19],
$V9 = [2, 17],
$Va = [2, 18],
$Vb = [9, 12, 18, 22, 23],
$Vc = [15, 18],
$Vd = [2, 14],
$Ve = [2, 10],
$Vf = [2, 11],
$Vg = [1, 22],
$Vh = [1, 24],
$Vi = [1, 26],
$Vj = [1, 27],
$Vk = [1, 30],
$Vl = [2, 8],
$Vm = [9, 11, 12, 13, 16, 17, 18, 22, 23],
$Vn = [2, 9],
parser = {
trace: function() {},
yy: {},
symbols_: {
error: 2,
expressions: 3,
root: 4,
EOF: 5,
nodes: 6,
node: 7,
nodebuilder: 8,
code: 9,
rawstring: 10,
lb: 11,
rb: 12,
lp: 13,
attributes: 14,
rp: 15,
raw: 16,
solid: 17,
name: 18,
attribute: 19,
eq: 20,
string: 21,
dstring: 22,
sstring: 23,
$accept: 0,
$end: 1
},
terminals_: {
2: "error",
5: "EOF",
9: "code",
11: "lb",
12: "rb",
13: "lp",
15: "rp",
16: "raw",
17: "solid",
18: "name",
20: "eq",
22: "dstring",
23: "sstring"
},
productions_: [0, [3, 2],
[4, 1],
[6, 2],
[6, 0],
[7, 1],
[7, 1],
[7, 1],
[8, 4],
[8, 4],
[8, 2],
[8, 2],
[8, 1],
[14, 2],
[14, 0],
[19, 3],
[19, 1],
[21, 1],
[21, 1],
[10, 1]
],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, context) {
var $0 = $$.length - 1;
switch (yystate) {
case 1:
return $$[$0 - 1];
case 3:
this.$ = $$[$0 - 1] + $$[$0];
break;
case 4:
case 14:
this.$ = "";
break;
case 5:
this.$ = $$[$0].selfclosing ? "<" + $$[$0].name + $$[$0].attributes + " />" : "<" + $$[$0].name + $$[$0].attributes + ">" + $$[$0].children + "</" + $$[$0].name + ">";
break;
case 6:
if ($$[$0] = $$[$0].trim(), $$[$0].length)
if (context) with(context) this.$ = eval($$[$0]);
else this.$ = eval($$[$0]);
break;
case 8:
this.$ = $$[$0 - 3], this.$.children += $$[$0 - 1];
break;
case 9:
this.$ = $$[$0 - 3], this.$.attributes += $$[$0 - 1];
break;
case 10:
this.$ = $$[$0 - 1], this.$.children += $$[$0];
break;
case 11:
this.$ = $$[$0 - 1], this.$.selfclosing = !0;
break;
case 12:
this.$ = {
name: $$[$0],
children: "",
attributes: "",
selfclosing: !1
};
break;
case 13:
this.$ = $$[$0 - 1] + " " + $$[$0];
break;
case 15:
this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0];
break;
case 19:
this.$ = $$[$0].substring(1, $$[$0].length - 1)
}
},
table: [o($V0, $V1, {
3: 1,
4: 2,
6: 3
}), {
1: [3]
}, {
5: [1, 4]
}, {
5: [2, 2],
7: 5,
8: 6,
9: [1, 7],
10: 8,
18: [1, 9],
21: 10,
22: [1, 11],
23: [1, 12]
}, {
1: [2, 1]
},
o($V0, $V2), o($V0, $V3, {
11: [1, 13],
13: [1, 14],
16: [1, 15],
17: [1, 16]
}), o($V0, $V4), o($V0, $V5), o($V6, $V7), o($V0, $V8), o($V0, $V9), o($V0, $Va), o($Vb, $V1, {
6: 17
}), o($Vc, $Vd, {
14: 18
}), o($V6, $Ve), o($V6, $Vf), {
7: 20,
8: 21,
9: $Vg,
10: 23,
12: [1, 19],
18: $Vh,
21: 25,
22: $Vi,
23: $Vj
}, {
15: [1, 28],
18: $Vk,
19: 29
},
o($V6, $Vl), o($Vb, $V2), o($Vb, $V3, {
11: [1, 31],
13: [1, 32],
16: [1, 33],
17: [1, 34]
}), o($Vb, $V4), o($Vb, $V5), o($Vm, $V7), o($Vb, $V8), o($Vb, $V9), o($Vb, $Va), o($V6, $Vn), o($Vc, [2, 13]), o($Vc, [2, 16], {
20: [1, 35]
}), o($Vb, $V1, {
6: 36
}), o($Vc, $Vd, {
14: 37
}), o($Vm, $Ve), o($Vm, $Vf), {
21: 38,
22: [1, 39],
23: [1, 40]
}, {
7: 20,
8: 21,
9: $Vg,
10: 23,
12: [1, 41],
18: $Vh,
21: 25,
22: $Vi,
23: $Vj
}, {
15: [1, 42],
18: $Vk,
19: 29
},
o($Vc, [2, 15]), o($Vc, $V9), o($Vc, $Va), o($Vm, $Vl), o($Vm, $Vn)
],
defaultActions: {
4: [2, 1]
},
parseError: function(t, e) {
if (!e.recoverable) throw new Error(t);
this.trace(t)
},
parse: function(t) {
function e() {
var t;
return t = g.lex() || y, "number" != typeof t && (t = i.symbols_[t] || t), t
}
var i = this,
s = [0],
n = [null],
r = [],
h = this.table,
o = "",
l = 0,
a = 0,
c = 0,
u = 2,
y = 1,
$ = r.slice.call(arguments, 1),
g = Object.create(this.lexer),
p = {
yy: {}
};
for (var f in this.yy) Object.prototype.hasOwnProperty.call(this.yy, f) && (p.yy[f] = this.yy[f]);
g.setInput(t, p.yy), p.yy.lexer = g, p.yy.parser = this, "undefined" == typeof g.yylloc && (g.yylloc = {});
var V = g.yylloc;
r.push(V);
var m = g.options && g.options.ranges;
this.parseError = "function" == typeof p.yy.parseError ? p.yy.parseError : Object.getPrototypeOf(this).parseError;
for (var b, _, d, k, x, F, v, w, S, E = {};;) {
if (d = s[s.length - 1], this.defaultActions[d] ? k = this.defaultActions[d] : ((null === b || "undefined" == typeof b) && (b = e()), k = h[d] && h[d][b]), "undefined" == typeof k || !k.length || !k[0]) {
var I = "";
S = [];
for (F in h[d]) this.terminals_[F] && F > u && S.push("'" + this.terminals_[F] + "'");
I = g.showPosition ? "Parse error on line " + (l + 1) + ":\n" + g.showPosition() + "\nExpecting " + S.join(", ") + ", got '" + (this.terminals_[b] || b) + "'" : "Parse error on line " + (l + 1) + ": Unexpected " + (b == y ? "end of input" : "'" + (this.terminals_[b] || b) + "'"), this.parseError(I, {
text: g.match,
token: this.terminals_[b] || b,
line: g.yylineno,
loc: V,
expected: S
})
}
if (k[0] instanceof Array && k.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + d + ", token: " + b);
switch (k[0]) {
case 1:
s.push(b), n.push(g.yytext), r.push(g.yylloc), s.push(k[1]), b = null, _ ? (b = _, _ = null) : (a = g.yyleng, o = g.yytext, l = g.yylineno, V = g.yylloc, c > 0 && c--);
break;
case 2:
if (v = this.productions_[k[1]][1], E.$ = n[n.length - v], E._$ = {
first_line: r[r.length - (v || 1)].first_line,
last_line: r[r.length - 1].last_line,
first_column: r[r.length - (v || 1)].first_column,
last_column: r[r.length - 1].last_column
}, m && (E._$.range = [r[r.length - (v || 1)].range[0], r[r.length - 1].range[1]]), x = this.performAction.apply(E, [o, a, l, p.yy, k[1], n, r].concat($)), "undefined" != typeof x) return x;
v && (s = s.slice(0, -1 * v * 2), n = n.slice(0, -1 * v), r = r.slice(0, -1 * v)), s.push(this.productions_[k[1]][0]), n.push(E.$), r.push(E._$), w = h[s[s.length - 2]][s[s.length - 1]], s.push(w);
break;
case 3:
return !0
}
}
return !0
}
}, lexer = function() {
var t = {
EOF: 1,
parseError: function(t, e) {
if (!this.yy.parser) throw new Error(t);
this.yy.parser.parseError(t, e)
},
setInput: function(t, e) {
return this.yy = e || this.yy || {}, this._input = t, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this
},
input: function() {
var t = this._input[0];
this.yytext += t, this.yyleng++, this.offset++, this.match += t, this.matched += t;
var e = t.match(/(?:\r\n?|\n).*/g);
return e ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), t
},
unput: function(t) {
var e = t.length,
i = t.split(/(?:\r\n?|\n)/g);
this._input = t + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - e), this.offset -= e;
var s = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), i.length - 1 && (this.yylineno -= i.length - 1);
var n = this.yylloc.range;
return this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: i ? (i.length === s.length ? this.yylloc.first_column : 0) + s[s.length - i.length].length - i[0].length : this.yylloc.first_column - e
}, this.options.ranges && (this.yylloc.range = [n[0], n[0] + this.yyleng - e]), this.yyleng = this.yytext.length, this
},
more: function() {
return this._more = !0, this
},
reject: function() {
return this.options.backtrack_lexer ? (this._backtrack = !0, this) : this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
})
},
less: function(t) {
this.unput(this.match.slice(t))
},
pastInput: function() {
var t = this.matched.substr(0, this.matched.length - this.match.length);
return (t.length > 20 ? "..." : "") + t.substr(-20).replace(/\n/g, "")
},
upcomingInput: function() {
var t = this.match;
return t.length < 20 && (t += this._input.substr(0, 20 - t.length)), (t.substr(0, 20) + (t.length > 20 ? "..." : "")).replace(/\n/g, "")
},
showPosition: function() {
var t = this.pastInput(),
e = new Array(t.length + 1).join("-");
return t + this.upcomingInput() + "\n" + e + "^"
},
test_match: function(t, e) {
var i, s, n;
if (this.options.backtrack_lexer && (n = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
}, this.options.ranges && (n.yylloc.range = this.yylloc.range.slice(0))), s = t[0].match(/(?:\r\n?|\n).*/g), s && (this.yylineno += s.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: s ? s[s.length - 1].length - s[s.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + t[0].length
}, this.yytext += t[0], this.match += t[0], this.matches = t, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(t[0].length), this.matched += t[0], i = this.performAction.call(this, this.yy, this, e, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), i) return i;
if (this._backtrack) {
for (var r in n) this[r] = n[r];
return !1
}
return !1
},
next: function() {
if (this.done) return this.EOF;
this._input || (this.done = !0);
var t, e, i, s;
this._more || (this.yytext = "", this.match = "");
for (var n = this._currentRules(), r = 0; r < n.length; r++)
if (i = this._input.match(this.rules[n[r]]), i && (!e || i[0].length > e[0].length)) {
if (e = i, s = r, this.options.backtrack_lexer) {
if (t = this.test_match(i, n[r]), t !== !1) return t;
if (this._backtrack) {
e = !1;
continue
}
return !1
}
if (!this.options.flex) break
}
return e ? (t = this.test_match(e, n[s]), t !== !1 ? t : !1) : "" === this._input ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
})
},
lex: function() {
var t = this.next();
return t ? t : this.lex()
},
begin: function(t) {
this.conditionStack.push(t)
},
popState: function() {
var t = this.conditionStack.length - 1;
return t > 0 ? this.conditionStack.pop() : this.conditionStack[0]
},
_currentRules: function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules
},
topState: function(t) {
return t = this.conditionStack.length - 1 - Math.abs(t || 0), t >= 0 ? this.conditionStack[t] : "INITIAL"
},
pushState: function(t) {
this.begin(t)
},
stateStackSize: function() {
return this.conditionStack.length
},
options: {},
performAction: function(t, e, i, s) {
switch (i) {
case 0:
break;
case 1:
return 18;
case 2:
return 11;
case 3:
return 12;
case 4:
return 13;
case 5:
return 15;
case 6:
return 20;
case 7:
return 17;
case 8:
this.begin("code"), this.codelevel = 1, this.codebuf = "";
break;
case 9:
this.codebuf += e.yytext;
break;
case 10:
this.begin("code"), this.codelevel++, this.codebuf += e.yytext;
break;
case 11:
if (this.popState(), this.codelevel--, 0 == this.codelevel) return e.yytext = this.codebuf, 9;
this.codebuf += e.yytext;
break;
case 12:
this.begin("raw"), this.rawtext = "";
break;
case 13:
this.rawtext += e.yytext;
break;
case 14:
this.rawtext += "|";
break;
case 15:
this.rawtext += "\\";
break;
case 16:
return this.popState(), e.yytext = this.rawtext, 16;
case 17:
this.begin("dstring"), this.stringtext = '"';
break;
case 18:
this.stringtext += e.yytext;
break;
case 19:
return this.popState(), e.yytext = this.stringtext + e.yytext, 22;
case 20:
this.begin("sstring"), this.stringtext = "'";
break;
case 21:
this.stringtext += e.yytext;
break;
case 22:
return this.popState(), e.yytext = this.stringtext + e.yytext, 23;
case 23:
return 5;
case 24:
return e.yytext
}
},
rules: [/^(?:\s+)/, /^(?:([:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD])(([:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD])|[-\.0-9\u00B7\u0300-\u036F\u203F-\u2040])*)/, /^(?:\{)/, /^(?:\})/, /^(?:\()/, /^(?:\))/, /^(?:=)/, /^(?:\/)/, /^(?:#\{)/, /^(?:[^\{\}]+)/, /^(?:\{)/, /^(?:\})/, /^(?:\|)/, /^(?:[^\\\|]+)/, /^(?:\\\|)/, /^(?:\\)/, /^(?:\|)/, /^(?:")/, /^(?:(\\[\'\"bfnrt]|[^\"\\])+)/, /^(?:")/, /^(?:')/, /^(?:(\\[\'\"bfnrt]|[^\'\\])+)/, /^(?:')/, /^(?:$)/, /^(?:.)/],
conditions: {
code: {
rules: [9, 10, 11],
inclusive: !1
},
raw: {
rules: [13, 14, 15, 16],
inclusive: !1
},
dstring: {
rules: [18, 19],
inclusive: !1
},
sstring: {
rules: [21, 22],
inclusive: !1
},
INITIAL: {
rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 17, 20, 23, 24],
inclusive: !0
}
}
};
return t
}();
return parser.lexer = lexer, Parser.prototype = parser, parser.Parser = Parser, new Parser
}();
var jisonslr = function() {
function Parser() {
this.yy = {}
}
var o = function(t, e, i, s) {
for (i = i || {}, s = t.length; s--; i[t[s]] = e);
return i
}, $V0 = [5, 9, 12, 18, 22, 23],
$V1 = [2, 4],
$V2 = [1, 7],
$V3 = [1, 9],
$V4 = [1, 11],
$V5 = [1, 12],
$V6 = [5, 9, 11, 12, 13, 16, 17, 18, 22, 23],
$V7 = [5, 9, 12, 15, 18, 22, 23],
$V8 = [15, 18],
parser = {
trace: function() {},
yy: {},
symbols_: {
error: 2,
expressions: 3,
root: 4,
EOF: 5,
nodes: 6,
node: 7,
nodebuilder: 8,
code: 9,
rawstring: 10,
lb: 11,
rb: 12,
lp: 13,
attributes: 14,
rp: 15,
raw: 16,
solid: 17,
name: 18,
attribute: 19,
eq: 20,
string: 21,
dstring: 22,
sstring: 23,
$accept: 0,
$end: 1
},
terminals_: {
2: "error",
5: "EOF",
9: "code",
11: "lb",
12: "rb",
13: "lp",
15: "rp",
16: "raw",
17: "solid",
18: "name",
20: "eq",
22: "dstring",
23: "sstring"
},
productions_: [0, [3, 2],
[4, 1],
[6, 2],
[6, 0],
[7, 1],
[7, 1],
[7, 1],
[8, 4],
[8, 4],
[8, 2],
[8, 2],
[8, 1],
[14, 2],
[14, 0],
[19, 3],
[19, 1],
[21, 1],
[21, 1],
[10, 1]
],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, context) {
var $0 = $$.length - 1;
switch (yystate) {
case 1:
return $$[$0 - 1];
case 3:
this.$ = $$[$0 - 1] + $$[$0];
break;
case 4:
case 14:
this.$ = "";
break;
case 5:
this.$ = $$[$0].selfclosing ? "<" + $$[$0].name + $$[$0].attributes + " />" : "<" + $$[$0].name + $$[$0].attributes + ">" + $$[$0].children + "</" + $$[$0].name + ">";
break;
case 6:
if ($$[$0] = $$[$0].trim(), $$[$0].length)
if (context) with(context) this.$ = eval($$[$0]);
else this.$ = eval($$[$0]);
break;
case 8:
this.$ = $$[$0 - 3], this.$.children += $$[$0 - 1];
break;
case 9:
this.$ = $$[$0 - 3], this.$.attributes += $$[$0 - 1];
break;
case 10:
this.$ = $$[$0 - 1], this.$.children += $$[$0];
break;
case 11:
this.$ = $$[$0 - 1], this.$.selfclosing = !0;
break;
case 12:
this.$ = {
name: $$[$0],
children: "",
attributes: "",
selfclosing: !1
};
break;
case 13:
this.$ = $$[$0 - 1] + " " + $$[$0];
break;
case 15:
this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0];
break;
case 19:
this.$ = $$[$0].substring(1, $$[$0].length - 1)
}
},
table: [o($V0, $V1, {
3: 1,
4: 2,
6: 3
}), {
1: [3]
}, {
5: [1, 4]
}, {
5: [2, 2],
7: 5,
8: 6,
9: $V2,
10: 8,
18: $V3,
21: 10,
22: $V4,
23: $V5
}, {
1: [2, 1]
},
o($V0, [2, 3]), o($V0, [2, 5], {
11: [1, 13],
13: [1, 14],
16: [1, 15],
17: [1, 16]
}), o($V0, [2, 6]), o($V0, [2, 7]), o($V6, [2, 12]), o($V0, [2, 19]), o($V7, [2, 17]), o($V7, [2, 18]), o($V0, $V1, {
6: 17
}), o($V8, [2, 14], {
14: 18
}), o($V6, [2, 10]), o($V6, [2, 11]), {
7: 5,
8: 6,
9: $V2,
10: 8,
12: [1, 19],
18: $V3,
21: 10,
22: $V4,
23: $V5
}, {
15: [1, 20],
18: [1, 22],
19: 21
},
o($V6, [2, 8]), o($V6, [2, 9]), o($V8, [2, 13]), o($V8, [2, 16], {
20: [1, 23]
}), {
21: 24,
22: $V4,
23: $V5
},
o($V8, [2, 15])
],
defaultActions: {
4: [2, 1]
},
parseError: function(t, e) {
if (!e.recoverable) throw new Error(t);
this.trace(t)
},
parse: function(t) {
function e() {
var t;
return t = p.lex() || y, "number" != typeof t && (t = i.symbols_[t] || t), t
}
var i = this,
s = [0],
n = [null],
r = [],
h = this.table,
o = "",
l = 0,
a = 0,
c = 0,
u = 2,
y = 1,
$ = r.slice.call(arguments, 1),
p = Object.create(this.lexer),
g = {
yy: {}
};
for (var f in this.yy) Object.prototype.hasOwnProperty.call(this.yy, f) && (g.yy[f] = this.yy[f]);
p.setInput(t, g.yy), g.yy.lexer = p, g.yy.parser = this, "undefined" == typeof p.yylloc && (p.yylloc = {});
var _ = p.yylloc;
r.push(_);
var m = p.options && p.options.ranges;
this.parseError = "function" == typeof g.yy.parseError ? g.yy.parseError : Object.getPrototypeOf(this).parseError;
for (var d, b, k, x, F, V, v, w, S, E = {};;) {
if (k = s[s.length - 1], this.defaultActions[k] ? x = this.defaultActions[k] : ((null === d || "undefined" == typeof d) && (d = e()), x = h[k] && h[k][d]), "undefined" == typeof x || !x.length || !x[0]) {
var I = "";
S = [];
for (V in h[k]) this.terminals_[V] && V > u && S.push("'" + this.terminals_[V] + "'");
I = p.showPosition ? "Parse error on line " + (l + 1) + ":\n" + p.showPosition() + "\nExpecting " + S.join(", ") + ", got '" + (this.terminals_[d] || d) + "'" : "Parse error on line " + (l + 1) + ": Unexpected " + (d == y ? "end of input" : "'" + (this.terminals_[d] || d) + "'"), this.parseError(I, {
text: p.match,
token: this.terminals_[d] || d,
line: p.yylineno,
loc: _,
expected: S
})
}
if (x[0] instanceof Array && x.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + k + ", token: " + d);
switch (x[0]) {
case 1:
s.push(d), n.push(p.yytext), r.push(p.yylloc), s.push(x[1]), d = null, b ? (d = b, b = null) : (a = p.yyleng, o = p.yytext, l = p.yylineno, _ = p.yylloc, c > 0 && c--);
break;
case 2:
if (v = this.productions_[x[1]][1], E.$ = n[n.length - v], E._$ = {
first_line: r[r.length - (v || 1)].first_line,
last_line: r[r.length - 1].last_line,
first_column: r[r.length - (v || 1)].first_column,
last_column: r[r.length - 1].last_column
}, m && (E._$.range = [r[r.length - (v || 1)].range[0], r[r.length - 1].range[1]]), F = this.performAction.apply(E, [o, a, l, g.yy, x[1], n, r].concat($)), "undefined" != typeof F) return F;
v && (s = s.slice(0, -1 * v * 2), n = n.slice(0, -1 * v), r = r.slice(0, -1 * v)), s.push(this.productions_[x[1]][0]), n.push(E.$), r.push(E._$), w = h[s[s.length - 2]][s[s.length - 1]], s.push(w);
break;
case 3:
return !0
}
}
return !0
}
}, lexer = function() {
var t = {
EOF: 1,
parseError: function(t, e) {
if (!this.yy.parser) throw new Error(t);
this.yy.parser.parseError(t, e)
},
setInput: function(t, e) {
return this.yy = e || this.yy || {}, this._input = t, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
first_line: 1,
first_column: 0,
last_line: 1,
last_column: 0
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this
},
input: function() {
var t = this._input[0];
this.yytext += t, this.yyleng++, this.offset++, this.match += t, this.matched += t;
var e = t.match(/(?:\r\n?|\n).*/g);
return e ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), t
},
unput: function(t) {
var e = t.length,
i = t.split(/(?:\r\n?|\n)/g);
this._input = t + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - e), this.offset -= e;
var s = this.match.split(/(?:\r\n?|\n)/g);
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), i.length - 1 && (this.yylineno -= i.length - 1);
var n = this.yylloc.range;
return this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: i ? (i.length === s.length ? this.yylloc.first_column : 0) + s[s.length - i.length].length - i[0].length : this.yylloc.first_column - e
}, this.options.ranges && (this.yylloc.range = [n[0], n[0] + this.yyleng - e]), this.yyleng = this.yytext.length, this
},
more: function() {
return this._more = !0, this
},
reject: function() {
return this.options.backtrack_lexer ? (this._backtrack = !0, this) : this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
})
},
less: function(t) {
this.unput(this.match.slice(t))
},
pastInput: function() {
var t = this.matched.substr(0, this.matched.length - this.match.length);
return (t.length > 20 ? "..." : "") + t.substr(-20).replace(/\n/g, "")
},
upcomingInput: function() {
var t = this.match;
return t.length < 20 && (t += this._input.substr(0, 20 - t.length)), (t.substr(0, 20) + (t.length > 20 ? "..." : "")).replace(/\n/g, "")
},
showPosition: function() {
var t = this.pastInput(),
e = new Array(t.length + 1).join("-");
return t + this.upcomingInput() + "\n" + e + "^"
},
test_match: function(t, e) {
var i, s, n;
if (this.options.backtrack_lexer && (n = {
yylineno: this.yylineno,
yylloc: {
first_line: this.yylloc.first_line,
last_line: this.last_line,
first_column: this.yylloc.first_column,
last_column: this.yylloc.last_column
},
yytext: this.yytext,
match: this.match,
matches: this.matches,
matched: this.matched,
yyleng: this.yyleng,
offset: this.offset,
_more: this._more,
_input: this._input,
yy: this.yy,
conditionStack: this.conditionStack.slice(0),
done: this.done
}, this.options.ranges && (n.yylloc.range = this.yylloc.range.slice(0))), s = t[0].match(/(?:\r\n?|\n).*/g), s && (this.yylineno += s.length), this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: s ? s[s.length - 1].length - s[s.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + t[0].length
}, this.yytext += t[0], this.match += t[0], this.matches = t, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(t[0].length), this.matched += t[0], i = this.performAction.call(this, this.yy, this, e, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), i) return i;
if (this._backtrack) {
for (var r in n) this[r] = n[r];
return !1
}
return !1
},
next: function() {
if (this.done) return this.EOF;
this._input || (this.done = !0);
var t, e, i, s;
this._more || (this.yytext = "", this.match = "");
for (var n = this._currentRules(), r = 0; r < n.length; r++)
if (i = this._input.match(this.rules[n[r]]), i && (!e || i[0].length > e[0].length)) {
if (e = i, s = r, this.options.backtrack_lexer) {
if (t = this.test_match(i, n[r]), t !== !1) return t;
if (this._backtrack) {
e = !1;
continue
}
return !1
}
if (!this.options.flex) break
}
return e ? (t = this.test_match(e, n[s]), t !== !1 ? t : !1) : "" === this._input ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
})
},
lex: function() {
var t = this.next();
return t ? t : this.lex()
},
begin: function(t) {
this.conditionStack.push(t)
},
popState: function() {
var t = this.conditionStack.length - 1;
return t > 0 ? this.conditionStack.pop() : this.conditionStack[0]
},
_currentRules: function() {
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules
},
topState: function(t) {
return t = this.conditionStack.length - 1 - Math.abs(t || 0), t >= 0 ? this.conditionStack[t] : "INITIAL"
},
pushState: function(t) {
this.begin(t)
},
stateStackSize: function() {
return this.conditionStack.length
},
options: {},
performAction: function(t, e, i, s) {
switch (i) {
case 0:
break;
case 1:
return 18;
case 2:
return 11;
case 3:
return 12;
case 4:
return 13;
case 5:
return 15;
case 6:
return 20;
case 7:
return 17;
case 8:
this.begin("code"), this.codelevel = 1, this.codebuf = "";
break;
case 9:
this.codebuf += e.yytext;
break;
case 10:
this.begin("code"), this.codelevel++, this.codebuf += e.yytext;
break;
case 11:
if (this.popState(), this.codelevel--, 0 == this.codelevel) return e.yytext = this.codebuf, 9;
this.codebuf += e.yytext;
break;
case 12:
this.begin("raw"), this.rawtext = "";
break;
case 13:
this.rawtext += e.yytext;
break;
case 14:
this.rawtext += "|";
break;
case 15:
this.rawtext += "\\";
break;
case 16:
return this.popState(), e.yytext = this.rawtext, 16;
case 17:
this.begin("dstring"), this.stringtext = '"';
break;
case 18:
this.stringtext += e.yytext;
break;
case 19:
return this.popState(), e.yytext = this.stringtext + e.yytext, 22;
case 20:
this.begin("sstring"), this.stringtext = "'";
break;
case 21:
this.stringtext += e.yytext;
break;
case 22:
return this.popState(), e.yytext = this.stringtext + e.yytext, 23;
case 23:
return 5;
case 24:
return e.yytext
}
},
rules: [/^(?:\s+)/, /^(?:([:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD])(([:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD])|[-\.0-9\u00B7\u0300-\u036F\u203F-\u2040])*)/, /^(?:\{)/, /^(?:\})/, /^(?:\()/, /^(?:\))/, /^(?:=)/, /^(?:\/)/, /^(?:#\{)/, /^(?:[^\{\}]+)/, /^(?:\{)/, /^(?:\})/, /^(?:\|)/, /^(?:[^\\\|]+)/, /^(?:\\\|)/, /^(?:\\)/, /^(?:\|)/, /^(?:")/, /^(?:(\\[\'\"bfnrt]|[^\"\\])+)/, /^(?:")/, /^(?:')/, /^(?:(\\[\'\"bfnrt]|[^\'\\])+)/, /^(?:')/, /^(?:$)/, /^(?:.)/],
conditions: {
code: {
rules: [9, 10, 11],
inclusive: !1
},
raw: {
rules: [13, 14, 15, 16],
inclusive: !1
},
dstring: {
rules: [18, 19],
inclusive: !1
},
sstring: {
rules: [21, 22],
inclusive: !1
},
INITIAL: {
rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 17, 20, 23, 24],
inclusive: !0
}
}
};
return t
}();
return parser.lexer = lexer, Parser.prototype = parser, parser.Parser = Parser, new Parser
}();
var text = $('#primbody').text();
Ready to run.
Test | Ops/sec | |
---|---|---|
Jison LALR |
| ready |
PEG |
| ready |
Jison LR |
| ready |
Jison SLR |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.