1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

rebuilding lexer.js

This commit is contained in:
Jeremy Ashkenas 2011-10-24 14:51:41 -04:00
parent 913171f708
commit 64bd4b3f74

View file

@ -107,14 +107,15 @@
}; };
Lexer.prototype.numberToken = function() { Lexer.prototype.numberToken = function() {
var is_binary, match, number, numlen; var binaryLiteral, lexedLength, match, number;
if (!(match = NUMBER.exec(this.chunk))) return 0; if (!(match = NUMBER.exec(this.chunk))) return 0;
number = match[0]; number = match[0];
numlen = number.length; lexedLength = number.length;
is_binary = /0b([01]+)/.exec(number); if (binaryLiteral = /0b([01]+)/.exec(number)) {
if (is_binary) number = (parseInt(is_binary[1], 2)).toString(); number = (parseInt(binaryLiteral[1], 2)).toString();
}
this.token('NUMBER', number); this.token('NUMBER', number);
return numlen; return lexedLength;
}; };
Lexer.prototype.stringToken = function() { Lexer.prototype.stringToken = function() {