MCPcopy Index your code
hub / github.com/lutzroeder/netron / _parseGenerators

Method _parseGenerators

source/python.js:1496–1512  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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('[');

Callers 2

_parseExpressionMethod · 0.80
_parseListMethod · 0.80

Calls 6

_parseExpressionMethod · 0.80
matchMethod · 0.45
_eatMethod · 0.45
expectMethod · 0.45
acceptMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected