public boolean hasNo(int c, String additional) { return !has(c, additional); } }
private String determineBlockHints(String text) { StringBuilder hints = new StringBuilder(); if (Constant.LINEBR.has(text.charAt(0), " ")) { hints.append(bestIndent); } char ch1 = text.charAt(text.length() - 1); if (Constant.LINEBR.hasNo(ch1)) { hints.append("-"); } else if (text.length() == 1 || Constant.LINEBR.has(text.charAt(text.length() - 2))) { hints.append("+"); } return hints.toString(); }
public boolean hasNo(int c) { return !has(c); }
private boolean isLineBreak(int c) { return Constant.NULL_OR_LINEBR.has(c); }
while (Constant.ALPHA.has(c)) { length++; c = reader.peek(length);
public boolean has(int c, String additional) { return has(c) || additional.indexOf(c, 0) != -1; }
int length = 0; int c = reader.peek(length); while (Constant.ALPHA.has(c)) { length++; c = reader.peek(length);
/** * Returns true if the next thing on the reader is a value token. */ private boolean checkValue() { // VALUE(flow context): ':' if (flowLevel != 0) { return true; } else { // VALUE(block context): ':' (' '|'\n') return Constant.NULL_BL_T_LINEBR.has(reader.peek(1)); } }
/** * Returns true if the next thing on the reader is a key token. */ private boolean checkKey() { // KEY(flow context): '?' if (this.flowLevel != 0) { return true; } else { // KEY(block context): '?' (' '|'\n') return Constant.NULL_BL_T_LINEBR.has(reader.peek(1)); } }
/** * Returns true if the next thing on the reader is a block token. */ private boolean checkBlockEntry() { // BLOCK-ENTRY: '-' (' '|'\n') return Constant.NULL_BL_T_LINEBR.has(reader.peek(1)); }
/** * Returns true if the next thing on the reader is a document-start ("---"). * A document-start is always followed immediately by a new line. */ private boolean checkDocumentStart() { // DOCUMENT-START: ^ '---' (' '|'\n') if (reader.getColumn() == 0) { if ("---".equals(reader.prefix(3)) && Constant.NULL_BL_T_LINEBR.has(reader.peek(3))) { return true; } } return false; }
/** * Returns true if the next thing on the reader is a document-end ("..."). A * document-end is always followed immediately by a new line. */ private boolean checkDocumentEnd() { // DOCUMENT-END: ^ '...' (' '|'\n') if (reader.getColumn() == 0) { if ("...".equals(reader.prefix(3)) && Constant.NULL_BL_T_LINEBR.has(reader.peek(3))) { return true; } } return false; }
/** * read the next length characters and move the pointer. * if the last character is high surrogate one more character will be read * * @param length amount of characters to move forward */ public void forward(int length) { for (int i = 0; i < length && ensureEnoughData(); i++) { int c = dataWindow[pointer++]; this.index++; if (Constant.LINEBR.has(c) || (c == '\r' && (ensureEnoughData() && dataWindow[pointer] != '\n'))) { this.line++; this.column = 0; } else if (c != 0xFEFF) { this.column++; } } }
private String scanFlowScalarBreaks(Mark startMark) { // See the specification for details. StringBuilder chunks = new StringBuilder(); while (true) { // Instead of checking indentation, we check for document // separators. String prefix = reader.prefix(3); if (("---".equals(prefix) || "...".equals(prefix)) && Constant.NULL_BL_T_LINEBR.has(reader.peek(3))) { throw new ScannerException("while scanning a quoted scalar", startMark, "found unexpected document separator", reader.getMark()); } // Scan past any number of spaces and tabs, ignoring them while (" \t".indexOf(reader.peek()) != -1) { reader.forward(); } // If we stopped at a line break, add that; otherwise, return the // assembled set of scalar breaks. String lineBreak = scanLineBreak(); if (lineBreak.length() != 0) { chunks.append(lineBreak); } else { return chunks.toString(); } } }
while (Constant.URI_CHARS.has(c)) { if (c == '%') { chunks.append(reader.prefixForward(length));
while (Constant.LINEBR.has(reader.peek(), " \r")) { if (reader.peek() != ' ') {
while (Constant.ALPHA.has(c)) { length++; c = reader.peek(length);