chat-pane
Version:
Solid-compatible Panes: Chat
1,639 lines (1,522 loc) • 3.35 MB
JavaScript
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./node_modules/@frogcat/ttl2jsonld/ttl2jsonld.js":
/*!********************************************************!*\
!*** ./node_modules/@frogcat/ttl2jsonld/ttl2jsonld.js ***!
\********************************************************/
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
* Generated by PEG.js 0.10.0.
*
* http://pegjs.org/
*/
(function(root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
})(this, function() {
"use strict";
function peg$subclass(child, parent) {
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor();
}
function peg$SyntaxError(message, expected, found, location) {
this.message = message;
this.expected = expected;
this.found = found;
this.location = location;
this.name = "SyntaxError";
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, peg$SyntaxError);
}
}
peg$subclass(peg$SyntaxError, Error);
peg$SyntaxError.buildMessage = function(expected, found) {
var DESCRIBE_EXPECTATION_FNS = {
literal: function(expectation) {
return "\"" + literalEscape(expectation.text) + "\"";
},
"class": function(expectation) {
var escapedParts = "",
i;
for (i = 0; i < expectation.parts.length; i++) {
escapedParts += expectation.parts[i] instanceof Array
? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
: classEscape(expectation.parts[i]);
}
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
},
any: function(expectation) {
return "any character";
},
end: function(expectation) {
return "end of input";
},
other: function(expectation) {
return expectation.description;
}
};
function hex(ch) {
return ch.charCodeAt(0).toString(16).toUpperCase();
}
function literalEscape(s) {
return s
.replace(/\\/g, '\\\\')
.replace(/"/g, '\\"')
.replace(/\0/g, '\\0')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
}
function classEscape(s) {
return s
.replace(/\\/g, '\\\\')
.replace(/\]/g, '\\]')
.replace(/\^/g, '\\^')
.replace(/-/g, '\\-')
.replace(/\0/g, '\\0')
.replace(/\t/g, '\\t')
.replace(/\n/g, '\\n')
.replace(/\r/g, '\\r')
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
}
function describeExpectation(expectation) {
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
}
function describeExpected(expected) {
var descriptions = new Array(expected.length),
i, j;
for (i = 0; i < expected.length; i++) {
descriptions[i] = describeExpectation(expected[i]);
}
descriptions.sort();
if (descriptions.length > 0) {
for (i = 1, j = 1; i < descriptions.length; i++) {
if (descriptions[i - 1] !== descriptions[i]) {
descriptions[j] = descriptions[i];
j++;
}
}
descriptions.length = j;
}
switch (descriptions.length) {
case 1:
return descriptions[0];
case 2:
return descriptions[0] + " or " + descriptions[1];
default:
return descriptions.slice(0, -1).join(", ")
+ ", or "
+ descriptions[descriptions.length - 1];
}
}
function describeFound(found) {
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
}
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
};
function peg$parse(input, options) {
options = options !== void 0 ? options : {};
var peg$FAILED = {},
peg$startRuleFunctions = { turtleDoc: peg$parseturtleDoc },
peg$startRuleFunction = peg$parseturtleDoc,
peg$c0 = function(statements) {
var jsonld = context.toJSON();
jsonld["@graph"] = [];
statements.filter(a=>Array.isArray(a)).forEach(a=>{
a.forEach(b=>{
jsonld["@graph"].push(b);
});
});
if(jsonld["@graph"].length===1){
Object.assign(jsonld,jsonld["@graph"][0]);
delete jsonld["@graph"];
}
return jsonld;
},
peg$c1 = ".",
peg$c2 = peg$literalExpectation(".", false),
peg$c3 = function(a) {return a;},
peg$c4 = "#",
peg$c5 = peg$literalExpectation("#", false),
peg$c6 = /^[^\n]/,
peg$c7 = peg$classExpectation(["\n"], true, false),
peg$c8 = "\n",
peg$c9 = peg$literalExpectation("\n", false),
peg$c10 = function(a) {return a.join("");},
peg$c11 = "@prefix",
peg$c12 = peg$literalExpectation("@prefix", false),
peg$c13 = function(a, b) {
context.addPrefix(a==="" ? "0" : a,b);
return {};
},
peg$c14 = "@base",
peg$c15 = peg$literalExpectation("@base", false),
peg$c16 = function(a) {
context.addBase(a);
return {};
},
peg$c17 = /^[Bb]/,
peg$c18 = peg$classExpectation(["B", "b"], false, false),
peg$c19 = /^[Aa]/,
peg$c20 = peg$classExpectation(["A", "a"], false, false),
peg$c21 = /^[Ss]/,
peg$c22 = peg$classExpectation(["S", "s"], false, false),
peg$c23 = /^[Ee]/,
peg$c24 = peg$classExpectation(["E", "e"], false, false),
peg$c25 = /^[Pp]/,
peg$c26 = peg$classExpectation(["P", "p"], false, false),
peg$c27 = /^[Rr]/,
peg$c28 = peg$classExpectation(["R", "r"], false, false),
peg$c29 = /^[Ff]/,
peg$c30 = peg$classExpectation(["F", "f"], false, false),
peg$c31 = /^[Ii]/,
peg$c32 = peg$classExpectation(["I", "i"], false, false),
peg$c33 = /^[Xx]/,
peg$c34 = peg$classExpectation(["X", "x"], false, false),
peg$c35 = function(s, p) {
var x = {};
if(typeof s==='string' && s!=='[]') x["@id"] = s;
else if(typeof s==='object') Object.assign(x,s);
if(p) Object.assign(x,p);
return [x];
},
peg$c36 = function(s, p) {
var x = {};
if(s) Object.assign(x,s);
if(p) Object.assign(x,p);
return [x];
},
peg$c37 = ";",
peg$c38 = peg$literalExpectation(";", false),
peg$c39 = function(a, b, e, f) {var x={};x[e]=f;return x;},
peg$c40 = function(a, b, d) {return d;},
peg$c41 = function(a, b, c) {
var x = {};
c.unshift(createObject(a,b));
c.forEach(t=>{
if(!t) return;
Object.keys(t).forEach(key=>{
t[key].forEach(val=>{
if(key==="@type" && val["@id"]!==undefined) val = val["@id"];
if(x[key]===undefined) x[key] = val;
else if(Array.isArray(x[key])) x[key].push(val);
else x[key] = [x[key],val];
});
});
});
return x;
},
peg$c42 = ",",
peg$c43 = peg$literalExpectation(",", false),
peg$c44 = function(a, c) {return c;},
peg$c45 = function(a, b) {
b.unshift(a);
return b;
},
peg$c46 = "a",
peg$c47 = peg$literalExpectation("a", false),
peg$c48 = function() {return '@type';},
peg$c49 = function(a) {return expandList(a,true);},
peg$c50 = function(a) {return expandList(a,false);},
peg$c51 = function(a) {return a==="[]" ? {} : {"@id":a};},
peg$c52 = function(a) {return {"@id":a};},
peg$c53 = "[",
peg$c54 = peg$literalExpectation("[", false),
peg$c55 = "]",
peg$c56 = peg$literalExpectation("]", false),
peg$c57 = "(",
peg$c58 = peg$literalExpectation("(", false),
peg$c59 = ")",
peg$c60 = peg$literalExpectation(")", false),
peg$c61 = function(a) {return {"@list":a};},
peg$c62 = function(a, b) {return {"@value":a,"@language":b};},
peg$c63 = "^^",
peg$c64 = peg$literalExpectation("^^", false),
peg$c65 = function(a, b) {
if(b==="http://www.w3.org/2001/XMLSchema#boolean" && a==="true") return true;
if(b==="http://www.w3.org/2001/XMLSchema#boolean" && a==="false") return false;
if(b==="http://www.w3.org/2001/XMLSchema#integer") return parseInt(a);
if(b==="http://www.w3.org/2001/XMLSchema#double") return parseFloat(a);
const uri = context.resolve(b,true);
if(uri){
const prefix = b.split(":")[0];
if(uri==="http://www.w3.org/2001/XMLSchema#boolean" && a==="true"){
context.decrement(prefix);
return true;
}
if(uri==="http://www.w3.org/2001/XMLSchema#boolean" && a==="false"){
context.decrement(prefix);
return false;
}
if(uri==="http://www.w3.org/2001/XMLSchema#integer"){
context.decrement(prefix);
return parseInt(a);
}
if(uri==="http://www.w3.org/2001/XMLSchema#double"){
context.decrement(prefix);
return parseFloat(a);
}
}
return {"@value":a,"@type":b};
},
peg$c66 = "true",
peg$c67 = peg$literalExpectation("true", false),
peg$c68 = function() {return true;},
peg$c69 = "false",
peg$c70 = peg$literalExpectation("false", false),
peg$c71 = function() {return false;},
peg$c72 = function(a) {return a+":";},
peg$c73 = "<",
peg$c74 = peg$literalExpectation("<", false),
peg$c75 = /^[^\0- <>"{}|\^`\\]/,
peg$c76 = peg$classExpectation([["\0", " "], "<", ">", "\"", "{", "}", "|", "^", "`", "\\"], true, false),
peg$c77 = ">",
peg$c78 = peg$literalExpectation(">", false),
peg$c79 = function(a) {
const decoded = a.map(s=> {
if(0x10000 <= s.codePointAt(0) && s.codePointAt(0) <= 0xeffff) return 'a';
if(s.length===1) return s;
if(s.length===6) return String.fromCharCode("0x"+s.substring(2));
if(s.length===10) return String.fromCodePoint("0x"+s.substring(2));
return s;
}).join("");
if(decoded.match(/^[^\u0000-\u0020<>"{}|^`\\]*$/)){
var join = a.join("");
try{
return context.resolve(join);
}catch(e){
error("Invalid IRIREF "+join);
}
}
else error("Invalid IRIREF "+a.join("")+" / "+decoded);
},
peg$c80 = ":",
peg$c81 = peg$literalExpectation(":", false),
peg$c82 = function(a) {
a = a || "0";
if(context.hasPrefix(a)===false)
error("undefined prefix "+a);
return a;
},
peg$c83 = function(a) {return (a||"");},
peg$c84 = function(a, b) {
context.increment(a);
return context.resolve(a+":"+b);
},
peg$c85 = "_:",
peg$c86 = peg$literalExpectation("_:", false),
peg$c87 = /^[0-9]/,
peg$c88 = peg$classExpectation([["0", "9"]], false, false),
peg$c89 = "@",
peg$c90 = peg$literalExpectation("@", false),
peg$c91 = /^[a-zA-Z]/,
peg$c92 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false),
peg$c93 = "-",
peg$c94 = peg$literalExpectation("-", false),
peg$c95 = /^[a-zA-Z0-9]/,
peg$c96 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"]], false, false),
peg$c97 = function(a, s) {return '-'+s.join("");},
peg$c98 = function(a, b) {return a.join("")+b.join("");},
peg$c99 = /^[+\-]/,
peg$c100 = peg$classExpectation(["+", "-"], false, false),
peg$c101 = function(a) {
if(a.match(/^[0+][0-9]+$/))
return {
"@value" : a,
"@type" : "http://www.w3.org/2001/XMLSchema#integer"
};
return parseInt(a);
},
peg$c102 = function(a) {
return {
"@value" : a,
"@type" : "http://www.w3.org/2001/XMLSchema#decimal"
}
},
peg$c103 = function(a) {
return {
"@value" : a,
"@type" : "http://www.w3.org/2001/XMLSchema#double"
};
},
peg$c104 = /^[eE]/,
peg$c105 = peg$classExpectation(["e", "E"], false, false),
peg$c106 = "\"",
peg$c107 = peg$literalExpectation("\"", false),
peg$c108 = /^[^"\\\n\r]/,
peg$c109 = peg$classExpectation(["\"", "\\", "\n", "\r"], true, false),
peg$c110 = "'",
peg$c111 = peg$literalExpectation("'", false),
peg$c112 = /^[^'\\\n\r]/,
peg$c113 = peg$classExpectation(["'", "\\", "\n", "\r"], true, false),
peg$c114 = "'''",
peg$c115 = peg$literalExpectation("'''", false),
peg$c116 = /^[^'\\]/,
peg$c117 = peg$classExpectation(["'", "\\"], true, false),
peg$c118 = "''",
peg$c119 = peg$literalExpectation("''", false),
peg$c120 = function(head, a) {return "''"+a.join("");},
peg$c121 = function(head, a) {return "'" +a.join("");},
peg$c122 = function(head, body) {return head.join("")+body.join("");},
peg$c123 = "\"\"\"",
peg$c124 = peg$literalExpectation("\"\"\"", false),
peg$c125 = /^[^"\\]/,
peg$c126 = peg$classExpectation(["\"", "\\"], true, false),
peg$c127 = "\"\"",
peg$c128 = peg$literalExpectation("\"\"", false),
peg$c129 = function(head, a) {return '""'+a.join("");},
peg$c130 = function(head, a) {return '"' +a.join("");},
peg$c131 = "\\U",
peg$c132 = peg$literalExpectation("\\U", false),
peg$c133 = function(hex) {
return String.fromCodePoint(parseInt(hex.join(""),16));
},
peg$c134 = "\\u",
peg$c135 = peg$literalExpectation("\\u", false),
peg$c136 = function(hex) {
return String.fromCharCode(parseInt(hex.join(""),16));
},
peg$c137 = "\\t",
peg$c138 = peg$literalExpectation("\\t", false),
peg$c139 = function() {return '\t';},
peg$c140 = "\\b",
peg$c141 = peg$literalExpectation("\\b", false),
peg$c142 = function() {return '\b';},
peg$c143 = "\\n",
peg$c144 = peg$literalExpectation("\\n", false),
peg$c145 = function() {return '\n';},
peg$c146 = "\\r",
peg$c147 = peg$literalExpectation("\\r", false),
peg$c148 = function() {return '\r';},
peg$c149 = "\\f",
peg$c150 = peg$literalExpectation("\\f", false),
peg$c151 = function() {return '\f';},
peg$c152 = "\\\"",
peg$c153 = peg$literalExpectation("\\\"", false),
peg$c154 = function() {return '"';},
peg$c155 = "\\'",
peg$c156 = peg$literalExpectation("\\'", false),
peg$c157 = function() {return "'";},
peg$c158 = "\\\\",
peg$c159 = peg$literalExpectation("\\\\", false),
peg$c160 = function() {return '\\';},
peg$c161 = /^[ \t\r\n]/,
peg$c162 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false),
peg$c163 = function() {return "[]";},
peg$c164 = /^[\uD800-\uDBFF]/,
peg$c165 = peg$classExpectation([["\uD800", "\uDBFF"]], false, false),
peg$c166 = /^[\uDC00-\uDFFF]/,
peg$c167 = peg$classExpectation([["\uDC00", "\uDFFF"]], false, false),
peg$c168 = function(a, b) {return a+b;},
peg$c169 = /^[A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,
peg$c170 = peg$classExpectation([["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"]], false, false),
peg$c171 = "_",
peg$c172 = peg$literalExpectation("_", false),
peg$c173 = "\xB7",
peg$c174 = peg$literalExpectation("\xB7", false),
peg$c175 = /^[\u0300-\u036F]/,
peg$c176 = peg$classExpectation([["\u0300", "\u036F"]], false, false),
peg$c177 = /^[\u203F-\u2040]/,
peg$c178 = peg$classExpectation([["\u203F", "\u2040"]], false, false),
peg$c179 = function(head, body, a, b) {return a.join("")+b.join("");},
peg$c180 = function(head, body, tail) {return head+body.join("")+tail.join("");},
peg$c181 = "%",
peg$c182 = peg$literalExpectation("%", false),
peg$c183 = /^[0-9A-Fa-f]/,
peg$c184 = peg$classExpectation([["0", "9"], ["A", "F"], ["a", "f"]], false, false),
peg$c185 = "\\",
peg$c186 = peg$literalExpectation("\\", false),
peg$c187 = /^[_~.!$&'()*+,;=\/?#@%\-]/,
peg$c188 = peg$classExpectation(["_", "~", ".", "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "=", "/", "?", "#", "@", "%", "-"], false, false),
peg$currPos = 0,
peg$savedPos = 0,
peg$posDetailsCache = [{ line: 1, column: 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];
}
function text() {
return input.substring(peg$savedPos, peg$currPos);
}
function location() {
return peg$computeLocation(peg$savedPos, peg$currPos);
}
function expected(description, location) {
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
throw peg$buildStructuredError(
[peg$otherExpectation(description)],
input.substring(peg$savedPos, peg$currPos),
location
);
}
function error(message, location) {
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
throw peg$buildSimpleError(message, location);
}
function peg$literalExpectation(text, ignoreCase) {
return { type: "literal", text: text, ignoreCase: ignoreCase };
}
function peg$classExpectation(parts, inverted, ignoreCase) {
return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
}
function peg$anyExpectation() {
return { type: "any" };
}
function peg$endExpectation() {
return { type: "end" };
}
function peg$otherExpectation(description) {
return { type: "other", description: description };
}
function peg$computePosDetails(pos) {
var details = peg$posDetailsCache[pos], p;
if (details) {
return details;
} else {
p = pos - 1;
while (!peg$posDetailsCache[p]) {
p--;
}
details = peg$posDetailsCache[p];
details = {
line: details.line,
column: details.column
};
while (p < pos) {
if (input.charCodeAt(p) === 10) {
details.line++;
details.column = 1;
} else {
details.column++;
}
p++;
}
peg$posDetailsCache[pos] = details;
return details;
}
}
function peg$computeLocation(startPos, endPos) {
var startPosDetails = peg$computePosDetails(startPos),
endPosDetails = peg$computePosDetails(endPos);
return {
start: {
offset: startPos,
line: startPosDetails.line,
column: startPosDetails.column
},
end: {
offset: endPos,
line: endPosDetails.line,
column: endPosDetails.column
}
};
}
function peg$fail(expected) {
if (peg$currPos < peg$maxFailPos) { return; }
if (peg$currPos > peg$maxFailPos) {
peg$maxFailPos = peg$currPos;
peg$maxFailExpected = [];
}
peg$maxFailExpected.push(expected);
}
function peg$buildSimpleError(message, location) {
return new peg$SyntaxError(message, null, null, location);
}
function peg$buildStructuredError(expected, found, location) {
return new peg$SyntaxError(
peg$SyntaxError.buildMessage(expected, found),
expected,
found,
location
);
}
function peg$parseturtleDoc() {
var s0, s1, s2, s3;
s0 = peg$currPos;
s1 = [];
s2 = peg$parsestatement();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parsestatement();
}
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseIGNORE();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseIGNORE();
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c0(s1);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsestatement() {
var s0, s1, s2, s3;
s0 = peg$parsedirective();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsetriples();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$parseIGNORE();
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$parseIGNORE();
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s3 = peg$c1;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c2); }
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c3(s1);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parseCOMMENT() {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 35) {
s1 = peg$c4;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c5); }
}
if (s1 !== peg$FAILED) {
s2 = [];
if (peg$c6.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c7); }
}
while (s3 !== peg$FAILED) {
s2.push(s3);
if (peg$c6.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c7); }
}
}
if (s2 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 10) {
s3 = peg$c8;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c9); }
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c10(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseIGNORE() {
var s0;
s0 = peg$parseWS();
if (s0 === peg$FAILED) {
s0 = peg$parseCOMMENT();
}
return s0;
}
function peg$parsedirective() {
var s0;
s0 = peg$parseprefixID();
if (s0 === peg$FAILED) {
s0 = peg$parsebase();
if (s0 === peg$FAILED) {
s0 = peg$parsesparqlPrefix();
if (s0 === peg$FAILED) {
s0 = peg$parsesparqlBase();
}
}
}
return s0;
}
function peg$parseprefixID() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseIGNORE();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseIGNORE();
}
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 7) === peg$c11) {
s2 = peg$c11;
peg$currPos += 7;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c12); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parseIGNORE();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parseIGNORE();
}
if (s3 !== peg$FAILED) {
s4 = peg$parsePNAME_NS_NO_CHECK();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$parseIGNORE();
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parseIGNORE();
}
if (s5 !== peg$FAILED) {
s6 = peg$parseIRIREF();
if (s6 !== peg$FAILED) {
s7 = [];
s8 = peg$parseIGNORE();
while (s8 !== peg$FAILED) {
s7.push(s8);
s8 = peg$parseIGNORE();
}
if (s7 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s8 = peg$c1;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c2); }
}
if (s8 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c13(s4, s6);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsebase() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseIGNORE();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseIGNORE();
}
if (s1 !== peg$FAILED) {
if (input.substr(peg$currPos, 5) === peg$c14) {
s2 = peg$c14;
peg$currPos += 5;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c15); }
}
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$parseIGNORE();
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$parseIGNORE();
}
if (s3 !== peg$FAILED) {
s4 = peg$parseIRIREF();
if (s4 !== peg$FAILED) {
s5 = [];
s6 = peg$parseIGNORE();
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parseIGNORE();
}
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 46) {
s6 = peg$c1;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c2); }
}
if (s6 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c16(s4);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsesparqlBase() {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseIGNORE();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseIGNORE();
}
if (s1 !== peg$FAILED) {
if (peg$c17.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c18); }
}
if (s2 !== peg$FAILED) {
if (peg$c19.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c20); }
}
if (s3 !== peg$FAILED) {
if (peg$c21.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c22); }
}
if (s4 !== peg$FAILED) {
if (peg$c23.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c24); }
}
if (s5 !== peg$FAILED) {
s6 = [];
s7 = peg$parseIGNORE();
while (s7 !== peg$FAILED) {
s6.push(s7);
s7 = peg$parseIGNORE();
}
if (s6 !== peg$FAILED) {
s7 = peg$parseIRIREF();
if (s7 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c16(s7);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsesparqlPrefix() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseIGNORE();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseIGNORE();
}
if (s1 !== peg$FAILED) {
if (peg$c25.test(input.charAt(peg$currPos))) {
s2 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c26); }
}
if (s2 !== peg$FAILED) {
if (peg$c27.test(input.charAt(peg$currPos))) {
s3 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c28); }
}
if (s3 !== peg$FAILED) {
if (peg$c23.test(input.charAt(peg$currPos))) {
s4 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s4 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c24); }
}
if (s4 !== peg$FAILED) {
if (peg$c29.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c30); }
}
if (s5 !== peg$FAILED) {
if (peg$c31.test(input.charAt(peg$currPos))) {
s6 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c32); }
}
if (s6 !== peg$FAILED) {
if (peg$c33.test(input.charAt(peg$currPos))) {
s7 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s7 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c34); }
}
if (s7 !== peg$FAILED) {
s8 = [];
s9 = peg$parseIGNORE();
while (s9 !== peg$FAILED) {
s8.push(s9);
s9 = peg$parseIGNORE();
}
if (s8 !== peg$FAILED) {
s9 = peg$parsePNAME_NS_NO_CHECK();
if (s9 !== peg$FAILED) {
s10 = [];
s11 = peg$parseIGNORE();
while (s11 !== peg$FAILED) {
s10.push(s11);
s11 = peg$parseIGNORE();
}
if (s10 !== peg$FAILED) {
s11 = peg$parseIRIREF();
if (s11 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c13(s9, s11);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsetriples() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parsesubject();
if (s1 !== peg$FAILED) {
s2 = peg$parsepredicateObjectList();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c35(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseblankNodePropertyList();
if (s1 !== peg$FAILED) {
s2 = peg$parsepredicateObjectList();
if (s2 === peg$FAILED) {
s2 = null;
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c36(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parsepredicateObjectList() {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
s0 = peg$currPos;
s1 = peg$parseverb();
if (s1 !== peg$FAILED) {
s2 = peg$parseobjectList();
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$currPos;
s5 = [];
s6 = peg$parseIGNORE();
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parseIGNORE();
}
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 59) {
s6 = peg$c37;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c38); }
}
if (s6 !== peg$FAILED) {
s7 = peg$currPos;
s8 = peg$parseverb();
if (s8 !== peg$FAILED) {
s9 = peg$parseobjectList();
if (s9 !== peg$FAILED) {
peg$savedPos = s7;
s8 = peg$c39(s1, s2, s8, s9);
s7 = s8;
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
if (s7 === peg$FAILED) {
s7 = null;
}
if (s7 !== peg$FAILED) {
peg$savedPos = s4;
s5 = peg$c40(s1, s2, s7);
s4 = s5;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$currPos;
s5 = [];
s6 = peg$parseIGNORE();
while (s6 !== peg$FAILED) {
s5.push(s6);
s6 = peg$parseIGNORE();
}
if (s5 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 59) {
s6 = peg$c37;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c38); }
}
if (s6 !== peg$FAILED) {
s7 = peg$currPos;
s8 = peg$parseverb();
if (s8 !== peg$FAILED) {
s9 = peg$parseobjectList();
if (s9 !== peg$FAILED) {
peg$savedPos = s7;
s8 = peg$c39(s1, s2, s8, s9);
s7 = s8;
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
} else {
peg$currPos = s7;
s7 = peg$FAILED;
}
if (s7 === peg$FAILED) {
s7 = null;
}
if (s7 !== peg$FAILED) {
peg$savedPos = s4;
s5 = peg$c40(s1, s2, s7);
s4 = s5;
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
} else {
peg$currPos = s4;
s4 = peg$FAILED;
}
}
if (s3 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c41(s1, s2, s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseobjectList() {
var s0, s1, s2, s3, s4, s5, s6;
s0 = peg$currPos;
s1 = peg$parseobject();
if (s1 !== peg$FAILED) {
s2 = [];
s3 = peg$currPos;
s4 = [];
s5 = peg$parseIGNORE();
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parseIGNORE();
}
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c42;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c43); }
}
if (s5 !== peg$FAILED) {
s6 = peg$parseobject();
if (s6 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c44(s1, s6);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
while (s3 !== peg$FAILED) {
s2.push(s3);
s3 = peg$currPos;
s4 = [];
s5 = peg$parseIGNORE();
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parseIGNORE();
}
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 44) {
s5 = peg$c42;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c43); }
}
if (s5 !== peg$FAILED) {
s6 = peg$parseobject();
if (s6 !== peg$FAILED) {
peg$savedPos = s3;
s4 = peg$c44(s1, s6);
s3 = s4;
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
} else {
peg$currPos = s3;
s3 = peg$FAILED;
}
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c45(s1, s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseverb() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = peg$parsepredicate();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c3(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = [];
s2 = peg$parseIGNORE();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseIGNORE();
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 97) {
s2 = peg$c46;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c47); }
}
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c48();
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
}
return s0;
}
function peg$parsesubject() {
var s0, s1;
s0 = peg$currPos;
s1 = peg$parsecollection();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c49(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$parseBlankNode();
if (s0 === peg$FAILED) {
s0 = peg$parseiri();
}
}
return s0;
}
function peg$parsepredicate() {
var s0, s1, s2;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseIGNORE();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseIGNORE();
}
if (s1 !== peg$FAILED) {
s2 = peg$parseiri();
if (s2 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c3(s2);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parseobject() {
var s0, s1;
s0 = peg$parseliteral();
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parsecollection();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c50(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseBlankNode();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c51(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseblankNodePropertyList();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c3(s1);
}
s0 = s1;
if (s0 === peg$FAILED) {
s0 = peg$currPos;
s1 = peg$parseiri();
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c52(s1);
}
s0 = s1;
}
}
}
}
return s0;
}
function peg$parseliteral() {
var s0;
s0 = peg$parseRDFLiteral();
if (s0 === peg$FAILED) {
s0 = peg$parseNumericLiteral();
if (s0 === peg$FAILED) {
s0 = peg$parseBooleanLiteral();
}
}
return s0;
}
function peg$parseblankNodePropertyList() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseIGNORE();
while (s2 !== peg$FAILED) {
s1.push(s2);
s2 = peg$parseIGNORE();
}
if (s1 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 91) {
s2 = peg$c53;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c54); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parsepredicateObjectList();
if (s3 !== peg$FAILED) {
s4 = [];
s5 = peg$parseIGNORE();
while (s5 !== peg$FAILED) {
s4.push(s5);
s5 = peg$parseIGNORE();
}
if (s4 !== peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 93) {
s5 = peg$c55;
peg$currPos++;
} else {
s5 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$c56); }
}
if (s5 !== peg$FAILED) {
peg$savedPos = s0;
s1 = peg$c3(s3);
s0 = s1;
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
} else {
peg$currPos = s0;
s0 = peg$FAILED;
}
return s0;
}
function peg$parsecollection() {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
s1 = [];
s2 = peg$parseIGNORE();
wh