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

Method HandleNode

lib/yamlcpp/src/singledocparser.cpp:50–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void SingleDocParser::HandleNode(EventHandler& eventHandler) {
51 DepthGuard<500> depthguard(depth, m_scanner.mark(), ErrorMsg::BAD_FILE);
52
53 // an empty node *is* a possibility
54 if (m_scanner.empty()) {
55 eventHandler.OnNull(m_scanner.mark(), NullAnchor);
56 return;
57 }
58
59 // save location
60 Mark mark = m_scanner.peek().mark;
61
62 // special case: a value node by itself must be a map, with no header
63 if (m_scanner.peek().type == Token::VALUE) {
64 eventHandler.OnMapStart(mark, "?", NullAnchor, EmitterStyle::Default);
65 HandleMap(eventHandler);
66 eventHandler.OnMapEnd();
67 return;
68 }
69
70 // special case: an alias node
71 if (m_scanner.peek().type == Token::ALIAS) {
72 eventHandler.OnAlias(mark, LookupAnchor(mark, m_scanner.peek().value));
73 m_scanner.pop();
74 return;
75 }
76
77 std::string tag;
78 std::string anchor_name;
79 anchor_t anchor;
80 ParseProperties(tag, anchor, anchor_name);
81
82 if (!anchor_name.empty())
83 eventHandler.OnAnchor(mark, anchor_name);
84
85 // after parsing properties, an empty node is again a possibility
86 if (m_scanner.empty()) {
87 eventHandler.OnNull(mark, anchor);
88 return;
89 }
90
91 const Token& token = m_scanner.peek();
92
93 // add non-specific tags
94 if (tag.empty())
95 tag = (token.type == Token::NON_PLAIN_SCALAR ? "!" : "?");
96
97 if (token.type == Token::PLAIN_SCALAR
98 && tag.compare("?") == 0 && IsNullString(token.value)) {
99 eventHandler.OnNull(mark, anchor);
100 m_scanner.pop();
101 return;
102 }
103
104 // now split based on what kind of node we should be
105 switch (token.type) {
106 case Token::PLAIN_SCALAR:
107 case Token::NON_PLAIN_SCALAR:

Callers

nothing calls this directly

Calls 15

IsNullStringFunction · 0.85
peekMethod · 0.80
OnAnchorMethod · 0.80
GetCurCollectionTypeMethod · 0.80
markMethod · 0.45
emptyMethod · 0.45
OnNullMethod · 0.45
OnMapStartMethod · 0.45
OnMapEndMethod · 0.45
OnAliasMethod · 0.45
popMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected