in src/main/java/org/apache/sling/graphql/schema/aggregator/impl/PartialReader.java [111:145]
private void parse(Supplier<Reader> source) throws IOException {
final Reader input = source.get();
StringBuilder line = new StringBuilder();
int c;
int charCount = 0;
int lastSectionStart = 0;
String sectionName = null;
String sectionDescription = "";
while((c = input.read()) != -1) {
if(c == EOL) {
final Matcher m = SECTION_LINE.matcher(line);
if(m.matches()) {
// Add previous section
addSectionIfNameIsSet(source, toSectionName(sectionName), sectionDescription, lastSectionStart, charCount - line.length());
// And setup for the new section
sectionName = m.group(1).trim();
sectionDescription = m.group(2).trim();
lastSectionStart = charCount + 1;
}
line = new StringBuilder();
} else {
line.append((char)c);
}
charCount++;
}
// Add last section
addSectionIfNameIsSet(source, toSectionName(sectionName), sectionDescription, lastSectionStart, Integer.MAX_VALUE);
// And validate
if(!sections.containsKey(SectionName.PARTIAL)) {
throw new SyntaxException(String.format("Missing required %s section", PARTIAL_SECTION));
}
}