MCPcopy Create free account
hub / github.com/benfry/processing4 / readForNewLine

Method readForNewLine

java/src/processing/mode/java/AutoFormat.java:325–354  ·  view source on GitHub ↗

Pump any '\t' and ' ' to buf, handle any following comment, and if the next character is '\n', discard it. @return Whether a '\n' was found and discarded.

()

Source from the content-addressed store, hash-verified

323 * @return Whether a '\n' was found and discarded.
324 */
325 private boolean readForNewLine() {
326 final int savedTabs = tabs;
327 char c = peek();
328 while (!EOF && (c == '\t' || c == ' ')) {
329 buf.append(nextChar());
330 c = peek();
331 }
332
333 if (c == '/') {
334 buf.append(nextChar());
335 c = peek();
336 if (c == '*') {
337 buf.append(nextChar());
338 handleMultiLineComment();
339 } else if (c == '/') {
340 buf.append(nextChar());
341 handleSingleLineComment();
342 return true;
343 }
344 }
345
346 c = peek();
347 if (c == '\n') {
348 // eat it
349 nextChar();
350 tabs = savedTabs;
351 return true;
352 }
353 return false;
354 }
355
356
357 /**

Callers 1

formatMethod · 0.95

Calls 5

peekMethod · 0.95
nextCharMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected