fixing the extends keyword when the expressions are complex, and should only be run once -- not that it's good style -- ticket #143

This commit is contained in:
Jeremy Ashkenas
2010-02-16 23:23:43 -05:00
parent bedc005d67
commit 0610e20a3c
6 changed files with 39 additions and 11 deletions

View File

@@ -249,11 +249,14 @@
};
// Matches and consumes non-meaningful whitespace.
lex.prototype.whitespace_token = function whitespace_token() {
var space;
var prev, space;
if (!((space = this.match(WHITESPACE, 1)))) {
return false;
}
this.tokens[this.tokens.length - 1].spaced = true;
prev = this.tokens[this.tokens.length - 1];
if (prev) {
prev.spaced = true;
}
this.i += space.length;
return true;
};
@@ -276,7 +279,7 @@
// Multi-character operators are also literal tokens, so that Racc can assign
// the proper order of operations.
lex.prototype.literal_token = function literal_token() {
var match, tag, value;
var match, prev, tag, value;
match = this.chunk.match(OPERATOR);
value = match && match[1];
if (value && value.match(CODE)) {
@@ -287,7 +290,8 @@
if (value === ';') {
tag = 'TERMINATOR';
}
if (!this.tokens[this.tokens.length - 1].spaced && CALLABLE.indexOf(this.tag()) >= 0) {
prev = this.tokens[this.tokens.length - 1];
if (CALLABLE.indexOf(this.tag()) >= 0 && (!prev || !prev.spaced)) {
if (value === '(') {
tag = 'CALL_START';
}