OLD | NEW |
1 Object.isEmpty=function(obj) | 1 Object.isEmpty=function(obj) |
2 {for(var i in obj) | 2 {for(var i in obj) |
3 return false;return true;} | 3 return false;return true;} |
4 Object.values=function(obj) | 4 Object.values=function(obj) |
5 {var result=Object.keys(obj);var length=result.length;for(var i=0;i<length;++i) | 5 {var result=Object.keys(obj);var length=result.length;for(var i=0;i<length;++i) |
6 result[i]=obj[result[i]];return result;} | 6 result[i]=obj[result[i]];return result;} |
7 String.prototype.findAll=function(string) | 7 String.prototype.findAll=function(string) |
8 {var matches=[];var i=this.indexOf(string);while(i!==-1){matches.push(i);i=this.
indexOf(string,i+string.length);} | 8 {var matches=[];var i=this.indexOf(string);while(i!==-1){matches.push(i);i=this.
indexOf(string,i+string.length);} |
9 return matches;} | 9 return matches;} |
10 String.prototype.lineEndings=function() | 10 String.prototype.lineEndings=function() |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 function maybeBackup(stream,pat,style){var cur=stream.current();var close=cur.se
arch(pat),m;if(close>-1)stream.backUp(cur.length-close);else if(m=cur.match(/<\/
?$/)){stream.backUp(cur.length);if(!stream.match(pat,false))stream.match(cur[0])
;} | 437 function maybeBackup(stream,pat,style){var cur=stream.current();var close=cur.se
arch(pat),m;if(close>-1)stream.backUp(cur.length-close);else if(m=cur.match(/<\/
?$/)){stream.backUp(cur.length);if(!stream.match(pat,false))stream.match(cur[0])
;} |
438 return style;} | 438 return style;} |
439 function script(stream,state){if(stream.match(/^<\/\s*script\s*>/i,false)){state
.token=html;state.localState=state.localMode=null;return html(stream,state);} | 439 function script(stream,state){if(stream.match(/^<\/\s*script\s*>/i,false)){state
.token=html;state.localState=state.localMode=null;return html(stream,state);} |
440 return maybeBackup(stream,/<\/\s*script\s*>/,state.localMode.token(stream,state.
localState));} | 440 return maybeBackup(stream,/<\/\s*script\s*>/,state.localMode.token(stream,state.
localState));} |
441 function css(stream,state){if(stream.match(/^<\/\s*style\s*>/i,false)){state.tok
en=html;state.localState=state.localMode=null;return html(stream,state);} | 441 function css(stream,state){if(stream.match(/^<\/\s*style\s*>/i,false)){state.tok
en=html;state.localState=state.localMode=null;return html(stream,state);} |
442 return maybeBackup(stream,/<\/\s*style\s*>/,cssMode.token(stream,state.localStat
e));} | 442 return maybeBackup(stream,/<\/\s*style\s*>/,cssMode.token(stream,state.localStat
e));} |
443 return{startState:function(){var state=htmlMode.startState();return{token:html,l
ocalMode:null,localState:null,htmlState:state};},copyState:function(state){if(st
ate.localState) | 443 return{startState:function(){var state=htmlMode.startState();return{token:html,l
ocalMode:null,localState:null,htmlState:state};},copyState:function(state){if(st
ate.localState) |
444 var local=CodeMirror.copyState(state.localMode,state.localState);return{token:st
ate.token,localMode:state.localMode,localState:local,htmlState:CodeMirror.copySt
ate(htmlMode,state.htmlState)};},token:function(stream,state){return state.token
(stream,state);},indent:function(state,textAfter){if(!state.localMode||/^\s*<\//
.test(textAfter)) | 444 var local=CodeMirror.copyState(state.localMode,state.localState);return{token:st
ate.token,localMode:state.localMode,localState:local,htmlState:CodeMirror.copySt
ate(htmlMode,state.htmlState)};},token:function(stream,state){return state.token
(stream,state);},indent:function(state,textAfter){if(!state.localMode||/^\s*<\//
.test(textAfter)) |
445 return htmlMode.indent(state.htmlState,textAfter);else if(state.localMode.indent
) | 445 return htmlMode.indent(state.htmlState,textAfter);else if(state.localMode.indent
) |
446 return state.localMode.indent(state.localState,textAfter);else | 446 return state.localMode.indent(state.localState,textAfter);else |
447 return CodeMirror.Pass;},electricChars:"/{}:",innerMode:function(state){return{s
tate:state.localState||state.htmlState,mode:state.localMode||htmlMode};}};},"xml
","javascript","css");CodeMirror.defineMIME("text/html","htmlmixed");;WebInspect
or={};WebInspector.CodeMirrorUtils={createTokenizer:function(mimeType) | 447 return CodeMirror.Pass;},electricChars:"/{}:",innerMode:function(state){return{s
tate:state.localState||state.htmlState,mode:state.localMode||htmlMode};}};},"xml
","javascript","css");CodeMirror.defineMIME("text/html","htmlmixed");;WebInspect
or={};FormatterWorker={};WebInspector.CodeMirrorUtils={createTokenizer:function(
mimeType) |
448 {var mode=CodeMirror.getMode({indentUnit:2},mimeType);var state=CodeMirror.start
State(mode);function tokenize(line,callback) | 448 {var mode=CodeMirror.getMode({indentUnit:2},mimeType);var state=CodeMirror.start
State(mode);function tokenize(line,callback) |
449 {var stream=new CodeMirror.StringStream(line);while(!stream.eol()){var style=mod
e.token(stream,state);var value=stream.current();callback(value,style,stream.sta
rt,stream.start+value.length);stream.start=stream.pos;}} | 449 {var stream=new CodeMirror.StringStream(line);while(!stream.eol()){var style=mod
e.token(stream,state);var value=stream.current();callback(value,style,stream.sta
rt,stream.start+value.length);stream.start=stream.pos;}} |
450 return tokenize;},convertTokenType:function(tokenType) | 450 return tokenize;},convertTokenType:function(tokenType) |
451 {if(tokenType.startsWith("js-variable")||tokenType.startsWith("js-property")||to
kenType==="js-def") | 451 {if(tokenType.startsWith("js-variable")||tokenType.startsWith("js-property")||to
kenType==="js-def") |
452 return"javascript-ident";if(tokenType==="js-string-2") | 452 return"javascript-ident";if(tokenType==="js-string-2") |
453 return"javascript-regexp";if(tokenType==="js-number"||tokenType==="js-comment"||
tokenType==="js-string"||tokenType==="js-keyword") | 453 return"javascript-regexp";if(tokenType==="js-number"||tokenType==="js-comment"||
tokenType==="js-string"||tokenType==="js-keyword") |
454 return"javascript-"+tokenType.substring("js-".length);return null;},overrideMode
WithPrefixedTokens:function(modeName,tokenPrefix) | 454 return"javascript-"+tokenType.substring("js-".length);if(tokenType==="css-number
") |
| 455 return"css-number";return null;},overrideModeWithPrefixedTokens:function(modeNam
e,tokenPrefix) |
455 {var oldModeName=modeName+"-old";if(CodeMirror.modes[oldModeName]) | 456 {var oldModeName=modeName+"-old";if(CodeMirror.modes[oldModeName]) |
456 return;CodeMirror.defineMode(oldModeName,CodeMirror.modes[modeName]);CodeMirror.
defineMode(modeName,modeConstructor);function modeConstructor(config,parserConfi
g) | 457 return;CodeMirror.defineMode(oldModeName,CodeMirror.modes[modeName]);CodeMirror.
defineMode(modeName,modeConstructor);function modeConstructor(config,parserConfi
g) |
457 {var innerConfig={};for(var i in parserConfig) | 458 {var innerConfig={};for(var i in parserConfig) |
458 innerConfig[i]=parserConfig[i];innerConfig.name=oldModeName;var codeMirrorMode=C
odeMirror.getMode(config,innerConfig);codeMirrorMode.name=modeName;codeMirrorMod
e.token=tokenOverride.bind(this,codeMirrorMode.token);return codeMirrorMode;} | 459 innerConfig[i]=parserConfig[i];innerConfig.name=oldModeName;var codeMirrorMode=C
odeMirror.getMode(config,innerConfig);codeMirrorMode.name=modeName;codeMirrorMod
e.token=tokenOverride.bind(this,codeMirrorMode.token);return codeMirrorMode;} |
459 function tokenOverride(superToken,stream,state) | 460 function tokenOverride(superToken,stream,state) |
460 {var token=superToken(stream,state);return token?tokenPrefix+token:token;}}} | 461 {var token=superToken(stream,state);return token?tokenPrefix+token:token;}}} |
461 WebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("css-base","css-");W
ebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("javascript","js-");W
ebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("xml","xml-");;onmess
age=function(event){if(!event.data.method) | 462 WebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("css-base","css-");W
ebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("javascript","js-");W
ebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("xml","xml-");;var on
message=function(event){if(!event.data.method) |
462 return;self[event.data.method](event.data.params);};function format(params) | 463 return;FormatterWorker[event.data.method](event.data.params);};FormatterWorker.f
ormat=function(params) |
463 {var indentString=params.indentString||" ";var result={};if(params.mimeType==
="text/html"){var formatter=new HTMLScriptFormatter(indentString);result=formatt
er.format(params.content);}else{result.mapping={original:[0],formatted:[0]};resu
lt.content=formatScript(params.content,result.mapping,0,0,indentString);} | 464 {var indentString=params.indentString||" ";var result={};if(params.mimeType==
="text/html"){var formatter=new FormatterWorker.HTMLFormatter(indentString);resu
lt=formatter.format(params.content);}else if(params.mimeType==="text/css"){resul
t.mapping={original:[0],formatted:[0]};result.content=FormatterWorker._formatCSS
(params.content,result.mapping,0,0,indentString);}else{result.mapping={original:
[0],formatted:[0]};result.content=FormatterWorker._formatScript(params.content,r
esult.mapping,0,0,indentString);} |
464 postMessage(result);} | 465 postMessage(result);} |
465 function getChunkCount(totalLength,chunkSize) | 466 FormatterWorker._chunkCount=function(totalLength,chunkSize) |
466 {if(totalLength<=chunkSize) | 467 {if(totalLength<=chunkSize) |
467 return 1;var remainder=totalLength%chunkSize;var partialLength=totalLength-remai
nder;return(partialLength/chunkSize)+(remainder?1:0);} | 468 return 1;var remainder=totalLength%chunkSize;var partialLength=totalLength-remai
nder;return(partialLength/chunkSize)+(remainder?1:0);} |
468 function outline(params) | 469 FormatterWorker.outline=function(params) |
469 {const chunkSize=100000;const totalLength=params.content.length;const lines=para
ms.content.split("\n");const chunkCount=getChunkCount(totalLength,chunkSize);var
outlineChunk=[];var previousIdentifier=null;var previousToken=null;var previous
TokenType=null;var currentChunk=1;var processedChunkCharacters=0;var addedFuncti
on=false;var isReadingArguments=false;var argumentsText="";var currentFunction=n
ull;var tokenizer=WebInspector.CodeMirrorUtils.createTokenizer("text/javascript"
);for(var i=0;i<lines.length;++i){var line=lines[i];function processToken(tokenV
alue,tokenType,column,newColumn) | 470 {const chunkSize=100000;const totalLength=params.content.length;const lines=para
ms.content.split("\n");const chunkCount=FormatterWorker._chunkCount(totalLength,
chunkSize);var outlineChunk=[];var previousIdentifier=null;var previousToken=nul
l;var previousTokenType=null;var currentChunk=1;var processedChunkCharacters=0;v
ar addedFunction=false;var isReadingArguments=false;var argumentsText="";var cur
rentFunction=null;var tokenizer=WebInspector.CodeMirrorUtils.createTokenizer("te
xt/javascript");for(var i=0;i<lines.length;++i){var line=lines[i];function proce
ssToken(tokenValue,tokenType,column,newColumn) |
470 {tokenType=tokenType?WebInspector.CodeMirrorUtils.convertTokenType(tokenType):nu
ll;if(tokenType==="javascript-ident"){previousIdentifier=tokenValue;if(tokenValu
e&&previousToken==="function"){currentFunction={line:i,column:column,name:tokenV
alue};addedFunction=true;previousIdentifier=null;}}else if(tokenType==="javascri
pt-keyword"){if(tokenValue==="function"){if(previousIdentifier&&(previousToken==
="="||previousToken===":")){currentFunction={line:i,column:column,name:previousI
dentifier};addedFunction=true;previousIdentifier=null;}}}else if(tokenValue===".
"&&previousTokenType==="javascript-ident") | 471 {tokenType=tokenType?WebInspector.CodeMirrorUtils.convertTokenType(tokenType):nu
ll;if(tokenType==="javascript-ident"){previousIdentifier=tokenValue;if(tokenValu
e&&previousToken==="function"){currentFunction={line:i,column:column,name:tokenV
alue};addedFunction=true;previousIdentifier=null;}}else if(tokenType==="javascri
pt-keyword"){if(tokenValue==="function"){if(previousIdentifier&&(previousToken==
="="||previousToken===":")){currentFunction={line:i,column:column,name:previousI
dentifier};addedFunction=true;previousIdentifier=null;}}}else if(tokenValue===".
"&&previousTokenType==="javascript-ident") |
471 previousIdentifier+=".";else if(tokenValue==="("&&addedFunction) | 472 previousIdentifier+=".";else if(tokenValue==="("&&addedFunction) |
472 isReadingArguments=true;if(isReadingArguments&&tokenValue) | 473 isReadingArguments=true;if(isReadingArguments&&tokenValue) |
473 argumentsText+=tokenValue;if(tokenValue===")"&&isReadingArguments){addedFunction
=false;isReadingArguments=false;currentFunction.arguments=argumentsText.replace(
/,[\r\n\s]*/g,", ").replace(/([^,])[\r\n\s]+/g,"$1");argumentsText="";outlineChu
nk.push(currentFunction);} | 474 argumentsText+=tokenValue;if(tokenValue===")"&&isReadingArguments){addedFunction
=false;isReadingArguments=false;currentFunction.arguments=argumentsText.replace(
/,[\r\n\s]*/g,", ").replace(/([^,])[\r\n\s]+/g,"$1");argumentsText="";outlineChu
nk.push(currentFunction);} |
474 if(tokenValue.trim().length){previousToken=tokenValue;previousTokenType=tokenTyp
e;} | 475 if(tokenValue.trim().length){previousToken=tokenValue;previousTokenType=tokenTyp
e;} |
475 processedChunkCharacters+=newColumn-column;if(processedChunkCharacters>=chunkSiz
e){postMessage({chunk:outlineChunk,total:chunkCount,index:currentChunk++});outli
neChunk=[];processedChunkCharacters=0;}} | 476 processedChunkCharacters+=newColumn-column;if(processedChunkCharacters>=chunkSiz
e){postMessage({chunk:outlineChunk,total:chunkCount,index:currentChunk++});outli
neChunk=[];processedChunkCharacters=0;}} |
476 tokenizer(line,processToken);} | 477 tokenizer(line,processToken);} |
477 postMessage({chunk:outlineChunk,total:chunkCount,index:chunkCount});} | 478 postMessage({chunk:outlineChunk,total:chunkCount,index:chunkCount});} |
478 function formatScript(content,mapping,offset,formattedOffset,indentString) | 479 FormatterWorker._formatScript=function(content,mapping,offset,formattedOffset,in
dentString) |
479 {var formattedContent;try{var tokenizer=new Tokenizer(content);var builder=new F
ormattedContentBuilder(tokenizer.content(),mapping,offset,formattedOffset,indent
String);var formatter=new JavaScriptFormatter(tokenizer,builder);formatter.forma
t();formattedContent=builder.content();}catch(e){formattedContent=content;} | 480 {var formattedContent;try{var tokenizer=new FormatterWorker.JavaScriptTokenizer(
content);var builder=new FormatterWorker.JavaScriptFormattedContentBuilder(token
izer.content(),mapping,offset,formattedOffset,indentString);var formatter=new Fo
rmatterWorker.JavaScriptFormatter(tokenizer,builder);formatter.format();formatte
dContent=builder.content();}catch(e){formattedContent=content;} |
480 return formattedContent;} | 481 return formattedContent;} |
| 482 FormatterWorker._formatCSS=function(content,mapping,offset,formattedOffset,inden
tString) |
| 483 {var formattedContent;try{var builder=new FormatterWorker.CSSFormattedContentBui
lder(content,mapping,offset,formattedOffset,indentString);var formatter=new Form
atterWorker.CSSFormatter(content,builder);formatter.format();formattedContent=bu
ilder.content();}catch(e){formattedContent=content;} |
| 484 return formattedContent;} |
| 485 FormatterWorker.HTMLFormatter=function(indentString) |
| 486 {this._indentString=indentString;} |
| 487 FormatterWorker.HTMLFormatter.prototype={format:function(content) |
| 488 {this.line=content;this._content=content;this._formattedContent="";this._mapping
={original:[0],formatted:[0]};this._position=0;var scriptOpened=false;var styleO
pened=false;var tokenizer=WebInspector.CodeMirrorUtils.createTokenizer("text/htm
l");function processToken(tokenValue,tokenType,tokenStart,tokenEnd){if(tokenType
!=="xml-tag") |
| 489 return;if(tokenValue.toLowerCase()==="<script"){scriptOpened=true;}else if(scrip
tOpened&&tokenValue===">"){scriptOpened=false;this._scriptStarted(tokenEnd);}els
e if(tokenValue.toLowerCase()==="</script"){this._scriptEnded(tokenStart);}else
if(tokenValue.toLowerCase()==="<style"){styleOpened=true;}else if(styleOpened&&t
okenValue===">"){styleOpened=false;this._styleStarted(tokenEnd);}else if(tokenVa
lue.toLowerCase()==="</style"){this._styleEnded(tokenStart);}} |
| 490 tokenizer(content,processToken.bind(this));this._formattedContent+=this._content
.substring(this._position);return{content:this._formattedContent,mapping:this._m
apping};},_scriptStarted:function(cursor) |
| 491 {this._handleSubFormatterStart(cursor);},_scriptEnded:function(cursor) |
| 492 {this._handleSubFormatterEnd(FormatterWorker._formatScript,cursor);},_styleStart
ed:function(cursor) |
| 493 {this._handleSubFormatterStart(cursor);},_styleEnded:function(cursor) |
| 494 {this._handleSubFormatterEnd(FormatterWorker._formatCSS,cursor);},_handleSubForm
atterStart:function(cursor) |
| 495 {this._formattedContent+=this._content.substring(this._position,cursor);this._fo
rmattedContent+="\n";this._position=cursor;},_handleSubFormatterEnd:function(for
matFunction,cursor) |
| 496 {if(cursor===this._position) |
| 497 return;var scriptContent=this._content.substring(this._position,cursor);this._ma
pping.original.push(this._position);this._mapping.formatted.push(this._formatted
Content.length);var formattedScriptContent=formatFunction(scriptContent,this._ma
pping,this._position,this._formattedContent.length,this._indentString);this._for
mattedContent+=formattedScriptContent;this._position=cursor;}} |
481 Array.prototype.keySet=function() | 498 Array.prototype.keySet=function() |
482 {var keys={};for(var i=0;i<this.length;++i) | 499 {var keys={};for(var i=0;i<this.length;++i) |
483 keys[this[i]]=true;return keys;};HTMLScriptFormatter=function(indentString) | 500 keys[this[i]]=true;return keys;};function require() |
484 {this._indentString=indentString;} | |
485 HTMLScriptFormatter.prototype={format:function(content) | |
486 {this.line=content;this._content=content;this._formattedContent="";this._mapping
={original:[0],formatted:[0]};this._position=0;var scriptOpened=false;var tokeni
zer=WebInspector.CodeMirrorUtils.createTokenizer("text/html");function processTo
ken(tokenValue,tokenType,tokenStart,tokenEnd){if(tokenValue.toLowerCase()==="<sc
ript"&&tokenType==="xml-tag"){scriptOpened=true;}else if(scriptOpened&&tokenValu
e===">"&&tokenType==="xml-tag"){scriptOpened=false;this._scriptStarted(tokenEnd)
;}else if(tokenValue.toLowerCase()==="</script"&&tokenType==="xml-tag"){this._sc
riptEnded(tokenStart);}} | |
487 tokenizer(content,processToken.bind(this));this._formattedContent+=this._content
.substring(this._position);return{content:this._formattedContent,mapping:this._m
apping};},_scriptStarted:function(cursor) | |
488 {this._formattedContent+=this._content.substring(this._position,cursor);this._fo
rmattedContent+="\n";this._position=cursor;},_scriptEnded:function(cursor) | |
489 {if(cursor===this._position) | |
490 return;var scriptContent=this._content.substring(this._position,cursor);this._ma
pping.original.push(this._position);this._mapping.formatted.push(this._formatted
Content.length);var formattedScriptContent=formatScript(scriptContent,this._mapp
ing,this._position,this._formattedContent.length,this._indentString);this._forma
ttedContent+=formattedScriptContent;this._position=cursor;},} | |
491 function require() | |
492 {return parse;} | 501 {return parse;} |
493 var exports={};var KEYWORDS=array_to_hash(["break","case","catch","const","conti
nue","default","delete","do","else","finally","for","function","if","in","instan
ceof","new","return","switch","throw","try","typeof","var","void","while","with"
]);var RESERVED_WORDS=array_to_hash(["abstract","boolean","byte","char","class",
"debugger","double","enum","export","extends","final","float","goto","implements
","import","int","interface","long","native","package","private","protected","pu
blic","short","static","super","synchronized","throws","transient","volatile"]);
var KEYWORDS_BEFORE_EXPRESSION=array_to_hash(["return","new","delete","throw","e
lse","case"]);var KEYWORDS_ATOM=array_to_hash(["false","null","true","undefined"
]);var OPERATOR_CHARS=array_to_hash(characters("+-*&%=<>!?|~^"));var RE_HEX_NUMB
ER=/^0x[0-9a-f]+$/i;var RE_OCT_NUMBER=/^0[0-7]+$/;var RE_DEC_NUMBER=/^\d*\.?\d*(
?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i;var OPERATORS=array_to_hash(["in","instanceof
","typeof","new","void","delete","++","--","+","-","!","~","&","|","^","*","/","
%",">>","<<",">>>","<",">","<=",">=","==","===","!=","!==","?","=","+=","-=","/=
","*=","%=",">>=","<<=",">>>=","%=","|=","^=","&=","&&","||"]);var WHITESPACE_CH
ARS=array_to_hash(characters(" \n\r\t"));var PUNC_BEFORE_EXPRESSION=array_to_has
h(characters("[{}(,.;:"));var PUNC_CHARS=array_to_hash(characters("[]{}(),;:"));
var REGEXP_MODIFIERS=array_to_hash(characters("gmsiy"));function is_alphanumeric
_char(ch){ch=ch.charCodeAt(0);return(ch>=48&&ch<=57)||(ch>=65&&ch<=90)||(ch>=97&
&ch<=122);};function is_identifier_char(ch){return is_alphanumeric_char(ch)||ch=
="$"||ch=="_";};function is_digit(ch){ch=ch.charCodeAt(0);return ch>=48&&ch<=57;
};function parse_js_number(num){if(RE_HEX_NUMBER.test(num)){return parseInt(num.
substr(2),16);}else if(RE_OCT_NUMBER.test(num)){return parseInt(num.substr(1),8)
;}else if(RE_DEC_NUMBER.test(num)){return parseFloat(num);}};function JS_Parse_E
rror(message,line,col,pos){this.message=message;this.line=line;this.col=col;this
.pos=pos;try{({})();}catch(ex){this.stack=ex.stack;};};JS_Parse_Error.prototype.
toString=function(){return this.message+" (line: "+this.line+", col: "+this.col+
", pos: "+this.pos+")"+"\n\n"+this.stack;};function js_error(message,line,col,po
s){throw new JS_Parse_Error(message,line,col,pos);};function is_token(token,type
,val){return token.type==type&&(val==null||token.value==val);};var EX_EOF={};fun
ction tokenizer($TEXT){var S={text:$TEXT.replace(/\r\n?|[\n\u2028\u2029]/g,"\n")
.replace(/^\uFEFF/,''),pos:0,tokpos:0,line:0,tokline:0,col:0,tokcol:0,newline_be
fore:false,regex_allowed:false,comments_before:[]};function peek(){return S.text
.charAt(S.pos);};function next(signal_eof){var ch=S.text.charAt(S.pos++);if(sign
al_eof&&!ch) | 502 var exports={tokenizer:null};var KEYWORDS=array_to_hash(["break","case","catch",
"const","continue","default","delete","do","else","finally","for","function","if
","in","instanceof","new","return","switch","throw","try","typeof","var","void",
"while","with"]);var RESERVED_WORDS=array_to_hash(["abstract","boolean","byte","
char","class","debugger","double","enum","export","extends","final","float","got
o","implements","import","int","interface","long","native","package","private","
protected","public","short","static","super","synchronized","throws","transient"
,"volatile"]);var KEYWORDS_BEFORE_EXPRESSION=array_to_hash(["return","new","dele
te","throw","else","case"]);var KEYWORDS_ATOM=array_to_hash(["false","null","tru
e","undefined"]);var OPERATOR_CHARS=array_to_hash(characters("+-*&%=<>!?|~^"));v
ar RE_HEX_NUMBER=/^0x[0-9a-f]+$/i;var RE_OCT_NUMBER=/^0[0-7]+$/;var RE_DEC_NUMBE
R=/^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i;var OPERATORS=array_to_hash(["i
n","instanceof","typeof","new","void","delete","++","--","+","-","!","~","&","|"
,"^","*","/","%",">>","<<",">>>","<",">","<=",">=","==","===","!=","!==","?","="
,"+=","-=","/=","*=","%=",">>=","<<=",">>>=","%=","|=","^=","&=","&&","||"]);var
WHITESPACE_CHARS=array_to_hash(characters(" \n\r\t"));var PUNC_BEFORE_EXPRESSIO
N=array_to_hash(characters("[{}(,.;:"));var PUNC_CHARS=array_to_hash(characters(
"[]{}(),;:"));var REGEXP_MODIFIERS=array_to_hash(characters("gmsiy"));function i
s_alphanumeric_char(ch){ch=ch.charCodeAt(0);return(ch>=48&&ch<=57)||(ch>=65&&ch<
=90)||(ch>=97&&ch<=122);};function is_identifier_char(ch){return is_alphanumeric
_char(ch)||ch=="$"||ch=="_";};function is_digit(ch){ch=ch.charCodeAt(0);return c
h>=48&&ch<=57;};function parse_js_number(num){if(RE_HEX_NUMBER.test(num)){return
parseInt(num.substr(2),16);}else if(RE_OCT_NUMBER.test(num)){return parseInt(nu
m.substr(1),8);}else if(RE_DEC_NUMBER.test(num)){return parseFloat(num);}};funct
ion JS_Parse_Error(message,line,col,pos){this.message=message;this.line=line;thi
s.col=col;this.pos=pos;try{({})();}catch(ex){this.stack=ex.stack;};};JS_Parse_Er
ror.prototype.toString=function(){return this.message+" (line: "+this.line+", co
l: "+this.col+", pos: "+this.pos+")"+"\n\n"+this.stack;};function js_error(messa
ge,line,col,pos){throw new JS_Parse_Error(message,line,col,pos);};function is_to
ken(token,type,val){return token.type==type&&(val==null||token.value==val);};var
EX_EOF={};function tokenizer($TEXT){var S={text:$TEXT.replace(/\r\n?|[\n\u2028\
u2029]/g,"\n").replace(/^\uFEFF/,''),pos:0,tokpos:0,line:0,tokline:0,col:0,tokco
l:0,newline_before:false,regex_allowed:false,comments_before:[]};function peek()
{return S.text.charAt(S.pos);};function next(signal_eof){var ch=S.text.charAt(S.
pos++);if(signal_eof&&!ch) |
494 throw EX_EOF;if(ch=="\n"){S.newline_before=true;++S.line;S.col=0;}else{++S.col;} | 503 throw EX_EOF;if(ch=="\n"){S.newline_before=true;++S.line;S.col=0;}else{++S.col;} |
495 return ch;};function eof(){return!S.peek();};function find(what,signal_eof){var
pos=S.text.indexOf(what,S.pos);if(signal_eof&&pos==-1)throw EX_EOF;return pos;};
function start_token(){S.tokline=S.line;S.tokcol=S.col;S.tokpos=S.pos;};function
token(type,value,is_comment){S.regex_allowed=((type=="operator"&&!HOP(UNARY_POS
TFIX,value))||(type=="keyword"&&HOP(KEYWORDS_BEFORE_EXPRESSION,value))||(type=="
punc"&&HOP(PUNC_BEFORE_EXPRESSION,value)));var ret={type:type,value:value,line:S
.tokline,col:S.tokcol,pos:S.tokpos,nlb:S.newline_before};if(!is_comment){ret.com
ments_before=S.comments_before;S.comments_before=[];} | 504 return ch;};function eof(){return!S.peek();};function find(what,signal_eof){var
pos=S.text.indexOf(what,S.pos);if(signal_eof&&pos==-1)throw EX_EOF;return pos;};
function start_token(){S.tokline=S.line;S.tokcol=S.col;S.tokpos=S.pos;};function
token(type,value,is_comment){S.regex_allowed=((type=="operator"&&!HOP(UNARY_POS
TFIX,value))||(type=="keyword"&&HOP(KEYWORDS_BEFORE_EXPRESSION,value))||(type=="
punc"&&HOP(PUNC_BEFORE_EXPRESSION,value)));var ret={type:type,value:value,line:S
.tokline,col:S.tokcol,pos:S.tokpos,nlb:S.newline_before};if(!is_comment){ret.com
ments_before=S.comments_before;S.comments_before=[];} |
496 S.newline_before=false;return ret;};function skip_whitespace(){while(HOP(WHITESP
ACE_CHARS,peek())) | 505 S.newline_before=false;return ret;};function skip_whitespace(){while(HOP(WHITESP
ACE_CHARS,peek())) |
497 next();};function read_while(pred){var ret="",ch=peek(),i=0;while(ch&&pred(ch,i+
+)){ret+=next();ch=peek();} | 506 next();};function read_while(pred){var ret="",ch=peek(),i=0;while(ch&&pred(ch,i+
+)){ret+=next();ch=peek();} |
498 return ret;};function parse_error(err){js_error(err,S.tokline,S.tokcol,S.tokpos)
;};function read_num(prefix){var has_e=false,after_e=false,has_x=false,has_dot=p
refix==".";var num=read_while(function(ch,i){if(ch=="x"||ch=="X"){if(has_x)retur
n false;return has_x=true;} | 507 return ret;};function parse_error(err){js_error(err,S.tokline,S.tokcol,S.tokpos)
;};function read_num(prefix){var has_e=false,after_e=false,has_x=false,has_dot=p
refix==".";var num=read_while(function(ch,i){if(ch=="x"||ch=="X"){if(has_x)retur
n false;return has_x=true;} |
499 if(!has_x&&(ch=="E"||ch=="e")){if(has_e)return false;return has_e=after_e=true;} | 508 if(!has_x&&(ch=="E"||ch=="e")){if(has_e)return false;return has_e=after_e=true;} |
500 if(ch=="-"){if(after_e||(i==0&&!prefix))return true;return false;} | 509 if(ch=="-"){if(after_e||(i==0&&!prefix))return true;return false;} |
501 if(ch=="+")return after_e;after_e=false;if(ch=="."){if(!has_dot) | 510 if(ch=="+")return after_e;after_e=false;if(ch=="."){if(!has_dot) |
502 return has_dot=true;return false;} | 511 return has_dot=true;return false;} |
503 return is_alphanumeric_char(ch);});if(prefix) | 512 return is_alphanumeric_char(ch);});if(prefix) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 return expr;};function is_assignable(expr){switch(expr[0]){case"dot":case"sub":r
eturn true;case"name":return expr[1]!="this";}};function maybe_assign(){var left
=maybe_conditional(),val=S.token.value;if(is("operator")&&HOP(ASSIGNMENT,val)){i
f(is_assignable(left)){next();return as("assign",ASSIGNMENT[val],left,maybe_assi
gn());} | 566 return expr;};function is_assignable(expr){switch(expr[0]){case"dot":case"sub":r
eturn true;case"name":return expr[1]!="this";}};function maybe_assign(){var left
=maybe_conditional(),val=S.token.value;if(is("operator")&&HOP(ASSIGNMENT,val)){i
f(is_assignable(left)){next();return as("assign",ASSIGNMENT[val],left,maybe_assi
gn());} |
558 croak("Invalid assignment");} | 567 croak("Invalid assignment");} |
559 return left;};function expression(commas){if(arguments.length==0) | 568 return left;};function expression(commas){if(arguments.length==0) |
560 commas=true;var expr=maybe_assign();if(commas&&is("punc",",")){next();return as(
"seq",expr,expression());} | 569 commas=true;var expr=maybe_assign();if(commas&&is("punc",",")){next();return as(
"seq",expr,expression());} |
561 return expr;};function in_loop(cont){try{++S.in_loop;return cont();}finally{--S.
in_loop;}};return as("toplevel",(function(a){while(!is("eof")) | 570 return expr;};function in_loop(cont){try{++S.in_loop;return cont();}finally{--S.
in_loop;}};return as("toplevel",(function(a){while(!is("eof")) |
562 a.push(statement());return a;})([]));};function curry(f){var args=slice(argument
s,1);return function(){return f.apply(this,args.concat(slice(arguments)));};};fu
nction prog1(ret){if(ret instanceof Function) | 571 a.push(statement());return a;})([]));};function curry(f){var args=slice(argument
s,1);return function(){return f.apply(this,args.concat(slice(arguments)));};};fu
nction prog1(ret){if(ret instanceof Function) |
563 ret=ret();for(var i=1,n=arguments.length;--n>0;++i) | 572 ret=ret();for(var i=1,n=arguments.length;--n>0;++i) |
564 arguments[i]();return ret;};function array_to_hash(a){var ret={};for(var i=0;i<a
.length;++i) | 573 arguments[i]();return ret;};function array_to_hash(a){var ret={};for(var i=0;i<a
.length;++i) |
565 ret[a[i]]=true;return ret;};function slice(a,start){return Array.prototype.slice
.call(a,start==null?0:start);};function characters(str){return str.split("");};f
unction member(name,array){for(var i=array.length;--i>=0;) | 574 ret[a[i]]=true;return ret;};function slice(a,start){return Array.prototype.slice
.call(a,start==null?0:start);};function characters(str){return str.split("");};f
unction member(name,array){for(var i=array.length;--i>=0;) |
566 if(array[i]===name) | 575 if(array[i]===name) |
567 return true;return false;};function HOP(obj,prop){return Object.prototype.hasOwn
Property.call(obj,prop);};exports.tokenizer=tokenizer;exports.parse=parse;export
s.slice=slice;exports.curry=curry;exports.member=member;exports.array_to_hash=ar
ray_to_hash;exports.PRECEDENCE=PRECEDENCE;exports.KEYWORDS_ATOM=KEYWORDS_ATOM;ex
ports.RESERVED_WORDS=RESERVED_WORDS;exports.KEYWORDS=KEYWORDS;exports.ATOMIC_STA
RT_TOKEN=ATOMIC_START_TOKEN;exports.OPERATORS=OPERATORS;exports.is_alphanumeric_
char=is_alphanumeric_char;exports.is_identifier_char=is_identifier_char;;var par
se=exports;function FormattedContentBuilder(content,mapping,originalOffset,forma
ttedOffset,indentString) | 576 return true;return false;};function HOP(obj,prop){return Object.prototype.hasOwn
Property.call(obj,prop);};exports.tokenizer=tokenizer;exports.parse=parse;export
s.slice=slice;exports.curry=curry;exports.member=member;exports.array_to_hash=ar
ray_to_hash;exports.PRECEDENCE=PRECEDENCE;exports.KEYWORDS_ATOM=KEYWORDS_ATOM;ex
ports.RESERVED_WORDS=RESERVED_WORDS;exports.KEYWORDS=KEYWORDS;exports.ATOMIC_STA
RT_TOKEN=ATOMIC_START_TOKEN;exports.OPERATORS=OPERATORS;exports.is_alphanumeric_
char=is_alphanumeric_char;exports.is_identifier_char=is_identifier_char;;var par
se=exports;FormatterWorker.JavaScriptFormatter=function(tokenizer,builder) |
| 577 {this._tokenizer=tokenizer;this._builder=builder;this._token=null;this._nextToke
n=this._tokenizer.next();} |
| 578 FormatterWorker.JavaScriptFormatter.prototype={format:function() |
| 579 {this._parseSourceElements(FormatterWorker.JavaScriptTokens.EOS);this._consume(F
ormatterWorker.JavaScriptTokens.EOS);},_peek:function() |
| 580 {return this._nextToken.token;},_next:function() |
| 581 {if(this._token&&this._token.token===FormatterWorker.JavaScriptTokens.EOS) |
| 582 throw"Unexpected EOS token";this._builder.addToken(this._nextToken);this._token=
this._nextToken;this._nextToken=this._tokenizer.next(this._forceRegexp);this._fo
rceRegexp=false;return this._token.token;},_consume:function(token) |
| 583 {var next=this._next();if(next!==token) |
| 584 throw"Unexpected token in consume: expected "+token+", actual "+next;},_expect:f
unction(token) |
| 585 {var next=this._next();if(next!==token) |
| 586 throw"Unexpected token: expected "+token+", actual "+next;},_expectSemicolon:fun
ction() |
| 587 {if(this._peek()===FormatterWorker.JavaScriptTokens.SEMICOLON) |
| 588 this._consume(FormatterWorker.JavaScriptTokens.SEMICOLON);},_hasLineTerminatorBe
foreNext:function() |
| 589 {return this._nextToken.nlb;},_parseSourceElements:function(endToken) |
| 590 {while(this._peek()!==endToken){this._parseStatement();this._builder.addNewLine(
);}},_parseStatementOrBlock:function() |
| 591 {if(this._peek()===FormatterWorker.JavaScriptTokens.LBRACE){this._builder.addSpa
ce();this._parseBlock();return true;} |
| 592 this._builder.addNewLine();this._builder.increaseNestingLevel();this._parseState
ment();this._builder.decreaseNestingLevel();},_parseStatement:function() |
| 593 {switch(this._peek()){case FormatterWorker.JavaScriptTokens.LBRACE:return this._
parseBlock();case FormatterWorker.JavaScriptTokens.CONST:case FormatterWorker.Ja
vaScriptTokens.VAR:return this._parseVariableStatement();case FormatterWorker.Ja
vaScriptTokens.SEMICOLON:return this._next();case FormatterWorker.JavaScriptToke
ns.IF:return this._parseIfStatement();case FormatterWorker.JavaScriptTokens.DO:r
eturn this._parseDoWhileStatement();case FormatterWorker.JavaScriptTokens.WHILE:
return this._parseWhileStatement();case FormatterWorker.JavaScriptTokens.FOR:ret
urn this._parseForStatement();case FormatterWorker.JavaScriptTokens.CONTINUE:ret
urn this._parseContinueStatement();case FormatterWorker.JavaScriptTokens.BREAK:r
eturn this._parseBreakStatement();case FormatterWorker.JavaScriptTokens.RETURN:r
eturn this._parseReturnStatement();case FormatterWorker.JavaScriptTokens.WITH:re
turn this._parseWithStatement();case FormatterWorker.JavaScriptTokens.SWITCH:ret
urn this._parseSwitchStatement();case FormatterWorker.JavaScriptTokens.THROW:ret
urn this._parseThrowStatement();case FormatterWorker.JavaScriptTokens.TRY:return
this._parseTryStatement();case FormatterWorker.JavaScriptTokens.FUNCTION:return
this._parseFunctionDeclaration();case FormatterWorker.JavaScriptTokens.DEBUGGER
:return this._parseDebuggerStatement();default:return this._parseExpressionOrLab
elledStatement();}},_parseFunctionDeclaration:function() |
| 594 {this._expect(FormatterWorker.JavaScriptTokens.FUNCTION);this._builder.addSpace(
);this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);this._parseFunctionL
iteral()},_parseBlock:function() |
| 595 {this._expect(FormatterWorker.JavaScriptTokens.LBRACE);this._builder.addNewLine(
);this._builder.increaseNestingLevel();while(this._peek()!==FormatterWorker.Java
ScriptTokens.RBRACE){this._parseStatement();this._builder.addNewLine();} |
| 596 this._builder.decreaseNestingLevel();this._expect(FormatterWorker.JavaScriptToke
ns.RBRACE);},_parseVariableStatement:function() |
| 597 {this._parseVariableDeclarations();this._expectSemicolon();},_parseVariableDecla
rations:function() |
| 598 {if(this._peek()===FormatterWorker.JavaScriptTokens.VAR) |
| 599 this._consume(FormatterWorker.JavaScriptTokens.VAR);else |
| 600 this._consume(FormatterWorker.JavaScriptTokens.CONST) |
| 601 this._builder.addSpace();var isFirstVariable=true;do{if(!isFirstVariable){this._
consume(FormatterWorker.JavaScriptTokens.COMMA);this._builder.addSpace();} |
| 602 isFirstVariable=false;this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);
if(this._peek()===FormatterWorker.JavaScriptTokens.ASSIGN){this._builder.addSpac
e();this._consume(FormatterWorker.JavaScriptTokens.ASSIGN);this._builder.addSpac
e();this._parseAssignmentExpression();}}while(this._peek()===FormatterWorker.Jav
aScriptTokens.COMMA);},_parseExpressionOrLabelledStatement:function() |
| 603 {this._parseExpression();if(this._peek()===FormatterWorker.JavaScriptTokens.COLO
N){this._expect(FormatterWorker.JavaScriptTokens.COLON);this._builder.addSpace()
;this._parseStatement();} |
| 604 this._expectSemicolon();},_parseIfStatement:function() |
| 605 {this._expect(FormatterWorker.JavaScriptTokens.IF);this._builder.addSpace();this
._expect(FormatterWorker.JavaScriptTokens.LPAREN);this._parseExpression();this._
expect(FormatterWorker.JavaScriptTokens.RPAREN);var isBlock=this._parseStatement
OrBlock();if(this._peek()===FormatterWorker.JavaScriptTokens.ELSE){if(isBlock) |
| 606 this._builder.addSpace();else |
| 607 this._builder.addNewLine();this._next();if(this._peek()===FormatterWorker.JavaSc
riptTokens.IF){this._builder.addSpace();this._parseStatement();}else |
| 608 this._parseStatementOrBlock();}},_parseContinueStatement:function() |
| 609 {this._expect(FormatterWorker.JavaScriptTokens.CONTINUE);var token=this._peek();
if(!this._hasLineTerminatorBeforeNext()&&token!==FormatterWorker.JavaScriptToken
s.SEMICOLON&&token!==FormatterWorker.JavaScriptTokens.RBRACE&&token!==FormatterW
orker.JavaScriptTokens.EOS){this._builder.addSpace();this._expect(FormatterWorke
r.JavaScriptTokens.IDENTIFIER);} |
| 610 this._expectSemicolon();},_parseBreakStatement:function() |
| 611 {this._expect(FormatterWorker.JavaScriptTokens.BREAK);var token=this._peek();if(
!this._hasLineTerminatorBeforeNext()&&token!==FormatterWorker.JavaScriptTokens.S
EMICOLON&&token!==FormatterWorker.JavaScriptTokens.RBRACE&&token!==FormatterWork
er.JavaScriptTokens.EOS){this._builder.addSpace();this._expect(FormatterWorker.J
avaScriptTokens.IDENTIFIER);} |
| 612 this._expectSemicolon();},_parseReturnStatement:function() |
| 613 {this._expect(FormatterWorker.JavaScriptTokens.RETURN);var token=this._peek();if
(!this._hasLineTerminatorBeforeNext()&&token!==FormatterWorker.JavaScriptTokens.
SEMICOLON&&token!==FormatterWorker.JavaScriptTokens.RBRACE&&token!==FormatterWor
ker.JavaScriptTokens.EOS){this._builder.addSpace();this._parseExpression();} |
| 614 this._expectSemicolon();},_parseWithStatement:function() |
| 615 {this._expect(FormatterWorker.JavaScriptTokens.WITH);this._builder.addSpace();th
is._expect(FormatterWorker.JavaScriptTokens.LPAREN);this._parseExpression();this
._expect(FormatterWorker.JavaScriptTokens.RPAREN);this._parseStatementOrBlock();
},_parseCaseClause:function() |
| 616 {if(this._peek()===FormatterWorker.JavaScriptTokens.CASE){this._expect(Formatter
Worker.JavaScriptTokens.CASE);this._builder.addSpace();this._parseExpression();}
else |
| 617 this._expect(FormatterWorker.JavaScriptTokens.DEFAULT);this._expect(FormatterWor
ker.JavaScriptTokens.COLON);this._builder.addNewLine();this._builder.increaseNes
tingLevel();while(this._peek()!==FormatterWorker.JavaScriptTokens.CASE&&this._pe
ek()!==FormatterWorker.JavaScriptTokens.DEFAULT&&this._peek()!==FormatterWorker.
JavaScriptTokens.RBRACE){this._parseStatement();this._builder.addNewLine();} |
| 618 this._builder.decreaseNestingLevel();},_parseSwitchStatement:function() |
| 619 {this._expect(FormatterWorker.JavaScriptTokens.SWITCH);this._builder.addSpace();
this._expect(FormatterWorker.JavaScriptTokens.LPAREN);this._parseExpression();th
is._expect(FormatterWorker.JavaScriptTokens.RPAREN);this._builder.addSpace();thi
s._expect(FormatterWorker.JavaScriptTokens.LBRACE);this._builder.addNewLine();th
is._builder.increaseNestingLevel();while(this._peek()!==FormatterWorker.JavaScri
ptTokens.RBRACE) |
| 620 this._parseCaseClause();this._builder.decreaseNestingLevel();this._expect(Format
terWorker.JavaScriptTokens.RBRACE);},_parseThrowStatement:function() |
| 621 {this._expect(FormatterWorker.JavaScriptTokens.THROW);this._builder.addSpace();t
his._parseExpression();this._expectSemicolon();},_parseTryStatement:function() |
| 622 {this._expect(FormatterWorker.JavaScriptTokens.TRY);this._builder.addSpace();thi
s._parseBlock();var token=this._peek();if(token===FormatterWorker.JavaScriptToke
ns.CATCH){this._builder.addSpace();this._consume(FormatterWorker.JavaScriptToken
s.CATCH);this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.
LPAREN);this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);this._expect(F
ormatterWorker.JavaScriptTokens.RPAREN);this._builder.addSpace();this._parseBloc
k();token=this._peek();} |
| 623 if(token===FormatterWorker.JavaScriptTokens.FINALLY){this._consume(FormatterWork
er.JavaScriptTokens.FINALLY);this._builder.addSpace();this._parseBlock();}},_par
seDoWhileStatement:function() |
| 624 {this._expect(FormatterWorker.JavaScriptTokens.DO);var isBlock=this._parseStatem
entOrBlock();if(isBlock) |
| 625 this._builder.addSpace();else |
| 626 this._builder.addNewLine();this._expect(FormatterWorker.JavaScriptTokens.WHILE);
this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.LPAREN);t
his._parseExpression();this._expect(FormatterWorker.JavaScriptTokens.RPAREN);thi
s._expectSemicolon();},_parseWhileStatement:function() |
| 627 {this._expect(FormatterWorker.JavaScriptTokens.WHILE);this._builder.addSpace();t
his._expect(FormatterWorker.JavaScriptTokens.LPAREN);this._parseExpression();thi
s._expect(FormatterWorker.JavaScriptTokens.RPAREN);this._parseStatementOrBlock()
;},_parseForStatement:function() |
| 628 {this._expect(FormatterWorker.JavaScriptTokens.FOR);this._builder.addSpace();thi
s._expect(FormatterWorker.JavaScriptTokens.LPAREN);if(this._peek()!==FormatterWo
rker.JavaScriptTokens.SEMICOLON){if(this._peek()===FormatterWorker.JavaScriptTok
ens.VAR||this._peek()===FormatterWorker.JavaScriptTokens.CONST){this._parseVaria
bleDeclarations();if(this._peek()===FormatterWorker.JavaScriptTokens.IN){this._b
uilder.addSpace();this._consume(FormatterWorker.JavaScriptTokens.IN);this._build
er.addSpace();this._parseExpression();}}else |
| 629 this._parseExpression();} |
| 630 if(this._peek()!==FormatterWorker.JavaScriptTokens.RPAREN){this._expect(Formatte
rWorker.JavaScriptTokens.SEMICOLON);this._builder.addSpace();if(this._peek()!==F
ormatterWorker.JavaScriptTokens.SEMICOLON) |
| 631 this._parseExpression();this._expect(FormatterWorker.JavaScriptTokens.SEMICOLON)
;this._builder.addSpace();if(this._peek()!==FormatterWorker.JavaScriptTokens.RPA
REN) |
| 632 this._parseExpression();} |
| 633 this._expect(FormatterWorker.JavaScriptTokens.RPAREN);this._parseStatementOrBloc
k();},_parseExpression:function() |
| 634 {this._parseAssignmentExpression();while(this._peek()===FormatterWorker.JavaScri
ptTokens.COMMA){this._expect(FormatterWorker.JavaScriptTokens.COMMA);this._build
er.addSpace();this._parseAssignmentExpression();}},_parseAssignmentExpression:fu
nction() |
| 635 {this._parseConditionalExpression();var token=this._peek();if(FormatterWorker.Ja
vaScriptTokens.ASSIGN<=token&&token<=FormatterWorker.JavaScriptTokens.ASSIGN_MOD
){this._builder.addSpace();this._next();this._builder.addSpace();this._parseAssi
gnmentExpression();}},_parseConditionalExpression:function() |
| 636 {this._parseBinaryExpression();if(this._peek()===FormatterWorker.JavaScriptToken
s.CONDITIONAL){this._builder.addSpace();this._consume(FormatterWorker.JavaScript
Tokens.CONDITIONAL);this._builder.addSpace();this._parseAssignmentExpression();t
his._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.COLON);thi
s._builder.addSpace();this._parseAssignmentExpression();}},_parseBinaryExpressio
n:function() |
| 637 {this._parseUnaryExpression();var token=this._peek();while(FormatterWorker.JavaS
criptTokens.OR<=token&&token<=FormatterWorker.JavaScriptTokens.IN){this._builder
.addSpace();this._next();this._builder.addSpace();this._parseBinaryExpression();
token=this._peek();}},_parseUnaryExpression:function() |
| 638 {var token=this._peek();if((FormatterWorker.JavaScriptTokens.NOT<=token&&token<=
FormatterWorker.JavaScriptTokens.VOID)||token===FormatterWorker.JavaScriptTokens
.ADD||token===FormatterWorker.JavaScriptTokens.SUB||token===FormatterWorker.Java
ScriptTokens.INC||token===FormatterWorker.JavaScriptTokens.DEC){this._next();if(
token===FormatterWorker.JavaScriptTokens.DELETE||token===FormatterWorker.JavaScr
iptTokens.TYPEOF||token===FormatterWorker.JavaScriptTokens.VOID) |
| 639 this._builder.addSpace();this._parseUnaryExpression();}else |
| 640 return this._parsePostfixExpression();},_parsePostfixExpression:function() |
| 641 {this._parseLeftHandSideExpression();var token=this._peek();if(!this._hasLineTer
minatorBeforeNext()&&(token===FormatterWorker.JavaScriptTokens.INC||token===Form
atterWorker.JavaScriptTokens.DEC)) |
| 642 this._next();},_parseLeftHandSideExpression:function() |
| 643 {if(this._peek()===FormatterWorker.JavaScriptTokens.NEW) |
| 644 this._parseNewExpression();else |
| 645 this._parseMemberExpression();while(true){switch(this._peek()){case FormatterWor
ker.JavaScriptTokens.LBRACK:this._consume(FormatterWorker.JavaScriptTokens.LBRAC
K);this._parseExpression();this._expect(FormatterWorker.JavaScriptTokens.RBRACK)
;break;case FormatterWorker.JavaScriptTokens.LPAREN:this._parseArguments();break
;case FormatterWorker.JavaScriptTokens.PERIOD:this._consume(FormatterWorker.Java
ScriptTokens.PERIOD);this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);b
reak;default:return;}}},_parseNewExpression:function() |
| 646 {this._expect(FormatterWorker.JavaScriptTokens.NEW);this._builder.addSpace();if(
this._peek()===FormatterWorker.JavaScriptTokens.NEW) |
| 647 this._parseNewExpression();else |
| 648 this._parseMemberExpression();},_parseMemberExpression:function() |
| 649 {if(this._peek()===FormatterWorker.JavaScriptTokens.FUNCTION){this._expect(Forma
tterWorker.JavaScriptTokens.FUNCTION);if(this._peek()===FormatterWorker.JavaScri
ptTokens.IDENTIFIER){this._builder.addSpace();this._expect(FormatterWorker.JavaS
criptTokens.IDENTIFIER);} |
| 650 this._parseFunctionLiteral();}else |
| 651 this._parsePrimaryExpression();while(true){switch(this._peek()){case FormatterWo
rker.JavaScriptTokens.LBRACK:this._consume(FormatterWorker.JavaScriptTokens.LBRA
CK);this._parseExpression();this._expect(FormatterWorker.JavaScriptTokens.RBRACK
);break;case FormatterWorker.JavaScriptTokens.PERIOD:this._consume(FormatterWork
er.JavaScriptTokens.PERIOD);this._expect(FormatterWorker.JavaScriptTokens.IDENTI
FIER);break;case FormatterWorker.JavaScriptTokens.LPAREN:this._parseArguments();
break;default:return;}}},_parseDebuggerStatement:function() |
| 652 {this._expect(FormatterWorker.JavaScriptTokens.DEBUGGER);this._expectSemicolon()
;},_parsePrimaryExpression:function() |
| 653 {switch(this._peek()){case FormatterWorker.JavaScriptTokens.THIS:return this._co
nsume(FormatterWorker.JavaScriptTokens.THIS);case FormatterWorker.JavaScriptToke
ns.NULL_LITERAL:return this._consume(FormatterWorker.JavaScriptTokens.NULL_LITER
AL);case FormatterWorker.JavaScriptTokens.TRUE_LITERAL:return this._consume(Form
atterWorker.JavaScriptTokens.TRUE_LITERAL);case FormatterWorker.JavaScriptTokens
.FALSE_LITERAL:return this._consume(FormatterWorker.JavaScriptTokens.FALSE_LITER
AL);case FormatterWorker.JavaScriptTokens.IDENTIFIER:return this._consume(Format
terWorker.JavaScriptTokens.IDENTIFIER);case FormatterWorker.JavaScriptTokens.NUM
BER:return this._consume(FormatterWorker.JavaScriptTokens.NUMBER);case Formatter
Worker.JavaScriptTokens.STRING:return this._consume(FormatterWorker.JavaScriptTo
kens.STRING);case FormatterWorker.JavaScriptTokens.ASSIGN_DIV:return this._parse
RegExpLiteral();case FormatterWorker.JavaScriptTokens.DIV:return this._parseRegE
xpLiteral();case FormatterWorker.JavaScriptTokens.LBRACK:return this._parseArray
Literal();case FormatterWorker.JavaScriptTokens.LBRACE:return this._parseObjectL
iteral();case FormatterWorker.JavaScriptTokens.LPAREN:this._consume(FormatterWor
ker.JavaScriptTokens.LPAREN);this._parseExpression();this._expect(FormatterWorke
r.JavaScriptTokens.RPAREN);return;default:return this._next();}},_parseArrayLite
ral:function() |
| 654 {this._expect(FormatterWorker.JavaScriptTokens.LBRACK);this._builder.increaseNes
tingLevel();while(this._peek()!==FormatterWorker.JavaScriptTokens.RBRACK){if(thi
s._peek()!==FormatterWorker.JavaScriptTokens.COMMA) |
| 655 this._parseAssignmentExpression();if(this._peek()!==FormatterWorker.JavaScriptTo
kens.RBRACK){this._expect(FormatterWorker.JavaScriptTokens.COMMA);this._builder.
addSpace();}} |
| 656 this._builder.decreaseNestingLevel();this._expect(FormatterWorker.JavaScriptToke
ns.RBRACK);},_parseObjectLiteralGetSet:function() |
| 657 {var token=this._peek();if(token===FormatterWorker.JavaScriptTokens.IDENTIFIER||
token===FormatterWorker.JavaScriptTokens.NUMBER||token===FormatterWorker.JavaScr
iptTokens.STRING||FormatterWorker.JavaScriptTokens.DELETE<=token&&token<=Formatt
erWorker.JavaScriptTokens.FALSE_LITERAL||token===FormatterWorker.JavaScriptToken
s.INSTANCEOF||token===FormatterWorker.JavaScriptTokens.IN||token===FormatterWork
er.JavaScriptTokens.CONST){this._next();this._parseFunctionLiteral();}},_parseOb
jectLiteral:function() |
| 658 {this._expect(FormatterWorker.JavaScriptTokens.LBRACE);this._builder.increaseNes
tingLevel();while(this._peek()!==FormatterWorker.JavaScriptTokens.RBRACE){var to
ken=this._peek();switch(token){case FormatterWorker.JavaScriptTokens.IDENTIFIER:
this._consume(FormatterWorker.JavaScriptTokens.IDENTIFIER);var name=this._token.
value;if((name==="get"||name==="set")&&this._peek()!==FormatterWorker.JavaScript
Tokens.COLON){this._builder.addSpace();this._parseObjectLiteralGetSet();if(this.
_peek()!==FormatterWorker.JavaScriptTokens.RBRACE){this._expect(FormatterWorker.
JavaScriptTokens.COMMA);} |
| 659 continue;} |
| 660 break;case FormatterWorker.JavaScriptTokens.STRING:this._consume(FormatterWorker
.JavaScriptTokens.STRING);break;case FormatterWorker.JavaScriptTokens.NUMBER:thi
s._consume(FormatterWorker.JavaScriptTokens.NUMBER);break;default:this._next();} |
| 661 this._expect(FormatterWorker.JavaScriptTokens.COLON);this._builder.addSpace();th
is._parseAssignmentExpression();if(this._peek()!==FormatterWorker.JavaScriptToke
ns.RBRACE){this._expect(FormatterWorker.JavaScriptTokens.COMMA);}} |
| 662 this._builder.decreaseNestingLevel();this._expect(FormatterWorker.JavaScriptToke
ns.RBRACE);},_parseRegExpLiteral:function() |
| 663 {if(this._nextToken.type==="regexp") |
| 664 this._next();else{this._forceRegexp=true;this._next();}},_parseArguments:functio
n() |
| 665 {this._expect(FormatterWorker.JavaScriptTokens.LPAREN);var done=(this._peek()===
FormatterWorker.JavaScriptTokens.RPAREN);while(!done){this._parseAssignmentExpre
ssion();done=(this._peek()===FormatterWorker.JavaScriptTokens.RPAREN);if(!done){
this._expect(FormatterWorker.JavaScriptTokens.COMMA);this._builder.addSpace();}} |
| 666 this._expect(FormatterWorker.JavaScriptTokens.RPAREN);},_parseFunctionLiteral:fu
nction() |
| 667 {this._expect(FormatterWorker.JavaScriptTokens.LPAREN);var done=(this._peek()===
FormatterWorker.JavaScriptTokens.RPAREN);while(!done){this._expect(FormatterWork
er.JavaScriptTokens.IDENTIFIER);done=(this._peek()===FormatterWorker.JavaScriptT
okens.RPAREN);if(!done){this._expect(FormatterWorker.JavaScriptTokens.COMMA);thi
s._builder.addSpace();}} |
| 668 this._expect(FormatterWorker.JavaScriptTokens.RPAREN);this._builder.addSpace();t
his._expect(FormatterWorker.JavaScriptTokens.LBRACE);this._builder.addNewLine();
this._builder.increaseNestingLevel();this._parseSourceElements(FormatterWorker.J
avaScriptTokens.RBRACE);this._builder.decreaseNestingLevel();this._expect(Format
terWorker.JavaScriptTokens.RBRACE);}} |
| 669 FormatterWorker.JavaScriptFormattedContentBuilder=function(content,mapping,origi
nalOffset,formattedOffset,indentString) |
568 {this._originalContent=content;this._originalOffset=originalOffset;this._lastOri
ginalPosition=0;this._formattedContent=[];this._formattedContentLength=0;this._f
ormattedOffset=formattedOffset;this._lastFormattedPosition=0;this._mapping=mappi
ng;this._lineNumber=0;this._nestingLevel=0;this._indentString=indentString;this.
_cachedIndents={};} | 670 {this._originalContent=content;this._originalOffset=originalOffset;this._lastOri
ginalPosition=0;this._formattedContent=[];this._formattedContentLength=0;this._f
ormattedOffset=formattedOffset;this._lastFormattedPosition=0;this._mapping=mappi
ng;this._lineNumber=0;this._nestingLevel=0;this._indentString=indentString;this.
_cachedIndents={};} |
569 FormattedContentBuilder.prototype={addToken:function(token) | 671 FormatterWorker.JavaScriptFormattedContentBuilder.prototype={addToken:function(t
oken) |
570 {for(var i=0;i<token.comments_before.length;++i) | 672 {for(var i=0;i<token.comments_before.length;++i) |
571 this._addComment(token.comments_before[i]);while(this._lineNumber<token.line){th
is._addText("\n");this._addIndent();this._needNewLine=false;this._lineNumber+=1;
} | 673 this._addComment(token.comments_before[i]);while(this._lineNumber<token.line){th
is._addText("\n");this._addIndent();this._needNewLine=false;this._lineNumber+=1;
} |
572 if(this._needNewLine){this._addText("\n");this._addIndent();this._needNewLine=fa
lse;} | 674 if(this._needNewLine){this._addText("\n");this._addIndent();this._needNewLine=fa
lse;} |
573 this._addMappingIfNeeded(token.pos);this._addText(this._originalContent.substrin
g(token.pos,token.endPos));this._lineNumber=token.endLine;},addSpace:function() | 675 this._addMappingIfNeeded(token.pos);this._addText(this._originalContent.substrin
g(token.pos,token.endPos));this._lineNumber=token.endLine;},addSpace:function() |
574 {this._addText(" ");},addNewLine:function() | 676 {this._addText(" ");},addNewLine:function() |
575 {this._needNewLine=true;},increaseNestingLevel:function() | 677 {this._needNewLine=true;},increaseNestingLevel:function() |
576 {this._nestingLevel+=1;},decreaseNestingLevel:function() | 678 {this._nestingLevel+=1;},decreaseNestingLevel:function() |
577 {this._nestingLevel-=1;},content:function() | 679 {this._nestingLevel-=1;},content:function() |
578 {return this._formattedContent.join("");},mapping:function() | 680 {return this._formattedContent.join("");},_addIndent:function() |
579 {return{original:this._originalPositions,formatted:this._formattedPositions};},_
addIndent:function() | |
580 {if(this._cachedIndents[this._nestingLevel]){this._addText(this._cachedIndents[t
his._nestingLevel]);return;} | 681 {if(this._cachedIndents[this._nestingLevel]){this._addText(this._cachedIndents[t
his._nestingLevel]);return;} |
581 var fullIndent="";for(var i=0;i<this._nestingLevel;++i) | 682 var fullIndent="";for(var i=0;i<this._nestingLevel;++i) |
582 fullIndent+=this._indentString;this._addText(fullIndent);if(this._nestingLevel<=
20) | 683 fullIndent+=this._indentString;this._addText(fullIndent);if(this._nestingLevel<=
20) |
583 this._cachedIndents[this._nestingLevel]=fullIndent;},_addComment:function(commen
t) | 684 this._cachedIndents[this._nestingLevel]=fullIndent;},_addComment:function(commen
t) |
584 {if(this._lineNumber<comment.line){for(var j=this._lineNumber;j<comment.line;++j
) | 685 {if(this._lineNumber<comment.line){for(var j=this._lineNumber;j<comment.line;++j
) |
585 this._addText("\n");this._lineNumber=comment.line;this._needNewLine=false;this._
addIndent();}else | 686 this._addText("\n");this._lineNumber=comment.line;this._needNewLine=false;this._
addIndent();}else |
586 this.addSpace();this._addMappingIfNeeded(comment.pos);if(comment.type==="comment
1") | 687 this.addSpace();this._addMappingIfNeeded(comment.pos);if(comment.type==="comment
1") |
587 this._addText("//");else | 688 this._addText("//");else |
588 this._addText("/*");this._addText(comment.value);if(comment.type!=="comment1"){t
his._addText("*/");var position;while((position=comment.value.indexOf("\n",posit
ion+1))!==-1) | 689 this._addText("/*");this._addText(comment.value);if(comment.type!=="comment1"){t
his._addText("*/");var position;while((position=comment.value.indexOf("\n",posit
ion+1))!==-1) |
589 this._lineNumber+=1;}},_addText:function(text) | 690 this._lineNumber+=1;}},_addText:function(text) |
590 {this._formattedContent.push(text);this._formattedContentLength+=text.length;},_
addMappingIfNeeded:function(originalPosition) | 691 {this._formattedContent.push(text);this._formattedContentLength+=text.length;},_
addMappingIfNeeded:function(originalPosition) |
591 {if(originalPosition-this._lastOriginalPosition===this._formattedContentLength-t
his._lastFormattedPosition) | 692 {if(originalPosition-this._lastOriginalPosition===this._formattedContentLength-t
his._lastFormattedPosition) |
592 return;this._mapping.original.push(this._originalOffset+originalPosition);this._
lastOriginalPosition=originalPosition;this._mapping.formatted.push(this._formatt
edOffset+this._formattedContentLength);this._lastFormattedPosition=this._formatt
edContentLength;}} | 693 return;this._mapping.original.push(this._originalOffset+originalPosition);this._
lastOriginalPosition=originalPosition;this._mapping.formatted.push(this._formatt
edOffset+this._formattedContentLength);this._lastFormattedPosition=this._formatt
edContentLength;}} |
593 var tokens=[["EOS"],["LPAREN","("],["RPAREN",")"],["LBRACK","["],["RBRACK","]"],
["LBRACE","{"],["RBRACE","}"],["COLON",":"],["SEMICOLON",";"],["PERIOD","."],["C
ONDITIONAL","?"],["INC","++"],["DEC","--"],["ASSIGN","="],["ASSIGN_BIT_OR","|="]
,["ASSIGN_BIT_XOR","^="],["ASSIGN_BIT_AND","&="],["ASSIGN_SHL","<<="],["ASSIGN_S
AR",">>="],["ASSIGN_SHR",">>>="],["ASSIGN_ADD","+="],["ASSIGN_SUB","-="],["ASSIG
N_MUL","*="],["ASSIGN_DIV","/="],["ASSIGN_MOD","%="],["COMMA",","],["OR","||"],[
"AND","&&"],["BIT_OR","|"],["BIT_XOR","^"],["BIT_AND","&"],["SHL","<<"],["SAR","
>>"],["SHR",">>>"],["ADD","+"],["SUB","-"],["MUL","*"],["DIV","/"],["MOD","%"],[
"EQ","=="],["NE","!="],["EQ_STRICT","==="],["NE_STRICT","!=="],["LT","<"],["GT",
">"],["LTE","<="],["GTE",">="],["INSTANCEOF","instanceof"],["IN","in"],["NOT","!
"],["BIT_NOT","~"],["DELETE","delete"],["TYPEOF","typeof"],["VOID","void"],["BRE
AK","break"],["CASE","case"],["CATCH","catch"],["CONTINUE","continue"],["DEBUGGE
R","debugger"],["DEFAULT","default"],["DO","do"],["ELSE","else"],["FINALLY","fin
ally"],["FOR","for"],["FUNCTION","function"],["IF","if"],["NEW","new"],["RETURN"
,"return"],["SWITCH","switch"],["THIS","this"],["THROW","throw"],["TRY","try"],[
"VAR","var"],["WHILE","while"],["WITH","with"],["NULL_LITERAL","null"],["TRUE_LI
TERAL","true"],["FALSE_LITERAL","false"],["NUMBER"],["STRING"],["IDENTIFIER"],["
CONST","const"]];var Tokens={};for(var i=0;i<tokens.length;++i) | 694 FormatterWorker.JavaScriptTokens={};FormatterWorker.JavaScriptTokensByValue={};F
ormatterWorker.JavaScriptTokens.EOS=0;FormatterWorker.JavaScriptTokens.LPAREN=Fo
rmatterWorker.JavaScriptTokensByValue["("]=1;FormatterWorker.JavaScriptTokens.RP
AREN=FormatterWorker.JavaScriptTokensByValue[")"]=2;FormatterWorker.JavaScriptTo
kens.LBRACK=FormatterWorker.JavaScriptTokensByValue["["]=3;FormatterWorker.JavaS
criptTokens.RBRACK=FormatterWorker.JavaScriptTokensByValue["]"]=4;FormatterWorke
r.JavaScriptTokens.LBRACE=FormatterWorker.JavaScriptTokensByValue["{"]=5;Formatt
erWorker.JavaScriptTokens.RBRACE=FormatterWorker.JavaScriptTokensByValue["}"]=6;
FormatterWorker.JavaScriptTokens.COLON=FormatterWorker.JavaScriptTokensByValue["
:"]=7;FormatterWorker.JavaScriptTokens.SEMICOLON=FormatterWorker.JavaScriptToken
sByValue[";"]=8;FormatterWorker.JavaScriptTokens.PERIOD=FormatterWorker.JavaScri
ptTokensByValue["."]=9;FormatterWorker.JavaScriptTokens.CONDITIONAL=FormatterWor
ker.JavaScriptTokensByValue["?"]=10;FormatterWorker.JavaScriptTokens.INC=Formatt
erWorker.JavaScriptTokensByValue["++"]=11;FormatterWorker.JavaScriptTokens.DEC=F
ormatterWorker.JavaScriptTokensByValue["--"]=12;FormatterWorker.JavaScriptTokens
.ASSIGN=FormatterWorker.JavaScriptTokensByValue["="]=13;FormatterWorker.JavaScri
ptTokens.ASSIGN_BIT_OR=FormatterWorker.JavaScriptTokensByValue["|="]=14;Formatte
rWorker.JavaScriptTokens.ASSIGN_BIT_XOR=FormatterWorker.JavaScriptTokensByValue[
"^="]=15;FormatterWorker.JavaScriptTokens.ASSIGN_BIT_AND=FormatterWorker.JavaScr
iptTokensByValue["&="]=16;FormatterWorker.JavaScriptTokens.ASSIGN_SHL=FormatterW
orker.JavaScriptTokensByValue["<<="]=17;FormatterWorker.JavaScriptTokens.ASSIGN_
SAR=FormatterWorker.JavaScriptTokensByValue[">>="]=18;FormatterWorker.JavaScript
Tokens.ASSIGN_SHR=FormatterWorker.JavaScriptTokensByValue[">>>="]=19;FormatterWo
rker.JavaScriptTokens.ASSIGN_ADD=FormatterWorker.JavaScriptTokensByValue["+="]=2
0;FormatterWorker.JavaScriptTokens.ASSIGN_SUB=FormatterWorker.JavaScriptTokensBy
Value["-="]=21;FormatterWorker.JavaScriptTokens.ASSIGN_MUL=FormatterWorker.JavaS
criptTokensByValue["*="]=22;FormatterWorker.JavaScriptTokens.ASSIGN_DIV=Formatte
rWorker.JavaScriptTokensByValue["/="]=23;FormatterWorker.JavaScriptTokens.ASSIGN
_MOD=FormatterWorker.JavaScriptTokensByValue["%="]=24;FormatterWorker.JavaScript
Tokens.COMMA=FormatterWorker.JavaScriptTokensByValue[","]=25;FormatterWorker.Jav
aScriptTokens.OR=FormatterWorker.JavaScriptTokensByValue["||"]=26;FormatterWorke
r.JavaScriptTokens.AND=FormatterWorker.JavaScriptTokensByValue["&&"]=27;Formatte
rWorker.JavaScriptTokens.BIT_OR=FormatterWorker.JavaScriptTokensByValue["|"]=28;
FormatterWorker.JavaScriptTokens.BIT_XOR=FormatterWorker.JavaScriptTokensByValue
["^"]=29;FormatterWorker.JavaScriptTokens.BIT_AND=FormatterWorker.JavaScriptToke
nsByValue["&"]=30;FormatterWorker.JavaScriptTokens.SHL=FormatterWorker.JavaScrip
tTokensByValue["<<"]=31;FormatterWorker.JavaScriptTokens.SAR=FormatterWorker.Jav
aScriptTokensByValue[">>"]=32;FormatterWorker.JavaScriptTokens.SHR=FormatterWork
er.JavaScriptTokensByValue[">>>"]=33;FormatterWorker.JavaScriptTokens.ADD=Format
terWorker.JavaScriptTokensByValue["+"]=34;FormatterWorker.JavaScriptTokens.SUB=F
ormatterWorker.JavaScriptTokensByValue["-"]=35;FormatterWorker.JavaScriptTokens.
MUL=FormatterWorker.JavaScriptTokensByValue["*"]=36;FormatterWorker.JavaScriptTo
kens.DIV=FormatterWorker.JavaScriptTokensByValue["/"]=37;FormatterWorker.JavaScr
iptTokens.MOD=FormatterWorker.JavaScriptTokensByValue["%"]=38;FormatterWorker.Ja
vaScriptTokens.EQ=FormatterWorker.JavaScriptTokensByValue["=="]=39;FormatterWork
er.JavaScriptTokens.NE=FormatterWorker.JavaScriptTokensByValue["!="]=40;Formatte
rWorker.JavaScriptTokens.EQ_STRICT=FormatterWorker.JavaScriptTokensByValue["==="
]=41;FormatterWorker.JavaScriptTokens.NE_STRICT=FormatterWorker.JavaScriptTokens
ByValue["!=="]=42;FormatterWorker.JavaScriptTokens.LT=FormatterWorker.JavaScript
TokensByValue["<"]=43;FormatterWorker.JavaScriptTokens.GT=FormatterWorker.JavaSc
riptTokensByValue[">"]=44;FormatterWorker.JavaScriptTokens.LTE=FormatterWorker.J
avaScriptTokensByValue["<="]=45;FormatterWorker.JavaScriptTokens.GTE=FormatterWo
rker.JavaScriptTokensByValue[">="]=46;FormatterWorker.JavaScriptTokens.INSTANCEO
F=FormatterWorker.JavaScriptTokensByValue["instanceof"]=47;FormatterWorker.JavaS
criptTokens.IN=FormatterWorker.JavaScriptTokensByValue["in"]=48;FormatterWorker.
JavaScriptTokens.NOT=FormatterWorker.JavaScriptTokensByValue["!"]=49;FormatterWo
rker.JavaScriptTokens.BIT_NOT=FormatterWorker.JavaScriptTokensByValue["~"]=50;Fo
rmatterWorker.JavaScriptTokens.DELETE=FormatterWorker.JavaScriptTokensByValue["d
elete"]=51;FormatterWorker.JavaScriptTokens.TYPEOF=FormatterWorker.JavaScriptTok
ensByValue["typeof"]=52;FormatterWorker.JavaScriptTokens.VOID=FormatterWorker.Ja
vaScriptTokensByValue["void"]=53;FormatterWorker.JavaScriptTokens.BREAK=Formatte
rWorker.JavaScriptTokensByValue["break"]=54;FormatterWorker.JavaScriptTokens.CAS
E=FormatterWorker.JavaScriptTokensByValue["case"]=55;FormatterWorker.JavaScriptT
okens.CATCH=FormatterWorker.JavaScriptTokensByValue["catch"]=56;FormatterWorker.
JavaScriptTokens.CONTINUE=FormatterWorker.JavaScriptTokensByValue["continue"]=57
;FormatterWorker.JavaScriptTokens.DEBUGGER=FormatterWorker.JavaScriptTokensByVal
ue["debugger"]=58;FormatterWorker.JavaScriptTokens.DEFAULT=FormatterWorker.JavaS
criptTokensByValue["default"]=59;FormatterWorker.JavaScriptTokens.DO=FormatterWo
rker.JavaScriptTokensByValue["do"]=60;FormatterWorker.JavaScriptTokens.ELSE=Form
atterWorker.JavaScriptTokensByValue["else"]=61;FormatterWorker.JavaScriptTokens.
FINALLY=FormatterWorker.JavaScriptTokensByValue["finally"]=62;FormatterWorker.Ja
vaScriptTokens.FOR=FormatterWorker.JavaScriptTokensByValue["for"]=63;FormatterWo
rker.JavaScriptTokens.FUNCTION=FormatterWorker.JavaScriptTokensByValue["function
"]=64;FormatterWorker.JavaScriptTokens.IF=FormatterWorker.JavaScriptTokensByValu
e["if"]=65;FormatterWorker.JavaScriptTokens.NEW=FormatterWorker.JavaScriptTokens
ByValue["new"]=66;FormatterWorker.JavaScriptTokens.RETURN=FormatterWorker.JavaSc
riptTokensByValue["return"]=67;FormatterWorker.JavaScriptTokens.SWITCH=Formatter
Worker.JavaScriptTokensByValue["switch"]=68;FormatterWorker.JavaScriptTokens.THI
S=FormatterWorker.JavaScriptTokensByValue["this"]=69;FormatterWorker.JavaScriptT
okens.THROW=FormatterWorker.JavaScriptTokensByValue["throw"]=70;FormatterWorker.
JavaScriptTokens.TRY=FormatterWorker.JavaScriptTokensByValue["try"]=71;Formatter
Worker.JavaScriptTokens.VAR=FormatterWorker.JavaScriptTokensByValue["var"]=72;Fo
rmatterWorker.JavaScriptTokens.WHILE=FormatterWorker.JavaScriptTokensByValue["wh
ile"]=73;FormatterWorker.JavaScriptTokens.WITH=FormatterWorker.JavaScriptTokensB
yValue["with"]=74;FormatterWorker.JavaScriptTokens.NULL_LITERAL=FormatterWorker.
JavaScriptTokensByValue["null"]=75;FormatterWorker.JavaScriptTokens.TRUE_LITERAL
=FormatterWorker.JavaScriptTokensByValue["true"]=76;FormatterWorker.JavaScriptTo
kens.FALSE_LITERAL=FormatterWorker.JavaScriptTokensByValue["false"]=77;Formatter
Worker.JavaScriptTokens.NUMBER=78;FormatterWorker.JavaScriptTokens.STRING=79;For
matterWorker.JavaScriptTokens.IDENTIFIER=80;FormatterWorker.JavaScriptTokens.CON
ST=FormatterWorker.JavaScriptTokensByValue["const"]=81;FormatterWorker.JavaScrip
tTokensByType={"eof":FormatterWorker.JavaScriptTokens.EOS,"name":FormatterWorker
.JavaScriptTokens.IDENTIFIER,"num":FormatterWorker.JavaScriptTokens.NUMBER,"rege
xp":FormatterWorker.JavaScriptTokens.DIV,"string":FormatterWorker.JavaScriptToke
ns.STRING};FormatterWorker.JavaScriptTokenizer=function(content) |
594 Tokens[tokens[i][0]]=i;var TokensByValue={};for(var i=0;i<tokens.length;++i){if(
tokens[i][1]) | |
595 TokensByValue[tokens[i][1]]=i;} | |
596 var TokensByType={"eof":Tokens.EOS,"name":Tokens.IDENTIFIER,"num":Tokens.NUMBER,
"regexp":Tokens.DIV,"string":Tokens.STRING};function Tokenizer(content) | |
597 {this._readNextToken=parse.tokenizer(content);this._state=this._readNextToken.co
ntext();} | 695 {this._readNextToken=parse.tokenizer(content);this._state=this._readNextToken.co
ntext();} |
598 Tokenizer.prototype={content:function() | 696 FormatterWorker.JavaScriptTokenizer.prototype={content:function() |
599 {return this._state.text;},next:function(forceRegexp) | 697 {return this._state.text;},next:function(forceRegexp) |
600 {var uglifyToken=this._readNextToken(forceRegexp);uglifyToken.endPos=this._state
.pos;uglifyToken.endLine=this._state.line;uglifyToken.token=this._convertUglifyT
oken(uglifyToken);return uglifyToken;},_convertUglifyToken:function(uglifyToken) | 698 {var uglifyToken=this._readNextToken(forceRegexp);uglifyToken.endPos=this._state
.pos;uglifyToken.endLine=this._state.line;uglifyToken.token=this._convertUglifyT
oken(uglifyToken);return uglifyToken;},_convertUglifyToken:function(uglifyToken) |
601 {var token=TokensByType[uglifyToken.type];if(typeof token==="number") | 699 {var token=FormatterWorker.JavaScriptTokensByType[uglifyToken.type];if(typeof to
ken==="number") |
602 return token;token=TokensByValue[uglifyToken.value];if(typeof token==="number") | 700 return token;token=FormatterWorker.JavaScriptTokensByValue[uglifyToken.value];if
(typeof token==="number") |
603 return token;throw"Unknown token type "+uglifyToken.type;}} | 701 return token;throw"Unknown token type "+uglifyToken.type;}};FormatterWorker.CSSF
ormatter=function(content,builder) |
604 function JavaScriptFormatter(tokenizer,builder) | 702 {this._content=content;this._builder=builder;this._lastLine=-1;this._state={};} |
605 {this._tokenizer=tokenizer;this._builder=builder;this._token=null;this._nextToke
n=this._tokenizer.next();} | 703 FormatterWorker.CSSFormatter.prototype={format:function() |
606 JavaScriptFormatter.prototype={format:function() | 704 {this._lineEndings=this._lineEndings(this._content);var tokenize=WebInspector.Co
deMirrorUtils.createTokenizer("text/css");var lines=this._content.split("\n");fo
r(var i=0;i<lines.length;++i){var line=lines[i];tokenize(line,this._tokenCallbac
k.bind(this,i));} |
607 {this._parseSourceElements(Tokens.EOS);this._consume(Tokens.EOS);},_peek:functio
n() | 705 this._builder.flushNewLines(true);},_lineEndings:function(text) |
608 {return this._nextToken.token;},_next:function() | 706 {var lineEndings=[];var i=text.indexOf("\n");while(i!==-1){lineEndings.push(i);i
=text.indexOf("\n",i+1);} |
609 {if(this._token&&this._token.token===Tokens.EOS) | 707 lineEndings.push(text.length);return lineEndings;},_tokenCallback:function(start
Line,token,type,startColumn) |
610 throw"Unexpected EOS token";this._builder.addToken(this._nextToken);this._token=
this._nextToken;this._nextToken=this._tokenizer.next(this._forceRegexp);this._fo
rceRegexp=false;return this._token.token;},_consume:function(token) | 708 {if(startLine!==this._lastLine) |
611 {var next=this._next();if(next!==token) | 709 this._state.eatWhitespace=true;if(/^css-property/.test(type)&&!this._state.inPro
pertyValue) |
612 throw"Unexpected token in consume: expected "+token+", actual "+next;},_expect:f
unction(token) | 710 this._state.seenProperty=true;this._lastLine=startLine;var isWhitespace=/^\s+$/.
test(token);if(isWhitespace){if(!this._state.eatWhitespace) |
613 {var next=this._next();if(next!==token) | 711 this._builder.addSpace();return;} |
614 throw"Unexpected token: expected "+token+", actual "+next;},_expectSemicolon:fun
ction() | 712 this._state.eatWhitespace=false;if(token==="\n") |
615 {if(this._peek()===Tokens.SEMICOLON) | 713 return;if(token!=="}"){if(this._state.afterClosingBrace) |
616 this._consume(Tokens.SEMICOLON);},_hasLineTerminatorBeforeNext:function() | 714 this._builder.addNewLine();this._state.afterClosingBrace=false;} |
617 {return this._nextToken.nlb;},_parseSourceElements:function(endToken) | 715 var startPosition=(startLine?this._lineEndings[startLine-1]:0)+startColumn;if(to
ken==="}"){if(this._state.inPropertyValue) |
618 {while(this._peek()!==endToken){this._parseStatement();this._builder.addNewLine(
);}},_parseStatementOrBlock:function() | 716 this._builder.addNewLine();this._builder.decreaseNestingLevel();this._state.afte
rClosingBrace=true;this._state.inPropertyValue=false;}else if(token===":"&&!this
._state.inPropertyValue&&this._state.seenProperty){this._builder.addToken(token,
startPosition,startLine,startColumn);this._builder.addSpace();this._state.eatWhi
tespace=true;this._state.inPropertyValue=true;this._state.seenProperty=false;ret
urn;}else if(token==="{"){this._builder.addSpace();this._builder.addToken(token,
startPosition,startLine,startColumn);this._builder.addNewLine();this._builder.in
creaseNestingLevel();return;} |
619 {if(this._peek()===Tokens.LBRACE){this._builder.addSpace();this._parseBlock();re
turn true;} | 717 this._builder.addToken(token,startPosition,startLine,startColumn);if(type==="css
-comment"&&!this._state.inPropertyValue&&!this._state.seenProperty) |
620 this._builder.addNewLine();this._builder.increaseNestingLevel();this._parseState
ment();this._builder.decreaseNestingLevel();},_parseStatement:function() | 718 this._builder.addNewLine();if(token===";"&&this._state.inPropertyValue){this._st
ate.inPropertyValue=false;this._builder.addNewLine();}else if(token==="}"){this.
_builder.addNewLine();}}} |
621 {switch(this._peek()){case Tokens.LBRACE:return this._parseBlock();case Tokens.C
ONST:case Tokens.VAR:return this._parseVariableStatement();case Tokens.SEMICOLON
:return this._next();case Tokens.IF:return this._parseIfStatement();case Tokens.
DO:return this._parseDoWhileStatement();case Tokens.WHILE:return this._parseWhil
eStatement();case Tokens.FOR:return this._parseForStatement();case Tokens.CONTIN
UE:return this._parseContinueStatement();case Tokens.BREAK:return this._parseBre
akStatement();case Tokens.RETURN:return this._parseReturnStatement();case Tokens
.WITH:return this._parseWithStatement();case Tokens.SWITCH:return this._parseSwi
tchStatement();case Tokens.THROW:return this._parseThrowStatement();case Tokens.
TRY:return this._parseTryStatement();case Tokens.FUNCTION:return this._parseFunc
tionDeclaration();case Tokens.DEBUGGER:return this._parseDebuggerStatement();def
ault:return this._parseExpressionOrLabelledStatement();}},_parseFunctionDeclarat
ion:function() | 719 FormatterWorker.CSSFormattedContentBuilder=function(content,mapping,originalOffs
et,formattedOffset,indentString) |
622 {this._expect(Tokens.FUNCTION);this._builder.addSpace();this._expect(Tokens.IDEN
TIFIER);this._parseFunctionLiteral()},_parseBlock:function() | 720 {this._originalContent=content;this._originalOffset=originalOffset;this._lastOri
ginalPosition=0;this._formattedContent=[];this._formattedContentLength=0;this._f
ormattedOffset=formattedOffset;this._lastFormattedPosition=0;this._mapping=mappi
ng;this._lineNumber=0;this._nestingLevel=0;this._needNewLines=0;this._atLineStar
t=true;this._indentString=indentString;this._cachedIndents={};} |
623 {this._expect(Tokens.LBRACE);this._builder.addNewLine();this._builder.increaseNe
stingLevel();while(this._peek()!==Tokens.RBRACE){this._parseStatement();this._bu
ilder.addNewLine();} | 721 FormatterWorker.CSSFormattedContentBuilder.prototype={addToken:function(token,st
artPosition,startLine,startColumn) |
624 this._builder.decreaseNestingLevel();this._expect(Tokens.RBRACE);},_parseVariabl
eStatement:function() | 722 {if((this._isWhitespaceRun||this._atLineStart)&&/^\s+$/.test(token)) |
625 {this._parseVariableDeclarations();this._expectSemicolon();},_parseVariableDecla
rations:function() | 723 return;if(this._isWhitespaceRun&&this._lineNumber===startLine&&!this._needNewLin
es) |
626 {if(this._peek()===Tokens.VAR) | 724 this._addText(" ");this._isWhitespaceRun=false;this._atLineStart=false;while(thi
s._lineNumber<startLine){this._addText("\n");this._addIndent();this._needNewLine
s=0;this._lineNumber+=1;this._atLineStart=true;} |
627 this._consume(Tokens.VAR);else | 725 if(this._needNewLines){this.flushNewLines();this._addIndent();this._atLineStart=
true;} |
628 this._consume(Tokens.CONST) | 726 this._addMappingIfNeeded(startPosition);this._addText(token);this._lineNumber=st
artLine;},addSpace:function() |
629 this._builder.addSpace();var isFirstVariable=true;do{if(!isFirstVariable){this._
consume(Tokens.COMMA);this._builder.addSpace();} | 727 {if(this._isWhitespaceRun) |
630 isFirstVariable=false;this._expect(Tokens.IDENTIFIER);if(this._peek()===Tokens.A
SSIGN){this._builder.addSpace();this._consume(Tokens.ASSIGN);this._builder.addSp
ace();this._parseAssignmentExpression();}}while(this._peek()===Tokens.COMMA);},_
parseExpressionOrLabelledStatement:function() | 728 return;this._isWhitespaceRun=true;},addNewLine:function() |
631 {this._parseExpression();if(this._peek()===Tokens.COLON){this._expect(Tokens.COL
ON);this._builder.addSpace();this._parseStatement();} | 729 {++this._needNewLines;},flushNewLines:function(atLeastOne) |
632 this._expectSemicolon();},_parseIfStatement:function() | 730 {var newLineCount=atLeastOne&&!this._needNewLines?1:this._needNewLines;if(newLin
eCount) |
633 {this._expect(Tokens.IF);this._builder.addSpace();this._expect(Tokens.LPAREN);th
is._parseExpression();this._expect(Tokens.RPAREN);var isBlock=this._parseStateme
ntOrBlock();if(this._peek()===Tokens.ELSE){if(isBlock) | 731 this._isWhitespaceRun=false;for(var i=0;i<newLineCount;++i) |
634 this._builder.addSpace();else | 732 this._addText("\n");this._needNewLines=0;},increaseNestingLevel:function() |
635 this._builder.addNewLine();this._next();if(this._peek()===Tokens.IF){this._build
er.addSpace();this._parseStatement();}else | 733 {this._nestingLevel+=1;},decreaseNestingLevel:function(addNewline) |
636 this._parseStatementOrBlock();}},_parseContinueStatement:function() | 734 {if(this._nestingLevel) |
637 {this._expect(Tokens.CONTINUE);var token=this._peek();if(!this._hasLineTerminato
rBeforeNext()&&token!==Tokens.SEMICOLON&&token!==Tokens.RBRACE&&token!==Tokens.E
OS){this._builder.addSpace();this._expect(Tokens.IDENTIFIER);} | 735 this._nestingLevel-=1;if(addNewline) |
638 this._expectSemicolon();},_parseBreakStatement:function() | 736 this.addNewLine();},content:function() |
639 {this._expect(Tokens.BREAK);var token=this._peek();if(!this._hasLineTerminatorBe
foreNext()&&token!==Tokens.SEMICOLON&&token!==Tokens.RBRACE&&token!==Tokens.EOS)
{this._builder.addSpace();this._expect(Tokens.IDENTIFIER);} | 737 {return this._formattedContent.join("");},_addIndent:function() |
640 this._expectSemicolon();},_parseReturnStatement:function() | 738 {if(this._cachedIndents[this._nestingLevel]){this._addText(this._cachedIndents[t
his._nestingLevel]);return;} |
641 {this._expect(Tokens.RETURN);var token=this._peek();if(!this._hasLineTerminatorB
eforeNext()&&token!==Tokens.SEMICOLON&&token!==Tokens.RBRACE&&token!==Tokens.EOS
){this._builder.addSpace();this._parseExpression();} | 739 var fullIndent="";for(var i=0;i<this._nestingLevel;++i) |
642 this._expectSemicolon();},_parseWithStatement:function() | 740 fullIndent+=this._indentString;this._addText(fullIndent);if(this._nestingLevel<=
20) |
643 {this._expect(Tokens.WITH);this._builder.addSpace();this._expect(Tokens.LPAREN);
this._parseExpression();this._expect(Tokens.RPAREN);this._parseStatementOrBlock(
);},_parseCaseClause:function() | 741 this._cachedIndents[this._nestingLevel]=fullIndent;},_addText:function(text) |
644 {if(this._peek()===Tokens.CASE){this._expect(Tokens.CASE);this._builder.addSpace
();this._parseExpression();}else | 742 {if(!text) |
645 this._expect(Tokens.DEFAULT);this._expect(Tokens.COLON);this._builder.addNewLine
();this._builder.increaseNestingLevel();while(this._peek()!==Tokens.CASE&&this._
peek()!==Tokens.DEFAULT&&this._peek()!==Tokens.RBRACE){this._parseStatement();th
is._builder.addNewLine();} | 743 return;this._formattedContent.push(text);this._formattedContentLength+=text.leng
th;},_addMappingIfNeeded:function(originalPosition) |
646 this._builder.decreaseNestingLevel();},_parseSwitchStatement:function() | 744 {if(originalPosition-this._lastOriginalPosition===this._formattedContentLength-t
his._lastFormattedPosition) |
647 {this._expect(Tokens.SWITCH);this._builder.addSpace();this._expect(Tokens.LPAREN
);this._parseExpression();this._expect(Tokens.RPAREN);this._builder.addSpace();t
his._expect(Tokens.LBRACE);this._builder.addNewLine();this._builder.increaseNest
ingLevel();while(this._peek()!==Tokens.RBRACE) | 745 return;this._mapping.original.push(this._originalOffset+originalPosition);this._
lastOriginalPosition=originalPosition;this._mapping.formatted.push(this._formatt
edOffset+this._formattedContentLength);this._lastFormattedPosition=this._formatt
edContentLength;}}; |
648 this._parseCaseClause();this._builder.decreaseNestingLevel();this._expect(Tokens
.RBRACE);},_parseThrowStatement:function() | |
649 {this._expect(Tokens.THROW);this._builder.addSpace();this._parseExpression();thi
s._expectSemicolon();},_parseTryStatement:function() | |
650 {this._expect(Tokens.TRY);this._builder.addSpace();this._parseBlock();var token=
this._peek();if(token===Tokens.CATCH){this._builder.addSpace();this._consume(Tok
ens.CATCH);this._builder.addSpace();this._expect(Tokens.LPAREN);this._expect(Tok
ens.IDENTIFIER);this._expect(Tokens.RPAREN);this._builder.addSpace();this._parse
Block();token=this._peek();} | |
651 if(token===Tokens.FINALLY){this._consume(Tokens.FINALLY);this._builder.addSpace(
);this._parseBlock();}},_parseDoWhileStatement:function() | |
652 {this._expect(Tokens.DO);var isBlock=this._parseStatementOrBlock();if(isBlock) | |
653 this._builder.addSpace();else | |
654 this._builder.addNewLine();this._expect(Tokens.WHILE);this._builder.addSpace();t
his._expect(Tokens.LPAREN);this._parseExpression();this._expect(Tokens.RPAREN);t
his._expectSemicolon();},_parseWhileStatement:function() | |
655 {this._expect(Tokens.WHILE);this._builder.addSpace();this._expect(Tokens.LPAREN)
;this._parseExpression();this._expect(Tokens.RPAREN);this._parseStatementOrBlock
();},_parseForStatement:function() | |
656 {this._expect(Tokens.FOR);this._builder.addSpace();this._expect(Tokens.LPAREN);i
f(this._peek()!==Tokens.SEMICOLON){if(this._peek()===Tokens.VAR||this._peek()===
Tokens.CONST){this._parseVariableDeclarations();if(this._peek()===Tokens.IN){thi
s._builder.addSpace();this._consume(Tokens.IN);this._builder.addSpace();this._pa
rseExpression();}}else | |
657 this._parseExpression();} | |
658 if(this._peek()!==Tokens.RPAREN){this._expect(Tokens.SEMICOLON);this._builder.ad
dSpace();if(this._peek()!==Tokens.SEMICOLON) | |
659 this._parseExpression();this._expect(Tokens.SEMICOLON);this._builder.addSpace();
if(this._peek()!==Tokens.RPAREN) | |
660 this._parseExpression();} | |
661 this._expect(Tokens.RPAREN);this._parseStatementOrBlock();},_parseExpression:fun
ction() | |
662 {this._parseAssignmentExpression();while(this._peek()===Tokens.COMMA){this._expe
ct(Tokens.COMMA);this._builder.addSpace();this._parseAssignmentExpression();}},_
parseAssignmentExpression:function() | |
663 {this._parseConditionalExpression();var token=this._peek();if(Tokens.ASSIGN<=tok
en&&token<=Tokens.ASSIGN_MOD){this._builder.addSpace();this._next();this._builde
r.addSpace();this._parseAssignmentExpression();}},_parseConditionalExpression:fu
nction() | |
664 {this._parseBinaryExpression();if(this._peek()===Tokens.CONDITIONAL){this._build
er.addSpace();this._consume(Tokens.CONDITIONAL);this._builder.addSpace();this._p
arseAssignmentExpression();this._builder.addSpace();this._expect(Tokens.COLON);t
his._builder.addSpace();this._parseAssignmentExpression();}},_parseBinaryExpress
ion:function() | |
665 {this._parseUnaryExpression();var token=this._peek();while(Tokens.OR<=token&&tok
en<=Tokens.IN){this._builder.addSpace();this._next();this._builder.addSpace();th
is._parseBinaryExpression();token=this._peek();}},_parseUnaryExpression:function
() | |
666 {var token=this._peek();if((Tokens.NOT<=token&&token<=Tokens.VOID)||token===Toke
ns.ADD||token===Tokens.SUB||token===Tokens.INC||token===Tokens.DEC){this._next()
;if(token===Tokens.DELETE||token===Tokens.TYPEOF||token===Tokens.VOID) | |
667 this._builder.addSpace();this._parseUnaryExpression();}else | |
668 return this._parsePostfixExpression();},_parsePostfixExpression:function() | |
669 {this._parseLeftHandSideExpression();var token=this._peek();if(!this._hasLineTer
minatorBeforeNext()&&(token===Tokens.INC||token===Tokens.DEC)) | |
670 this._next();},_parseLeftHandSideExpression:function() | |
671 {if(this._peek()===Tokens.NEW) | |
672 this._parseNewExpression();else | |
673 this._parseMemberExpression();while(true){switch(this._peek()){case Tokens.LBRAC
K:this._consume(Tokens.LBRACK);this._parseExpression();this._expect(Tokens.RBRAC
K);break;case Tokens.LPAREN:this._parseArguments();break;case Tokens.PERIOD:this
._consume(Tokens.PERIOD);this._expect(Tokens.IDENTIFIER);break;default:return;}}
},_parseNewExpression:function() | |
674 {this._expect(Tokens.NEW);this._builder.addSpace();if(this._peek()===Tokens.NEW) | |
675 this._parseNewExpression();else | |
676 this._parseMemberExpression();},_parseMemberExpression:function() | |
677 {if(this._peek()===Tokens.FUNCTION){this._expect(Tokens.FUNCTION);if(this._peek(
)===Tokens.IDENTIFIER){this._builder.addSpace();this._expect(Tokens.IDENTIFIER);
} | |
678 this._parseFunctionLiteral();}else | |
679 this._parsePrimaryExpression();while(true){switch(this._peek()){case Tokens.LBRA
CK:this._consume(Tokens.LBRACK);this._parseExpression();this._expect(Tokens.RBRA
CK);break;case Tokens.PERIOD:this._consume(Tokens.PERIOD);this._expect(Tokens.ID
ENTIFIER);break;case Tokens.LPAREN:this._parseArguments();break;default:return;}
}},_parseDebuggerStatement:function() | |
680 {this._expect(Tokens.DEBUGGER);this._expectSemicolon();},_parsePrimaryExpression
:function() | |
681 {switch(this._peek()){case Tokens.THIS:return this._consume(Tokens.THIS);case To
kens.NULL_LITERAL:return this._consume(Tokens.NULL_LITERAL);case Tokens.TRUE_LIT
ERAL:return this._consume(Tokens.TRUE_LITERAL);case Tokens.FALSE_LITERAL:return
this._consume(Tokens.FALSE_LITERAL);case Tokens.IDENTIFIER:return this._consume(
Tokens.IDENTIFIER);case Tokens.NUMBER:return this._consume(Tokens.NUMBER);case T
okens.STRING:return this._consume(Tokens.STRING);case Tokens.ASSIGN_DIV:return t
his._parseRegExpLiteral();case Tokens.DIV:return this._parseRegExpLiteral();case
Tokens.LBRACK:return this._parseArrayLiteral();case Tokens.LBRACE:return this._
parseObjectLiteral();case Tokens.LPAREN:this._consume(Tokens.LPAREN);this._parse
Expression();this._expect(Tokens.RPAREN);return;default:return this._next();}},_
parseArrayLiteral:function() | |
682 {this._expect(Tokens.LBRACK);this._builder.increaseNestingLevel();while(this._pe
ek()!==Tokens.RBRACK){if(this._peek()!==Tokens.COMMA) | |
683 this._parseAssignmentExpression();if(this._peek()!==Tokens.RBRACK){this._expect(
Tokens.COMMA);this._builder.addSpace();}} | |
684 this._builder.decreaseNestingLevel();this._expect(Tokens.RBRACK);},_parseObjectL
iteralGetSet:function() | |
685 {var token=this._peek();if(token===Tokens.IDENTIFIER||token===Tokens.NUMBER||tok
en===Tokens.STRING||Tokens.DELETE<=token&&token<=Tokens.FALSE_LITERAL||token===T
okens.INSTANCEOF||token===Tokens.IN||token===Tokens.CONST){this._next();this._pa
rseFunctionLiteral();}},_parseObjectLiteral:function() | |
686 {this._expect(Tokens.LBRACE);this._builder.increaseNestingLevel();while(this._pe
ek()!==Tokens.RBRACE){var token=this._peek();switch(token){case Tokens.IDENTIFIE
R:this._consume(Tokens.IDENTIFIER);var name=this._token.value;if((name==="get"||
name==="set")&&this._peek()!==Tokens.COLON){this._builder.addSpace();this._parse
ObjectLiteralGetSet();if(this._peek()!==Tokens.RBRACE){this._expect(Tokens.COMMA
);} | |
687 continue;} | |
688 break;case Tokens.STRING:this._consume(Tokens.STRING);break;case Tokens.NUMBER:t
his._consume(Tokens.NUMBER);break;default:this._next();} | |
689 this._expect(Tokens.COLON);this._builder.addSpace();this._parseAssignmentExpress
ion();if(this._peek()!==Tokens.RBRACE){this._expect(Tokens.COMMA);}} | |
690 this._builder.decreaseNestingLevel();this._expect(Tokens.RBRACE);},_parseRegExpL
iteral:function() | |
691 {if(this._nextToken.type==="regexp") | |
692 this._next();else{this._forceRegexp=true;this._next();}},_parseArguments:functio
n() | |
693 {this._expect(Tokens.LPAREN);var done=(this._peek()===Tokens.RPAREN);while(!done
){this._parseAssignmentExpression();done=(this._peek()===Tokens.RPAREN);if(!done
){this._expect(Tokens.COMMA);this._builder.addSpace();}} | |
694 this._expect(Tokens.RPAREN);},_parseFunctionLiteral:function() | |
695 {this._expect(Tokens.LPAREN);var done=(this._peek()===Tokens.RPAREN);while(!done
){this._expect(Tokens.IDENTIFIER);done=(this._peek()===Tokens.RPAREN);if(!done){
this._expect(Tokens.COMMA);this._builder.addSpace();}} | |
696 this._expect(Tokens.RPAREN);this._builder.addSpace();this._expect(Tokens.LBRACE)
;this._builder.addNewLine();this._builder.increaseNestingLevel();this._parseSour
ceElements(Tokens.RBRACE);this._builder.decreaseNestingLevel();this._expect(Toke
ns.RBRACE);}}; | |
OLD | NEW |