private void AddEnabledRulesOrInverses(OptionalRuleMap optionalRuleMap) { if (optionalRuleMap == null) { optionalRuleMap = new OptionalRuleMap(Enumerable.Empty <DisableableRules>()); } this.Map = new Dictionary <SyntaxKind, Dictionary <SyntaxKind, RuleBucket> >(); foreach (Rule rule in Rules.AllRules) { if (optionalRuleMap.DisabledRules.Contains(rule)) { if (rule as SimpleRule != null && (rule.RuleOperationContext.Action == RuleAction.Space || rule.RuleOperationContext.Action == RuleAction.Delete)) { this.Add(rule.Inverse); } } else { this.Add(rule); } } }
internal static RuleMap Create(OptionalRuleMap optionalRuleMap) { RuleMap ruleMap = new RuleMap(); ruleMap.AddEnabledRulesOrInverses(optionalRuleMap); return(ruleMap); }