public ReferencesRuler(IPatternParser patternParser, IReadOnlyList <ReferenceRule> rules) { _patternParser = patternParser; _forbiddingRules = rules.Where(r => r.Kind == RuleKind.Forbidden).ToList(); _allowingRules = rules.Where(r => r.Kind == RuleKind.Allowed).ToList(); _explicitlyForbiddenRules = rules.Where(r => r.Kind == RuleKind.ExplicitlyForbidden).ToList(); }
public PatternCompiler( IPatternTypeResolver resolver, IPatternParser parser, IPatternValidator validator) { this.resolver = CheckValue(resolver, nameof(resolver)); this.parser = CheckValue(parser, nameof(parser)); this.validator = CheckValue(validator, nameof(validator)); }
/// <summary> /// Initializes a new instance of the <see cref="MessageFormatter" /> class. /// </summary> /// <param name="patternParser"> /// The pattern parser. /// </param> /// <param name="library"> /// The library. /// </param> /// <param name="useCache"> /// if set to <c>true</c> uses the cache. /// </param> /// <param name="locale"> /// The locale to use. Formatters may need this. /// </param> internal MessageFormatter( IPatternParser patternParser, IFormatterLibrary library, bool useCache, string locale = "en") { this.patternParser = patternParser ?? throw new ArgumentNullException("patternParser"); this.library = library ?? throw new ArgumentNullException("library"); this.Locale = locale; if (useCache) { this.cache = new ConcurrentDictionary <string, IFormatterRequestCollection>(); } }
internal FixedFormatInfoPatternParser(IPatternParser <T> patternParser, NodaFormatInfo formatInfo) { cache = new Cache <string, IPattern <T> >(CacheSize, patternText => patternParser.ParsePattern(patternText, formatInfo), StringComparer.Ordinal); }
/// <summary> /// Initializes a new instance of the <see cref="MessageFormatter" /> class. /// </summary> /// <param name="patternParser"> /// The pattern parser. /// </param> /// <param name="library"> /// The library. /// </param> /// <param name="useCache"> /// if set to <c>true</c> uses the cache. /// </param> /// <param name="locale"> /// The locale to use. Formatters may need this. /// </param> internal MessageFormatter( IPatternParser patternParser, IFormatterLibrary library, bool useCache, string locale = "en") { if (patternParser == null) { throw new ArgumentNullException("patternParser"); } if (library == null) { throw new ArgumentNullException("library"); } this.patternParser = patternParser; this.library = library; this.Locale = locale; if (useCache) { this.cache = new Dictionary<string, IFormatterRequestCollection>(); } }