LinkReferenceDefinitionParser { private boolean label(Scanner scanner) { Position start = scanner.position(); if (!LinkScanner.scanLinkLabelContent(scanner)) { return false; } label.append(scanner.textBetween(start, scanner.position())); if (!scanner.hasNext()) { label.append('\n'); return true; } else if (scanner.next(']')) { if (!scanner.next(':')) { return false; } if (label.length() > 999) { return false; } String normalizedLabel = Escaping.normalizeLabelContent(label.toString()); if (normalizedLabel.isEmpty()) { return false; } this.normalizedLabel = normalizedLabel; state = State.DESTINATION; scanner.whitespace(); return true; } else { return false; } }  void parse(CharSequence line); void addSourceSpan(SourceSpan sourceSpan);  }
@Test public void testLabel() { assertState("[foo]:", State.DESTINATION, "[foo]:"); assertState("[ foo ]:", State.DESTINATION, "[ foo ]:"); }