MCPcopy
hub / github.com/lutzroeder/netron / _parseSuite

Method _parseSuite

source/python.js:714–752  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

712 return module;
713 }
714 _parseSuite() {
715 const body = [];
716 let statement = null;
717 if (this._tokenizer.accept('\n')) {
718 if (this._tokenizer.accept('indent')) {
719 while (!this._tokenizer.accept('eof') && !this._tokenizer.accept('dedent')) {
720 if (this._tokenizer.accept(';')) {
721 continue;
722 }
723 statement = this._parseStatement();
724 if (statement) {
725 body.push(statement);
726 continue;
727 }
728 if (this._tokenizer.accept('\n')) {
729 continue;
730 }
731 if (this._tokenizer.match('dedent') || this._tokenizer.match('eof')) {
732 continue;
733 }
734 throw new python.Error(`Empty statement ${this._location()}`);
735 }
736 }
737 } else if (!this._tokenizer.accept('eof')) {
738 while (!this._tokenizer.match('\n') && !this._tokenizer.match('eof') && !this._tokenizer.match('dedent')) {
739 if (this._tokenizer.accept(';')) {
740 continue;
741 }
742 statement = this._parseStatement();
743 if (statement) {
744 body.push(statement);
745 continue;
746 }
747 throw new python.Error(`Empty statement ${this._location()}`);
748 }
749 this._tokenizer.accept('\n');
750 }
751 return body;
752 }
753 _parseStatement() {
754 let node = null;
755 let position = this._position();

Callers 1

_parseStatementMethod · 0.80

Calls 5

_parseStatementMethod · 0.80
acceptMethod · 0.45
pushMethod · 0.45
matchMethod · 0.45
_locationMethod · 0.45

Tested by

no test coverage detected