lexer: fixed ASSIGNED
This commit is contained in:
parent
9a3b736174
commit
c515aaac5a
|
@ -44,7 +44,7 @@
|
||||||
this.token('ALL', id);
|
this.token('ALL', id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
forcedIdentifier = this.tagAccessor() || this.match(ASSIGNED, 1);
|
forcedIdentifier = this.tagAccessor() || ASSIGNED.test(this.chunk);
|
||||||
tag = 'IDENTIFIER';
|
tag = 'IDENTIFIER';
|
||||||
if (include(JS_KEYWORDS, id) || !forcedIdentifier && include(COFFEE_KEYWORDS, id)) {
|
if (include(JS_KEYWORDS, id) || !forcedIdentifier && include(COFFEE_KEYWORDS, id)) {
|
||||||
tag = id.toUpperCase();
|
tag = id.toUpperCase();
|
||||||
|
@ -607,7 +607,7 @@
|
||||||
MULTILINER = /\n/g;
|
MULTILINER = /\n/g;
|
||||||
NO_NEWLINE = /^(?:[-+*&|\/%=<>!.\\][<>=&|]*|and|or|is(?:nt)?|not|delete|typeof|instanceof)$/;
|
NO_NEWLINE = /^(?:[-+*&|\/%=<>!.\\][<>=&|]*|and|or|is(?:nt)?|not|delete|typeof|instanceof)$/;
|
||||||
HEREDOC_INDENT = /\n+([ \t]*)|^([ \t]+)/g;
|
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)/;
|
NEXT_CHARACTER = /^\s*(\S)/;
|
||||||
COMPOUND_ASSIGN = ['-=', '+=', '/=', '*=', '%=', '||=', '&&=', '?=', '<<=', '>>=', '>>>=', '&=', '^=', '|='];
|
COMPOUND_ASSIGN = ['-=', '+=', '/=', '*=', '%=', '||=', '&&=', '?=', '<<=', '>>=', '>>>=', '&=', '^=', '|='];
|
||||||
UNARY = ['UMINUS', 'UPLUS', '!', '!!', '~', 'TYPEOF', 'DELETE'];
|
UNARY = ['UMINUS', 'UPLUS', '!', '!!', '~', 'TYPEOF', 'DELETE'];
|
||||||
|
|
|
@ -79,7 +79,7 @@ exports.Lexer = class Lexer
|
||||||
if id is 'all' and @tag() is 'FOR'
|
if id is 'all' and @tag() is 'FOR'
|
||||||
@token 'ALL', id
|
@token 'ALL', id
|
||||||
return true
|
return true
|
||||||
forcedIdentifier = @tagAccessor() or @match ASSIGNED, 1
|
forcedIdentifier = @tagAccessor() or ASSIGNED.test @chunk
|
||||||
tag = 'IDENTIFIER'
|
tag = 'IDENTIFIER'
|
||||||
if include(JS_KEYWORDS, id) or
|
if include(JS_KEYWORDS, id) or
|
||||||
not forcedIdentifier and include(COFFEE_KEYWORDS, id)
|
not forcedIdentifier and include(COFFEE_KEYWORDS, id)
|
||||||
|
@ -555,7 +555,7 @@ REGEX_ESCAPE = /\\[^#]/g
|
||||||
MULTILINER = /\n/g
|
MULTILINER = /\n/g
|
||||||
NO_NEWLINE = /^(?:[-+*&|\/%=<>!.\\][<>=&|]*|and|or|is(?:nt)?|not|delete|typeof|instanceof)$/
|
NO_NEWLINE = /^(?:[-+*&|\/%=<>!.\\][<>=&|]*|and|or|is(?:nt)?|not|delete|typeof|instanceof)$/
|
||||||
HEREDOC_INDENT = /\n+([ \t]*)|^([ \t]+)/g
|
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)/
|
NEXT_CHARACTER = /^\s*(\S)/
|
||||||
|
|
||||||
# Compound assignment tokens.
|
# Compound assignment tokens.
|
||||||
|
|
Loading…
Reference in New Issue