1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00
This commit is contained in:
Sean Hussey 2014-02-17 18:37:10 -05:00
parent a216f93b54
commit a323160d14
2 changed files with 2 additions and 2 deletions

View file

@ -169,7 +169,7 @@
var octalEsc, quote, string, trimmed; var octalEsc, quote, string, trimmed;
switch (quote = this.chunk.charAt(0)) { switch (quote = this.chunk.charAt(0)) {
case "'": case "'":
string = SIMPLESTR.exec(this.chunk)[0]; string = (SIMPLESTR.exec(this.chunk) || [])[0];
break; break;
case '"': case '"':
string = this.balancedString(this.chunk, '"'); string = this.balancedString(this.chunk, '"');

View file

@ -187,7 +187,7 @@ exports.Lexer = class Lexer
# are balanced within the string's contents, and within nested interpolations. # are balanced within the string's contents, and within nested interpolations.
stringToken: -> stringToken: ->
switch quote = @chunk.charAt 0 switch quote = @chunk.charAt 0
when "'" then [string] = SIMPLESTR.exec @chunk when "'" then [string] = SIMPLESTR.exec(@chunk) || []
when '"' then string = @balancedString @chunk, '"' when '"' then string = @balancedString @chunk, '"'
return 0 unless string return 0 unless string
trimmed = @removeNewlines string[1...-1] trimmed = @removeNewlines string[1...-1]