mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
updated lexer to allow 'yield*'
This commit is contained in:
@@ -427,7 +427,7 @@
|
||||
};
|
||||
|
||||
Lexer.prototype.literalToken = function() {
|
||||
var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5;
|
||||
var match, poppedToken, prev, tag, value, _ref2, _ref3, _ref4, _ref5;
|
||||
if (match = OPERATOR.exec(this.chunk)) {
|
||||
value = match[0];
|
||||
if (CODE.test(value)) {
|
||||
@@ -451,6 +451,10 @@
|
||||
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) {
|
||||
|
||||
@@ -404,6 +404,10 @@ 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