SimpleParser parser = new SimpleParser(sourceIntro);
return parser.tryConsume(splitKeywords) > 0;
}
public void splitSourceCases(String defaultMarker, String fileSource) throws TemplatedSourceException {
SimpleParser parser = new SimpleParser(fileSource);
do {
boolean isHeader = false;
String keyMarker = defaultMarker;
int alt = parser.tryConsume(splitKeywords);
if(alt != SimpleParser.EOF) {
if(alt == 0 || alt == 1) {
isHeader = true;
}
if(parser.seekToNewLine() == false) {
handleError(new TemplatedSourceException(parser.getSourcePosition()));
}
Matcher matcher = Pattern.compile("→(.)").matcher(parser.getLastConsumedString());
if(matcher.find()) {
keyMarker = matcher.group(1);
}
} else {
assertTrue(parser.getSourcePosition() == 0);
}
parser.consumeUntilAny(splitKeywords);
String unprocessedCaseSource = parser.getLastConsumedString();
processSplitCaseSource(unprocessedCaseSource, isHeader, keyMarker);
} while(!parser.lookaheadIsEOF());
}