use of gherkin.formatter.FilterFormatter in project cucumber-jvm by cucumber.
the class FeatureBuilder method parse.
public void parse(Resource resource, List<Object> filters) {
String gherkin = read(resource);
String checksum = checksum(gherkin);
String path = pathsByChecksum.get(checksum);
if (path != null) {
return;
}
pathsByChecksum.put(checksum, resource.getPath());
Formatter formatter = this;
if (!filters.isEmpty()) {
formatter = new FilterFormatter(this, filters);
}
Parser parser = new Parser(formatter);
try {
parser.parse(gherkin, convertFileSeparatorToForwardSlash(resource.getPath()), 0);
} catch (Exception e) {
throw new CucumberException(String.format("Error parsing feature file %s", convertFileSeparatorToForwardSlash(resource.getPath())), e);
}
I18n i18n = parser.getI18nLanguage();
if (currentCucumberFeature != null) {
// The current feature may be null if we used a very restrictive filter, say a tag that isn't used.
// Might also happen if the feature file itself is empty.
currentCucumberFeature.setI18n(i18n);
}
}
Aggregations