Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6435)

Unified Diff: chrome_linux/resources/inspector/ScriptFormatterWorker.js

Issue 85333005: Update reference builds to Chrome 32.0.1700.19 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/reference_builds/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome_linux/resources/inspector/ScriptFormatterWorker.js
===================================================================
--- chrome_linux/resources/inspector/ScriptFormatterWorker.js (revision 237140)
+++ chrome_linux/resources/inspector/ScriptFormatterWorker.js (working copy)
@@ -444,29 +444,30 @@
var local=CodeMirror.copyState(state.localMode,state.localState);return{token:state.token,localMode:state.localMode,localState:local,htmlState:CodeMirror.copyState(htmlMode,state.htmlState)};},token:function(stream,state){return state.token(stream,state);},indent:function(state,textAfter){if(!state.localMode||/^\s*<\//.test(textAfter))
return htmlMode.indent(state.htmlState,textAfter);else if(state.localMode.indent)
return state.localMode.indent(state.localState,textAfter);else
-return CodeMirror.Pass;},electricChars:"/{}:",innerMode:function(state){return{state:state.localState||state.htmlState,mode:state.localMode||htmlMode};}};},"xml","javascript","css");CodeMirror.defineMIME("text/html","htmlmixed");;WebInspector={};WebInspector.CodeMirrorUtils={createTokenizer:function(mimeType)
+return CodeMirror.Pass;},electricChars:"/{}:",innerMode:function(state){return{state:state.localState||state.htmlState,mode:state.localMode||htmlMode};}};},"xml","javascript","css");CodeMirror.defineMIME("text/html","htmlmixed");;WebInspector={};FormatterWorker={};WebInspector.CodeMirrorUtils={createTokenizer:function(mimeType)
{var mode=CodeMirror.getMode({indentUnit:2},mimeType);var state=CodeMirror.startState(mode);function tokenize(line,callback)
{var stream=new CodeMirror.StringStream(line);while(!stream.eol()){var style=mode.token(stream,state);var value=stream.current();callback(value,style,stream.start,stream.start+value.length);stream.start=stream.pos;}}
return tokenize;},convertTokenType:function(tokenType)
{if(tokenType.startsWith("js-variable")||tokenType.startsWith("js-property")||tokenType==="js-def")
return"javascript-ident";if(tokenType==="js-string-2")
return"javascript-regexp";if(tokenType==="js-number"||tokenType==="js-comment"||tokenType==="js-string"||tokenType==="js-keyword")
-return"javascript-"+tokenType.substring("js-".length);return null;},overrideModeWithPrefixedTokens:function(modeName,tokenPrefix)
+return"javascript-"+tokenType.substring("js-".length);if(tokenType==="css-number")
+return"css-number";return null;},overrideModeWithPrefixedTokens:function(modeName,tokenPrefix)
{var oldModeName=modeName+"-old";if(CodeMirror.modes[oldModeName])
return;CodeMirror.defineMode(oldModeName,CodeMirror.modes[modeName]);CodeMirror.defineMode(modeName,modeConstructor);function modeConstructor(config,parserConfig)
{var innerConfig={};for(var i in parserConfig)
innerConfig[i]=parserConfig[i];innerConfig.name=oldModeName;var codeMirrorMode=CodeMirror.getMode(config,innerConfig);codeMirrorMode.name=modeName;codeMirrorMode.token=tokenOverride.bind(this,codeMirrorMode.token);return codeMirrorMode;}
function tokenOverride(superToken,stream,state)
{var token=superToken(stream,state);return token?tokenPrefix+token:token;}}}
-WebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("css-base","css-");WebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("javascript","js-");WebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("xml","xml-");;onmessage=function(event){if(!event.data.method)
-return;self[event.data.method](event.data.params);};function format(params)
-{var indentString=params.indentString||" ";var result={};if(params.mimeType==="text/html"){var formatter=new HTMLScriptFormatter(indentString);result=formatter.format(params.content);}else{result.mapping={original:[0],formatted:[0]};result.content=formatScript(params.content,result.mapping,0,0,indentString);}
+WebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("css-base","css-");WebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("javascript","js-");WebInspector.CodeMirrorUtils.overrideModeWithPrefixedTokens("xml","xml-");;var onmessage=function(event){if(!event.data.method)
+return;FormatterWorker[event.data.method](event.data.params);};FormatterWorker.format=function(params)
+{var indentString=params.indentString||" ";var result={};if(params.mimeType==="text/html"){var formatter=new FormatterWorker.HTMLFormatter(indentString);result=formatter.format(params.content);}else if(params.mimeType==="text/css"){result.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,result.mapping,0,0,indentString);}
postMessage(result);}
-function getChunkCount(totalLength,chunkSize)
+FormatterWorker._chunkCount=function(totalLength,chunkSize)
{if(totalLength<=chunkSize)
return 1;var remainder=totalLength%chunkSize;var partialLength=totalLength-remainder;return(partialLength/chunkSize)+(remainder?1:0);}
-function outline(params)
-{const chunkSize=100000;const totalLength=params.content.length;const lines=params.content.split("\n");const chunkCount=getChunkCount(totalLength,chunkSize);var outlineChunk=[];var previousIdentifier=null;var previousToken=null;var previousTokenType=null;var currentChunk=1;var processedChunkCharacters=0;var addedFunction=false;var isReadingArguments=false;var argumentsText="";var currentFunction=null;var tokenizer=WebInspector.CodeMirrorUtils.createTokenizer("text/javascript");for(var i=0;i<lines.length;++i){var line=lines[i];function processToken(tokenValue,tokenType,column,newColumn)
+FormatterWorker.outline=function(params)
+{const chunkSize=100000;const totalLength=params.content.length;const lines=params.content.split("\n");const chunkCount=FormatterWorker._chunkCount(totalLength,chunkSize);var outlineChunk=[];var previousIdentifier=null;var previousToken=null;var previousTokenType=null;var currentChunk=1;var processedChunkCharacters=0;var addedFunction=false;var isReadingArguments=false;var argumentsText="";var currentFunction=null;var tokenizer=WebInspector.CodeMirrorUtils.createTokenizer("text/javascript");for(var i=0;i<lines.length;++i){var line=lines[i];function processToken(tokenValue,tokenType,column,newColumn)
{tokenType=tokenType?WebInspector.CodeMirrorUtils.convertTokenType(tokenType):null;if(tokenType==="javascript-ident"){previousIdentifier=tokenValue;if(tokenValue&&previousToken==="function"){currentFunction={line:i,column:column,name:tokenValue};addedFunction=true;previousIdentifier=null;}}else if(tokenType==="javascript-keyword"){if(tokenValue==="function"){if(previousIdentifier&&(previousToken==="="||previousToken===":")){currentFunction={line:i,column:column,name:previousIdentifier};addedFunction=true;previousIdentifier=null;}}}else if(tokenValue==="."&&previousTokenType==="javascript-ident")
previousIdentifier+=".";else if(tokenValue==="("&&addedFunction)
isReadingArguments=true;if(isReadingArguments&&tokenValue)
@@ -475,22 +476,30 @@
processedChunkCharacters+=newColumn-column;if(processedChunkCharacters>=chunkSize){postMessage({chunk:outlineChunk,total:chunkCount,index:currentChunk++});outlineChunk=[];processedChunkCharacters=0;}}
tokenizer(line,processToken);}
postMessage({chunk:outlineChunk,total:chunkCount,index:chunkCount});}
-function formatScript(content,mapping,offset,formattedOffset,indentString)
-{var formattedContent;try{var tokenizer=new Tokenizer(content);var builder=new FormattedContentBuilder(tokenizer.content(),mapping,offset,formattedOffset,indentString);var formatter=new JavaScriptFormatter(tokenizer,builder);formatter.format();formattedContent=builder.content();}catch(e){formattedContent=content;}
+FormatterWorker._formatScript=function(content,mapping,offset,formattedOffset,indentString)
+{var formattedContent;try{var tokenizer=new FormatterWorker.JavaScriptTokenizer(content);var builder=new FormatterWorker.JavaScriptFormattedContentBuilder(tokenizer.content(),mapping,offset,formattedOffset,indentString);var formatter=new FormatterWorker.JavaScriptFormatter(tokenizer,builder);formatter.format();formattedContent=builder.content();}catch(e){formattedContent=content;}
return formattedContent;}
-Array.prototype.keySet=function()
-{var keys={};for(var i=0;i<this.length;++i)
-keys[this[i]]=true;return keys;};HTMLScriptFormatter=function(indentString)
+FormatterWorker._formatCSS=function(content,mapping,offset,formattedOffset,indentString)
+{var formattedContent;try{var builder=new FormatterWorker.CSSFormattedContentBuilder(content,mapping,offset,formattedOffset,indentString);var formatter=new FormatterWorker.CSSFormatter(content,builder);formatter.format();formattedContent=builder.content();}catch(e){formattedContent=content;}
+return formattedContent;}
+FormatterWorker.HTMLFormatter=function(indentString)
{this._indentString=indentString;}
-HTMLScriptFormatter.prototype={format:function(content)
-{this.line=content;this._content=content;this._formattedContent="";this._mapping={original:[0],formatted:[0]};this._position=0;var scriptOpened=false;var tokenizer=WebInspector.CodeMirrorUtils.createTokenizer("text/html");function processToken(tokenValue,tokenType,tokenStart,tokenEnd){if(tokenValue.toLowerCase()==="<script"&&tokenType==="xml-tag"){scriptOpened=true;}else if(scriptOpened&&tokenValue===">"&&tokenType==="xml-tag"){scriptOpened=false;this._scriptStarted(tokenEnd);}else if(tokenValue.toLowerCase()==="</script"&&tokenType==="xml-tag"){this._scriptEnded(tokenStart);}}
+FormatterWorker.HTMLFormatter.prototype={format:function(content)
+{this.line=content;this._content=content;this._formattedContent="";this._mapping={original:[0],formatted:[0]};this._position=0;var scriptOpened=false;var styleOpened=false;var tokenizer=WebInspector.CodeMirrorUtils.createTokenizer("text/html");function processToken(tokenValue,tokenType,tokenStart,tokenEnd){if(tokenType!=="xml-tag")
+return;if(tokenValue.toLowerCase()==="<script"){scriptOpened=true;}else if(scriptOpened&&tokenValue===">"){scriptOpened=false;this._scriptStarted(tokenEnd);}else if(tokenValue.toLowerCase()==="</script"){this._scriptEnded(tokenStart);}else if(tokenValue.toLowerCase()==="<style"){styleOpened=true;}else if(styleOpened&&tokenValue===">"){styleOpened=false;this._styleStarted(tokenEnd);}else if(tokenValue.toLowerCase()==="</style"){this._styleEnded(tokenStart);}}
tokenizer(content,processToken.bind(this));this._formattedContent+=this._content.substring(this._position);return{content:this._formattedContent,mapping:this._mapping};},_scriptStarted:function(cursor)
-{this._formattedContent+=this._content.substring(this._position,cursor);this._formattedContent+="\n";this._position=cursor;},_scriptEnded:function(cursor)
+{this._handleSubFormatterStart(cursor);},_scriptEnded:function(cursor)
+{this._handleSubFormatterEnd(FormatterWorker._formatScript,cursor);},_styleStarted:function(cursor)
+{this._handleSubFormatterStart(cursor);},_styleEnded:function(cursor)
+{this._handleSubFormatterEnd(FormatterWorker._formatCSS,cursor);},_handleSubFormatterStart:function(cursor)
+{this._formattedContent+=this._content.substring(this._position,cursor);this._formattedContent+="\n";this._position=cursor;},_handleSubFormatterEnd:function(formatFunction,cursor)
{if(cursor===this._position)
-return;var scriptContent=this._content.substring(this._position,cursor);this._mapping.original.push(this._position);this._mapping.formatted.push(this._formattedContent.length);var formattedScriptContent=formatScript(scriptContent,this._mapping,this._position,this._formattedContent.length,this._indentString);this._formattedContent+=formattedScriptContent;this._position=cursor;},}
-function require()
+return;var scriptContent=this._content.substring(this._position,cursor);this._mapping.original.push(this._position);this._mapping.formatted.push(this._formattedContent.length);var formattedScriptContent=formatFunction(scriptContent,this._mapping,this._position,this._formattedContent.length,this._indentString);this._formattedContent+=formattedScriptContent;this._position=cursor;}}
+Array.prototype.keySet=function()
+{var keys={};for(var i=0;i<this.length;++i)
+keys[this[i]]=true;return keys;};function require()
{return parse;}
-var exports={};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","goto","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","delete","throw","else","case"]);var KEYWORDS_ATOM=array_to_hash(["false","null","true","undefined"]);var OPERATOR_CHARS=array_to_hash(characters("+-*&%=<>!?|~^"));var RE_HEX_NUMBER=/^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_CHARS=array_to_hash(characters(" \n\r\t"));var PUNC_BEFORE_EXPRESSION=array_to_hash(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_Error(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,pos){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={};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,tokcol: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)
+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","goto","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","delete","throw","else","case"]);var KEYWORDS_ATOM=array_to_hash(["false","null","true","undefined"]);var OPERATOR_CHARS=array_to_hash(characters("+-*&%=<>!?|~^"));var RE_HEX_NUMBER=/^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_CHARS=array_to_hash(characters(" \n\r\t"));var PUNC_BEFORE_EXPRESSION=array_to_hash(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_Error(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,pos){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={};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,tokcol: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)
throw EX_EOF;if(ch=="\n"){S.newline_before=true;++S.line;S.col=0;}else{++S.col;}
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_POSTFIX,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.comments_before=S.comments_before;S.comments_before=[];}
S.newline_before=false;return ret;};function skip_whitespace(){while(HOP(WHITESPACE_CHARS,peek()))
@@ -564,133 +573,173 @@
arguments[i]();return ret;};function array_to_hash(a){var ret={};for(var i=0;i<a.length;++i)
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("");};function member(name,array){for(var i=array.length;--i>=0;)
if(array[i]===name)
-return true;return false;};function HOP(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop);};exports.tokenizer=tokenizer;exports.parse=parse;exports.slice=slice;exports.curry=curry;exports.member=member;exports.array_to_hash=array_to_hash;exports.PRECEDENCE=PRECEDENCE;exports.KEYWORDS_ATOM=KEYWORDS_ATOM;exports.RESERVED_WORDS=RESERVED_WORDS;exports.KEYWORDS=KEYWORDS;exports.ATOMIC_START_TOKEN=ATOMIC_START_TOKEN;exports.OPERATORS=OPERATORS;exports.is_alphanumeric_char=is_alphanumeric_char;exports.is_identifier_char=is_identifier_char;;var parse=exports;function FormattedContentBuilder(content,mapping,originalOffset,formattedOffset,indentString)
-{this._originalContent=content;this._originalOffset=originalOffset;this._lastOriginalPosition=0;this._formattedContent=[];this._formattedContentLength=0;this._formattedOffset=formattedOffset;this._lastFormattedPosition=0;this._mapping=mapping;this._lineNumber=0;this._nestingLevel=0;this._indentString=indentString;this._cachedIndents={};}
-FormattedContentBuilder.prototype={addToken:function(token)
-{for(var i=0;i<token.comments_before.length;++i)
-this._addComment(token.comments_before[i]);while(this._lineNumber<token.line){this._addText("\n");this._addIndent();this._needNewLine=false;this._lineNumber+=1;}
-if(this._needNewLine){this._addText("\n");this._addIndent();this._needNewLine=false;}
-this._addMappingIfNeeded(token.pos);this._addText(this._originalContent.substring(token.pos,token.endPos));this._lineNumber=token.endLine;},addSpace:function()
-{this._addText(" ");},addNewLine:function()
-{this._needNewLine=true;},increaseNestingLevel:function()
-{this._nestingLevel+=1;},decreaseNestingLevel:function()
-{this._nestingLevel-=1;},content:function()
-{return this._formattedContent.join("");},mapping:function()
-{return{original:this._originalPositions,formatted:this._formattedPositions};},_addIndent:function()
-{if(this._cachedIndents[this._nestingLevel]){this._addText(this._cachedIndents[this._nestingLevel]);return;}
-var fullIndent="";for(var i=0;i<this._nestingLevel;++i)
-fullIndent+=this._indentString;this._addText(fullIndent);if(this._nestingLevel<=20)
-this._cachedIndents[this._nestingLevel]=fullIndent;},_addComment:function(comment)
-{if(this._lineNumber<comment.line){for(var j=this._lineNumber;j<comment.line;++j)
-this._addText("\n");this._lineNumber=comment.line;this._needNewLine=false;this._addIndent();}else
-this.addSpace();this._addMappingIfNeeded(comment.pos);if(comment.type==="comment1")
-this._addText("//");else
-this._addText("/*");this._addText(comment.value);if(comment.type!=="comment1"){this._addText("*/");var position;while((position=comment.value.indexOf("\n",position+1))!==-1)
-this._lineNumber+=1;}},_addText:function(text)
-{this._formattedContent.push(text);this._formattedContentLength+=text.length;},_addMappingIfNeeded:function(originalPosition)
-{if(originalPosition-this._lastOriginalPosition===this._formattedContentLength-this._lastFormattedPosition)
-return;this._mapping.original.push(this._originalOffset+originalPosition);this._lastOriginalPosition=originalPosition;this._mapping.formatted.push(this._formattedOffset+this._formattedContentLength);this._lastFormattedPosition=this._formattedContentLength;}}
-var tokens=[["EOS"],["LPAREN","("],["RPAREN",")"],["LBRACK","["],["RBRACK","]"],["LBRACE","{"],["RBRACE","}"],["COLON",":"],["SEMICOLON",";"],["PERIOD","."],["CONDITIONAL","?"],["INC","++"],["DEC","--"],["ASSIGN","="],["ASSIGN_BIT_OR","|="],["ASSIGN_BIT_XOR","^="],["ASSIGN_BIT_AND","&="],["ASSIGN_SHL","<<="],["ASSIGN_SAR",">>="],["ASSIGN_SHR",">>>="],["ASSIGN_ADD","+="],["ASSIGN_SUB","-="],["ASSIGN_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"],["BREAK","break"],["CASE","case"],["CATCH","catch"],["CONTINUE","continue"],["DEBUGGER","debugger"],["DEFAULT","default"],["DO","do"],["ELSE","else"],["FINALLY","finally"],["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_LITERAL","true"],["FALSE_LITERAL","false"],["NUMBER"],["STRING"],["IDENTIFIER"],["CONST","const"]];var Tokens={};for(var i=0;i<tokens.length;++i)
-Tokens[tokens[i][0]]=i;var TokensByValue={};for(var i=0;i<tokens.length;++i){if(tokens[i][1])
-TokensByValue[tokens[i][1]]=i;}
-var TokensByType={"eof":Tokens.EOS,"name":Tokens.IDENTIFIER,"num":Tokens.NUMBER,"regexp":Tokens.DIV,"string":Tokens.STRING};function Tokenizer(content)
-{this._readNextToken=parse.tokenizer(content);this._state=this._readNextToken.context();}
-Tokenizer.prototype={content:function()
-{return this._state.text;},next:function(forceRegexp)
-{var uglifyToken=this._readNextToken(forceRegexp);uglifyToken.endPos=this._state.pos;uglifyToken.endLine=this._state.line;uglifyToken.token=this._convertUglifyToken(uglifyToken);return uglifyToken;},_convertUglifyToken:function(uglifyToken)
-{var token=TokensByType[uglifyToken.type];if(typeof token==="number")
-return token;token=TokensByValue[uglifyToken.value];if(typeof token==="number")
-return token;throw"Unknown token type "+uglifyToken.type;}}
-function JavaScriptFormatter(tokenizer,builder)
+return true;return false;};function HOP(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop);};exports.tokenizer=tokenizer;exports.parse=parse;exports.slice=slice;exports.curry=curry;exports.member=member;exports.array_to_hash=array_to_hash;exports.PRECEDENCE=PRECEDENCE;exports.KEYWORDS_ATOM=KEYWORDS_ATOM;exports.RESERVED_WORDS=RESERVED_WORDS;exports.KEYWORDS=KEYWORDS;exports.ATOMIC_START_TOKEN=ATOMIC_START_TOKEN;exports.OPERATORS=OPERATORS;exports.is_alphanumeric_char=is_alphanumeric_char;exports.is_identifier_char=is_identifier_char;;var parse=exports;FormatterWorker.JavaScriptFormatter=function(tokenizer,builder)
{this._tokenizer=tokenizer;this._builder=builder;this._token=null;this._nextToken=this._tokenizer.next();}
-JavaScriptFormatter.prototype={format:function()
-{this._parseSourceElements(Tokens.EOS);this._consume(Tokens.EOS);},_peek:function()
+FormatterWorker.JavaScriptFormatter.prototype={format:function()
+{this._parseSourceElements(FormatterWorker.JavaScriptTokens.EOS);this._consume(FormatterWorker.JavaScriptTokens.EOS);},_peek:function()
{return this._nextToken.token;},_next:function()
-{if(this._token&&this._token.token===Tokens.EOS)
+{if(this._token&&this._token.token===FormatterWorker.JavaScriptTokens.EOS)
throw"Unexpected EOS token";this._builder.addToken(this._nextToken);this._token=this._nextToken;this._nextToken=this._tokenizer.next(this._forceRegexp);this._forceRegexp=false;return this._token.token;},_consume:function(token)
{var next=this._next();if(next!==token)
throw"Unexpected token in consume: expected "+token+", actual "+next;},_expect:function(token)
{var next=this._next();if(next!==token)
throw"Unexpected token: expected "+token+", actual "+next;},_expectSemicolon:function()
-{if(this._peek()===Tokens.SEMICOLON)
-this._consume(Tokens.SEMICOLON);},_hasLineTerminatorBeforeNext:function()
+{if(this._peek()===FormatterWorker.JavaScriptTokens.SEMICOLON)
+this._consume(FormatterWorker.JavaScriptTokens.SEMICOLON);},_hasLineTerminatorBeforeNext:function()
{return this._nextToken.nlb;},_parseSourceElements:function(endToken)
{while(this._peek()!==endToken){this._parseStatement();this._builder.addNewLine();}},_parseStatementOrBlock:function()
-{if(this._peek()===Tokens.LBRACE){this._builder.addSpace();this._parseBlock();return true;}
+{if(this._peek()===FormatterWorker.JavaScriptTokens.LBRACE){this._builder.addSpace();this._parseBlock();return true;}
this._builder.addNewLine();this._builder.increaseNestingLevel();this._parseStatement();this._builder.decreaseNestingLevel();},_parseStatement:function()
-{switch(this._peek()){case Tokens.LBRACE:return this._parseBlock();case Tokens.CONST: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._parseWhileStatement();case Tokens.FOR:return this._parseForStatement();case Tokens.CONTINUE:return this._parseContinueStatement();case Tokens.BREAK:return this._parseBreakStatement();case Tokens.RETURN:return this._parseReturnStatement();case Tokens.WITH:return this._parseWithStatement();case Tokens.SWITCH:return this._parseSwitchStatement();case Tokens.THROW:return this._parseThrowStatement();case Tokens.TRY:return this._parseTryStatement();case Tokens.FUNCTION:return this._parseFunctionDeclaration();case Tokens.DEBUGGER:return this._parseDebuggerStatement();default:return this._parseExpressionOrLabelledStatement();}},_parseFunctionDeclaration:function()
-{this._expect(Tokens.FUNCTION);this._builder.addSpace();this._expect(Tokens.IDENTIFIER);this._parseFunctionLiteral()},_parseBlock:function()
-{this._expect(Tokens.LBRACE);this._builder.addNewLine();this._builder.increaseNestingLevel();while(this._peek()!==Tokens.RBRACE){this._parseStatement();this._builder.addNewLine();}
-this._builder.decreaseNestingLevel();this._expect(Tokens.RBRACE);},_parseVariableStatement:function()
+{switch(this._peek()){case FormatterWorker.JavaScriptTokens.LBRACE:return this._parseBlock();case FormatterWorker.JavaScriptTokens.CONST:case FormatterWorker.JavaScriptTokens.VAR:return this._parseVariableStatement();case FormatterWorker.JavaScriptTokens.SEMICOLON:return this._next();case FormatterWorker.JavaScriptTokens.IF:return this._parseIfStatement();case FormatterWorker.JavaScriptTokens.DO:return this._parseDoWhileStatement();case FormatterWorker.JavaScriptTokens.WHILE:return this._parseWhileStatement();case FormatterWorker.JavaScriptTokens.FOR:return this._parseForStatement();case FormatterWorker.JavaScriptTokens.CONTINUE:return this._parseContinueStatement();case FormatterWorker.JavaScriptTokens.BREAK:return this._parseBreakStatement();case FormatterWorker.JavaScriptTokens.RETURN:return this._parseReturnStatement();case FormatterWorker.JavaScriptTokens.WITH:return this._parseWithStatement();case FormatterWorker.JavaScriptTokens.SWITCH:return this._parseSwitchStatement();case FormatterWorker.JavaScriptTokens.THROW:return 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._parseExpressionOrLabelledStatement();}},_parseFunctionDeclaration:function()
+{this._expect(FormatterWorker.JavaScriptTokens.FUNCTION);this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);this._parseFunctionLiteral()},_parseBlock:function()
+{this._expect(FormatterWorker.JavaScriptTokens.LBRACE);this._builder.addNewLine();this._builder.increaseNestingLevel();while(this._peek()!==FormatterWorker.JavaScriptTokens.RBRACE){this._parseStatement();this._builder.addNewLine();}
+this._builder.decreaseNestingLevel();this._expect(FormatterWorker.JavaScriptTokens.RBRACE);},_parseVariableStatement:function()
{this._parseVariableDeclarations();this._expectSemicolon();},_parseVariableDeclarations:function()
-{if(this._peek()===Tokens.VAR)
-this._consume(Tokens.VAR);else
-this._consume(Tokens.CONST)
-this._builder.addSpace();var isFirstVariable=true;do{if(!isFirstVariable){this._consume(Tokens.COMMA);this._builder.addSpace();}
-isFirstVariable=false;this._expect(Tokens.IDENTIFIER);if(this._peek()===Tokens.ASSIGN){this._builder.addSpace();this._consume(Tokens.ASSIGN);this._builder.addSpace();this._parseAssignmentExpression();}}while(this._peek()===Tokens.COMMA);},_parseExpressionOrLabelledStatement:function()
-{this._parseExpression();if(this._peek()===Tokens.COLON){this._expect(Tokens.COLON);this._builder.addSpace();this._parseStatement();}
+{if(this._peek()===FormatterWorker.JavaScriptTokens.VAR)
+this._consume(FormatterWorker.JavaScriptTokens.VAR);else
+this._consume(FormatterWorker.JavaScriptTokens.CONST)
+this._builder.addSpace();var isFirstVariable=true;do{if(!isFirstVariable){this._consume(FormatterWorker.JavaScriptTokens.COMMA);this._builder.addSpace();}
+isFirstVariable=false;this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);if(this._peek()===FormatterWorker.JavaScriptTokens.ASSIGN){this._builder.addSpace();this._consume(FormatterWorker.JavaScriptTokens.ASSIGN);this._builder.addSpace();this._parseAssignmentExpression();}}while(this._peek()===FormatterWorker.JavaScriptTokens.COMMA);},_parseExpressionOrLabelledStatement:function()
+{this._parseExpression();if(this._peek()===FormatterWorker.JavaScriptTokens.COLON){this._expect(FormatterWorker.JavaScriptTokens.COLON);this._builder.addSpace();this._parseStatement();}
this._expectSemicolon();},_parseIfStatement:function()
-{this._expect(Tokens.IF);this._builder.addSpace();this._expect(Tokens.LPAREN);this._parseExpression();this._expect(Tokens.RPAREN);var isBlock=this._parseStatementOrBlock();if(this._peek()===Tokens.ELSE){if(isBlock)
+{this._expect(FormatterWorker.JavaScriptTokens.IF);this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.LPAREN);this._parseExpression();this._expect(FormatterWorker.JavaScriptTokens.RPAREN);var isBlock=this._parseStatementOrBlock();if(this._peek()===FormatterWorker.JavaScriptTokens.ELSE){if(isBlock)
this._builder.addSpace();else
-this._builder.addNewLine();this._next();if(this._peek()===Tokens.IF){this._builder.addSpace();this._parseStatement();}else
+this._builder.addNewLine();this._next();if(this._peek()===FormatterWorker.JavaScriptTokens.IF){this._builder.addSpace();this._parseStatement();}else
this._parseStatementOrBlock();}},_parseContinueStatement:function()
-{this._expect(Tokens.CONTINUE);var token=this._peek();if(!this._hasLineTerminatorBeforeNext()&&token!==Tokens.SEMICOLON&&token!==Tokens.RBRACE&&token!==Tokens.EOS){this._builder.addSpace();this._expect(Tokens.IDENTIFIER);}
+{this._expect(FormatterWorker.JavaScriptTokens.CONTINUE);var token=this._peek();if(!this._hasLineTerminatorBeforeNext()&&token!==FormatterWorker.JavaScriptTokens.SEMICOLON&&token!==FormatterWorker.JavaScriptTokens.RBRACE&&token!==FormatterWorker.JavaScriptTokens.EOS){this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);}
this._expectSemicolon();},_parseBreakStatement:function()
-{this._expect(Tokens.BREAK);var token=this._peek();if(!this._hasLineTerminatorBeforeNext()&&token!==Tokens.SEMICOLON&&token!==Tokens.RBRACE&&token!==Tokens.EOS){this._builder.addSpace();this._expect(Tokens.IDENTIFIER);}
+{this._expect(FormatterWorker.JavaScriptTokens.BREAK);var token=this._peek();if(!this._hasLineTerminatorBeforeNext()&&token!==FormatterWorker.JavaScriptTokens.SEMICOLON&&token!==FormatterWorker.JavaScriptTokens.RBRACE&&token!==FormatterWorker.JavaScriptTokens.EOS){this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);}
this._expectSemicolon();},_parseReturnStatement:function()
-{this._expect(Tokens.RETURN);var token=this._peek();if(!this._hasLineTerminatorBeforeNext()&&token!==Tokens.SEMICOLON&&token!==Tokens.RBRACE&&token!==Tokens.EOS){this._builder.addSpace();this._parseExpression();}
+{this._expect(FormatterWorker.JavaScriptTokens.RETURN);var token=this._peek();if(!this._hasLineTerminatorBeforeNext()&&token!==FormatterWorker.JavaScriptTokens.SEMICOLON&&token!==FormatterWorker.JavaScriptTokens.RBRACE&&token!==FormatterWorker.JavaScriptTokens.EOS){this._builder.addSpace();this._parseExpression();}
this._expectSemicolon();},_parseWithStatement:function()
-{this._expect(Tokens.WITH);this._builder.addSpace();this._expect(Tokens.LPAREN);this._parseExpression();this._expect(Tokens.RPAREN);this._parseStatementOrBlock();},_parseCaseClause:function()
-{if(this._peek()===Tokens.CASE){this._expect(Tokens.CASE);this._builder.addSpace();this._parseExpression();}else
-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();this._builder.addNewLine();}
+{this._expect(FormatterWorker.JavaScriptTokens.WITH);this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.LPAREN);this._parseExpression();this._expect(FormatterWorker.JavaScriptTokens.RPAREN);this._parseStatementOrBlock();},_parseCaseClause:function()
+{if(this._peek()===FormatterWorker.JavaScriptTokens.CASE){this._expect(FormatterWorker.JavaScriptTokens.CASE);this._builder.addSpace();this._parseExpression();}else
+this._expect(FormatterWorker.JavaScriptTokens.DEFAULT);this._expect(FormatterWorker.JavaScriptTokens.COLON);this._builder.addNewLine();this._builder.increaseNestingLevel();while(this._peek()!==FormatterWorker.JavaScriptTokens.CASE&&this._peek()!==FormatterWorker.JavaScriptTokens.DEFAULT&&this._peek()!==FormatterWorker.JavaScriptTokens.RBRACE){this._parseStatement();this._builder.addNewLine();}
this._builder.decreaseNestingLevel();},_parseSwitchStatement:function()
-{this._expect(Tokens.SWITCH);this._builder.addSpace();this._expect(Tokens.LPAREN);this._parseExpression();this._expect(Tokens.RPAREN);this._builder.addSpace();this._expect(Tokens.LBRACE);this._builder.addNewLine();this._builder.increaseNestingLevel();while(this._peek()!==Tokens.RBRACE)
-this._parseCaseClause();this._builder.decreaseNestingLevel();this._expect(Tokens.RBRACE);},_parseThrowStatement:function()
-{this._expect(Tokens.THROW);this._builder.addSpace();this._parseExpression();this._expectSemicolon();},_parseTryStatement:function()
-{this._expect(Tokens.TRY);this._builder.addSpace();this._parseBlock();var token=this._peek();if(token===Tokens.CATCH){this._builder.addSpace();this._consume(Tokens.CATCH);this._builder.addSpace();this._expect(Tokens.LPAREN);this._expect(Tokens.IDENTIFIER);this._expect(Tokens.RPAREN);this._builder.addSpace();this._parseBlock();token=this._peek();}
-if(token===Tokens.FINALLY){this._consume(Tokens.FINALLY);this._builder.addSpace();this._parseBlock();}},_parseDoWhileStatement:function()
-{this._expect(Tokens.DO);var isBlock=this._parseStatementOrBlock();if(isBlock)
+{this._expect(FormatterWorker.JavaScriptTokens.SWITCH);this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.LPAREN);this._parseExpression();this._expect(FormatterWorker.JavaScriptTokens.RPAREN);this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.LBRACE);this._builder.addNewLine();this._builder.increaseNestingLevel();while(this._peek()!==FormatterWorker.JavaScriptTokens.RBRACE)
+this._parseCaseClause();this._builder.decreaseNestingLevel();this._expect(FormatterWorker.JavaScriptTokens.RBRACE);},_parseThrowStatement:function()
+{this._expect(FormatterWorker.JavaScriptTokens.THROW);this._builder.addSpace();this._parseExpression();this._expectSemicolon();},_parseTryStatement:function()
+{this._expect(FormatterWorker.JavaScriptTokens.TRY);this._builder.addSpace();this._parseBlock();var token=this._peek();if(token===FormatterWorker.JavaScriptTokens.CATCH){this._builder.addSpace();this._consume(FormatterWorker.JavaScriptTokens.CATCH);this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.LPAREN);this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);this._expect(FormatterWorker.JavaScriptTokens.RPAREN);this._builder.addSpace();this._parseBlock();token=this._peek();}
+if(token===FormatterWorker.JavaScriptTokens.FINALLY){this._consume(FormatterWorker.JavaScriptTokens.FINALLY);this._builder.addSpace();this._parseBlock();}},_parseDoWhileStatement:function()
+{this._expect(FormatterWorker.JavaScriptTokens.DO);var isBlock=this._parseStatementOrBlock();if(isBlock)
this._builder.addSpace();else
-this._builder.addNewLine();this._expect(Tokens.WHILE);this._builder.addSpace();this._expect(Tokens.LPAREN);this._parseExpression();this._expect(Tokens.RPAREN);this._expectSemicolon();},_parseWhileStatement:function()
-{this._expect(Tokens.WHILE);this._builder.addSpace();this._expect(Tokens.LPAREN);this._parseExpression();this._expect(Tokens.RPAREN);this._parseStatementOrBlock();},_parseForStatement:function()
-{this._expect(Tokens.FOR);this._builder.addSpace();this._expect(Tokens.LPAREN);if(this._peek()!==Tokens.SEMICOLON){if(this._peek()===Tokens.VAR||this._peek()===Tokens.CONST){this._parseVariableDeclarations();if(this._peek()===Tokens.IN){this._builder.addSpace();this._consume(Tokens.IN);this._builder.addSpace();this._parseExpression();}}else
+this._builder.addNewLine();this._expect(FormatterWorker.JavaScriptTokens.WHILE);this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.LPAREN);this._parseExpression();this._expect(FormatterWorker.JavaScriptTokens.RPAREN);this._expectSemicolon();},_parseWhileStatement:function()
+{this._expect(FormatterWorker.JavaScriptTokens.WHILE);this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.LPAREN);this._parseExpression();this._expect(FormatterWorker.JavaScriptTokens.RPAREN);this._parseStatementOrBlock();},_parseForStatement:function()
+{this._expect(FormatterWorker.JavaScriptTokens.FOR);this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.LPAREN);if(this._peek()!==FormatterWorker.JavaScriptTokens.SEMICOLON){if(this._peek()===FormatterWorker.JavaScriptTokens.VAR||this._peek()===FormatterWorker.JavaScriptTokens.CONST){this._parseVariableDeclarations();if(this._peek()===FormatterWorker.JavaScriptTokens.IN){this._builder.addSpace();this._consume(FormatterWorker.JavaScriptTokens.IN);this._builder.addSpace();this._parseExpression();}}else
this._parseExpression();}
-if(this._peek()!==Tokens.RPAREN){this._expect(Tokens.SEMICOLON);this._builder.addSpace();if(this._peek()!==Tokens.SEMICOLON)
-this._parseExpression();this._expect(Tokens.SEMICOLON);this._builder.addSpace();if(this._peek()!==Tokens.RPAREN)
+if(this._peek()!==FormatterWorker.JavaScriptTokens.RPAREN){this._expect(FormatterWorker.JavaScriptTokens.SEMICOLON);this._builder.addSpace();if(this._peek()!==FormatterWorker.JavaScriptTokens.SEMICOLON)
+this._parseExpression();this._expect(FormatterWorker.JavaScriptTokens.SEMICOLON);this._builder.addSpace();if(this._peek()!==FormatterWorker.JavaScriptTokens.RPAREN)
this._parseExpression();}
-this._expect(Tokens.RPAREN);this._parseStatementOrBlock();},_parseExpression:function()
-{this._parseAssignmentExpression();while(this._peek()===Tokens.COMMA){this._expect(Tokens.COMMA);this._builder.addSpace();this._parseAssignmentExpression();}},_parseAssignmentExpression:function()
-{this._parseConditionalExpression();var token=this._peek();if(Tokens.ASSIGN<=token&&token<=Tokens.ASSIGN_MOD){this._builder.addSpace();this._next();this._builder.addSpace();this._parseAssignmentExpression();}},_parseConditionalExpression:function()
-{this._parseBinaryExpression();if(this._peek()===Tokens.CONDITIONAL){this._builder.addSpace();this._consume(Tokens.CONDITIONAL);this._builder.addSpace();this._parseAssignmentExpression();this._builder.addSpace();this._expect(Tokens.COLON);this._builder.addSpace();this._parseAssignmentExpression();}},_parseBinaryExpression:function()
-{this._parseUnaryExpression();var token=this._peek();while(Tokens.OR<=token&&token<=Tokens.IN){this._builder.addSpace();this._next();this._builder.addSpace();this._parseBinaryExpression();token=this._peek();}},_parseUnaryExpression:function()
-{var token=this._peek();if((Tokens.NOT<=token&&token<=Tokens.VOID)||token===Tokens.ADD||token===Tokens.SUB||token===Tokens.INC||token===Tokens.DEC){this._next();if(token===Tokens.DELETE||token===Tokens.TYPEOF||token===Tokens.VOID)
+this._expect(FormatterWorker.JavaScriptTokens.RPAREN);this._parseStatementOrBlock();},_parseExpression:function()
+{this._parseAssignmentExpression();while(this._peek()===FormatterWorker.JavaScriptTokens.COMMA){this._expect(FormatterWorker.JavaScriptTokens.COMMA);this._builder.addSpace();this._parseAssignmentExpression();}},_parseAssignmentExpression:function()
+{this._parseConditionalExpression();var token=this._peek();if(FormatterWorker.JavaScriptTokens.ASSIGN<=token&&token<=FormatterWorker.JavaScriptTokens.ASSIGN_MOD){this._builder.addSpace();this._next();this._builder.addSpace();this._parseAssignmentExpression();}},_parseConditionalExpression:function()
+{this._parseBinaryExpression();if(this._peek()===FormatterWorker.JavaScriptTokens.CONDITIONAL){this._builder.addSpace();this._consume(FormatterWorker.JavaScriptTokens.CONDITIONAL);this._builder.addSpace();this._parseAssignmentExpression();this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.COLON);this._builder.addSpace();this._parseAssignmentExpression();}},_parseBinaryExpression:function()
+{this._parseUnaryExpression();var token=this._peek();while(FormatterWorker.JavaScriptTokens.OR<=token&&token<=FormatterWorker.JavaScriptTokens.IN){this._builder.addSpace();this._next();this._builder.addSpace();this._parseBinaryExpression();token=this._peek();}},_parseUnaryExpression:function()
+{var token=this._peek();if((FormatterWorker.JavaScriptTokens.NOT<=token&&token<=FormatterWorker.JavaScriptTokens.VOID)||token===FormatterWorker.JavaScriptTokens.ADD||token===FormatterWorker.JavaScriptTokens.SUB||token===FormatterWorker.JavaScriptTokens.INC||token===FormatterWorker.JavaScriptTokens.DEC){this._next();if(token===FormatterWorker.JavaScriptTokens.DELETE||token===FormatterWorker.JavaScriptTokens.TYPEOF||token===FormatterWorker.JavaScriptTokens.VOID)
this._builder.addSpace();this._parseUnaryExpression();}else
return this._parsePostfixExpression();},_parsePostfixExpression:function()
-{this._parseLeftHandSideExpression();var token=this._peek();if(!this._hasLineTerminatorBeforeNext()&&(token===Tokens.INC||token===Tokens.DEC))
+{this._parseLeftHandSideExpression();var token=this._peek();if(!this._hasLineTerminatorBeforeNext()&&(token===FormatterWorker.JavaScriptTokens.INC||token===FormatterWorker.JavaScriptTokens.DEC))
this._next();},_parseLeftHandSideExpression:function()
-{if(this._peek()===Tokens.NEW)
+{if(this._peek()===FormatterWorker.JavaScriptTokens.NEW)
this._parseNewExpression();else
-this._parseMemberExpression();while(true){switch(this._peek()){case Tokens.LBRACK:this._consume(Tokens.LBRACK);this._parseExpression();this._expect(Tokens.RBRACK);break;case Tokens.LPAREN:this._parseArguments();break;case Tokens.PERIOD:this._consume(Tokens.PERIOD);this._expect(Tokens.IDENTIFIER);break;default:return;}}},_parseNewExpression:function()
-{this._expect(Tokens.NEW);this._builder.addSpace();if(this._peek()===Tokens.NEW)
+this._parseMemberExpression();while(true){switch(this._peek()){case FormatterWorker.JavaScriptTokens.LBRACK:this._consume(FormatterWorker.JavaScriptTokens.LBRACK);this._parseExpression();this._expect(FormatterWorker.JavaScriptTokens.RBRACK);break;case FormatterWorker.JavaScriptTokens.LPAREN:this._parseArguments();break;case FormatterWorker.JavaScriptTokens.PERIOD:this._consume(FormatterWorker.JavaScriptTokens.PERIOD);this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);break;default:return;}}},_parseNewExpression:function()
+{this._expect(FormatterWorker.JavaScriptTokens.NEW);this._builder.addSpace();if(this._peek()===FormatterWorker.JavaScriptTokens.NEW)
this._parseNewExpression();else
this._parseMemberExpression();},_parseMemberExpression:function()
-{if(this._peek()===Tokens.FUNCTION){this._expect(Tokens.FUNCTION);if(this._peek()===Tokens.IDENTIFIER){this._builder.addSpace();this._expect(Tokens.IDENTIFIER);}
+{if(this._peek()===FormatterWorker.JavaScriptTokens.FUNCTION){this._expect(FormatterWorker.JavaScriptTokens.FUNCTION);if(this._peek()===FormatterWorker.JavaScriptTokens.IDENTIFIER){this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);}
this._parseFunctionLiteral();}else
-this._parsePrimaryExpression();while(true){switch(this._peek()){case Tokens.LBRACK:this._consume(Tokens.LBRACK);this._parseExpression();this._expect(Tokens.RBRACK);break;case Tokens.PERIOD:this._consume(Tokens.PERIOD);this._expect(Tokens.IDENTIFIER);break;case Tokens.LPAREN:this._parseArguments();break;default:return;}}},_parseDebuggerStatement:function()
-{this._expect(Tokens.DEBUGGER);this._expectSemicolon();},_parsePrimaryExpression:function()
-{switch(this._peek()){case Tokens.THIS:return this._consume(Tokens.THIS);case Tokens.NULL_LITERAL:return this._consume(Tokens.NULL_LITERAL);case Tokens.TRUE_LITERAL: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 Tokens.STRING:return this._consume(Tokens.STRING);case Tokens.ASSIGN_DIV:return this._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._parseExpression();this._expect(Tokens.RPAREN);return;default:return this._next();}},_parseArrayLiteral:function()
-{this._expect(Tokens.LBRACK);this._builder.increaseNestingLevel();while(this._peek()!==Tokens.RBRACK){if(this._peek()!==Tokens.COMMA)
-this._parseAssignmentExpression();if(this._peek()!==Tokens.RBRACK){this._expect(Tokens.COMMA);this._builder.addSpace();}}
-this._builder.decreaseNestingLevel();this._expect(Tokens.RBRACK);},_parseObjectLiteralGetSet:function()
-{var token=this._peek();if(token===Tokens.IDENTIFIER||token===Tokens.NUMBER||token===Tokens.STRING||Tokens.DELETE<=token&&token<=Tokens.FALSE_LITERAL||token===Tokens.INSTANCEOF||token===Tokens.IN||token===Tokens.CONST){this._next();this._parseFunctionLiteral();}},_parseObjectLiteral:function()
-{this._expect(Tokens.LBRACE);this._builder.increaseNestingLevel();while(this._peek()!==Tokens.RBRACE){var token=this._peek();switch(token){case Tokens.IDENTIFIER:this._consume(Tokens.IDENTIFIER);var name=this._token.value;if((name==="get"||name==="set")&&this._peek()!==Tokens.COLON){this._builder.addSpace();this._parseObjectLiteralGetSet();if(this._peek()!==Tokens.RBRACE){this._expect(Tokens.COMMA);}
+this._parsePrimaryExpression();while(true){switch(this._peek()){case FormatterWorker.JavaScriptTokens.LBRACK:this._consume(FormatterWorker.JavaScriptTokens.LBRACK);this._parseExpression();this._expect(FormatterWorker.JavaScriptTokens.RBRACK);break;case FormatterWorker.JavaScriptTokens.PERIOD:this._consume(FormatterWorker.JavaScriptTokens.PERIOD);this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);break;case FormatterWorker.JavaScriptTokens.LPAREN:this._parseArguments();break;default:return;}}},_parseDebuggerStatement:function()
+{this._expect(FormatterWorker.JavaScriptTokens.DEBUGGER);this._expectSemicolon();},_parsePrimaryExpression:function()
+{switch(this._peek()){case FormatterWorker.JavaScriptTokens.THIS:return this._consume(FormatterWorker.JavaScriptTokens.THIS);case FormatterWorker.JavaScriptTokens.NULL_LITERAL:return this._consume(FormatterWorker.JavaScriptTokens.NULL_LITERAL);case FormatterWorker.JavaScriptTokens.TRUE_LITERAL:return this._consume(FormatterWorker.JavaScriptTokens.TRUE_LITERAL);case FormatterWorker.JavaScriptTokens.FALSE_LITERAL:return this._consume(FormatterWorker.JavaScriptTokens.FALSE_LITERAL);case FormatterWorker.JavaScriptTokens.IDENTIFIER:return this._consume(FormatterWorker.JavaScriptTokens.IDENTIFIER);case FormatterWorker.JavaScriptTokens.NUMBER:return this._consume(FormatterWorker.JavaScriptTokens.NUMBER);case FormatterWorker.JavaScriptTokens.STRING:return this._consume(FormatterWorker.JavaScriptTokens.STRING);case FormatterWorker.JavaScriptTokens.ASSIGN_DIV:return this._parseRegExpLiteral();case FormatterWorker.JavaScriptTokens.DIV:return this._parseRegExpLiteral();case FormatterWorker.JavaScriptTokens.LBRACK:return this._parseArrayLiteral();case FormatterWorker.JavaScriptTokens.LBRACE:return this._parseObjectLiteral();case FormatterWorker.JavaScriptTokens.LPAREN:this._consume(FormatterWorker.JavaScriptTokens.LPAREN);this._parseExpression();this._expect(FormatterWorker.JavaScriptTokens.RPAREN);return;default:return this._next();}},_parseArrayLiteral:function()
+{this._expect(FormatterWorker.JavaScriptTokens.LBRACK);this._builder.increaseNestingLevel();while(this._peek()!==FormatterWorker.JavaScriptTokens.RBRACK){if(this._peek()!==FormatterWorker.JavaScriptTokens.COMMA)
+this._parseAssignmentExpression();if(this._peek()!==FormatterWorker.JavaScriptTokens.RBRACK){this._expect(FormatterWorker.JavaScriptTokens.COMMA);this._builder.addSpace();}}
+this._builder.decreaseNestingLevel();this._expect(FormatterWorker.JavaScriptTokens.RBRACK);},_parseObjectLiteralGetSet:function()
+{var token=this._peek();if(token===FormatterWorker.JavaScriptTokens.IDENTIFIER||token===FormatterWorker.JavaScriptTokens.NUMBER||token===FormatterWorker.JavaScriptTokens.STRING||FormatterWorker.JavaScriptTokens.DELETE<=token&&token<=FormatterWorker.JavaScriptTokens.FALSE_LITERAL||token===FormatterWorker.JavaScriptTokens.INSTANCEOF||token===FormatterWorker.JavaScriptTokens.IN||token===FormatterWorker.JavaScriptTokens.CONST){this._next();this._parseFunctionLiteral();}},_parseObjectLiteral:function()
+{this._expect(FormatterWorker.JavaScriptTokens.LBRACE);this._builder.increaseNestingLevel();while(this._peek()!==FormatterWorker.JavaScriptTokens.RBRACE){var token=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.JavaScriptTokens.COLON){this._builder.addSpace();this._parseObjectLiteralGetSet();if(this._peek()!==FormatterWorker.JavaScriptTokens.RBRACE){this._expect(FormatterWorker.JavaScriptTokens.COMMA);}
continue;}
-break;case Tokens.STRING:this._consume(Tokens.STRING);break;case Tokens.NUMBER:this._consume(Tokens.NUMBER);break;default:this._next();}
-this._expect(Tokens.COLON);this._builder.addSpace();this._parseAssignmentExpression();if(this._peek()!==Tokens.RBRACE){this._expect(Tokens.COMMA);}}
-this._builder.decreaseNestingLevel();this._expect(Tokens.RBRACE);},_parseRegExpLiteral:function()
+break;case FormatterWorker.JavaScriptTokens.STRING:this._consume(FormatterWorker.JavaScriptTokens.STRING);break;case FormatterWorker.JavaScriptTokens.NUMBER:this._consume(FormatterWorker.JavaScriptTokens.NUMBER);break;default:this._next();}
+this._expect(FormatterWorker.JavaScriptTokens.COLON);this._builder.addSpace();this._parseAssignmentExpression();if(this._peek()!==FormatterWorker.JavaScriptTokens.RBRACE){this._expect(FormatterWorker.JavaScriptTokens.COMMA);}}
+this._builder.decreaseNestingLevel();this._expect(FormatterWorker.JavaScriptTokens.RBRACE);},_parseRegExpLiteral:function()
{if(this._nextToken.type==="regexp")
this._next();else{this._forceRegexp=true;this._next();}},_parseArguments:function()
-{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();}}
-this._expect(Tokens.RPAREN);},_parseFunctionLiteral:function()
-{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();}}
-this._expect(Tokens.RPAREN);this._builder.addSpace();this._expect(Tokens.LBRACE);this._builder.addNewLine();this._builder.increaseNestingLevel();this._parseSourceElements(Tokens.RBRACE);this._builder.decreaseNestingLevel();this._expect(Tokens.RBRACE);}};
+{this._expect(FormatterWorker.JavaScriptTokens.LPAREN);var done=(this._peek()===FormatterWorker.JavaScriptTokens.RPAREN);while(!done){this._parseAssignmentExpression();done=(this._peek()===FormatterWorker.JavaScriptTokens.RPAREN);if(!done){this._expect(FormatterWorker.JavaScriptTokens.COMMA);this._builder.addSpace();}}
+this._expect(FormatterWorker.JavaScriptTokens.RPAREN);},_parseFunctionLiteral:function()
+{this._expect(FormatterWorker.JavaScriptTokens.LPAREN);var done=(this._peek()===FormatterWorker.JavaScriptTokens.RPAREN);while(!done){this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);done=(this._peek()===FormatterWorker.JavaScriptTokens.RPAREN);if(!done){this._expect(FormatterWorker.JavaScriptTokens.COMMA);this._builder.addSpace();}}
+this._expect(FormatterWorker.JavaScriptTokens.RPAREN);this._builder.addSpace();this._expect(FormatterWorker.JavaScriptTokens.LBRACE);this._builder.addNewLine();this._builder.increaseNestingLevel();this._parseSourceElements(FormatterWorker.JavaScriptTokens.RBRACE);this._builder.decreaseNestingLevel();this._expect(FormatterWorker.JavaScriptTokens.RBRACE);}}
+FormatterWorker.JavaScriptFormattedContentBuilder=function(content,mapping,originalOffset,formattedOffset,indentString)
+{this._originalContent=content;this._originalOffset=originalOffset;this._lastOriginalPosition=0;this._formattedContent=[];this._formattedContentLength=0;this._formattedOffset=formattedOffset;this._lastFormattedPosition=0;this._mapping=mapping;this._lineNumber=0;this._nestingLevel=0;this._indentString=indentString;this._cachedIndents={};}
+FormatterWorker.JavaScriptFormattedContentBuilder.prototype={addToken:function(token)
+{for(var i=0;i<token.comments_before.length;++i)
+this._addComment(token.comments_before[i]);while(this._lineNumber<token.line){this._addText("\n");this._addIndent();this._needNewLine=false;this._lineNumber+=1;}
+if(this._needNewLine){this._addText("\n");this._addIndent();this._needNewLine=false;}
+this._addMappingIfNeeded(token.pos);this._addText(this._originalContent.substring(token.pos,token.endPos));this._lineNumber=token.endLine;},addSpace:function()
+{this._addText(" ");},addNewLine:function()
+{this._needNewLine=true;},increaseNestingLevel:function()
+{this._nestingLevel+=1;},decreaseNestingLevel:function()
+{this._nestingLevel-=1;},content:function()
+{return this._formattedContent.join("");},_addIndent:function()
+{if(this._cachedIndents[this._nestingLevel]){this._addText(this._cachedIndents[this._nestingLevel]);return;}
+var fullIndent="";for(var i=0;i<this._nestingLevel;++i)
+fullIndent+=this._indentString;this._addText(fullIndent);if(this._nestingLevel<=20)
+this._cachedIndents[this._nestingLevel]=fullIndent;},_addComment:function(comment)
+{if(this._lineNumber<comment.line){for(var j=this._lineNumber;j<comment.line;++j)
+this._addText("\n");this._lineNumber=comment.line;this._needNewLine=false;this._addIndent();}else
+this.addSpace();this._addMappingIfNeeded(comment.pos);if(comment.type==="comment1")
+this._addText("//");else
+this._addText("/*");this._addText(comment.value);if(comment.type!=="comment1"){this._addText("*/");var position;while((position=comment.value.indexOf("\n",position+1))!==-1)
+this._lineNumber+=1;}},_addText:function(text)
+{this._formattedContent.push(text);this._formattedContentLength+=text.length;},_addMappingIfNeeded:function(originalPosition)
+{if(originalPosition-this._lastOriginalPosition===this._formattedContentLength-this._lastFormattedPosition)
+return;this._mapping.original.push(this._originalOffset+originalPosition);this._lastOriginalPosition=originalPosition;this._mapping.formatted.push(this._formattedOffset+this._formattedContentLength);this._lastFormattedPosition=this._formattedContentLength;}}
+FormatterWorker.JavaScriptTokens={};FormatterWorker.JavaScriptTokensByValue={};FormatterWorker.JavaScriptTokens.EOS=0;FormatterWorker.JavaScriptTokens.LPAREN=FormatterWorker.JavaScriptTokensByValue["("]=1;FormatterWorker.JavaScriptTokens.RPAREN=FormatterWorker.JavaScriptTokensByValue[")"]=2;FormatterWorker.JavaScriptTokens.LBRACK=FormatterWorker.JavaScriptTokensByValue["["]=3;FormatterWorker.JavaScriptTokens.RBRACK=FormatterWorker.JavaScriptTokensByValue["]"]=4;FormatterWorker.JavaScriptTokens.LBRACE=FormatterWorker.JavaScriptTokensByValue["{"]=5;FormatterWorker.JavaScriptTokens.RBRACE=FormatterWorker.JavaScriptTokensByValue["}"]=6;FormatterWorker.JavaScriptTokens.COLON=FormatterWorker.JavaScriptTokensByValue[":"]=7;FormatterWorker.JavaScriptTokens.SEMICOLON=FormatterWorker.JavaScriptTokensByValue[";"]=8;FormatterWorker.JavaScriptTokens.PERIOD=FormatterWorker.JavaScriptTokensByValue["."]=9;FormatterWorker.JavaScriptTokens.CONDITIONAL=FormatterWorker.JavaScriptTokensByValue["?"]=10;FormatterWorker.JavaScriptTokens.INC=FormatterWorker.JavaScriptTokensByValue["++"]=11;FormatterWorker.JavaScriptTokens.DEC=FormatterWorker.JavaScriptTokensByValue["--"]=12;FormatterWorker.JavaScriptTokens.ASSIGN=FormatterWorker.JavaScriptTokensByValue["="]=13;FormatterWorker.JavaScriptTokens.ASSIGN_BIT_OR=FormatterWorker.JavaScriptTokensByValue["|="]=14;FormatterWorker.JavaScriptTokens.ASSIGN_BIT_XOR=FormatterWorker.JavaScriptTokensByValue["^="]=15;FormatterWorker.JavaScriptTokens.ASSIGN_BIT_AND=FormatterWorker.JavaScriptTokensByValue["&="]=16;FormatterWorker.JavaScriptTokens.ASSIGN_SHL=FormatterWorker.JavaScriptTokensByValue["<<="]=17;FormatterWorker.JavaScriptTokens.ASSIGN_SAR=FormatterWorker.JavaScriptTokensByValue[">>="]=18;FormatterWorker.JavaScriptTokens.ASSIGN_SHR=FormatterWorker.JavaScriptTokensByValue[">>>="]=19;FormatterWorker.JavaScriptTokens.ASSIGN_ADD=FormatterWorker.JavaScriptTokensByValue["+="]=20;FormatterWorker.JavaScriptTokens.ASSIGN_SUB=FormatterWorker.JavaScriptTokensByValue["-="]=21;FormatterWorker.JavaScriptTokens.ASSIGN_MUL=FormatterWorker.JavaScriptTokensByValue["*="]=22;FormatterWorker.JavaScriptTokens.ASSIGN_DIV=FormatterWorker.JavaScriptTokensByValue["/="]=23;FormatterWorker.JavaScriptTokens.ASSIGN_MOD=FormatterWorker.JavaScriptTokensByValue["%="]=24;FormatterWorker.JavaScriptTokens.COMMA=FormatterWorker.JavaScriptTokensByValue[","]=25;FormatterWorker.JavaScriptTokens.OR=FormatterWorker.JavaScriptTokensByValue["||"]=26;FormatterWorker.JavaScriptTokens.AND=FormatterWorker.JavaScriptTokensByValue["&&"]=27;FormatterWorker.JavaScriptTokens.BIT_OR=FormatterWorker.JavaScriptTokensByValue["|"]=28;FormatterWorker.JavaScriptTokens.BIT_XOR=FormatterWorker.JavaScriptTokensByValue["^"]=29;FormatterWorker.JavaScriptTokens.BIT_AND=FormatterWorker.JavaScriptTokensByValue["&"]=30;FormatterWorker.JavaScriptTokens.SHL=FormatterWorker.JavaScriptTokensByValue["<<"]=31;FormatterWorker.JavaScriptTokens.SAR=FormatterWorker.JavaScriptTokensByValue[">>"]=32;FormatterWorker.JavaScriptTokens.SHR=FormatterWorker.JavaScriptTokensByValue[">>>"]=33;FormatterWorker.JavaScriptTokens.ADD=FormatterWorker.JavaScriptTokensByValue["+"]=34;FormatterWorker.JavaScriptTokens.SUB=FormatterWorker.JavaScriptTokensByValue["-"]=35;FormatterWorker.JavaScriptTokens.MUL=FormatterWorker.JavaScriptTokensByValue["*"]=36;FormatterWorker.JavaScriptTokens.DIV=FormatterWorker.JavaScriptTokensByValue["/"]=37;FormatterWorker.JavaScriptTokens.MOD=FormatterWorker.JavaScriptTokensByValue["%"]=38;FormatterWorker.JavaScriptTokens.EQ=FormatterWorker.JavaScriptTokensByValue["=="]=39;FormatterWorker.JavaScriptTokens.NE=FormatterWorker.JavaScriptTokensByValue["!="]=40;FormatterWorker.JavaScriptTokens.EQ_STRICT=FormatterWorker.JavaScriptTokensByValue["==="]=41;FormatterWorker.JavaScriptTokens.NE_STRICT=FormatterWorker.JavaScriptTokensByValue["!=="]=42;FormatterWorker.JavaScriptTokens.LT=FormatterWorker.JavaScriptTokensByValue["<"]=43;FormatterWorker.JavaScriptTokens.GT=FormatterWorker.JavaScriptTokensByValue[">"]=44;FormatterWorker.JavaScriptTokens.LTE=FormatterWorker.JavaScriptTokensByValue["<="]=45;FormatterWorker.JavaScriptTokens.GTE=FormatterWorker.JavaScriptTokensByValue[">="]=46;FormatterWorker.JavaScriptTokens.INSTANCEOF=FormatterWorker.JavaScriptTokensByValue["instanceof"]=47;FormatterWorker.JavaScriptTokens.IN=FormatterWorker.JavaScriptTokensByValue["in"]=48;FormatterWorker.JavaScriptTokens.NOT=FormatterWorker.JavaScriptTokensByValue["!"]=49;FormatterWorker.JavaScriptTokens.BIT_NOT=FormatterWorker.JavaScriptTokensByValue["~"]=50;FormatterWorker.JavaScriptTokens.DELETE=FormatterWorker.JavaScriptTokensByValue["delete"]=51;FormatterWorker.JavaScriptTokens.TYPEOF=FormatterWorker.JavaScriptTokensByValue["typeof"]=52;FormatterWorker.JavaScriptTokens.VOID=FormatterWorker.JavaScriptTokensByValue["void"]=53;FormatterWorker.JavaScriptTokens.BREAK=FormatterWorker.JavaScriptTokensByValue["break"]=54;FormatterWorker.JavaScriptTokens.CASE=FormatterWorker.JavaScriptTokensByValue["case"]=55;FormatterWorker.JavaScriptTokens.CATCH=FormatterWorker.JavaScriptTokensByValue["catch"]=56;FormatterWorker.JavaScriptTokens.CONTINUE=FormatterWorker.JavaScriptTokensByValue["continue"]=57;FormatterWorker.JavaScriptTokens.DEBUGGER=FormatterWorker.JavaScriptTokensByValue["debugger"]=58;FormatterWorker.JavaScriptTokens.DEFAULT=FormatterWorker.JavaScriptTokensByValue["default"]=59;FormatterWorker.JavaScriptTokens.DO=FormatterWorker.JavaScriptTokensByValue["do"]=60;FormatterWorker.JavaScriptTokens.ELSE=FormatterWorker.JavaScriptTokensByValue["else"]=61;FormatterWorker.JavaScriptTokens.FINALLY=FormatterWorker.JavaScriptTokensByValue["finally"]=62;FormatterWorker.JavaScriptTokens.FOR=FormatterWorker.JavaScriptTokensByValue["for"]=63;FormatterWorker.JavaScriptTokens.FUNCTION=FormatterWorker.JavaScriptTokensByValue["function"]=64;FormatterWorker.JavaScriptTokens.IF=FormatterWorker.JavaScriptTokensByValue["if"]=65;FormatterWorker.JavaScriptTokens.NEW=FormatterWorker.JavaScriptTokensByValue["new"]=66;FormatterWorker.JavaScriptTokens.RETURN=FormatterWorker.JavaScriptTokensByValue["return"]=67;FormatterWorker.JavaScriptTokens.SWITCH=FormatterWorker.JavaScriptTokensByValue["switch"]=68;FormatterWorker.JavaScriptTokens.THIS=FormatterWorker.JavaScriptTokensByValue["this"]=69;FormatterWorker.JavaScriptTokens.THROW=FormatterWorker.JavaScriptTokensByValue["throw"]=70;FormatterWorker.JavaScriptTokens.TRY=FormatterWorker.JavaScriptTokensByValue["try"]=71;FormatterWorker.JavaScriptTokens.VAR=FormatterWorker.JavaScriptTokensByValue["var"]=72;FormatterWorker.JavaScriptTokens.WHILE=FormatterWorker.JavaScriptTokensByValue["while"]=73;FormatterWorker.JavaScriptTokens.WITH=FormatterWorker.JavaScriptTokensByValue["with"]=74;FormatterWorker.JavaScriptTokens.NULL_LITERAL=FormatterWorker.JavaScriptTokensByValue["null"]=75;FormatterWorker.JavaScriptTokens.TRUE_LITERAL=FormatterWorker.JavaScriptTokensByValue["true"]=76;FormatterWorker.JavaScriptTokens.FALSE_LITERAL=FormatterWorker.JavaScriptTokensByValue["false"]=77;FormatterWorker.JavaScriptTokens.NUMBER=78;FormatterWorker.JavaScriptTokens.STRING=79;FormatterWorker.JavaScriptTokens.IDENTIFIER=80;FormatterWorker.JavaScriptTokens.CONST=FormatterWorker.JavaScriptTokensByValue["const"]=81;FormatterWorker.JavaScriptTokensByType={"eof":FormatterWorker.JavaScriptTokens.EOS,"name":FormatterWorker.JavaScriptTokens.IDENTIFIER,"num":FormatterWorker.JavaScriptTokens.NUMBER,"regexp":FormatterWorker.JavaScriptTokens.DIV,"string":FormatterWorker.JavaScriptTokens.STRING};FormatterWorker.JavaScriptTokenizer=function(content)
+{this._readNextToken=parse.tokenizer(content);this._state=this._readNextToken.context();}
+FormatterWorker.JavaScriptTokenizer.prototype={content:function()
+{return this._state.text;},next:function(forceRegexp)
+{var uglifyToken=this._readNextToken(forceRegexp);uglifyToken.endPos=this._state.pos;uglifyToken.endLine=this._state.line;uglifyToken.token=this._convertUglifyToken(uglifyToken);return uglifyToken;},_convertUglifyToken:function(uglifyToken)
+{var token=FormatterWorker.JavaScriptTokensByType[uglifyToken.type];if(typeof token==="number")
+return token;token=FormatterWorker.JavaScriptTokensByValue[uglifyToken.value];if(typeof token==="number")
+return token;throw"Unknown token type "+uglifyToken.type;}};FormatterWorker.CSSFormatter=function(content,builder)
+{this._content=content;this._builder=builder;this._lastLine=-1;this._state={};}
+FormatterWorker.CSSFormatter.prototype={format:function()
+{this._lineEndings=this._lineEndings(this._content);var tokenize=WebInspector.CodeMirrorUtils.createTokenizer("text/css");var lines=this._content.split("\n");for(var i=0;i<lines.length;++i){var line=lines[i];tokenize(line,this._tokenCallback.bind(this,i));}
+this._builder.flushNewLines(true);},_lineEndings:function(text)
+{var lineEndings=[];var i=text.indexOf("\n");while(i!==-1){lineEndings.push(i);i=text.indexOf("\n",i+1);}
+lineEndings.push(text.length);return lineEndings;},_tokenCallback:function(startLine,token,type,startColumn)
+{if(startLine!==this._lastLine)
+this._state.eatWhitespace=true;if(/^css-property/.test(type)&&!this._state.inPropertyValue)
+this._state.seenProperty=true;this._lastLine=startLine;var isWhitespace=/^\s+$/.test(token);if(isWhitespace){if(!this._state.eatWhitespace)
+this._builder.addSpace();return;}
+this._state.eatWhitespace=false;if(token==="\n")
+return;if(token!=="}"){if(this._state.afterClosingBrace)
+this._builder.addNewLine();this._state.afterClosingBrace=false;}
+var startPosition=(startLine?this._lineEndings[startLine-1]:0)+startColumn;if(token==="}"){if(this._state.inPropertyValue)
+this._builder.addNewLine();this._builder.decreaseNestingLevel();this._state.afterClosingBrace=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.eatWhitespace=true;this._state.inPropertyValue=true;this._state.seenProperty=false;return;}else if(token==="{"){this._builder.addSpace();this._builder.addToken(token,startPosition,startLine,startColumn);this._builder.addNewLine();this._builder.increaseNestingLevel();return;}
+this._builder.addToken(token,startPosition,startLine,startColumn);if(type==="css-comment"&&!this._state.inPropertyValue&&!this._state.seenProperty)
+this._builder.addNewLine();if(token===";"&&this._state.inPropertyValue){this._state.inPropertyValue=false;this._builder.addNewLine();}else if(token==="}"){this._builder.addNewLine();}}}
+FormatterWorker.CSSFormattedContentBuilder=function(content,mapping,originalOffset,formattedOffset,indentString)
+{this._originalContent=content;this._originalOffset=originalOffset;this._lastOriginalPosition=0;this._formattedContent=[];this._formattedContentLength=0;this._formattedOffset=formattedOffset;this._lastFormattedPosition=0;this._mapping=mapping;this._lineNumber=0;this._nestingLevel=0;this._needNewLines=0;this._atLineStart=true;this._indentString=indentString;this._cachedIndents={};}
+FormatterWorker.CSSFormattedContentBuilder.prototype={addToken:function(token,startPosition,startLine,startColumn)
+{if((this._isWhitespaceRun||this._atLineStart)&&/^\s+$/.test(token))
+return;if(this._isWhitespaceRun&&this._lineNumber===startLine&&!this._needNewLines)
+this._addText(" ");this._isWhitespaceRun=false;this._atLineStart=false;while(this._lineNumber<startLine){this._addText("\n");this._addIndent();this._needNewLines=0;this._lineNumber+=1;this._atLineStart=true;}
+if(this._needNewLines){this.flushNewLines();this._addIndent();this._atLineStart=true;}
+this._addMappingIfNeeded(startPosition);this._addText(token);this._lineNumber=startLine;},addSpace:function()
+{if(this._isWhitespaceRun)
+return;this._isWhitespaceRun=true;},addNewLine:function()
+{++this._needNewLines;},flushNewLines:function(atLeastOne)
+{var newLineCount=atLeastOne&&!this._needNewLines?1:this._needNewLines;if(newLineCount)
+this._isWhitespaceRun=false;for(var i=0;i<newLineCount;++i)
+this._addText("\n");this._needNewLines=0;},increaseNestingLevel:function()
+{this._nestingLevel+=1;},decreaseNestingLevel:function(addNewline)
+{if(this._nestingLevel)
+this._nestingLevel-=1;if(addNewline)
+this.addNewLine();},content:function()
+{return this._formattedContent.join("");},_addIndent:function()
+{if(this._cachedIndents[this._nestingLevel]){this._addText(this._cachedIndents[this._nestingLevel]);return;}
+var fullIndent="";for(var i=0;i<this._nestingLevel;++i)
+fullIndent+=this._indentString;this._addText(fullIndent);if(this._nestingLevel<=20)
+this._cachedIndents[this._nestingLevel]=fullIndent;},_addText:function(text)
+{if(!text)
+return;this._formattedContent.push(text);this._formattedContentLength+=text.length;},_addMappingIfNeeded:function(originalPosition)
+{if(originalPosition-this._lastOriginalPosition===this._formattedContentLength-this._lastFormattedPosition)
+return;this._mapping.original.push(this._originalOffset+originalPosition);this._lastOriginalPosition=originalPosition;this._mapping.formatted.push(this._formattedOffset+this._formattedContentLength);this._lastFormattedPosition=this._formattedContentLength;}};
« no previous file with comments | « chrome_linux/resources/inspector/ResourcesPanel.js ('k') | chrome_linux/resources/inspector/ScriptsPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698