@SuppressWarnings({ "unchecked", "rawtypes" }) private Token scanDirective() { // See the specification for details. Mark startMark = reader.getMark(); Mark endMark; reader.forward(); String name = scanDirectiveName(startMark); List<?> value = null; if ("YAML".equals(name)) { value = scanYamlDirectiveValue(startMark); endMark = reader.getMark(); } else if ("TAG".equals(name)) { value = scanTagDirectiveValue(startMark); endMark = reader.getMark(); } else { endMark = reader.getMark(); int ff = 0; while (Constant.NULL_OR_LINEBR.hasNo(reader.peek(ff))) { ff++; } if (ff > 0) { reader.forward(ff); } } scanDirectiveIgnoredLine(startMark); return new DirectiveToken(name, value, startMark, endMark); }
private Token scanDirective() { String chunk1 = data.substring(index, index + DIRECTIVE.length()); char chunk2 = data.charAt(index + DIRECTIVE.length()); if (DIRECTIVE.equals(chunk1) && "\n\0".indexOf(chunk2) != -1) { index += DIRECTIVE.length(); List<Integer> implicit = new ArrayList<Integer>(2); implicit.add(new Integer(1)); implicit.add(new Integer(1)); return new DirectiveToken<Integer>("YAML", implicit, mark, mark); } else { throw new CanonicalException("invalid directive"); } }