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

Method collectValue

Rewrite-Parser.beta.js:3249–3275  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3247 }
3248
3249 collectValue() {
3250 let value = ''
3251 let depth = 0
3252 // console.log(`Collecting value starting at position ${this.position}`)
3253 while (this.position < this.tokens.length) {
3254 const token = this.peek()
3255 if (token.type === 'LPAREN') {
3256 depth++
3257 this.consume()
3258 value += '('
3259 } else if (token.type === 'RPAREN') {
3260 if (depth === 0) {
3261 break
3262 }
3263 depth--
3264 this.consume()
3265 value += ')'
3266 } else if (token.type === 'COMMA' && depth === 0) {
3267 break
3268 } else {
3269 value += token.value
3270 this.consume()
3271 }
3272 }
3273 // console.log(`Collected value: '${value}'`)
3274 return value
3275 }
3276 }
3277
3278 function checkBalancedParentheses(input) {

Callers 1

parseExpressionMethod · 0.95

Calls 2

peekMethod · 0.95
consumeMethod · 0.95

Tested by

no test coverage detected