MCPcopy Create free account
hub / github.com/couchbase/fleece / skipComment

Method skipComment

Fleece/Support/JSON5.cc:193–216  ·  view source on GitHub ↗

Reads a comment from the input. Writes nothing to the output.

Source from the content-addressed store, hash-verified

191
192 // Reads a comment from the input. Writes nothing to the output.
193 void skipComment() {
194 char c;
195 get(); // consume initial '/'
196 switch (get()) {
197 case '/':
198 do {
199 c = peek();
200 if (c)
201 get();
202 } while (c != 0 && !isnewline(c));
203 break;
204 case '*': {
205 bool star;
206 c = 0;
207 do {
208 star = (c == '*');
209 c = get();
210 } while (!(star && c=='/'));
211 break;
212 }
213 default:
214 fail("Syntax error after '/'");
215 }
216 }
217
218 // Returns the next character from the input without consuming it, or 0 at EOF.
219 char peek() {

Callers

nothing calls this directly

Calls 2

isnewlineFunction · 0.85
failFunction · 0.85

Tested by

no test coverage detected