dev.yasint.regexsynth.core.Expression Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of regexsynth Show documentation
Show all versions of regexsynth Show documentation
RegexSynth is a minimal library that aims to construct, synthesize, and improve comprehension of complex regular expressions.
package dev.yasint.regexsynth.core;
import java.util.Objects;
import java.util.function.Consumer;
/**
* An abstract representation of a expression. This can be either
* a complete expression or a 'partial' expression.
*
* The {@code toRegex} lambda function returns a string representation
* of a regular expression. (It can be any of the regex constructs)
*/
@FunctionalInterface
public interface Expression {
StringBuilder toRegex();
default Expression debug(final Consumer callback) {
Objects.requireNonNull(callback).accept(toRegex());
return this;
}
}