make equals signs full equals of colons -- you can use them inside of object literals now too

This commit is contained in:
Jeremy Ashkenas
2009-12-25 13:21:17 -08:00
parent bc6ec37272
commit 4b5db1181c
6 changed files with 23 additions and 16 deletions

View File

@@ -40,6 +40,9 @@ module CoffeeScript
# Tokens that always constitute the end of an expression.
EXP_END = ['}', ')', ']']
# Assignment tokens.
ASSIGN = [':', '=']
# Scan by attempting to match tokens one character at a time. Slow and steady.
def tokenize(code)
@code = code.chomp # Cleanup code by remove extra line breaks
@@ -139,7 +142,8 @@ module CoffeeScript
value ||= @chunk[0,1]
skip_following_newlines if EXP_START.include?(value)
remove_leading_newlines if EXP_END.include?(value)
token(value, value)
tag = ASSIGN.include?(value) ? :ASSIGN : value
token(tag, value)
@i += value.length
end