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

Method expect

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

Source from the content-addressed store, hash-verified

3053 }
3054
3055 expect(type, value = null) {
3056 const token = this.consume()
3057 if (!token || token.type !== type || (value !== null && token.value !== value)) {
3058 throw new Error(
3059 `期望 ${value !== null ? `'${value}'` : type},但得到 '${token ? token.value : 'EOF'}',在位置 ${
3060 this.position
3061 }`
3062 )
3063 }
3064 return token
3065 }
3066
3067 parse() {
3068 // console.log('=== 开始语法分析 ===')

Callers 1

parseExpressionMethod · 0.95

Calls 1

consumeMethod · 0.95

Tested by

no test coverage detected