| Index: Source/devtools/front_end/script_formatter_worker/JavaScriptFormatter.js
|
| diff --git a/Source/devtools/front_end/script_formatter_worker/JavaScriptFormatter.js b/Source/devtools/front_end/script_formatter_worker/JavaScriptFormatter.js
|
| index bcc75accee1097790c026e99a1d9359afced37ea..935efa643c6ea60d6b36691c7946c307a95a6f7d 100644
|
| --- a/Source/devtools/front_end/script_formatter_worker/JavaScriptFormatter.js
|
| +++ b/Source/devtools/front_end/script_formatter_worker/JavaScriptFormatter.js
|
| @@ -41,6 +41,8 @@ FormatterWorker.JavaScriptFormatter = function(tokenizer, builder)
|
| this._nextToken = this._tokenizer.next();
|
| }
|
|
|
| +FormatterWorker.JavaScriptFormatter._identifierRegex = /^[$A-Z_][0-9A-Z_$]*$/i;
|
| +
|
| FormatterWorker.JavaScriptFormatter.prototype = {
|
| format: function()
|
| {
|
| @@ -91,6 +93,13 @@ FormatterWorker.JavaScriptFormatter.prototype = {
|
| throw "Unexpected token: expected " + token + ", actual " + next;
|
| },
|
|
|
| + _expectGeneralIdentifier: function()
|
| + {
|
| + var next = this._next();
|
| + if (next !== FormatterWorker.JavaScriptTokens.IDENTIFIER && !FormatterWorker.JavaScriptFormatter._identifierRegex.test(this._token.value))
|
| + throw "Unexpected token: expected javascript identifier, actual " + this._token.value;
|
| + },
|
| +
|
| _expectSemicolon: function()
|
| {
|
| if (this._peek() === FormatterWorker.JavaScriptTokens.SEMICOLON)
|
| @@ -522,7 +531,7 @@ FormatterWorker.JavaScriptFormatter.prototype = {
|
|
|
| case FormatterWorker.JavaScriptTokens.PERIOD:
|
| this._consume(FormatterWorker.JavaScriptTokens.PERIOD);
|
| - this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);
|
| + this._expectGeneralIdentifier();
|
| break;
|
|
|
| default:
|
| @@ -563,7 +572,7 @@ FormatterWorker.JavaScriptFormatter.prototype = {
|
|
|
| case FormatterWorker.JavaScriptTokens.PERIOD:
|
| this._consume(FormatterWorker.JavaScriptTokens.PERIOD);
|
| - this._expect(FormatterWorker.JavaScriptTokens.IDENTIFIER);
|
| + this._expectGeneralIdentifier();
|
| break;
|
|
|
| case FormatterWorker.JavaScriptTokens.LPAREN:
|
|
|