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

Method ScanAnchorOrAlias

lib/yamlcpp/src/scantoken.cpp:221–253  ·  view source on GitHub ↗

AnchorOrAlias

Source from the content-addressed store, hash-verified

219
220// AnchorOrAlias
221void Scanner::ScanAnchorOrAlias() {
222 bool alias;
223 std::string name;
224
225 // insert a potential simple key
226 InsertPotentialSimpleKey();
227 m_simpleKeyAllowed = false;
228 m_canBeJSONFlow = false;
229
230 // eat the indicator
231 Mark mark = INPUT.mark();
232 char indicator = INPUT.get();
233 alias = (indicator == Keys::Alias);
234
235 // now eat the content
236 while (INPUT && Exp::Anchor().Matches(INPUT))
237 name += INPUT.get();
238
239 // we need to have read SOMETHING!
240 if (name.empty())
241 throw ParserException(INPUT.mark(), alias ? ErrorMsg::ALIAS_NOT_FOUND
242 : ErrorMsg::ANCHOR_NOT_FOUND);
243
244 // and needs to end correctly
245 if (INPUT && !Exp::AnchorEnd().Matches(INPUT))
246 throw ParserException(INPUT.mark(), alias ? ErrorMsg::CHAR_IN_ALIAS
247 : ErrorMsg::CHAR_IN_ANCHOR);
248
249 // and we're done
250 Token token(alias ? Token::ALIAS : Token::ANCHOR, mark);
251 token.value = name;
252 m_tokens.push(token);
253}
254
255// Tag
256void Scanner::ScanTag() {

Callers

nothing calls this directly

Calls 7

AnchorFunction · 0.85
ParserExceptionFunction · 0.85
MatchesMethod · 0.80
markMethod · 0.45
getMethod · 0.45
emptyMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected