mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
36 lines
43 KiB
JavaScript
36 lines
43 KiB
JavaScript
|
/*
|
|||
|
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
|
|||
|
Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
|
|||
|
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
|
|||
|
Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
|
|||
|
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
|
|||
|
Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
|
|||
|
Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
|
|||
|
|
|||
|
Redistribution and use in source and binary forms, with or without
|
|||
|
modification, are permitted provided that the following conditions are met:
|
|||
|
|
|||
|
* Redistributions of source code must retain the above copyright
|
|||
|
notice, this list of conditions and the following disclaimer.
|
|||
|
* Redistributions in binary form must reproduce the above copyright
|
|||
|
notice, this list of conditions and the following disclaimer in the
|
|||
|
documentation and/or other materials provided with the distribution.
|
|||
|
|
|||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|||
|
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
*//*jslint bitwise:true plusplus:true *//*global esprima:true, define:true, exports:true, window: true,
|
|||
|
throwError: true, generateStatement: true, peek: true,
|
|||
|
parseAssignmentExpression: true, parseBlock: true, parseExpression: true,
|
|||
|
parseFunctionDeclaration: true, parseFunctionExpression: true,
|
|||
|
parseFunctionSourceElements: true, parseVariableIdentifier: true,
|
|||
|
parseLeftHandSideExpression: true,
|
|||
|
parseStatement: true, parseSourceElement: true */(function(e,t){"use strict";typeof define=="function"&&define.amd?define(["exports"],t):typeof exports!="undefined"?t(exports):t(e.esprima={})})(this,function(e){"use strict";function y(e,t){if(!e)throw new Error("ASSERT: "+t)}function b(e,t){return a.slice(e,t)}function w(e){return"0123456789".indexOf(e)>=0}function E(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function S(e){return"01234567".indexOf(e)>=0}function x(e){return e===" "||e===" "||e===""||e==="\f"||e===" "||e.charCodeAt(0)>=5760&&" ".indexOf(e)>=0}function T(e){return e==="\n"||e==="\r"||e==="\u2028"||e==="\u2029"}function N(e){return e==="$"||e==="_"||e==="\\"||e>="a"&&e<="z"||e>="A"&&e<="Z"||e.charCodeAt(0)>=128&&o.NonAsciiIdentifierStart.test(e)}function C(e){return e==="$"||e==="_"||e==="\\"||e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e.charCodeAt(0)>=128&&o.NonAsciiIdentifierPart.test(e)}function k(e){return["class","enum","export","extends","import","super"].indexOf(e)>=0}function L(e){return["implements","interface","package","private","protected","public","static","yield","let"].indexOf(e)>=0}function A(e){return e==="eval"||e==="arguments"}function O(e){if(f&&L(e))return!0;switch(e.length){case 2:return e==="if"||e==="in"||e==="do";case 3:return e==="var"||e==="for"||e==="new"||e==="try"||e==="let";case 4:return e==="this"||e==="else"||e==="case"||e==="void"||e==="with"||e==="enum";case 5:return e==="while"||e==="break"||e==="catch"||e==="throw"||e==="const"||e==="yield"||e==="class"||e==="super";case 6:return e==="return"||e==="typeof"||e==="delete"||e==="switch"||e==="export"||e==="import";case 7:return e==="default"||e==="finally"||e==="extends";case 8:return e==="function"||e==="continue"||e==="debugger";case 10:return e==="instanceof";default:return!1}}function M(){var e,t,n;t=!1,n=!1;while(l<p){e=a[l];if(n)e=a[l++],T(e)&&(n=!1,e==="\r"&&a[l]==="\n"&&++l,++c,h=l);else if(t)T(e)?(e==="\r"&&a[l+1]==="\n"&&++l,++c,++l,h=l,l>=p&&X({},s.UnexpectedToken,"ILLEGAL")):(e=a[l++],l>=p&&X({},s.UnexpectedToken,"ILLEGAL"),e==="*"&&(e=a[l],e==="/"&&(++l,t=!1)));else if(e==="/"){e=a[l+1];if(e==="/")l+=2,n=!0;else{if(e!=="*")break;l+=2,t=!0,l>=p&&X({},s.UnexpectedToken,"ILLEGAL")}}else if(x(e))++l;else{if(!T(e))break;++l,e==="\r"&&a[l]==="\n"&&++l,++c,h=l}}}function _(e){var t,n,r,i=0;n=e==="u"?4:2;for(t=0;t<n;++t){if(!(l<p&&E(a[l])))return"";r=a[l++],i=i*16+"0123456789abcdef".indexOf(r.toLowerCase())}return String.fromCharCode(i)}function D(){var e,t,n,r;e=t=a[l++],e==="\\"&&(a[l]!=="u"&&X({},s.UnexpectedToken,"ILLEGAL"),++l,n=l,e=_("u"),e?((e==="\\"||!N(e))&&X({},s.UnexpectedToken,"ILLEGAL"),t=e):(l=n,t="u"));while(l<p){e=a[l];if(!C(e))break;++l,t+=e,e==="\\"&&(t=t.substr(0,t.length-1),a[l]!=="u"&&X({},s.UnexpectedToken,"ILLEGAL"),++l,n=l,e=_("u"),e?((e==="\\"||!C(e))&&X({},s.UnexpectedToken,"ILLEGAL"),t+=e):(l=n,t+="u"))}return t}function P(){var e,t;e=l++;while(l<p){t=a[l];if(t==="\\")return l=e,D();if(!C(t))break;++l}return b(e,l)}function H(){var e,n,r;return e=l,N(a[l])||X({},s.UnexpectedToken,"ILLEGAL"),n=a[l]==="\\"?D():P(),n.length===1?r=t.Identifier:O(n)?r=t.Keyword:n==="null"?r=t.NullLiteral:n==="true"||n==="false"?r=t.BooleanLiteral:r=t.Identifier,{type:r,value:n,lineNumber:c,lineStart:h,range:[e,l]}}function B(){var e=l,n=a[l],r,i,o;if(n==="."||n==="("||n===")"||n===";"||n===","||n==="{"||n==="}"||n==="["||n==="]"||n===":"||n==="?"||n==="~")return++l,{type:t.Punctuator,value:n,lineNumber:c,lineStart:h,range:[e,l]};r=a[l+1],i=a[l+2],o=a[l+3];if(n===">"&&r===">"&&i===">"&&o==="=")return l+=4,{type:t.Punctuator,value:">>>=",lineNumber:c,lineStart:h,range:[e,l]};if(n==="="&&r==="="&&i==="=")return l+=3,{type:t.Punctuator,value:"===",lineNumber:c,lineStart:h,range:[e,l]};if(n==="!"&&r==="="&&i==="=")return l+=3,{type:t.Punctuator,value:"!==",lineNumber:c,lineStart:h,range:[e,l]};if(n===">"&&r===">"&&i===">")return l+=3,{type:t.Punctuator,value:">>>",lineNumber:c,lineStart:h,range:[e,l]};if(n==="<"&&r==="<"&&i==="=")return l+=3,{type:t.Punctua
|
|||
|
,UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode",AccessorDataProperty:"Object literal may not have data and accessor property with the same name",AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode"},o={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎<EFBFBD><EFBFBD>
|