MCPcopy Create free account
hub / github.com/Noumena-Network/code / splitTopLevelCommaList

Function splitTopLevelCommaList

scripts/generate_slash_command_appendix.mjs:109–204  ·  view source on GitHub ↗
(source)

Source from the content-addressed store, hash-verified

107}
108
109function splitTopLevelCommaList(source) {
110 const items = []
111 let quote = null
112 let inLineComment = false
113 let inBlockComment = false
114 let parenDepth = 0
115 let bracketDepth = 0
116 let braceDepth = 0
117 let start = 0
118
119 for (let i = 0; i < source.length; i += 1) {
120 const char = source[i]
121 const next = source[i + 1]
122
123 if (inLineComment) {
124 if (char === '\n') inLineComment = false
125 continue
126 }
127
128 if (inBlockComment) {
129 if (char === '*' && next === '/') {
130 inBlockComment = false
131 i += 1
132 }
133 continue
134 }
135
136 if (quote) {
137 if (char === '\\') {
138 i += 1
139 continue
140 }
141 if (char === quote) {
142 quote = null
143 }
144 continue
145 }
146
147 if (char === '/' && next === '/') {
148 inLineComment = true
149 i += 1
150 continue
151 }
152
153 if (char === '/' && next === '*') {
154 inBlockComment = true
155 i += 1
156 continue
157 }
158
159 if (char === "'" || char === '"' || char === '`') {
160 quote = char
161 continue
162 }
163
164 if (char === '(') {
165 parenDepth += 1
166 continue

Callers 2

parseBuildFeaturesFunction · 0.85
parseArraySymbolsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected