public ManifestContents getManifestContents() { return visitor.getManifestContents(); }
public void setTerminateAfterMainSection(boolean shouldTerminate) { visitor.setTerminateAfterMainSection(shouldTerminate); }
/** * Expects to eat "Name" ":" "<value>" * @return continue? */ public boolean eatNameAttribute() { boolean cont; if (maybeEatHeaderName("Name")) { eatColon(); Token valueToken = tokenStream.next(); tokenStream.next(); // newline cont = visitor.visitSection(false, valueToken.value()); if (!cont) { return false; } visitor.visitHeader(NAME_HEADER, valueToken.value()); } else { Token token = tokenStream.peek(); // ERROR: they didn't supply a Name. Report an error and treat this // as a regular attribute cont = visitor.visitSection(false, null); // still the start of a // section, just has no // name recordProblem(ManifestProblemKind.MISSING_NAME_HEADER, token.getStartOffset(), token.getEndOffset(), token.value()); } return cont; }
public void eatVersionNumber() { Token tok = tokenStream.next(); assert tok.getKind() == TokenKind.VALUE; visitor.visitManifestVersion(tok.value()); }
public void eatAttribute(boolean isMain) { Token nameToken = tokenStream.next(); // Token colonToken = tokenStream.next(); Token valueToken = tokenStream.next(); // Token newlineToken = tokenStream.next(); // This gives the visitor a chance to decide what it wants to do about // the value visitor.visitHeader(nameToken.value(), valueToken.value()); }
visitor.visitSection(true, null);
ManifestContents parseManifest() { checkForRogueNewlinesProceedingInput(); boolean cont = eatSection(true); // cont indicates whether the visitor // decided to stop processing early while (tokenStream.hasMore() && cont) { cont = eatSection(false); } if (cont) { confirmEnd(); } return visitor.getManifestContents(); }