| 1494 | return list; |
| 1495 | } |
| 1496 | _parseGenerators() { |
| 1497 | const generators = []; |
| 1498 | while (this._tokenizer.match('id', 'for') || this._tokenizer.match('id', 'async')) { |
| 1499 | const is_async = this._eat('id', 'async') ? 1 : 0; |
| 1500 | this._tokenizer.expect('id', 'for'); |
| 1501 | const target = this._parseExpression(-1, ['in'], true); |
| 1502 | this._tokenizer.expect('id', 'in'); |
| 1503 | const iter = this._parseExpression(-1, ['for', 'if'], true); |
| 1504 | const ifs = []; |
| 1505 | while (this._tokenizer.accept('id', 'if')) { |
| 1506 | ifs.push(this._parseExpression(-1, ['for', 'if'])); |
| 1507 | } |
| 1508 | const comprehension = new ast.comprehension(target, iter, ifs, is_async); |
| 1509 | generators.push(comprehension); |
| 1510 | } |
| 1511 | return generators; |
| 1512 | } |
| 1513 | _parseList() { |
| 1514 | const elts = []; |
| 1515 | this._tokenizer.expect('['); |