MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / sequence

Method sequence

source/core/StarJsonParser.hpp:198–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196 }
197
198 void sequence() {
199 m_stream.beginArray();
200 while (true) {
201 if (isSpace(m_char)) {
202 next();
203 continue;
204 } else if (m_char == '{')
205 object();
206 else if (m_char == '[')
207 array();
208 else if (m_char == '"')
209 string();
210 else if (m_char == '-')
211 number();
212 else if (m_char == 0)
213 break;
214 else {
215 auto begin = m_current;
216 auto b_char = m_char;
217 if (m_char >= '0' && m_char <= '9') {
218 try {
219 number(true);
220 }
221 catch (ParsingException const&) {
222 m_current = begin;
223 m_char = b_char;
224 }
225 if (m_error == nullptr) {
226 next();
227 continue;
228 }
229 }
230 m_error = nullptr;
231 if (m_char == 't' || m_char == 'f' || m_char == 'n') {
232 try {
233 word(true);
234 }
235 catch (ParsingException const&) {
236 m_current = begin;
237 m_char = b_char;
238 }
239 if (m_error == nullptr) {
240 next();
241 continue;
242 }
243 }
244 m_error = nullptr;
245 // well, shit. do a simple string parse until we hit whitespace
246 // no fancy things like \n, do a proper string if you want that
247 CharArray str;
248 do {
249 str += m_char;
250 next();
251 } while (m_char != 0 && !isSpace(m_char));
252 m_stream.putString(str.c_str(), str.length());
253 }
254 next();
255 }

Callers

nothing calls this directly

Calls 6

stringFunction · 0.85
beginArrayMethod · 0.45
putStringMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45
endArrayMethod · 0.45

Tested by

no test coverage detected