public ExpressionValidator(IExpressionConfig expressionConfig) { _expressionConfig = expressionConfig; _checkForValidCharacters = new ValidationCheck( expression => { var matches = _expressionConfig.ValidCharacters.Matches(expression); return matches.Count == 1 && matches[0].ToString() == expression; }, "Expression contains one or more invalid characters"); _checkForValidNumbers = new ValidationCheck( expression => _expressionConfig.NumbersHaveValidFormat(expression), "Expression has numbers with invalid format"); _checkForValidOpSeq = new ValidationCheck( expression => _expressionConfig.InvalidOperatorSequence.Matches(expression).Count == 0, "Expression has invalid contiguous operators"); _checkForValidOpSequences = new ValidationCheck( HasValidOperatorSequences, "Expression has invalid operator sequences" ); _checkForValidNumOpMix = new ValidationCheck( HasValidNumOpMix, "Expression has invalid combinations"); }
public ExpressionProcessor(IExpressionConfig expressionConfig) { _expressionConfig = expressionConfig; _expressionValidator = new ExpressionValidator(expressionConfig); }