lexer: fixed broken logics (due to f051d088) and a snakecased variable

This commit is contained in:
satyr
2010-09-25 16:00:07 +09:00
parent 3fd7f9efdd
commit 9a3b736174
2 changed files with 20 additions and 16 deletions

View File

@@ -35,29 +35,31 @@
return this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken();
};
Lexer.prototype.identifierToken = function() {
var close_index, forcedIdentifier, id, tag;
var closeIndex, forcedIdentifier, id, tag;
if (!(id = this.match(IDENTIFIER))) {
return false;
}
this.i += id.length;
if (id === 'all' && this.tag() === 'FOR') {
this.token('ALL', id);
return true;
}
forcedIdentifier = this.tagAccessor() || this.match(ASSIGNED, 1);
tag = 'IDENTIFIER';
if (include(JS_KEYWORDS, id) || !forcedIdentifier && include(COFFEE_KEYWORDS, id)) {
tag = id.toUpperCase();
if (tag === 'WHEN' && include(LINE_BREAK, this.tag())) {
tag = 'LEADING_WHEN';
} else if (include(UNARY, tag)) {
tag = 'UNARY';
}
} else if (id === 'all' && this.tag() === 'FOR') {
tag = 'ALL';
}
if (include(UNARY, tag)) {
tag = 'UNARY';
} else if (include(JS_FORBIDDEN, id)) {
if (include(JS_FORBIDDEN, id)) {
if (forcedIdentifier) {
tag = 'STRING';
id = ("\"" + (id) + "\"");
if (forcedIdentifier === 'accessor') {
close_index = true;
closeIndex = true;
if (this.tag() !== '@') {
this.tokens.pop();
}
@@ -78,7 +80,7 @@
}
}
this.token(tag, id);
if (close_index) {
if (closeIndex) {
this.token(']', ']');
}
return true;