use of io.confluent.ksql.test.parser.TestDirective.Type in project ksql by confluentinc.
the class DirectiveParser method parse.
public static TestDirective parse(final Token comment) {
final NodeLocation loc = new NodeLocation(comment.getLine(), comment.getCharPositionInLine());
final Matcher matcher = DIRECTIVE_REGEX.matcher(comment.getText().trim());
if (!matcher.find()) {
throw new ParsingException("Expected directive matching pattern " + DIRECTIVE_REGEX + " but got " + comment, null, loc.getLineNumber(), loc.getColumnNumber());
}
final Type type = Type.from(matcher.group("type").toLowerCase());
final String contents = matcher.group("contents");
return new TestDirective(type, contents, loc);
}
Aggregations