MCPcopy Create free account
hub / github.com/Script-Hub-Org/Script-Hub / expect

Method expect

Rewrite-Parser.js:2643–2653  ·  view source on GitHub ↗
(type, value = null)

Source from the content-addressed store, hash-verified

2641 }
2642
2643 expect(type, value = null) {
2644 const token = this.consume()
2645 if (!token || token.type !== type || (value !== null && token.value !== value)) {
2646 throw new Error(
2647 `期望 ${value !== null ? `'${value}'` : type},但得到 '${token ? token.value : 'EOF'}',在位置 ${
2648 this.position
2649 }`
2650 )
2651 }
2652 return token
2653 }
2654
2655 parse() {
2656 // console.log('=== 开始语法分析 ===')

Callers 1

parseExpressionMethod · 0.95

Calls 1

consumeMethod · 0.95

Tested by

no test coverage detected