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

Method ScanToNextToken

lib/yamlcpp/src/scanner.cpp:176–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176void Scanner::ScanToNextToken() {
177 while (true) {
178 // first eat whitespace
179 while (INPUT && IsWhitespaceToBeEaten(INPUT.peek())) {
180 if (InBlockContext() && Exp::Tab().Matches(INPUT)) {
181 m_simpleKeyAllowed = false;
182 }
183 INPUT.eat(1);
184 }
185
186 // then eat a comment
187 if (Exp::Comment().Matches(INPUT)) {
188 // eat until line break
189 while (INPUT && !Exp::Break().Matches(INPUT)) {
190 INPUT.eat(1);
191 }
192 }
193
194 // if it's NOT a line break, then we're done!
195 if (!Exp::Break().Matches(INPUT)) {
196 break;
197 }
198
199 // otherwise, let's eat the line break and keep going
200 int n = Exp::Break().Match(INPUT);
201 INPUT.eat(n);
202
203 // oh yeah, and let's get rid of that simple key
204 InvalidateSimpleKey();
205
206 // new line - we may be able to accept a simple key now
207 if (InBlockContext()) {
208 m_simpleKeyAllowed = true;
209 }
210 }
211}
212
213///////////////////////////////////////////////////////////////////////
214// Misc. helpers

Callers

nothing calls this directly

Calls 5

peekMethod · 0.80
MatchesMethod · 0.80
eatMethod · 0.80
CommentFunction · 0.70
MatchMethod · 0.45

Tested by

no test coverage detected