From c515aaac5a595fcc7567846ddaa607c2343aabe9 Mon Sep 17 00:00:00 2001 From: satyr Date: Sat, 25 Sep 2010 23:37:33 +0900 Subject: [PATCH] lexer: fixed ASSIGNED --- lib/lexer.js | 4 ++-- src/lexer.coffee | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/lexer.js b/lib/lexer.js index 22f1c388..896aa9f7 100644 --- a/lib/lexer.js +++ b/lib/lexer.js @@ -44,7 +44,7 @@ this.token('ALL', id); return true; } - forcedIdentifier = this.tagAccessor() || this.match(ASSIGNED, 1); + forcedIdentifier = this.tagAccessor() || ASSIGNED.test(this.chunk); tag = 'IDENTIFIER'; if (include(JS_KEYWORDS, id) || !forcedIdentifier && include(COFFEE_KEYWORDS, id)) { tag = id.toUpperCase(); @@ -607,7 +607,7 @@ MULTILINER = /\n/g; NO_NEWLINE = /^(?:[-+*&|\/%=<>!.\\][<>=&|]*|and|or|is(?:nt)?|not|delete|typeof|instanceof)$/; HEREDOC_INDENT = /\n+([ \t]*)|^([ \t]+)/g; - ASSIGNED = /^\s*((?:[a-zA-Z$_@]\w*|["'][^\n]+?["']|\d+)[ \t]*?[:=][^:=])/; + ASSIGNED = /^\s*@?[$A-Za-z_][$\w]*[ \t]*?[:=][^:=>]/; NEXT_CHARACTER = /^\s*(\S)/; COMPOUND_ASSIGN = ['-=', '+=', '/=', '*=', '%=', '||=', '&&=', '?=', '<<=', '>>=', '>>>=', '&=', '^=', '|=']; UNARY = ['UMINUS', 'UPLUS', '!', '!!', '~', 'TYPEOF', 'DELETE']; diff --git a/src/lexer.coffee b/src/lexer.coffee index 0cc35db4..ba827679 100644 --- a/src/lexer.coffee +++ b/src/lexer.coffee @@ -79,7 +79,7 @@ exports.Lexer = class Lexer if id is 'all' and @tag() is 'FOR' @token 'ALL', id return true - forcedIdentifier = @tagAccessor() or @match ASSIGNED, 1 + forcedIdentifier = @tagAccessor() or ASSIGNED.test @chunk tag = 'IDENTIFIER' if include(JS_KEYWORDS, id) or not forcedIdentifier and include(COFFEE_KEYWORDS, id) @@ -555,7 +555,7 @@ REGEX_ESCAPE = /\\[^#]/g MULTILINER = /\n/g NO_NEWLINE = /^(?:[-+*&|\/%=<>!.\\][<>=&|]*|and|or|is(?:nt)?|not|delete|typeof|instanceof)$/ HEREDOC_INDENT = /\n+([ \t]*)|^([ \t]+)/g -ASSIGNED = /^\s*((?:[a-zA-Z$_@]\w*|["'][^\n]+?["']|\d+)[ \t]*?[:=][^:=])/ +ASSIGNED = /^\s*@?[$A-Za-z_][$\w]*[ \t]*?[:=][^:=>]/ NEXT_CHARACTER = /^\s*(\S)/ # Compound assignment tokens.