Example #1
0
        public override SyntaxNode VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node)
        {
            node = (RegionDirectiveTriviaSyntax)base.VisitRegionDirectiveTrivia(node);
            var region  = _stack.Peek();
            var content = node.ToString().Trim();
            var match   = _regionRegex.Match(content);

            if (match.Success)
            {
                var tags      = match.Groups[1].Value.Trim().Split(TagSeparators, StringSplitOptions.RemoveEmptyEntries);
                var tagString = string.Join(" ", tags);
                if (region.Annotation != null)
                {
                    tagString = region.Annotation.Data + " " + tagString;
                }
                region = new RegionInfo(new SyntaxAnnotation("MDK", tagString));
                _stack.Push(region);
                return(node);
            }

            _stack.Push(region.AsCopy());
            if (region.Annotation != null)
            {
                return(node.WithAdditionalAnnotations(region.Annotation));
            }
            return(node);
        }
 public override void VisitRegionDirectiveTrivia(RegionDirectiveTriviaSyntax node)
 {
     Debug.Fail(node.ToString());
     base.VisitRegionDirectiveTrivia(node);
 }