refactor: init cypress-cucumber-preprocessor install.

This commit is contained in:
2021-09-02 17:02:45 +02:00
parent 89ec2d42ac
commit 1aa57bbd0a
5000 changed files with 408119 additions and 231 deletions

View File

@@ -0,0 +1,35 @@
"use strict";
const Argument = require('./argument');
const TreeRegexp = require('./tree_regexp');
const ParameterType = require('./parameter_type');
class RegularExpression {
constructor(expressionRegexp, parameterTypeRegistry) {
this._expressionRegexp = expressionRegexp;
this._parameterTypeRegistry = parameterTypeRegistry;
this._treeRegexp = new TreeRegexp(expressionRegexp);
}
match(text) {
const parameterTypes = this._treeRegexp.groupBuilder.children.map(groupBuilder => {
const parameterTypeRegexp = groupBuilder.source;
return this._parameterTypeRegistry.lookupByRegexp(parameterTypeRegexp, this._treeRegexp, text) || new ParameterType(null, parameterTypeRegexp, String, s => s, false, false);
});
return Argument.build(this._treeRegexp, text, parameterTypes);
}
get regexp() {
return this._expressionRegexp;
}
get source() {
return this._expressionRegexp.source;
}
}
module.exports = RegularExpression;