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

Method collectValue

Rewrite-Parser.js:2837–2863  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2835 }
2836
2837 collectValue() {
2838 let value = ''
2839 let depth = 0
2840 // console.log(`Collecting value starting at position ${this.position}`)
2841 while (this.position < this.tokens.length) {
2842 const token = this.peek()
2843 if (token.type === 'LPAREN') {
2844 depth++
2845 this.consume()
2846 value += '('
2847 } else if (token.type === 'RPAREN') {
2848 if (depth === 0) {
2849 break
2850 }
2851 depth--
2852 this.consume()
2853 value += ')'
2854 } else if (token.type === 'COMMA' && depth === 0) {
2855 break
2856 } else {
2857 value += token.value
2858 this.consume()
2859 }
2860 }
2861 // console.log(`Collected value: '${value}'`)
2862 return value
2863 }
2864 }
2865
2866 function checkBalancedParentheses(input) {

Callers 1

parseExpressionMethod · 0.95

Calls 2

peekMethod · 0.95
consumeMethod · 0.95

Tested by

no test coverage detected