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

Method expect

source/python.js:1798–1807  ·  view source on GitHub ↗
(type, value)

Source from the content-addressed store, hash-verified

1796 return false;
1797 }
1798 expect(type, value) {
1799 const token = this.peek();
1800 if (token.type !== type) {
1801 throw new python.Error(`Unexpected '${token.value}' instead of '${type}' ${this.location()}`);
1802 }
1803 if (value && token.value !== value) {
1804 throw new python.Error(`Unexpected '${token.value}' instead of '${value}' ${this.location()}`);
1805 }
1806 this.read();
1807 }
1808 location() {
1809 return `at ${this.filename}:${this.lineno}:${this.col_offset}.`;
1810 }

Callers 15

_parseStatementMethod · 0.45
_parseExpressionMethod · 0.45
_parseGeneratorsMethod · 0.45
_parseListMethod · 0.45
_parseSliceMethod · 0.45
_parseTypeArgumentsMethod · 0.45
_parseArgumentsMethod · 0.45
_eatMethod · 0.45
parseNameMethod · 0.45
parseArgumentMethod · 0.45
parseSingleConstantMethod · 0.45
parseConstantListMethod · 0.45

Calls 5

curMethod · 0.80
peekMethod · 0.45
locationMethod · 0.45
readMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected