Exemple #1
0
        private AnalyzerConfigSet(ImmutableArray <AnalyzerConfig> analyzerConfigs)
        {
            _analyzerConfigs = analyzerConfigs;

            var allMatchers = ArrayBuilder <ImmutableArray <SectionNameMatcher?> > .GetInstance(_analyzerConfigs.Length);

            foreach (var config in _analyzerConfigs)
            {
                // Create an array of regexes with each entry corresponding to the same index
                // in <see cref="EditorConfig.NamedSections"/>.
                var builder = ArrayBuilder <SectionNameMatcher?> .GetInstance(config.NamedSections.Length);

                foreach (var section in config.NamedSections)
                {
                    SectionNameMatcher?matcher = AnalyzerConfig.TryCreateSectionNameMatcher(section.Name);
                    builder.Add(matcher);
                }

                Debug.Assert(builder.Count == config.NamedSections.Length);

                allMatchers.Add(builder.ToImmutableAndFree());
            }

            Debug.Assert(allMatchers.Count == _analyzerConfigs.Length);

            _analyzerMatchers = allMatchers.ToImmutableAndFree();
        }
Exemple #2
0
        public void UnmatchedBraces()
        {
            SectionNameMatcher?matcher = TryCreateSectionNameMatcher("{{{{}}");

            Assert.Null(matcher);
        }
Exemple #3
0
        public void CommaOutsideBraces()
        {
            SectionNameMatcher?matcher = TryCreateSectionNameMatcher("abc,def");

            Assert.Null(matcher);
        }
Exemple #4
0
        public void EndBackslashMatch()
        {
            SectionNameMatcher?matcher = TryCreateSectionNameMatcher("abc\\");

            Assert.Null(matcher);
        }