MCPcopy Create free account
hub / github.com/adamritter/fastgron / parseSlice

Method parseSlice

src/parse_path.cpp:204–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202 }
203
204 Slice
205 parseSlice()
206 {
207 Slice slice;
208 if (match('[')) // Double [
209 {
210 slice.append_index = false;
211 if (!tryParseInt(slice.start))
212 {
213 throw std::runtime_error("Expected a value accessor, path: " + std::string(input_) + " index: " + std::to_string(index_));
214 }
215 expect(']');
216 slice.end = slice.start + 1;
217 slice.step = 1;
218 slice.value_accessor = parseValueAccessor();
219 return slice;
220 }
221 slice.append_index = true;
222
223 tryParseInt(slice.start);
224
225 if (match(':'))
226 {
227 tryParseInt(slice.end);
228 if (match(':'))
229 {
230 tryParseInt(slice.step);
231 }
232 }
233 else
234 {
235 slice.end = slice.start + 1;
236 }
237 expect(']');
238
239 slice.value_accessor = parseValueAccessor();
240 return slice;
241 }
242
243 void parseIdentifier(std::string &identifier)
244 {

Callers

nothing calls this directly

Calls 1

to_stringFunction · 0.85

Tested by

no test coverage detected