Optimize breakOutAtomicTokens

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-11-06 10:20:27 -08:00
parent be424c365f
commit 2c14bc7ebd
2 changed files with 7 additions and 2 deletions

View File

@@ -23,6 +23,11 @@ class Token
[new Token(value: value1, scopes: @scopes), new Token(value: value2, scopes: @scopes)]
breakOutAtomicTokens: (tabLength, breakOutLeadingWhitespace) ->
if breakOutLeadingWhitespace
return [this] unless /^[ ]|\t/.test(@value)
else
return [this] unless /\t/.test(@value)
outputTokens = []
regex = new RegExp("([ ]{#{tabLength}})|(\t)|([^\t]+)", "g")