@Test public void testCanSkipComments() throws Exception { final ParserBuffer reader = reader(" \n" + "# this is a comment\n" + " # and another\r\n" + " # and one more\n" + " word"); parser.skipWhitespaceAndComments(reader); checkRemainder("word", reader); }
public void skipWhitespaceAndComments(ParserBuffer reader) throws IOException { skipWhitespace(reader); int c = read(reader); if(c == -1) return; if(c == '#') { skipToEndOfLine(reader); skipWhitespaceAndComments(reader); } else { unread(reader, c); } }
DefaultInterpreterParser { public void skipWhitespaceAndComments(ParserBuffer reader) throws IOException { skipWhitespace(reader); int c = read(reader); if(c == -1) return; if(c == '#') { skipToEndOfLine(reader); skipWhitespaceAndComments(reader); } else { unread(reader, c); } } }
DefaultInterpreterParser { public void skipWhitespaceAndComments(ParserBuffer reader) throws IOException { skipWhitespace(reader); int c = read(reader); if(c == -1) return; if(c == '#') { skipToEndOfLine(reader); skipWhitespaceAndComments(reader); } else { unread(reader, c); } }  }
DefaultInterpreterParser { public void skipWhitespaceAndComments(ParserBuffer reader) throws IOException { skipWhitespace(reader); int c = read(reader); if(c == -1) return; if(c == '#') { skipToEndOfLine(reader); skipWhitespaceAndComments(reader); } else { unread(reader, c); } }  ParsedCommand parseCommand(ParserBuffer reader); void skipWhitespace(ParserBuffer reader); void skipWhitespaceAndComments(ParserBuffer reader); String parseWord(ParserBuffer reader); }
DefaultInterpreterParser { public void skipWhitespaceAndComments(ParserBuffer reader) throws IOException { skipWhitespace(reader); int c = read(reader); if(c == -1) return; if(c == '#') { skipToEndOfLine(reader); skipWhitespaceAndComments(reader); } else { unread(reader, c); } }  ParsedCommand parseCommand(ParserBuffer reader); void skipWhitespace(ParserBuffer reader); void skipWhitespaceAndComments(ParserBuffer reader); String parseWord(ParserBuffer reader);  }