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

Method ScanDirective

lib/yamlcpp/src/scantoken.cpp:20–58  ·  view source on GitHub ↗

Directive . Note: no semantic checking is done here (that's for the parser to do)

Source from the content-addressed store, hash-verified

18// Directive
19// . Note: no semantic checking is done here (that's for the parser to do)
20void Scanner::ScanDirective() {
21 std::string name;
22 std::vector<std::string> params;
23
24 // pop indents and simple keys
25 PopAllIndents();
26 PopAllSimpleKeys();
27
28 m_simpleKeyAllowed = false;
29 m_canBeJSONFlow = false;
30
31 // store pos and eat indicator
32 Token token(Token::DIRECTIVE, INPUT.mark());
33 INPUT.eat(1);
34
35 // read name
36 while (INPUT && !Exp::BlankOrBreak().Matches(INPUT))
37 token.value += INPUT.get();
38
39 // read parameters
40 while (true) {
41 // first get rid of whitespace
42 while (Exp::Blank().Matches(INPUT))
43 INPUT.eat(1);
44
45 // break on newline or comment
46 if (!INPUT || Exp::Break().Matches(INPUT) || Exp::Comment().Matches(INPUT))
47 break;
48
49 // now read parameter
50 std::string param;
51 while (INPUT && !Exp::BlankOrBreak().Matches(INPUT))
52 param += INPUT.get();
53
54 token.params.push_back(param);
55 }
56
57 m_tokens.push(token);
58}
59
60// DocStart
61void Scanner::ScanDocStart() {

Callers

nothing calls this directly

Calls 7

eatMethod · 0.80
MatchesMethod · 0.80
CommentFunction · 0.70
markMethod · 0.45
getMethod · 0.45
push_backMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected