mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
'yield*' now works as expected
This commit is contained in:
@@ -59,10 +59,13 @@
|
||||
|
||||
Lexer.prototype.identifierToken = function() {
|
||||
var colon, colonOffset, forcedIdentifier, id, idLength, input, match, poppedToken, prev, tag, tagToken, _ref2, _ref3, _ref4;
|
||||
if (!(match = IDENTIFIER.exec(this.chunk))) {
|
||||
if (!(match = /^yield\*/.exec(this.chunk) || IDENTIFIER.exec(this.chunk))) {
|
||||
return 0;
|
||||
}
|
||||
input = match[0], id = match[1], colon = match[2];
|
||||
if (input === 'yield*') {
|
||||
id = 'yield*';
|
||||
}
|
||||
idLength = id.length;
|
||||
poppedToken = void 0;
|
||||
if (id === 'own' && this.tag() === 'FOR') {
|
||||
@@ -427,7 +430,7 @@
|
||||
};
|
||||
|
||||
Lexer.prototype.literalToken = function() {
|
||||
var match, poppedToken, prev, tag, value, _ref2, _ref3, _ref4, _ref5;
|
||||
var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5;
|
||||
if (match = OPERATOR.exec(this.chunk)) {
|
||||
value = match[0];
|
||||
if (CODE.test(value)) {
|
||||
@@ -451,10 +454,6 @@
|
||||
if (value === ';') {
|
||||
this.seenFor = false;
|
||||
tag = 'TERMINATOR';
|
||||
} else if (value === '*' && prev[1] === 'yield' && !prev.spaced) {
|
||||
poppedToken = this.tokens.pop();
|
||||
tag = 'UNARY';
|
||||
value = 'yield*';
|
||||
} else if (__indexOf.call(MATH, value) >= 0) {
|
||||
tag = 'MATH';
|
||||
} else if (__indexOf.call(COMPARE, value) >= 0) {
|
||||
|
||||
@@ -99,8 +99,9 @@ exports.Lexer = class Lexer
|
||||
# referenced as property names here, so you can still do `jQuery.is()` even
|
||||
# though `is` means `===` otherwise.
|
||||
identifierToken: ->
|
||||
return 0 unless match = IDENTIFIER.exec @chunk
|
||||
return 0 unless match = /^yield\*/.exec(@chunk) or IDENTIFIER.exec @chunk
|
||||
[input, id, colon] = match
|
||||
if input is 'yield*' then id = 'yield*'
|
||||
|
||||
# Preserve length of id for location data
|
||||
idLength = id.length
|
||||
@@ -404,10 +405,6 @@ exports.Lexer = class Lexer
|
||||
if value is ';'
|
||||
@seenFor = no
|
||||
tag = 'TERMINATOR'
|
||||
else if value is '*' and prev[1] is 'yield' and not prev.spaced
|
||||
poppedToken = @tokens.pop()
|
||||
tag = 'UNARY'
|
||||
value = 'yield*'
|
||||
else if value in MATH then tag = 'MATH'
|
||||
else if value in COMPARE then tag = 'COMPARE'
|
||||
else if value in COMPOUND_ASSIGN then tag = 'COMPOUND_ASSIGN'
|
||||
|
||||
Reference in New Issue
Block a user