UNPKG

@bokeh/bokehjs

Version:

Interactive, novel data visualization

159 lines (158 loc) 11.2 kB
// Generated automatically by nearley, version 2.20.1 // http://github.com/Hardmath123/nearley (function () { function id(x) { return x[0]; } var grammar = { Lexer: undefined, ParserRules: [ {"name": "_$ebnf$1", "symbols": []}, {"name": "_$ebnf$1", "symbols": ["_$ebnf$1", "wschar"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "_", "symbols": ["_$ebnf$1"], "postprocess": function(d) {return null;}}, {"name": "__$ebnf$1", "symbols": ["wschar"]}, {"name": "__$ebnf$1", "symbols": ["__$ebnf$1", "wschar"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "__", "symbols": ["__$ebnf$1"], "postprocess": function(d) {return null;}}, {"name": "wschar", "symbols": [/[ \t\n\v\f]/], "postprocess": id}, {"name": "unsigned_int$ebnf$1", "symbols": [/[0-9]/]}, {"name": "unsigned_int$ebnf$1", "symbols": ["unsigned_int$ebnf$1", /[0-9]/], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "unsigned_int", "symbols": ["unsigned_int$ebnf$1"], "postprocess": function(d) { return parseInt(d[0].join("")); } }, {"name": "int$ebnf$1$subexpression$1", "symbols": [{"literal":"-"}]}, {"name": "int$ebnf$1$subexpression$1", "symbols": [{"literal":"+"}]}, {"name": "int$ebnf$1", "symbols": ["int$ebnf$1$subexpression$1"], "postprocess": id}, {"name": "int$ebnf$1", "symbols": [], "postprocess": function(d) {return null;}}, {"name": "int$ebnf$2", "symbols": [/[0-9]/]}, {"name": "int$ebnf$2", "symbols": ["int$ebnf$2", /[0-9]/], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "int", "symbols": ["int$ebnf$1", "int$ebnf$2"], "postprocess": function(d) { if (d[0]) { return parseInt(d[0][0]+d[1].join("")); } else { return parseInt(d[1].join("")); } } }, {"name": "unsigned_decimal$ebnf$1", "symbols": [/[0-9]/]}, {"name": "unsigned_decimal$ebnf$1", "symbols": ["unsigned_decimal$ebnf$1", /[0-9]/], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "unsigned_decimal$ebnf$2$subexpression$1$ebnf$1", "symbols": [/[0-9]/]}, {"name": "unsigned_decimal$ebnf$2$subexpression$1$ebnf$1", "symbols": ["unsigned_decimal$ebnf$2$subexpression$1$ebnf$1", /[0-9]/], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "unsigned_decimal$ebnf$2$subexpression$1", "symbols": [{"literal":"."}, "unsigned_decimal$ebnf$2$subexpression$1$ebnf$1"]}, {"name": "unsigned_decimal$ebnf$2", "symbols": ["unsigned_decimal$ebnf$2$subexpression$1"], "postprocess": id}, {"name": "unsigned_decimal$ebnf$2", "symbols": [], "postprocess": function(d) {return null;}}, {"name": "unsigned_decimal", "symbols": ["unsigned_decimal$ebnf$1", "unsigned_decimal$ebnf$2"], "postprocess": function(d) { return parseFloat( d[0].join("") + (d[1] ? "."+d[1][1].join("") : "") ); } }, {"name": "decimal$ebnf$1", "symbols": [{"literal":"-"}], "postprocess": id}, {"name": "decimal$ebnf$1", "symbols": [], "postprocess": function(d) {return null;}}, {"name": "decimal$ebnf$2", "symbols": [/[0-9]/]}, {"name": "decimal$ebnf$2", "symbols": ["decimal$ebnf$2", /[0-9]/], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "decimal$ebnf$3$subexpression$1$ebnf$1", "symbols": [/[0-9]/]}, {"name": "decimal$ebnf$3$subexpression$1$ebnf$1", "symbols": ["decimal$ebnf$3$subexpression$1$ebnf$1", /[0-9]/], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "decimal$ebnf$3$subexpression$1", "symbols": [{"literal":"."}, "decimal$ebnf$3$subexpression$1$ebnf$1"]}, {"name": "decimal$ebnf$3", "symbols": ["decimal$ebnf$3$subexpression$1"], "postprocess": id}, {"name": "decimal$ebnf$3", "symbols": [], "postprocess": function(d) {return null;}}, {"name": "decimal", "symbols": ["decimal$ebnf$1", "decimal$ebnf$2", "decimal$ebnf$3"], "postprocess": function(d) { return parseFloat( (d[0] || "") + d[1].join("") + (d[2] ? "."+d[2][1].join("") : "") ); } }, {"name": "percentage", "symbols": ["decimal", {"literal":"%"}], "postprocess": function(d) { return d[0]/100; } }, {"name": "jsonfloat$ebnf$1", "symbols": [{"literal":"-"}], "postprocess": id}, {"name": "jsonfloat$ebnf$1", "symbols": [], "postprocess": function(d) {return null;}}, {"name": "jsonfloat$ebnf$2", "symbols": [/[0-9]/]}, {"name": "jsonfloat$ebnf$2", "symbols": ["jsonfloat$ebnf$2", /[0-9]/], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "jsonfloat$ebnf$3$subexpression$1$ebnf$1", "symbols": [/[0-9]/]}, {"name": "jsonfloat$ebnf$3$subexpression$1$ebnf$1", "symbols": ["jsonfloat$ebnf$3$subexpression$1$ebnf$1", /[0-9]/], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "jsonfloat$ebnf$3$subexpression$1", "symbols": [{"literal":"."}, "jsonfloat$ebnf$3$subexpression$1$ebnf$1"]}, {"name": "jsonfloat$ebnf$3", "symbols": ["jsonfloat$ebnf$3$subexpression$1"], "postprocess": id}, {"name": "jsonfloat$ebnf$3", "symbols": [], "postprocess": function(d) {return null;}}, {"name": "jsonfloat$ebnf$4$subexpression$1$ebnf$1", "symbols": [/[+-]/], "postprocess": id}, {"name": "jsonfloat$ebnf$4$subexpression$1$ebnf$1", "symbols": [], "postprocess": function(d) {return null;}}, {"name": "jsonfloat$ebnf$4$subexpression$1$ebnf$2", "symbols": [/[0-9]/]}, {"name": "jsonfloat$ebnf$4$subexpression$1$ebnf$2", "symbols": ["jsonfloat$ebnf$4$subexpression$1$ebnf$2", /[0-9]/], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "jsonfloat$ebnf$4$subexpression$1", "symbols": [/[eE]/, "jsonfloat$ebnf$4$subexpression$1$ebnf$1", "jsonfloat$ebnf$4$subexpression$1$ebnf$2"]}, {"name": "jsonfloat$ebnf$4", "symbols": ["jsonfloat$ebnf$4$subexpression$1"], "postprocess": id}, {"name": "jsonfloat$ebnf$4", "symbols": [], "postprocess": function(d) {return null;}}, {"name": "jsonfloat", "symbols": ["jsonfloat$ebnf$1", "jsonfloat$ebnf$2", "jsonfloat$ebnf$3", "jsonfloat$ebnf$4"], "postprocess": function(d) { return parseFloat( (d[0] || "") + d[1].join("") + (d[2] ? "."+d[2][1].join("") : "") + (d[3] ? "e" + (d[3][1] || "+") + d[3][2].join("") : "") ); } }, {"name": "dqstring$ebnf$1", "symbols": []}, {"name": "dqstring$ebnf$1", "symbols": ["dqstring$ebnf$1", "dstrchar"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "dqstring", "symbols": [{"literal":"\""}, "dqstring$ebnf$1", {"literal":"\""}], "postprocess": function(d) {return d[1].join(""); }}, {"name": "sqstring$ebnf$1", "symbols": []}, {"name": "sqstring$ebnf$1", "symbols": ["sqstring$ebnf$1", "sstrchar"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "sqstring", "symbols": [{"literal":"'"}, "sqstring$ebnf$1", {"literal":"'"}], "postprocess": function(d) {return d[1].join(""); }}, {"name": "btstring$ebnf$1", "symbols": []}, {"name": "btstring$ebnf$1", "symbols": ["btstring$ebnf$1", /[^`]/], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "btstring", "symbols": [{"literal":"`"}, "btstring$ebnf$1", {"literal":"`"}], "postprocess": function(d) {return d[1].join(""); }}, {"name": "dstrchar", "symbols": [/[^\\"\n]/], "postprocess": id}, {"name": "dstrchar", "symbols": [{"literal":"\\"}, "strescape"], "postprocess": function(d) { return JSON.parse("\""+d.join("")+"\""); } }, {"name": "sstrchar", "symbols": [/[^\\'\n]/], "postprocess": id}, {"name": "sstrchar", "symbols": [{"literal":"\\"}, "strescape"], "postprocess": function(d) { return JSON.parse("\""+d.join("")+"\""); }}, {"name": "sstrchar$string$1", "symbols": [{"literal":"\\"}, {"literal":"'"}], "postprocess": function joiner(d) {return d.join('');}}, {"name": "sstrchar", "symbols": ["sstrchar$string$1"], "postprocess": function(d) {return "'"; }}, {"name": "strescape", "symbols": [/["\\/bfnrt]/], "postprocess": id}, {"name": "strescape", "symbols": [{"literal":"u"}, /[a-fA-F0-9]/, /[a-fA-F0-9]/, /[a-fA-F0-9]/, /[a-fA-F0-9]/], "postprocess": function(d) { return d.join(""); } }, {"name": "Pipe$ebnf$1", "symbols": []}, {"name": "Pipe$ebnf$1$subexpression$1", "symbols": ["_", {"literal":"|"}, "_", "Call"]}, {"name": "Pipe$ebnf$1", "symbols": ["Pipe$ebnf$1", "Pipe$ebnf$1$subexpression$1"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "Pipe", "symbols": ["Call", "Pipe$ebnf$1"], "postprocess": (d) => {return [d[0], ...d[1].map((p) => p[3])] }}, {"name": "Call$ebnf$1$subexpression$1$ebnf$1", "symbols": ["Args"], "postprocess": id}, {"name": "Call$ebnf$1$subexpression$1$ebnf$1", "symbols": [], "postprocess": function(d) {return null;}}, {"name": "Call$ebnf$1$subexpression$1", "symbols": [{"literal":"("}, "_", "Call$ebnf$1$subexpression$1$ebnf$1", "_", {"literal":")"}]}, {"name": "Call$ebnf$1", "symbols": ["Call$ebnf$1$subexpression$1"], "postprocess": id}, {"name": "Call$ebnf$1", "symbols": [], "postprocess": function(d) {return null;}}, {"name": "Call", "symbols": ["Name", "Call$ebnf$1"], "postprocess": (d) => { return {name: d[0], args: d[1] != null ? d[1][2] : []} }}, {"name": "Name$ebnf$1", "symbols": []}, {"name": "Name$ebnf$1", "symbols": ["Name$ebnf$1", /[a-z0-9_]/], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "Name", "symbols": [/[a-z_]/, "Name$ebnf$1"], "postprocess": (d) => { return {lit: `${d[0]}${d[1].join("")}`} }}, {"name": "Args$ebnf$1", "symbols": []}, {"name": "Args$ebnf$1$subexpression$1", "symbols": ["_", {"literal":","}, "_", "Arg"]}, {"name": "Args$ebnf$1", "symbols": ["Args$ebnf$1", "Args$ebnf$1$subexpression$1"], "postprocess": function arrpush(d) {return d[0].concat([d[1]]);}}, {"name": "Args", "symbols": ["Arg", "Args$ebnf$1"], "postprocess": (d) => { return [d[0], ...d[1].map((p) => p[3])] }}, {"name": "Arg$subexpression$1", "symbols": ["decimal"]}, {"name": "Arg$subexpression$1", "symbols": ["str"]}, {"name": "Arg$subexpression$1", "symbols": ["Name"]}, {"name": "Arg", "symbols": ["Arg$subexpression$1"], "postprocess": (d) => { return d[0][0] }}, {"name": "str$subexpression$1", "symbols": ["dqstring"]}, {"name": "str$subexpression$1", "symbols": ["sqstring"]}, {"name": "str", "symbols": ["str$subexpression$1"], "postprocess": (d) => { return d[0][0] }} ] , ParserStart: "Pipe" } if (typeof module !== 'undefined'&& typeof module.exports !== 'undefined') { module.exports = grammar; } else { window.grammar = grammar; } })();