MCPcopy Create free account
hub / github.com/apache/trafficserver / PushIndentTo

Method PushIndentTo

lib/yamlcpp/src/scanner.cpp:286–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286Scanner::IndentMarker* Scanner::PushIndentTo(int column,
287 IndentMarker::INDENT_TYPE type) {
288 // are we in flow?
289 if (InFlowContext()) {
290 return nullptr;
291 }
292
293 std::unique_ptr<IndentMarker> pIndent(new IndentMarker(column, type));
294 IndentMarker& indent = *pIndent;
295 const IndentMarker& lastIndent = *m_indents.top();
296
297 // is this actually an indentation?
298 if (indent.column < lastIndent.column) {
299 return nullptr;
300 }
301 if (indent.column == lastIndent.column &&
302 !(indent.type == IndentMarker::SEQ &&
303 lastIndent.type == IndentMarker::MAP)) {
304 return nullptr;
305 }
306
307 // push a start token
308 indent.pStartToken = PushToken(GetStartTokenFor(type));
309
310 // and then the indent
311 m_indents.push(&indent);
312 m_indentRefs.push_back(std::move(pIndent));
313 return &m_indentRefs.back();
314}
315
316void Scanner::PopIndentToHere() {
317 // are we in flow?

Callers

nothing calls this directly

Calls 3

topMethod · 0.45
pushMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected