public IReadOnlyCollection <ValidationResult> Validate(Token token, ITokenCollection tokenCollection) { var value = tokenCollection.Peek(); var integerResult = _integerTokenValueValidator.Validate(token, tokenCollection).Single(); int.TryParse(value.Value, out var integerValue); if (!integerResult.IsSuccess || integerValue < 0) { var error = new ParserError($"{token.Name} is not non negative integer.", token.Line, token.Column); return(new[] { ValidationResult.Error(error) }); } return(new[] { ValidationResult.Success() }); }
public IReadOnlyCollection <ValidationResult> Validate(Token token, ITokenCollection tokenCollection) { return(_integerTokenValueValidator.Validate(token, tokenCollection)); }