JSFiddle - React, Tailwind, and code Playground
by Darby Rathbone
JavaScript
var parser = (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 = { start: peg$parsestart },
peg$startRuleFunction = peg$parsestart,
peg$c0 = peg$FAILED,
peg$c1 = "+",
peg$c2 = { type: "literal", value: "+", description: "\"+\"" },
peg$c3 = function(left, right) { return left + right; },
peg$c4 = "-",
peg$c5 = { type: "literal", value: "-", description: "\"-\"" },
peg$c6 = function(left, right) { return left-right;},
peg$c7 = "*",
peg$c8 = { type: "literal", value: "*", description: "\"*\"" },
peg$c9 = function(left, right) { return left * right; },
peg$c10 = "(",
peg$c11 = { type: "literal", value: "(", description: "\"(\"" },
peg$c12 = ")",
peg$c13 = { type: "literal", value: ")", description: "\")\"" },
peg$c14 = function(left, inside) {return left*inside;},
peg$c15 = "/",
peg$c16 = { type: "literal", value: "/", description: "\"/\"" },
peg$c17 = function(left, right) { return left / right;},
peg$c18 = "^",
peg$c19 = { type: "literal", value: "^", description: "\"^\"" },
peg$c20 = function(left, right) { return Math.pow(left,right);},
peg$c21 = function(inside) { return inside; },
peg$c22 = { type: "other",...