cucumber.runtime.autocomplete.MetaStepdef Maven / Gradle / Ivy
package cucumber.runtime.autocomplete;
import java.util.ArrayList;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class MetaStepdef {
public String source;
public String flags;
public SortedSet steps = new TreeSet();
private Pattern pattern;
public boolean matches(String text) {
Pattern p = pattern();
Matcher m = p.matcher(text);
return m.matches() || m.hitEnd();
}
private Pattern pattern() {
if (pattern == null) {
pattern = Pattern.compile(source);
}
return pattern;
}
public static class MetaStep implements Comparable {
public String name;
public List args = new ArrayList();
@Override
public int compareTo(MetaStep other) {
return name.compareTo(other.name);
}
}
public static class MetaArgument {
public int offset;
public String val;
}
}