Neater numberToken function.

This commit is contained in:
Revence Kalibwani
2011-10-21 22:33:03 +03:00
parent 938abae4b5
commit 350e50600d

View File

@@ -133,14 +133,11 @@ exports.Lexer = class Lexer
numberToken: ->
return 0 unless match = NUMBER.exec @chunk
number = match[0]
numlen = number.length
# Now, since it is not JavaScript-descended, if it is binary, we will have
# to massage it into something similar and then hand it over. May the user
# forgive us.
is_binary = /0b([01]+)/.exec number
number = (parseInt is_binary[1], 2).toString() if is_binary
lexedLength = number.length
if is_binary = /0b([01]+)/.exec number
number = (parseInt is_binary[1], 2).toString()
@token 'NUMBER', number
numlen
lexedLength
# Matches strings, including multi-line strings. Ensures that quotation marks
# are balanced within the string's contents, and within nested interpolations.