From 162f6b9d5c2c3544a057198a915f359741203c8a Mon Sep 17 00:00:00 2001 From: Jeremy Ashkenas Date: Sun, 21 Mar 2010 22:05:49 -0400 Subject: [PATCH] one step at a time --- lib/lexer.js | 8 ++++---- src/lexer.coffee | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/lexer.js b/lib/lexer.js index 7cd8068a..5907a0b8 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -122,14 +122,14 @@ // referenced as property names here, so you can still do `jQuery.is()` even // though `is` means `===` otherwise. Lexer.prototype.identifier_token = function identifier_token() { - var id, space, tag; + var accessed, id, tag; if (!((id = this.match(IDENTIFIER, 1)))) { return false; } this.name_access_type(); - space = this.prev() && this.prev().spaced; + accessed = include(ACCESSORS, this.tag(0)); tag = 'IDENTIFIER'; - if (include(KEYWORDS, id) && !(include(ACCESSORS, this.tag(0)) && !space)) { + if (!accessed && include(KEYWORDS, id)) { tag = id.toUpperCase(); } if (include(RESERVED, id)) { @@ -139,7 +139,7 @@ tag = 'LEADING_WHEN'; } this.i += id.length; - if (space && include(COFFEE_ALIASES, id)) { + if (!accessed && include(COFFEE_ALIASES, id)) { tag = (id = CONVERSIONS[id]); } this.token(tag, id); diff --git a/src/lexer.coffee b/src/lexer.coffee index dfc538a3..2814a2f3 100644 --- a/src/lexer.coffee +++ b/src/lexer.coffee @@ -94,13 +94,13 @@ exports.Lexer: class Lexer identifier_token: -> return false unless id: @match IDENTIFIER, 1 @name_access_type() - space: @prev() and @prev().spaced + accessed: include ACCESSORS, @tag(0) tag: 'IDENTIFIER' - tag: id.toUpperCase() if include(KEYWORDS, id) and not (include(ACCESSORS, @tag(0)) and not space) + tag: id.toUpperCase() if not accessed and include(KEYWORDS, id) @identifier_error id if include RESERVED, id tag: 'LEADING_WHEN' if tag is 'WHEN' and include LINE_BREAK, @tag() @i += id.length - tag: id: CONVERSIONS[id] if space and include(COFFEE_ALIASES, id) + tag: id: CONVERSIONS[id] if not accessed and include(COFFEE_ALIASES, id) @token(tag, id) true