mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-12-01 20:33:22 +03:00
3 lines
155 KiB
JavaScript
3 lines
155 KiB
JavaScript
|
module.exports=function(){function peg$subclass(child,parent){function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor}function SyntaxError(expected,found,offset,line,column){function buildMessage(expected,found){function stringEscape(s){function hex(ch){return ch.charCodeAt(0).toString(16).toUpperCase()}return s.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(ch){return"\\x0"+hex(ch)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(ch){return"\\x"+hex(ch)}).replace(/[\u0180-\u0FFF]/g,function(ch){return"\\u0"+hex(ch)}).replace(/[\u1080-\uFFFF]/g,function(ch){return"\\u"+hex(ch)})}var expectedDesc,foundDesc;switch(expected.length){case 0:expectedDesc="end of input";break;case 1:expectedDesc=expected[0];break;default:expectedDesc=expected.slice(0,-1).join(", ")+" or "+expected[expected.length-1]}foundDesc=found?'"'+stringEscape(found)+'"':"end of input";return"Expected "+expectedDesc+" but "+foundDesc+" found."}this.expected=expected;this.found=found;this.offset=offset;this.line=line;this.column=column;this.name="SyntaxError";this.message=buildMessage(expected,found)}peg$subclass(SyntaxError,Error);function parse(input){var options=arguments.length>1?arguments[1]:{},peg$startRuleFunctions={TypeExpression:peg$parseTypeExpression},peg$startRuleFunction=peg$parseTypeExpression,peg$c0=null,peg$c1="",peg$c2=function(unk){return unk},peg$c3="?",peg$c4='"?"',peg$c5="!",peg$c6='"!"',peg$c7=function(prefix,expr,postfix){if(prefix!==""&&postfix!==""){return null}[prefix,postfix].forEach(function(modifier){if(modifier!==""){expr.nullable=modifier==="?"?true:false}});return expr},peg$c8=function(repeat,lit,opt){var result=lit;if(opt.optional){result.optional=true}if(repeat.repeatable){result.repeatable=true}return result},peg$c9="*",peg$c10='"*"',peg$c11=function(){return{type:Types.AllLiteral}},peg$c12=function(){return{type:Types.NullLiteral}},peg$c13=function(){return{type:Types.UndefinedLiteral}},peg$c14="...",peg$c15='"..."',peg$c16=function(){return{repeatable:true}},peg$c17="=",peg$c18='"="',peg$c19=function(){return{optional:true}},peg$c20="[]",peg$c21='"[]"',peg$c22=function(name){var result;if(!options.jsdoc){return null}result={type:Types.TypeApplication,expression:{type:Types.NameExpression,name:"Array"},applications:[name]};result.applications[0].type=Types.NameExpression;return result},peg$c23=function(exp,appl,opt){var result={};var nameExp={type:Types.NameExpression,name:exp.name};if(appl.length){result.type=Types.TypeApplication;result.expression=nameExp;result.applications=appl}else{result=nameExp}if(exp.repeatable){result.repeatable=true}if(opt.optional){result.optional=true}return result},peg$c24=function(name){if(!options.jsdoc){return null}return name},peg$c25=function(exp,opt){var result={type:Types.NameExpression,name:exp.name,reservedWord:true};if(exp.repeatable){result.repeatable=true}if(opt.optional){result.optional=true}return result},peg$c26=".",peg$c27='"."',peg$c28="<",peg$c29='"<"',peg$c30=">",peg$c31='">"',peg$c32=function(sep,l){if(sep===""&&!options.jsdoc){return null}return l},peg$c33=[],peg$c34=",",peg$c35='","',peg$c36=function(expr,list){var result=[expr];for(var i=0,l=list.length;i<l;i++){result.push(list[i][3])}return result},peg$c37="function",peg$c38='"function"',peg$c39=function(sig,opt){if(!sig&&!options.jsdoc){return null}else if(typeof sig!=="object"){sig={params:[]}}var result={type:Types.FunctionType};Object.keys(sig).forEach(function(key){result[key]=sig[key]});if(opt.optional){result.optional=true}return result},peg$c40="(",peg$c41='"("',peg$c42=")",peg$c43='")"',peg$c44=":",peg$c45='":"',peg$c46=function(sig,returns){var result={};result.params=sig.params||[];if(sig["new"]){result["new"]=sig["new"]}if(sig["this"]){result["this"]=sig["this"]}if(returns&&returns[3]){result.result=returns[3]}return result},peg$c47=function(funcNew,funcThis,params){var result={params:params!==""?params[3]:[],"new":funcNew};if(f
|
||
|
},peg$c254=function(seq){return seq},peg$c255="\n",peg$c256='"\\n"',peg$c257="\r",peg$c258='"\\r"',peg$c259="\u2028",peg$c260='"\\u2028"',peg$c261="\u2029",peg$c262='"\\u2029"',peg$c263="\r\n",peg$c264='"\\r\\n"',peg$c265=function(){return"0"},peg$c266=/^['"\\bfnrtv]/,peg$c267="['\"\\\\bfnrtv]",peg$c268=function(c){return c},peg$c269="x",peg$c270='"x"',peg$c271="any character",peg$c272=function(seq){return seq},peg$c273="whitespace",peg$c274="empty",peg$c275=/^[\t\x0B\f \xA0\uFEFF]/,peg$c276="[\\t\\x0B\\f \\xA0\\uFEFF]",peg$currPos=0,peg$reportedPos=0,peg$cachedPos=0,peg$cachedPosDetails={line:1,column:1,seenCR:false},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$reportedPos,peg$currPos)}function offset(){return peg$reportedPos}function line(){return peg$computePosDetails(peg$reportedPos).line}function column(){return peg$computePosDetails(peg$reportedPos).column}function peg$computePosDetails(pos){function advance(details,pos){var p,ch;for(p=0;p<pos;p++){ch=input.charAt(p);if(ch==="\n"){if(!details.seenCR){details.line++}details.column=1;details.seenCR=false}else if(ch==="\r"||ch==="\u2028"||ch==="\u2029"){details.line++;details.column=1;details.seenCR=true}else{details.column++;details.seenCR=false}}}if(peg$cachedPos!==pos){if(peg$cachedPos>pos){peg$cachedPos=0;peg$cachedPosDetails={line:1,column:1,seenCR:false}}peg$cachedPos=pos;advance(peg$cachedPosDetails,peg$cachedPos)}return peg$cachedPosDetails}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$cleanupExpected(expected){var i=0;expected.sort();while(i<expected.length){if(expected[i-1]===expected[i]){expected.splice(i,1)}else{i++}}}function peg$parseTypeExpression(){var s0,s1,s2,s3;s0=peg$currPos;s1=peg$parseUnknownLiteral();if(s1!==null){s2=peg$currPos;peg$silentFails++;s3=peg$parseBasicTypeExpression();peg$silentFails--;if(s3===null){s2=peg$c1}else{peg$currPos=s2;s2=peg$c0}if(s2!==null){peg$reportedPos=s0;s1=peg$c2(s1);if(s1===null){peg$currPos=s0;s0=s1}else{s0=s1}}else{peg$currPos=s0;s0=peg$c0}}else{peg$currPos=s0;s0=peg$c0}if(s0===null){s0=peg$currPos;if(input.charCodeAt(peg$currPos)===63){s1=peg$c3;peg$currPos++}else{s1=null;if(peg$silentFails===0){peg$fail(peg$c4)}}if(s1===null){if(input.charCodeAt(peg$currPos)===33){s1=peg$c5;peg$currPos++}else{s1=null;if(peg$silentFails===0){peg$fail(peg$c6)}}}if(s1===null){s1=peg$c1}if(s1!==null){s2=peg$parseBasicTypeExpression();if(s2!==null){if(input.charCodeAt(peg$currPos)===63){s3=peg$c3;peg$currPos++}else{s3=null;if(peg$silentFails===0){peg$fail(peg$c4)}}if(s3===null){if(input.charCodeAt(peg$currPos)===33){s3=peg$c5;peg$currPos++}else{s3=null;if(peg$silentFails===0){peg$fail(peg$c6)}}}if(s3===null){s3=peg$c1}if(s3!==null){peg$reportedPos=s0;s1=peg$c7(s1,s2,s3);if(s1===null){peg$currPos=s0;s0=s1}else{s0=s1}}else{peg$currPos=s0;s0=peg$c0}}else{peg$currPos=s0;s0=peg$c0}}else{peg$currPos=s0;s0=peg$c0}}return s0}function peg$parseBasicTypeExpression(){var s0;s0=peg$parseTypeUnion();if(s0===null){s0=peg$parseFunctionType();if(s0===null){s0=peg$parseRecordType();if(s0===null){s0=peg$parseLiteralType();if(s0===null){s0=peg$parseNameExpressionType()}}}}return s0}function peg$parseRestrictedTypeExpression(){var s0;s0=peg$parseFunctionType();if(s0===null){s0=peg$parseRecordType();if(s0===null){s0=peg$parseLiteralType();if(s0===null){s0=peg$parseNameExpressionType()}}}return s0}function peg$parseLiteralType(){var s0,s1,s2,s3;s0=peg$currPos;s1=peg$parseRepeatable();if(s1===null){s1=peg$c1}if(s1!==null){s2=peg$parseLiteral();if(s2!==null){s3=peg$parseOptional();if(s3===null){s3=peg$c1}if(s3!==null){peg$reportedPos=s0;s1=peg$c8(s1,s2,s3);if(s1===null){peg$currPos=s0;s0=s1}else{s0=s1}}else{peg$currPos=s0;s0=peg$c0
|
||
|
}}if(s5!==null){peg$reportedPos=s0;s1=peg$c105(s3);if(s1===null){peg$currPos=s0;s0=s1}else{s0=s1}}else{peg$currPos=s0;s0=peg$c0}}else{peg$currPos=s0;s0=peg$c0}}else{peg$currPos=s0;s0=peg$c0}}else{peg$currPos=s0;s0=peg$c0}}else{peg$currPos=s0;s0=peg$c0}if(s0===null){s0=peg$parseIdentifierPart()}}return s0}function peg$parseReservedWord(){var s0;s0=peg$parseKeyword();if(s0===null){s0=peg$parseFutureReservedWord();if(s0===null){s0=peg$parseNullLiteral();if(s0===null){s0=peg$parseBooleanLiteral()}}}return s0}function peg$parseKeyword(){var s0,s1,s2,s3;s0=peg$currPos;s1=peg$currPos;if(input.substr(peg$currPos,5)===peg$c106){s2=peg$c106;peg$currPos+=5}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c107)}}if(s2===null){if(input.substr(peg$currPos,4)===peg$c108){s2=peg$c108;peg$currPos+=4}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c109)}}if(s2===null){if(input.substr(peg$currPos,5)===peg$c110){s2=peg$c110;peg$currPos+=5}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c111)}}if(s2===null){if(input.substr(peg$currPos,8)===peg$c112){s2=peg$c112;peg$currPos+=8}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c113)}}if(s2===null){if(input.substr(peg$currPos,8)===peg$c114){s2=peg$c114;peg$currPos+=8}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c115)}}if(s2===null){if(input.substr(peg$currPos,7)===peg$c116){s2=peg$c116;peg$currPos+=7}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c117)}}if(s2===null){if(input.substr(peg$currPos,6)===peg$c118){s2=peg$c118;peg$currPos+=6}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c119)}}if(s2===null){if(input.substr(peg$currPos,2)===peg$c120){s2=peg$c120;peg$currPos+=2}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c121)}}if(s2===null){if(input.substr(peg$currPos,4)===peg$c122){s2=peg$c122;peg$currPos+=4}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c123)}}if(s2===null){if(input.substr(peg$currPos,7)===peg$c124){s2=peg$c124;peg$currPos+=7}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c125)}}if(s2===null){if(input.substr(peg$currPos,3)===peg$c126){s2=peg$c126;peg$currPos+=3}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c127)}}if(s2===null){if(input.substr(peg$currPos,8)===peg$c37){s2=peg$c37;peg$currPos+=8}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c38)}}if(s2===null){if(input.substr(peg$currPos,2)===peg$c128){s2=peg$c128;peg$currPos+=2}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c129)}}if(s2===null){if(input.substr(peg$currPos,2)===peg$c130){s2=peg$c130;peg$currPos+=2}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c131)}}if(s2===null){if(input.substr(peg$currPos,10)===peg$c132){s2=peg$c132;peg$currPos+=10}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c133)}}if(s2===null){if(input.substr(peg$currPos,3)===peg$c50){s2=peg$c50;peg$currPos+=3}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c51)}}if(s2===null){if(input.substr(peg$currPos,6)===peg$c134){s2=peg$c134;peg$currPos+=6}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c135)}}if(s2===null){if(input.substr(peg$currPos,6)===peg$c136){s2=peg$c136;peg$currPos+=6}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c137)}}if(s2===null){if(input.substr(peg$currPos,4)===peg$c53){s2=peg$c53;peg$currPos+=4}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c54)}}if(s2===null){if(input.substr(peg$currPos,5)===peg$c138){s2=peg$c138;peg$currPos+=5}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c139)}}if(s2===null){if(input.substr(peg$currPos,3)===peg$c140){s2=peg$c140;peg$currPos+=3}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c141)}}if(s2===null){if(input.substr(peg$currPos,6)===peg$c142){s2=peg$c142;peg$currPos+=6}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c143)}}if(s2===null){if(input.substr(peg$currPos,3)===peg$c144){s2=peg$c144;peg$currPos+=3}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c145)}}if(s2===null){if(input.substr(peg$currPos,4)===peg$c146){s2=peg$c146;peg$currPos+=4}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c147)}}if(s2===null){if(input.substr(peg$currPos,5)===peg$c148){s2=peg$c148;peg$currPos+=5}else{s2=null;if(peg$silentFails===0){peg$fail(peg$c149)}}if(s2==
|