shaclc-parse
Version:
A parser for files written with SHACL compact syntax
1,072 lines (980 loc) • 51.4 kB
JavaScript
/* parser generated by jison 0.4.18 */
/*
Returns a Parser object of the following structure:
Parser: {
yy: {}
}
Parser.prototype: {
yy: {},
trace: function(),
symbols_: {associative list: name ==> number},
terminals_: {associative list: number ==> name},
productions_: [...],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
table: [...],
defaultActions: {...},
parseError: function(str, hash),
parse: function(input),
lexer: {
EOF: 1,
parseError: function(str, hash),
setInput: function(input),
input: function(),
unput: function(str),
more: function(),
less: function(n),
pastInput: function(),
upcomingInput: function(),
showPosition: function(),
test_match: function(regex_match_array, rule_index),
next: function(),
lex: function(),
begin: function(condition),
popState: function(),
_currentRules: function(),
topState: function(),
pushState: function(condition),
options: {
ranges: boolean (optional: true ==> token location info will include a .range[] member)
flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
},
performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
rules: [...],
conditions: {associative list: name ==> set},
}
}
token location info (@$, _$, etc.): {
first_line: n,
last_line: n,
first_column: n,
last_column: n,
range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
}
the parseError function receives a 'hash' object with these members for lexer and parser errors: {
text: (matched text)
token: (the produced terminal token, if any)
line: (yylineno)
}
while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
loc: (yylloc)
expected: (string describing the set of expected tokens)
recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
}
*/
var ShaclcParser = (function(){
var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[7,12,13,14,15,16,20,25,115,130],$V1=[7,13,16,20,25,115,130],$V2=[7,13,16,115,130],$V3=[1,25],$V4=[1,29],$V5=[1,27],$V6=[1,28],$V7=[13,16,115,130],$V8=[13,16,28,38,40,42,44,46,48,53,56,61,67,85,87,92,93,95,96,102,110,111,115,119,120,126,128,129,130,131,132,133,134,135,136],$V9=[28,56],$Va=[1,42],$Vb=[46,48,53,56],$Vc=[1,54],$Vd=[1,60],$Ve=[1,56],$Vf=[1,57],$Vg=[1,58],$Vh=[1,63],$Vi=[1,64],$Vj=[1,65],$Vk=[1,66],$Vl=[1,67],$Vm=[1,68],$Vn=[1,75],$Vo=[28,46,48,53,56],$Vp=[28,42,46,48,53,56],$Vq=[13,16,28,38,40,42,44,46,48,53,56,92,115,119,120,130,131,132,133,134,135,136],$Vr=[13,16,28,38,40,42,44,46,48,53,56,67,85,87,92,95,96,115,119,120,126,128,129,130,131,132,133,134,135,136],$Vs=[13,16,38,40,44,92,115,119,120,130,131,132,133,134,135,136],$Vt=[13,16,28,38,40,42,44,46,48,53,56,67,85,87,92,95,96,115,117,118,119,120,126,128,129,130,131,132,133,134,135,136],$Vu=[13,16,28,56,115,130],$Vv=[13,16,38,58,87,96,109,115,126,130],$Vw=[1,116],$Vx=[1,112],$Vy=[1,108],$Vz=[1,114],$VA=[1,111],$VB=[7,13,16,20,25,44,48,53,56,67,85,87,95,96,115,128,129,130],$VC=[48,53],$VD=[48,53,87,96,126],$VE=[13,16,44,48,53,56,85,87,95,96,115,128,129,130],$VF=[1,126],$VG=[13,16,40,44,48,53,56,85,87,95,96,115,128,129,130],$VH=[1,129],$VI=[48,53,67,87,96,126],$VJ=[13,16,40,44,48,53,56,67,85,87,95,96,115,128,129,130],$VK=[1,133],$VL=[13,16,40,44,48,53,56,67,85,87,95,96,102,115,128,129,130],$VM=[13,16,40,44,48,53,56,67,85,87,93,95,96,102,110,111,115,128,129,130],$VN=[1,151],$VO=[1,153],$VP=[1,156],$VQ=[1,157],$VR=[1,158],$VS=[1,167],$VT=[1,175],$VU=[13,16,44,48,53,56,67,85,87,95,96,115,128,129,130],$VV=[13,16,44,48,53,56,67,85,87,95,96,115,126,128,129,130],$VW=[13,16,46,92,115,119,120,130,131,132,133,134,135,136];
var parser = {trace: function trace () { },
yy: {},
symbols_: {"error":2,"shaclDoc":3,"shaclDoc_repetition0":4,"shaclDoc_repetition1":5,"ttlSection":6,"EOF":7,"directive":8,"baseDecl":9,"importsDecl":10,"prefixDecl":11,"KW_BASE":12,"IRIREF":13,"KW_IMPORTS":14,"KW_PREFIX":15,"PNAME_NS":16,"nodeShapeIri":17,"iri":18,"nodeShape":19,"KW_SHAPE":20,"nodeShape_option0":21,"nodeShape_option1":22,"nodeShapeBody":23,"shapeClass":24,"KW_SHAPE_CLASS":25,"shapeClass_option0":26,"turtleAnnotation":27,";":28,"turtleAnnotation2":29,"predicate":30,"turtleAnnotation2_option0":31,"objectList":32,"object":33,"objectList_repetition0":34,"iriOrLiteral":35,"blankNodeSection":36,"list":37,"(":38,"list_repetition0":39,")":40,"objectTail":41,",":42,"LB":43,"[":44,"RB":45,"]":46,"LP":47,"%":48,"RP":49,"pcSection":50,"iriHead":51,"ttlStatement":52,".":53,"ttlSection_repetition0":54,"startNodeShape":55,"{":56,"endNodeShape":57,"}":58,"nodeShapeBody_repetition0":59,"targetClass":60,"->":61,"targetClass_repetition_plus0":62,"constraint":63,"constraint_group0":64,"constraint_option0":65,"orNotComponent":66,"|":67,"nodeNot":68,"nodeOrEmit":69,"nodeOr":70,"nodeOr_repetition_plus0":71,"nodeValue":72,"negation":73,"nodeValue_group0":74,"=":75,"iriOrLiteralOrArray":76,"propertyShape":77,"path":78,"propertyShape_repetition0":79,"propertyOrComponent":80,"propertyNot":81,"propertyOr":82,"propertyOr_repetition_plus0":83,"propertyAtom":84,"NODEKIND":85,"shapeRef":86,"PARAM":87,"propertyCount":88,"propertyMinCount":89,"..":90,"propertyMaxCount":91,"INTEGER":92,"*":93,"shapeRef_group0":94,"@":95,"!":96,"pathAlternative":97,"additionalAlternative":98,"pathSequence":99,"pathAlternative_repetition_plus0":100,"additionalSequence":101,"/":102,"pathEltOrInverse":103,"pathSequence_repetition_plus0":104,"pathElt":105,"pathPrimary":106,"pathMod":107,"pathInverse":108,"^":109,"?":110,"+":111,"iriOrLiteralOrArray_repetition0":112,"literal":113,"iri_group0":114,"a":115,"string":116,"LANGTAG":117,"^^":118,"DECIMAL":119,"DOUBLE":120,"literal_group0":121,"string_group0":122,"string_group1":123,"shaclDoc_repetition1_group0":124,"constraint_group0_repetition_plus0":125,"TARGET":126,"propertyShape_repetition0_group0":127,"ATPNAME_LN":128,"ATPNAME_NS":129,"PNAME_LN":130,"KW_TRUE":131,"KW_FALSE":132,"STRING_LITERAL1":133,"STRING_LITERAL2":134,"STRING_LITERAL_LONG1":135,"STRING_LITERAL_LONG2":136,"$accept":0,"$end":1},
terminals_: {2:"error",7:"EOF",12:"KW_BASE",13:"IRIREF",14:"KW_IMPORTS",15:"KW_PREFIX",16:"PNAME_NS",20:"KW_SHAPE",25:"KW_SHAPE_CLASS",28:";",38:"(",40:")",42:",",44:"[",46:"]",48:"%",53:".",56:"{",58:"}",61:"->",67:"|",75:"=",85:"NODEKIND",87:"PARAM",90:"..",92:"INTEGER",93:"*",95:"@",96:"!",102:"/",109:"^",110:"?",111:"+",115:"a",117:"LANGTAG",118:"^^",119:"DECIMAL",120:"DOUBLE",126:"TARGET",128:"ATPNAME_LN",129:"ATPNAME_NS",130:"PNAME_LN",131:"KW_TRUE",132:"KW_FALSE",133:"STRING_LITERAL1",134:"STRING_LITERAL2",135:"STRING_LITERAL_LONG1",136:"STRING_LITERAL_LONG2"},
productions_: [0,[3,4],[8,1],[8,1],[8,1],[9,2],[10,2],[11,3],[17,1],[19,5],[24,4],[27,2],[29,2],[30,2],[32,2],[33,1],[33,1],[33,1],[37,3],[41,2],[43,1],[45,1],[36,3],[47,1],[49,1],[50,3],[51,1],[52,3],[6,1],[55,1],[57,1],[23,3],[60,2],[63,3],[66,2],[69,1],[70,1],[70,2],[68,1],[68,2],[72,3],[77,2],[80,2],[82,1],[82,2],[81,1],[81,2],[84,1],[84,1],[84,1],[84,3],[84,1],[88,5],[89,1],[91,1],[91,1],[86,1],[86,2],[73,1],[78,1],[98,2],[97,1],[97,2],[101,2],[99,1],[99,2],[105,1],[105,2],[103,1],[103,2],[108,1],[107,1],[107,1],[107,1],[106,1],[106,3],[76,1],[76,3],[35,1],[35,1],[18,1],[18,1],[18,1],[113,1],[113,2],[113,3],[113,1],[113,1],[113,1],[113,1],[116,1],[116,1],[4,0],[4,2],[124,1],[124,1],[5,0],[5,2],[21,0],[21,1],[22,0],[22,1],[26,0],[26,1],[31,0],[31,1],[34,0],[34,2],[39,0],[39,2],[54,0],[54,2],[59,0],[59,2],[62,1],[62,2],[125,1],[125,2],[64,1],[64,1],[65,0],[65,1],[71,1],[71,2],[74,1],[74,1],[127,1],[127,1],[79,0],[79,2],[83,1],[83,2],[94,1],[94,1],[100,1],[100,2],[104,1],[104,2],[112,0],[112,2],[114,1],[114,1],[121,1],[121,1],[122,1],[122,1],[123,1],[123,1]],
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
/* this == yyval */
var $0 = $$.length - 1;
switch (yystate) {
case 1:
this.$ = emit(Parser.factory.namedNode(resolveIRI('')), Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(OWL + 'Ontology'));
break;
case 5:
Parser.base = Parser.factory.namedNode($$[$0].slice(1, -1));
Parser.n3Parser._setBase(resolveIRI(Parser.base.value));
break;
case 6:
this.$ = emit(Parser.base, Parser.factory.namedNode(OWL + 'imports'), Parser.factory.namedNode($$[$0].slice(1, -1)));
break;
case 7:
this.$ = Parser.prefixes[$$[$0-1].substr(0, $$[$0-1].length - 1)] = resolveIRI($$[$0]);
break;
case 8:
Parser.nodeShapeStack = false
emit(Parser.currentNodeShape = $$[$0], Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(SH + 'NodeShape'))
break;
case 10:
this.$ = emit(Parser.currentNodeShape, Parser.factory.namedNode(RDF_TYPE), Parser.factory.namedNode(RDFS + 'Class'));
break;
case 11:
this.$ = ensureExtended();
break;
case 13:
this.$ = $$[$0].forEach(e => emit(Parser.currentNodeShape, $$[$0-1], e));
break;
case 14:
this.$ = [$$[$0-1], ...$$[$0]];
break;
case 18:
this.$ = addList($$[$0-1], true);
break;
case 19: case 34: case 42: case 60: case 63:
this.$ = $$[$0];
break;
case 20:
Parser.tempCurrentNodeShape = Parser.currentNodeShape;
this.$ = Parser.currentNodeShape = blank();
break;
case 21:
Parser.currentNodeShape = Parser.tempCurrentNodeShape;
break;
case 22: case 31:
this.$ = $$[$0-2];
break;
case 23:
Parser.tempCurrentNodeShape = Parser.currentNodeShape;
Parser.currentNodeShape = Parser.currentPropertyNode;
break;
case 24:
Parser.currentNodeShape = Parser.tempCurrentNodeShape
break;
case 26:
Parser.currentNodeShape = $$[$0]
break;
case 29:
if (!Parser.nodeShapeStack) {
Parser.nodeShapeStack = [];
} else {
Parser.nodeShapeStack.push(Parser.currentNodeShape);
emit(
// In the grammar a path signals the start of a new property declaration
Parser.currentPropertyNode,
Parser.factory.namedNode(SH + 'node'),
Parser.currentNodeShape = blank(),
)
}
this.$ = Parser.currentNodeShape;
break;
case 30:
if (Parser.nodeShapeStack.length > 0) {
Parser.currentNodeShape = Parser.nodeShapeStack.pop();
}
break;
case 32:
this.$ = $$[$0].forEach(node => { emit(Parser.currentNodeShape, Parser.factory.namedNode(SH + 'targetClass'), node) });
break;
case 35:
this.$ = emit(Parser.currentNodeShape, Parser.factory.namedNode(SH + $$[$0][0]), $$[$0][1]);
break;
case 36:
// console.log('ndoe not')
break;
case 37:
const o = addList([$$[$0-1], ...$$[$0]].map(elem => {
const x = blank();
emit(x, Parser.factory.namedNode(SH + elem[0]), elem[1]);
return x;
}))
this.$ = ['or', o]
break;
case 39: case 46:
this.$ = chainProperty('not', ...$$[$0]);
break;
case 40: case 50:
this.$ = [$$[$0-2], $$[$0]];
break;
case 43:
this.$ = $$[$0] && emitProperty(...$$[$0]);
break;
case 44:
this.$ = emitProperty(
'or',
addList([$$[$0-1], ...$$[$0]].map(elem => {
const x = blank();
emit(x, Parser.factory.namedNode(SH + elem[0]), elem[1]);
return x;
}))
)
break;
case 47:
this.$ = [datatypes[$$[$0].value] ? 'datatype' : 'class', $$[$0]];
break;
case 48:
this.$ = ['nodeKind', Parser.factory.namedNode(SH + $$[$0])];
break;
case 49:
this.$ = ['node', Parser.factory.namedNode($$[$0])];
break;
case 51:
this.$ = undefined //['node', $$[$0]];
break;
case 53:
this.$ = $$[$0] > 0 && emitProperty('minCount', createTypedLiteral($$[$0], XSD_INTEGER));
break;
case 54:
this.$ = emitProperty('maxCount', createTypedLiteral($$[$0], XSD_INTEGER));
break;
case 56:
this.$ = expandPrefix($$[$0].slice(1));
break;
case 57:
this.$ = resolveIRI($$[$0]);
break;
case 59:
emit(
// In the grammar a path signals the start of a new property declaration
Parser.currentNodeShape,
Parser.factory.namedNode(SH + 'property'),
Parser.currentPropertyNode = blank(),
)
emitProperty('path', $$[$0])
break;
case 62:
const n = blank();
emit(
n,
Parser.factory.namedNode(SH + 'alternativePath'),
addList([$$[$0-1], ...$$[$0]])
)
this.$ = n
break;
case 65:
this.$ = addList([$$[$0-1], ...$$[$0]]);
break;
case 67:
emit(this.$ = blank(), Parser.factory.namedNode(SH + $$[$0]), $$[$0-1])
break;
case 69:
emit(this.$ = blank(), Parser.factory.namedNode(SH + 'inversePath'), $$[$0])
break;
case 71:
this.$ = 'zeroOrOnePath';
break;
case 72:
this.$ = 'zeroOrMorePath';
break;
case 73:
this.$ = 'oneOrMorePath';
break;
case 75:
this.$ = $$[$0-1];
break;
case 77:
this.$ = addList($$[$0-1]);
break;
case 80:
this.$ = Parser.factory.namedNode(resolveIRI($$[$0]));
break;
case 81:
this.$ = Parser.factory.namedNode(expandPrefix($$[$0]));
break;
case 82:
this.$ = ensureExtended(Parser.factory.namedNode(RDF_TYPE));
break;
case 83:
this.$ = createTypedLiteral($$[$0]);
break;
case 84:
this.$ = createLangLiteral($$[$0-1], $$[$0].substr(1).toLowerCase());
break;
case 85:
this.$ = createTypedLiteral($$[$0-2], $$[$0]);
break;
case 86:
this.$ = createTypedLiteral($$[$0], XSD_INTEGER);
break;
case 87:
this.$ = createTypedLiteral($$[$0], XSD_DECIMAL);
break;
case 88:
this.$ = createTypedLiteral($$[$0].toLowerCase(), XSD_DOUBLE);
break;
case 89:
this.$ = createTypedLiteral($$[$0].toLowerCase(), XSD_BOOLEAN);
break;
case 90:
this.$ = unescapeString($$[$0], 1);
break;
case 91:
this.$ = unescapeString($$[$0], 3);
break;
case 92: case 96: case 106: case 108: case 110: case 112: case 128: case 138:
this.$ = [];
break;
case 93: case 97: case 107: case 109: case 111: case 113: case 115: case 117: case 123: case 129: case 131: case 135: case 137: case 139:
$$[$0-1].push($$[$0]);
break;
case 114: case 116: case 122: case 130: case 134: case 136:
this.$ = [$$[$0]];
break;
}
},
table: [o($V0,[2,92],{3:1,4:2}),{1:[3]},o($V1,[2,96],{5:3,8:4,9:5,10:6,11:7,12:[1,8],14:[1,9],15:[1,10]}),o($V2,[2,110],{6:11,124:12,54:13,19:14,24:15,20:[1,16],25:[1,17]}),o($V0,[2,93]),o($V0,[2,2]),o($V0,[2,3]),o($V0,[2,4]),{13:[1,18]},{13:[1,19]},{16:[1,20]},{7:[1,21]},o($V1,[2,97]),{7:[2,28],13:$V3,16:$V4,18:24,51:23,52:22,114:26,115:$V5,130:$V6},o($V1,[2,94]),o($V1,[2,95]),{13:$V3,16:$V4,17:30,18:31,114:26,115:$V5,130:$V6},{13:$V3,16:$V4,17:32,18:31,114:26,115:$V5,130:$V6},o($V0,[2,5]),o($V0,[2,6]),{13:[1,33]},{1:[2,1]},o($V2,[2,111]),{13:$V3,16:$V4,18:36,29:34,30:35,114:26,115:$V5,130:$V6},o($V7,[2,26]),o($V8,[2,80]),o($V8,[2,81]),o($V8,[2,82]),o($V8,[2,140]),o($V8,[2,141]),o($V9,[2,98],{21:37,60:38,61:[1,39]}),o([28,56,61],[2,8]),{26:40,27:41,28:$Va,56:[2,102]},o($V0,[2,7]),{53:[1,43]},o($Vb,[2,104],{31:44,27:45,28:$Va}),{13:$V3,16:$V4,18:51,32:46,33:47,35:48,36:49,37:50,38:$Vc,43:53,44:$Vd,92:$Ve,113:52,114:26,115:$V5,116:55,119:$Vf,120:$Vg,121:59,122:61,123:62,130:$V6,131:$Vh,132:$Vi,133:$Vj,134:$Vk,135:$Vl,136:$Vm},{22:69,27:70,28:$Va,56:[2,100]},o($V9,[2,99]),{13:$V3,16:$V4,18:72,62:71,114:26,115:$V5,130:$V6},{23:73,55:74,56:$Vn},{56:[2,103]},{13:$V3,16:$V4,18:36,29:76,30:35,114:26,115:$V5,130:$V6},o($V2,[2,27]),o($Vb,[2,12]),o($Vb,[2,105]),o($Vo,[2,13]),o($Vp,[2,106],{34:77}),o($Vq,[2,15]),o($Vq,[2,16]),o($Vq,[2,17]),o($Vr,[2,78]),o($Vr,[2,79]),{13:$V3,16:$V4,18:36,29:78,30:35,114:26,115:$V5,130:$V6},o($Vs,[2,108],{39:79}),o($Vr,[2,83],{117:[1,80],118:[1,81]}),o($Vr,[2,86]),o($Vr,[2,87]),o($Vr,[2,88]),o($Vr,[2,89]),o($V7,[2,20]),o($Vt,[2,90]),o($Vt,[2,91]),o($Vr,[2,142]),o($Vr,[2,143]),o($Vt,[2,144]),o($Vt,[2,145]),o($Vt,[2,146]),o($Vt,[2,147]),{23:82,55:74,56:$Vn},{56:[2,101]},o($V9,[2,32],{114:26,18:83,13:$V3,16:$V4,115:$V5,130:$V6}),o($Vu,[2,114]),o($V1,[2,10]),o($Vv,[2,112],{59:84}),o($Vv,[2,29]),o($Vb,[2,11]),o($Vo,[2,14],{41:85,42:[1,86]}),{45:87,46:[1,88]},{13:$V3,16:$V4,18:51,33:90,35:48,36:49,37:50,38:$Vc,40:[1,89],43:53,44:$Vd,92:$Ve,113:52,114:26,115:$V5,116:55,119:$Vf,120:$Vg,121:59,122:61,123:62,130:$V6,131:$Vh,132:$Vi,133:$Vj,134:$Vk,135:$Vl,136:$Vm},o($Vr,[2,84]),{13:$V3,16:$V4,18:91,114:26,115:$V5,130:$V6},o($V1,[2,9]),o($Vu,[2,115]),{13:$V3,16:$V4,18:115,38:$Vw,57:92,58:[1,94],63:93,64:95,68:102,69:98,70:100,72:104,73:105,74:107,77:97,78:99,87:$Vx,96:$Vy,97:101,99:103,103:106,105:109,106:113,108:110,109:$Vz,114:26,115:$V5,125:96,126:$VA,130:$V6},o($Vp,[2,107]),{13:$V3,16:$V4,18:51,33:117,35:48,36:49,37:50,38:$Vc,43:53,44:$Vd,92:$Ve,113:52,114:26,115:$V5,116:55,119:$Vf,120:$Vg,121:59,122:61,123:62,130:$V6,131:$Vh,132:$Vi,133:$Vj,134:$Vk,135:$Vl,136:$Vm},o($Vq,[2,22]),o($Vq,[2,21]),o($Vq,[2,18]),o($Vs,[2,109]),o($Vr,[2,85]),o($VB,[2,31]),o($Vv,[2,113]),o($VB,[2,30]),{47:120,48:[1,121],50:119,53:[2,120],65:118},o($VC,[2,118],{70:100,68:102,72:104,73:105,74:107,69:122,87:$Vx,96:$Vy,126:$VA}),o($VC,[2,119]),o($VD,[2,116]),o($VE,[2,128],{79:123}),o($VD,[2,35]),o($VE,[2,59]),o($VD,[2,36],{71:124,66:125,67:$VF}),o($VG,[2,61],{100:127,98:128,67:$VH}),o($VI,[2,38]),{72:130,74:107,87:$Vx,126:$VA},o($VJ,[2,64],{104:131,101:132,102:$VK}),{75:[1,134]},o([13,16,56,85,87,95,115,126,128,129,130],[2,58]),o($VL,[2,68]),{13:$V3,16:$V4,18:115,38:$Vw,105:135,106:113,114:26,115:$V5,130:$V6},{75:[2,124]},{75:[2,125]},o($VL,[2,66],{107:136,93:[1,138],110:[1,137],111:[1,139]}),o([13,16,38,115,130],[2,70]),o($VM,[2,74]),{13:$V3,16:$V4,18:115,38:$Vw,97:140,99:103,103:106,105:109,106:113,108:110,109:$Vz,114:26,115:$V5,130:$V6},o($Vp,[2,19]),{53:[1,141]},{53:[2,121]},{13:$V3,16:$V4,18:36,29:142,30:35,114:26,115:$V5,130:$V6},o($V7,[2,23]),o($VD,[2,117]),o($VC,[2,41],{114:26,55:74,127:143,88:144,82:145,81:147,84:148,73:149,18:150,86:152,23:154,94:155,13:$V3,16:$V4,44:[1,146],56:$Vn,85:$VN,87:$VO,95:$VP,96:$Vy,115:$V5,128:$VQ,129:$VR,130:$V6}),o($VD,[2,37],{66:159,67:$VF}),o($VI,[2,122]),{68:160,72:104,73:105,74:107,87:$Vx,96:$Vy,126:$VA},o($VG,[2,62],{98:161,67:$VH}),o($VJ,[2,134]),{13:$V3,16:$V4,18:115,38:$Vw,99:162,103:106,105:109,106:113,108:110,109:$Vz,114:26,115:$V5,130:$V6},o($VI,[2,39]),o($VJ,[2,65],{101:163,102:$VK}),o($VL,[2,136]),{13:$V3,16:$V4,18:115,38:$Vw,103:164,105:109,106:113,108:110,109:$Vz,114:26,115:$V5,130:$V6},{13:$V3,16:$V4,18:51,35:166,44:$VS,76:165,92:$Ve,113:52,114:26,115:$V5,116:55,119:$Vf,120:$Vg,121:59,122:61,123:62,130:$V6,131:$Vh,132:$Vi,133:$Vj,134:$Vk,135:$Vl,136:$Vm},o($VL,[2,69]),o($VL,[2,67]),o($VL,[2,71]),o($VL,[2,72]),o($VL,[2,73]),{40:[1,168]},o($Vv,[2,33]),{48:[1,170],49:169},o($VE,[2,129]),o($VE,[2,126]),o($VE,[2,127]),{89:171,92:[1,172]},o($VE,[2,43],{83:173,80:174,67:$VT}),o($VU,[2,45]),{13:$V3,16:$V4,18:150,23:154,55:74,56:$Vn,84:176,85:$VN,86:152,87:$VO,94:155,95:$VP,114:26,115:$V5,128:$VQ,129:$VR,130:$V6},o($VU,[2,47]),o($VU,[2,48]),o($VU,[2,49]),{75:[1,177]},o($VU,[2,51]),o($VU,[2,56]),{13:[1,178]},o($VU,[2,132]),o($VU,[2,133]),o($VI,[2,123]),o($VI,[2,34]),o($VJ,[2,135]),o($VJ,[2,60]),o($VL,[2,137]),o($VL,[2,63]),o($VI,[2,40]),o($VV,[2,76]),o($VW,[2,138],{112:179}),o($VM,[2,75]),{53:[2,25]},{53:[2,24]},{90:[1,180]},{90:[2,53]},o($VE,[2,44],{80:181,67:$VT}),o($VU,[2,130]),{13:$V3,16:$V4,18:150,23:154,55:74,56:$Vn,73:149,81:182,84:148,85:$VN,86:152,87:$VO,94:155,95:$VP,96:$Vy,114:26,115:$V5,128:$VQ,129:$VR,130:$V6},o($VU,[2,46]),{13:$V3,16:$V4,18:51,35:166,44:$VS,76:183,92:$Ve,113:52,114:26,115:$V5,116:55,119:$Vf,120:$Vg,121:59,122:61,123:62,130:$V6,131:$Vh,132:$Vi,133:$Vj,134:$Vk,135:$Vl,136:$Vm},o($VU,[2,57]),{13:$V3,16:$V4,18:51,35:185,46:[1,184],92:$Ve,113:52,114:26,115:$V5,116:55,119:$Vf,120:$Vg,121:59,122:61,123:62,130:$V6,131:$Vh,132:$Vi,133:$Vj,134:$Vk,135:$Vl,136:$Vm},{91:186,92:[1,187],93:[1,188]},o($VU,[2,131]),o($VU,[2,42]),o($VU,[2,50]),o($VV,[2,77]),o($VW,[2,139]),{46:[1,189]},{46:[2,54]},{46:[2,55]},o($VE,[2,52])],
defaultActions: {21:[2,1],41:[2,103],70:[2,101],111:[2,124],112:[2,125],119:[2,121],169:[2,25],170:[2,24],172:[2,53],187:[2,54],188:[2,55]},
parseError: function parseError (str, hash) {
if (hash.recoverable) {
this.trace(str);
} else {
var error = new Error(str);
error.hash = hash;
throw error;
}
},
parse: function parse(input) {
var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
var args = lstack.slice.call(arguments, 1);
var lexer = Object.create(this.lexer);
var sharedState = { yy: {} };
for (var k in this.yy) {
if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
sharedState.yy[k] = this.yy[k];
}
}
lexer.setInput(input, sharedState.yy);
sharedState.yy.lexer = lexer;
sharedState.yy.parser = this;
if (typeof lexer.yylloc == 'undefined') {
lexer.yylloc = {};
}
var yyloc = lexer.yylloc;
lstack.push(yyloc);
var ranges = lexer.options && lexer.options.ranges;
if (typeof sharedState.yy.parseError === 'function') {
this.parseError = sharedState.yy.parseError;
} else {
this.parseError = Object.getPrototypeOf(this).parseError;
}
function popStack(n) {
stack.length = stack.length - 2 * n;
vstack.length = vstack.length - n;
lstack.length = lstack.length - n;
}
_token_stack:
var lex = function () {
var token;
token = lexer.lex() || EOF;
if (typeof token !== 'number') {
token = self.symbols_[token] || token;
}
return token;
};
var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
while (true) {
state = stack[stack.length - 1];
if (this.defaultActions[state]) {
action = this.defaultActions[state];
} else {
if (symbol === null || typeof symbol == 'undefined') {
symbol = lex();
}
action = table[state] && table[state][symbol];
}
if (typeof action === 'undefined' || !action.length || !action[0]) {
var errStr = '';
expected = [];
for (p in table[state]) {
if (this.terminals_[p] && p > TERROR) {
expected.push('\'' + this.terminals_[p] + '\'');
}
}
if (lexer.showPosition) {
errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
} else {
errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
}
this.parseError(errStr, {
text: lexer.match,
token: this.terminals_[symbol] || symbol,
line: lexer.yylineno,
loc: yyloc,
expected: expected
});
}
if (action[0] instanceof Array && action.length > 1) {
throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
}
switch (action[0]) {
case 1:
stack.push(symbol);
vstack.push(lexer.yytext);
lstack.push(lexer.yylloc);
stack.push(action[1]);
symbol = null;
if (!preErrorSymbol) {
yyleng = lexer.yyleng;
yytext = lexer.yytext;
yylineno = lexer.yylineno;
yyloc = lexer.yylloc;
if (recovering > 0) {
recovering--;
}
} else {
symbol = preErrorSymbol;
preErrorSymbol = null;
}
break;
case 2:
len = this.productions_[action[1]][1];
yyval.$ = vstack[vstack.length - len];
yyval._$ = {
first_line: lstack[lstack.length - (len || 1)].first_line,
last_line: lstack[lstack.length - 1].last_line,
first_column: lstack[lstack.length - (len || 1)].first_column,
last_column: lstack[lstack.length - 1].last_column
};
if (ranges) {
yyval._$.range = [
lstack[lstack.length - (len || 1)].range[0],
lstack[lstack.length - 1].range[1]
];
}
r = this.performAction.apply(yyval, [
yytext,
yyleng,
yylineno,
sharedState.yy,
action[1],
vstack,
lstack
].concat(args));
if (typeof r !== 'undefined') {
return r;
}
if (len) {
stack = stack.slice(0, -1 * len * 2);
vstack = vstack.slice(0, -1 * len);
lstack = lstack.slice(0, -1 * len);
}
stack.push(this.productions_[action[1]][0]);
vstack.push(yyval.$);
lstack.push(yyval._$);
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
stack.push(newState);
break;
case 3:
return true;
}
}
return true;
}};
/*
Grammar specification for a SHACL compact
syntax parser.
Several functions are from <https://github.com/RubenVerborgh/SPARQL.js/>
*/
// Common namespaces and entities
const RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
RDF_TYPE = RDF + 'type',
RDF_FIRST = RDF + 'first',
RDF_REST = RDF + 'rest',
RDF_NIL = RDF + 'nil',
XSD = 'http://www.w3.org/2001/XMLSchema#',
XSD_INTEGER = XSD + 'integer',
XSD_DECIMAL = XSD + 'decimal',
XSD_DOUBLE = XSD + 'double',
XSD_BOOLEAN = XSD + 'boolean',
SH = 'http://www.w3.org/ns/shacl#',
OWL = 'http://www.w3.org/2002/07/owl#',
RDFS = 'http://www.w3.org/2000/01/rdf-schema#';
// TODO: Make sure all SPARQL supported datatypes are here
const datatypes = {
[XSD_INTEGER]: true,
[XSD_DECIMAL]: true,
[XSD + 'float']: true,
[XSD_DOUBLE]: true,
[XSD + 'string']: true,
[XSD_BOOLEAN]: true,
[XSD + 'dateTime']: true,
[XSD + 'nonPositiveInteger']: true,
[XSD + 'negativeInteger']: true,
[XSD + 'long']: true,
[XSD + 'int']: true,
[XSD + 'short']: true,
[XSD + 'byte']: true,
[XSD + 'nonNegativeInteger']: true,
[XSD + 'unsignedLong']: true,
[XSD + 'unsignedShort']: true,
[XSD + 'unsignedByte']: true,
[XSD + 'positiveInteger']: true,
[RDF + 'langString']: true
}
function addList(elems, ttlList = false) {
let i = 0, l = elems.length;
// TODO: Double check this behavior and see why it differes from the other l == 0 case
if (ttlList && l === 0) {
return Parser.factory.namedNode(RDF_NIL)
}
const list = head = blank();
if (l === 0) {
// TODO: see if this should be here
emit(head, Parser.factory.namedNode(RDF_REST), Parser.factory.namedNode(RDF_NIL))
}
elems.forEach(elem => {
if (elem === undefined) {
throw new Error('b')
}
emit(head, Parser.factory.namedNode(RDF_FIRST), elem)
emit(head, Parser.factory.namedNode(RDF_REST), head = ++i < l ? blank() : Parser.factory.namedNode(RDF_NIL))
})
return list;
}
// TODO: Port over any updates to this from SPARLQL.js
// Resolves an IRI against a base path
function resolveIRI(iri) {
// Strip off possible angular brackets and resolve the IRI
return Parser.n3Parser._resolveIRI(iri[0] === '<' ? iri.substring(1, iri.length - 1) : iri)
}
function expandPrefix(iri) {
const namePos = iri.indexOf(':'),
prefix = iri.substr(0, namePos),
expansion = Parser.prefixes[prefix];
if (!expansion) throw new Error('Unknown prefix: ' + prefix);
return resolveIRI(expansion + iri.substr(namePos + 1));
}
// Converts the string to a number
function toInt(string) {
return parseInt(string, 10);
}
// Creates a literal with the given value and type
function createTypedLiteral(value, type) {
if (type && type.termType !== 'NamedNode'){
type = Parser.factory.namedNode(type);
}
return Parser.factory.literal(value, type);
}
// Creates a literal with the given value and language
function createLangLiteral(value, lang) {
return Parser.factory.literal(value, lang);
}
// Creates a new blank node
function blank(name) {
if (typeof name === 'string') { // Only use name if a name is given
if (name.startsWith('e_')) return Parser.factory.blankNode(name);
return Parser.factory.blankNode('e_' + name);
}
return Parser.factory.blankNode('g_' + blankId++);
};
var blankId = 0;
Parser._resetBlanks = function () { blankId = 0; }
// Regular expression and replacement strings to escape strings
var escapeSequence = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\(.)/g,
escapeReplacements = { '\\': '\\', "'": "'", '"': '"',
't': '\t', 'b': '\b', 'n': '\n', 'r': '\r', 'f': '\f' },
fromCharCode = String.fromCharCode;
// Translates escape codes in the string into their textual equivalent
function unescapeString(string, trimLength) {
return Parser.n3Parser._lexer._unescape(string.substring(trimLength, string.length - trimLength));
}
function emit(s, p, o) {
if (!s.termType || !p.termType || p.value.includes(',') || !o.termType) {
throw new Error(`boo ${s.value} ${p.value} ${o.value}`)
}
Parser.onQuad(Parser.factory.quad(s, p, o))
}
function emitProperty(p, o) {
emit(Parser.currentPropertyNode, Parser.factory.namedNode(SH + p), o)
}
function chainProperty(name, p, o) {
const b = blank();
emit(b, Parser.factory.namedNode(SH + p), o);
return [name, b];
}
function ensureExtended(input) {
if (!Parser.extended) {
throw new Error('Encountered extended SHACLC syntax; but extended parsing is disabled')
}
return input
}
/* generated by jison-lex 0.3.4 */
var lexer = (function(){
var lexer = ({
EOF:1,
parseError:function parseError(str, hash) {
if (this.yy.parser) {
this.yy.parser.parseError(str, hash);
} else {
throw new Error(str);
}
},
// resets the lexer, sets new input
setInput:function (input, yy) {
this.yy = yy || this.yy || {};
this._input = input;
this._more = this._backtrack = this.done = false;
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
};
if (this.options.ranges) {
this.yylloc.range = [0,0];
}
this.offset = 0;
return this;
},
// consumes and returns one char from the input
input:function () {
var ch = this._input[0];
this.yytext += ch;
this.yyleng++;
this.offset++;
this.match += ch;
this.matched += ch;
var lines = ch.match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno++;
this.yylloc.last_line++;
} else {
this.yylloc.last_column++;
}
if (this.options.ranges) {
this.yylloc.range[1]++;
}
this._input = this._input.slice(1);
return ch;
},
// unshifts one char (or a string) into the input
unput:function (ch) {
var len = ch.length;
var lines = ch.split(/(?:\r\n?|\n)/g);
this._input = ch + this._input;
this.yytext = this.yytext.substr(0, this.yytext.length - len);
//this.yyleng -= len;
this.offset -= len;
var oldLines = 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);
if (lines.length - 1) {
this.yylineno -= lines.length - 1;
}
var r = this.yylloc.range;
this.yylloc = {
first_line: this.yylloc.first_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.first_column,
last_column: lines ?
(lines.length === oldLines.length ? this.yylloc.first_column : 0)
+ oldLines[oldLines.length - lines.length].length - lines[0].length :
this.yylloc.first_column - len
};
if (this.options.ranges) {
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
}
this.yyleng = this.yytext.length;
return this;
},
// When called from action, caches matched text and appends it on next action
more:function () {
this._more = true;
return this;
},
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
reject:function () {
if (this.options.backtrack_lexer) {
this._backtrack = true;
} else {
return 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
});
}
return this;
},
// retain first n characters of the match
less:function (n) {
this.unput(this.match.slice(n));
},
// displays already matched input, i.e. for error messages
pastInput:function () {
var past = this.matched.substr(0, this.matched.length - this.match.length);
return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
},
// displays upcoming input, i.e. for error messages
upcomingInput:function () {
var next = this.match;
if (next.length < 20) {
next += this._input.substr(0, 20-next.length);
}
return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
},
// displays the character position where the lexing error occurred, i.e. for error messages
showPosition:function () {
var pre = this.pastInput();
var c = new Array(pre.length + 1).join("-");
return pre + this.upcomingInput() + "\n" + c + "^";
},
// test the lexed token: return FALSE when not a match, otherwise return token
test_match:function(match, indexed_rule) {
var token,
lines,
backup;
if (this.options.backtrack_lexer) {
// save context
backup = {
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
};
if (this.options.ranges) {
backup.yylloc.range = this.yylloc.range.slice(0);
}
}
lines = match[0].match(/(?:\r\n?|\n).*/g);
if (lines) {
this.yylineno += lines.length;
}
this.yylloc = {
first_line: this.yylloc.last_line,
last_line: this.yylineno + 1,
first_column: this.yylloc.last_column,
last_column: lines ?
lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
this.yylloc.last_column + match[0].length
};
this.yytext += match[0];
this.match += match[0];
this.matches = match;
this.yyleng = this.yytext.length;
if (this.options.ranges) {
this.yylloc.range = [this.offset, this.offset += this.yyleng];
}
this._more = false;
this._backtrack = false;
this._input = this._input.slice(match[0].length);
this.matched += match[0];
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
if (this.done && this._input) {
this.done = false;
}
if (token) {
return token;
} else if (this._backtrack) {
// recover context
for (var k in backup) {
this[k] = backup[k];
}
return false; // rule action called reject() implying the next rule should be tested instead.
}
return false;
},
// return next match in input
next:function () {
if (this.done) {
return this.EOF;
}
if (!this._input) {
this.done = true;
}
var token,
match,
tempMatch,
index;
if (!this._more) {
this.yytext = '';
this.match = '';
}
var rules = this._currentRules();
for (var i = 0; i < rules.length; i++) {
tempMatch = this._input.match(this.rules[rules[i]]);
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
match = tempMatch;
index = i;
if (this.options.backtrack_lexer) {
token = this.test_match(tempMatch, rules[i]);
if (token !== false) {
return token;
} else if (this._backtrack) {
match = false;
continue; // rule action called reject() implying a rule MISmatch.
} else {
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
return false;
}
} else if (!this.options.flex) {
break;
}
}
}
if (match) {
token = this.test_match(match, rules[index]);
if (token !== false) {
return token;
}
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
return false;
}
if (this._input === "") {
return this.EOF;
} else {
return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
text: "",
token: null,
line: this.yylineno
});
}
},
// return next match that has a token
lex:function lex () {
var r = this.next();
if (r) {
return r;
} else {
return this.lex();
}
},
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
begin:function begin (condition) {
this.conditionStack.push(condition);
},
// pop the previously active lexer condition state off the condition stack
popState:function popState () {
var n = this.conditionStack.length - 1;
if (n > 0) {
return this.conditionStack.pop();
} else {
return this.conditionStack[0];
}
},
// produce the lexer rule set which is active for the currently active lexer condition state
_currentRules:function _currentRules () {
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
} else {
return this.conditions["INITIAL"].rules;
}
},
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
topState:function topState (n) {
n = this.conditionStack.length - 1 - Math.abs(n || 0);
if (n >= 0) {
return this.conditionStack[n];
} else {
return "INITIAL";
}
},
// alias for begin(condition)
pushState:function pushState (condition) {
this.begin(condition);
},
// return the number of states currently on the stack
stateStackSize:function stateStackSize() {
return this.conditionStack.length;
},
options: {"flex":true,"case-insensitive":true},
performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
var YYSTATE=YY_START;
switch($avoiding_name_collisions) {
case 0:/* ignore */
break;
case 1:return 12
break;
case 2:return 14
break;
case 3:return 15
break;
case 4:return 25
break;
case 5:return 20
break;
case 6:return 131
break;
case 7:return 132
break;
case 8:return 85
break;
case 9:return 126
break;
case 10:return 87
break;
case 11:return 'PASS'
break;
case 12:return 'COMMENT'
break;
case 13:return 13
break;
case 14:return 16
break;
case 15:return 130
break;
case 16:return 129
break;
case 17:return 128
break;
case 18:return 117
break;
case 19:return 92
break;
case 20:return 119
break;
case 21:return 120
break;
case 22:return 'EXPONENT'
break;
case 23:return 133
break;
case 24:return 134
break;
case 25:return 135
break;
case 26:return 136
break;
case 27:return 61
break;
case 28:return 90
break;
case 29:return 58
break;
case 30:return 56
break;
case 31:return 38
break;
case 32:return 40
break;
case 33:return 44
break;
case 34:return 46
break;
case 35:return 110
break;
case 36:return 93
break;
case 37:return 111
break;
case 38:return 67
break;
case 39:return 118
break;
case 40:return 53
break;
case 41:return 96
break;
case 42:return 102
break;
case 43:return 75
break;
case 44:return 95
break;
case 45:return 109
break;
case 46:return 28
break;
case 47:return 42
break;
case 48:return 48
break;
case 49:return 115
break;
case 50:return 7
break;
case 51:console.log(yy_.yytext);
break;
}
},
rules: [/^(?:\s+|#[^\n\r]*)/i,/^(?:BASE)/i,/^(?:IMPORTS)/i,/^(?:PREFIX)/i,/^(?:shapeClass)/i,/^(?:shape)/i,/^(?:true)/i,/^(?:false)/i,/^(?:(BlankNode|IRI|Literal|BlankNodeOrIRI|BlankNodeOrLiteral|IRIOrLiteral\b))/i,/^(?:(targetNode|targetObjectsOf|targetSubjectsOf\b))/i,/^(?:(deactivated|severity|message|class|datatype|nodeKind|minExclusive|minInclusive|maxExclusive|maxInclusive|minLength|maxLength|pattern|flags|languageIn|uniqueLang|equals|disjoint|lessThan|lessThanOrEquals|qualifiedValueShape|qualifiedMinCount|qualifiedMaxCount|qualifiedValueShapesDisjoint|closed|ignoredProperties|hasValue|in))/i,/^(?:([ \t\r\n]+))/i,/^(?:(#[\r\n]*))/i,/^(?:(<([^=<>\"\{\}\|\^`\\\u0000-\u0020]|(\\u([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])|\\U([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f])))*>))/i,/^(?:((([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])|_\b)|-|[0-9]|[\u00B7]|[\u0300-\u036F]|[\u203F-\u2040])|\.)*((([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])|_\b)|-|[0-9]|[\u00B7]|[\u0300-\u036F]|[\u203F-\u2040]))?)?:))/i,/^(?:(((([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])|_\b)|-|[0-9]|[\u00B7]|[\u0300-\u036F]|[\u203F-\u2040])|\.)*((([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])|_\b)|-|[0-9]|[\u00B7]|[\u0300-\u036F]|[\u203F-\u2040]))?)?:)(((([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])|_\b)|:|[0-9]|((%([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))((((([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])|_\b)|-|[0-9]|[\u00B7]|[\u0300-\u036F]|[\u203F-\u2040])|\.|:|((%([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*(((([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])|_\b)|-|[0-9]|[\u00B7]|[\u0300-\u036F]|[\u203F-\u2040])|:|((%([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%)))))?)))/i,/^(?:(@(([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])|_\b)|-|[0-9]|[\u00B7]|[\u0300-\u036F]|[\u203F-\u2040])|\.)*((([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])|_\b)|-|[0-9]|[\u00B7]|[\u0300-\u036F]|[\u203F-\u2040]))?)?:))/i,/^(?:(@((([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])|_\b)|-|[0-9]|[\u00B7]|[\u0300-\u036F]|[\u203F-\u2040])|\.)*((([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])|_\b)|-|[0-9]|[\u00B7]|[\u0300-\u036F]|[\u203F-\u2040]))?)?:)(((([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])|_\b)|:|[0-9]|((%([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))((((([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])|_\b)|-|[0-9]|[\u00B7]|[\u0300-\u036F]|[\u203F-\u2040])|\.|:|((%([0-9]|[A-F]|[a-f])([0-9]|[A-F]|[a-f]))|(\\(_|~|\.|-|!|\$|&|'|\(|\)|\*|\+|,|;|=|\/|\?|#|@|%))))*(((([A-Z]|[a-z]|[\u00C0-\u00D6]|