diff options
author | Minteck <contact@minteck.org> | 2023-01-10 14:54:04 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2023-01-10 14:54:04 +0100 |
commit | 99c1d9af689e5325f3cf535c4007b3aeb8325229 (patch) | |
tree | e663b3c2ebdbd67c818ac0c5147f0ce1d2463cda /school/node_modules/xml-name-validator/lib | |
parent | 9871b03912fc28ad38b4037ebf26a78aa937baba (diff) | |
download | pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.tar.gz pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.tar.bz2 pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.zip |
Update - This is an automated commit
Diffstat (limited to 'school/node_modules/xml-name-validator/lib')
3 files changed, 556 insertions, 0 deletions
diff --git a/school/node_modules/xml-name-validator/lib/generated-parser.js b/school/node_modules/xml-name-validator/lib/generated-parser.js new file mode 100644 index 0000000..a62111a --- /dev/null +++ b/school/node_modules/xml-name-validator/lib/generated-parser.js @@ -0,0 +1,504 @@ +module.exports = (function(){function _waka(parser, startRule) { + if(startRule && ! parser.rules[startRule]) + throw new Error('start rule missing: ' + JSON.stringify(startRule)) + + return { + getState: function() { + return parser.state + }, + + getTrace: function(message) { + return (message ? message + '\n' : '') + parser.state.traceLine() + }, + + exec: function(input) { + if(! startRule) + throw new Error('no start rule given') + + parser.state.setInput(input) + + try { + var value = parser.rules[startRule]() + } + catch(err) { + var error = err + } + + if(error == null) { + if(! parser.state.adv || ! parser.state.isEOF()) + var error = new Error('Unexpected syntax in top') + } + + return { + success: error == null, + value: ! error ? value : undefined, + error: error + } + }, + + startWith: function(rule) { + return _waka(parser, rule) + }, + } +}; +return _waka((function(){'use strict'; +var _rules={}; +_rules.NameStartChar = function() { +var _R=_P.match(":"); +if(!_P.adv){ _P.adv=true; +var $0=_P.cur(); +if($0==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("A"<=$0&&$0<="Z"); +} +} +if(!_P.adv){ _P.adv=true; +var _R=_P.match("_"); +} +if(!_P.adv){ _P.adv=true; +var $1=_P.cur(); +if($1==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("a"<=$1&&$1<="z"); +} +} +if(!_P.adv){ _P.adv=true; +var $2=_P.cur(); +if($2==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u00C0"<=$2&&$2<="\u00D6"); +} +} +if(!_P.adv){ _P.adv=true; +var $3=_P.cur(); +if($3==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u00D8"<=$3&&$3<="\u00F6"); +} +} +if(!_P.adv){ _P.adv=true; +var $4=_P.cur(); +if($4==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u00F8"<=$4&&$4<="\u02FF"); +} +} +if(!_P.adv){ _P.adv=true; +var $5=_P.cur(); +if($5==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u0370"<=$5&&$5<="\u037D"); +} +} +if(!_P.adv){ _P.adv=true; +var $6=_P.cur(); +if($6==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u037F"<=$6&&$6<="\u1FFF"); +} +} +if(!_P.adv){ _P.adv=true; +var $7=_P.cur(); +if($7==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u200C"<=$7&&$7<="\u200D"); +} +} +if(!_P.adv){ _P.adv=true; +var $8=_P.cur(); +if($8==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u2070"<=$8&&$8<="\u218F"); +} +} +if(!_P.adv){ _P.adv=true; +var $9=_P.cur(); +if($9==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u2C00"<=$9&&$9<="\u2FEF"); +} +} +if(!_P.adv){ _P.adv=true; +var $a=_P.cur(); +if($a==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u3001"<=$a&&$a<="\uD7FF"); +} +} +if(!_P.adv){ _P.adv=true; +var $b=_P.cur(); +if($b==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\uF900"<=$b&&$b<="\uFDCF"); +} +} +if(!_P.adv){ _P.adv=true; +var $c=_P.cur(); +if($c==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\uFDF0"<=$c&&$c<="\uFFFD"); +} +} +if(!_P.adv){ _P.adv=true; +$d:{var $e=_P.pos; +var $f=_P.cur(); +if($f==null){_P.adv=false; +null; +}else{ +_P.step("\uD800"<=$f&&$f<="\uDB7F"); +} +if(!_P.adv) break $d; +var $g=_P.cur(); +if($g==null){_P.adv=false; +null; +}else{ +_P.step("\uDC00"<=$g&&$g<="\uDFFF"); +} +var _R=_P.doc.substring($e,_P.pos); +} +if(!_P.adv) _P.pos=$e; +} +return _R; +} +_rules.NameChar = function() { +var _R=_rules.NameStartChar(); +if(!_P.adv){ _P.adv=true; +var _R=_P.match("-"); +} +if(!_P.adv){ _P.adv=true; +var _R=_P.match("."); +} +if(!_P.adv){ _P.adv=true; +var $0=_P.cur(); +if($0==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("0"<=$0&&$0<="9"); +} +} +if(!_P.adv){ _P.adv=true; +var _R=_P.match("\u00B7"); +} +if(!_P.adv){ _P.adv=true; +var $1=_P.cur(); +if($1==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u0300"<=$1&&$1<="\u036F"); +} +} +if(!_P.adv){ _P.adv=true; +var $2=_P.cur(); +if($2==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u203F"<=$2&&$2<="\u2040"); +} +} +return _R; +} +_rules.Name = function() { +$0:{var $1=_P.pos; +_rules.NameStartChar(); +if(!_P.adv) break $0; +var $2=false; +for(;;) { +_rules.NameChar(); +if(!_P.adv) break; +$2=true; +}; _P.adv=true; +var _R=_P.doc.substring($1,_P.pos); +} +if(!_P.adv) _P.pos=$1; +return _R; +} +_rules.QName = function() { +var _R=_rules.PrefixedName(); +if(!_P.adv){ _P.adv=true; +var _R=_rules.UnprefixedName(); +} +return _R; +} +_rules.PrefixedName = function() { +$0:{var $1=_P.pos; +_rules.Prefix(); +if(!_P.adv) break $0; +_P.match(":"); +if(!_P.adv) break $0; +_rules.LocalPart(); +var _R=_P.doc.substring($1,_P.pos); +} +if(!_P.adv) _P.pos=$1; +return _R; +} +_rules.UnprefixedName = function() { +var _R=_rules.LocalPart(); +return _R; +} +_rules.Prefix = function() { +var _R=_rules.NCName(); +return _R; +} +_rules.LocalPart = function() { +var _R=_rules.NCName(); +return _R; +} +_rules.NCNameStartChar = function() { +var $0=_P.cur(); +if($0==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("A"<=$0&&$0<="Z"); +} +if(!_P.adv){ _P.adv=true; +var _R=_P.match("_"); +} +if(!_P.adv){ _P.adv=true; +var $1=_P.cur(); +if($1==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("a"<=$1&&$1<="z"); +} +} +if(!_P.adv){ _P.adv=true; +var $2=_P.cur(); +if($2==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u00C0"<=$2&&$2<="\u00D6"); +} +} +if(!_P.adv){ _P.adv=true; +var $3=_P.cur(); +if($3==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u00D8"<=$3&&$3<="\u00F6"); +} +} +if(!_P.adv){ _P.adv=true; +var $4=_P.cur(); +if($4==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u00F8"<=$4&&$4<="\u02FF"); +} +} +if(!_P.adv){ _P.adv=true; +var $5=_P.cur(); +if($5==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u0370"<=$5&&$5<="\u037D"); +} +} +if(!_P.adv){ _P.adv=true; +var $6=_P.cur(); +if($6==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u037F"<=$6&&$6<="\u1FFF"); +} +} +if(!_P.adv){ _P.adv=true; +var $7=_P.cur(); +if($7==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u200C"<=$7&&$7<="\u200D"); +} +} +if(!_P.adv){ _P.adv=true; +var $8=_P.cur(); +if($8==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u2070"<=$8&&$8<="\u218F"); +} +} +if(!_P.adv){ _P.adv=true; +var $9=_P.cur(); +if($9==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u2C00"<=$9&&$9<="\u2FEF"); +} +} +if(!_P.adv){ _P.adv=true; +var $a=_P.cur(); +if($a==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u3001"<=$a&&$a<="\uD7FF"); +} +} +if(!_P.adv){ _P.adv=true; +var $b=_P.cur(); +if($b==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\uF900"<=$b&&$b<="\uFDCF"); +} +} +if(!_P.adv){ _P.adv=true; +var $c=_P.cur(); +if($c==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\uFDF0"<=$c&&$c<="\uFFFD"); +} +} +if(!_P.adv){ _P.adv=true; +$d:{var $e=_P.pos; +var $f=_P.cur(); +if($f==null){_P.adv=false; +null; +}else{ +_P.step("\uD800"<=$f&&$f<="\uDB7F"); +} +if(!_P.adv) break $d; +var $g=_P.cur(); +if($g==null){_P.adv=false; +null; +}else{ +_P.step("\uDC00"<=$g&&$g<="\uDFFF"); +} +var _R=_P.doc.substring($e,_P.pos); +} +if(!_P.adv) _P.pos=$e; +} +return _R; +} +_rules.NCNameChar = function() { +var _R=_rules.NCNameStartChar(); +if(!_P.adv){ _P.adv=true; +var _R=_P.match("-"); +} +if(!_P.adv){ _P.adv=true; +var _R=_P.match("."); +} +if(!_P.adv){ _P.adv=true; +var $0=_P.cur(); +if($0==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("0"<=$0&&$0<="9"); +} +} +if(!_P.adv){ _P.adv=true; +var _R=_P.match("\u00B7"); +} +if(!_P.adv){ _P.adv=true; +var $1=_P.cur(); +if($1==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u0300"<=$1&&$1<="\u036F"); +} +} +if(!_P.adv){ _P.adv=true; +var $2=_P.cur(); +if($2==null){_P.adv=false; +var _R=null; +}else{ +var _R=_P.step("\u203F"<=$2&&$2<="\u2040"); +} +} +return _R; +} +_rules.NCName = function() { +$0:{var $1=_P.pos; +_rules.NCNameStartChar(); +if(!_P.adv) break $0; +var $2=false; +for(;;) { +_rules.NCNameChar(); +if(!_P.adv) break; +$2=true; +}; _P.adv=true; +var _R=_P.doc.substring($1,_P.pos); +} +if(!_P.adv) _P.pos=$1; +return _R; +} +function ParserState() { + this.doc = '' + this.pos = 0 + this.adv = true + + this.setInput = function(doc) { + this.doc = doc + this.pos = 0 + this.adv = true + } + + this.isEOF = function() { + return this.pos == this.doc.length + } + + this.cur = function() { + return _P.doc[_P.pos] + } + + this.match = function(str) { + if(_P.adv = _P.doc.substr(_P.pos, str.length) == str) { + _P.pos += str.length + return str + } + } + + this.step = function(flag) { + if(_P.adv = flag) { + _P.pos++ + return _P.doc[_P.pos - 1] + } + } + + this.unexpected = function(rule) { + throw new Error('Unexpected syntax in ' + rule) + } + + this.traceLine = function(pos) { + if(! pos) pos = _P.pos + + var from = _P.doc.lastIndexOf('\n', pos), to = _P.doc.indexOf('\n', pos) + + if(from == -1) + from = 0 + else + from++ + + if(to == -1) + to = pos.length + + var lineNo = _P.doc.substring(0, from).split('\n').length + var line = _P.doc.substring(from, to) + var pointer = Array(200).join(' ').substr(0, pos - from) + '^^^' + + return ( + 'Line ' + lineNo + ':\n' + + line + '\n' + + pointer + ) + } +} +var _P = new ParserState +return { + state: _P, + rules: _rules, +} +})(),null)})()
\ No newline at end of file diff --git a/school/node_modules/xml-name-validator/lib/grammar.pegjs b/school/node_modules/xml-name-validator/lib/grammar.pegjs new file mode 100644 index 0000000..0bcd608 --- /dev/null +++ b/school/node_modules/xml-name-validator/lib/grammar.pegjs @@ -0,0 +1,35 @@ +// http://www.w3.org/TR/xml/#NT-Name + +NameStartChar = ":" / [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] / [\uD800-\uDB7F][\uDC00-\uDFFF] ; + +// last clause above produced by https://mothereff.in/regexpu#%2F%5B%5Cu%7B10000%7D-%5Cu%7BEFFFF%7D%5D%2Fu + +NameChar = NameStartChar / "-" / "." / [0-9] / "\u00B7" / [\u0300-\u036F] / [\u203F-\u2040] ; + +Name = NameStartChar NameChar* ; + +// http://www.w3.org/TR/xml-names/#NT-QName + +QName = PrefixedName + / UnprefixedName ; + +PrefixedName = Prefix ":" LocalPart ; + +UnprefixedName = LocalPart ; + +Prefix = NCName ; + +LocalPart = NCName ; + +// http://www.w3.org/TR/xml-names/#NT-NCName +// Same as Name productions but removing the ":" from NCNameStartChar + +NCNameStartChar = [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] / [\uD800-\uDB7F][\uDC00-\uDFFF] ; + +NCNameChar = NCNameStartChar / "-" / "." / [0-9] / "\u00B7" / [\u0300-\u036F] / [\u203F-\u2040] ; + +NCName = NCNameStartChar NCNameChar* ; diff --git a/school/node_modules/xml-name-validator/lib/xml-name-validator.js b/school/node_modules/xml-name-validator/lib/xml-name-validator.js new file mode 100644 index 0000000..54695fa --- /dev/null +++ b/school/node_modules/xml-name-validator/lib/xml-name-validator.js @@ -0,0 +1,17 @@ +"use strict"; +const parser = require("./generated-parser.js"); + +exports.name = function (potentialName) { + return mapResult(parser.startWith("Name").exec(potentialName)); +}; + +exports.qname = function (potentialQname) { + return mapResult(parser.startWith("QName").exec(potentialQname)); +}; + +function mapResult(result) { + return { + success: result.success, + error: result.error && parser.getTrace(result.error.message) + }; +} |