示例#1
0
        private int CalcNumOfRootElements(Scope scope)
        {
            var rootElementCount = 0;

            foreach (var entity in scope.Entities)
            {
                if (entity is DOM.Element)
                {
                    rootElementCount++;
                }

                if (entity is Scope scopeEntity)
                {
                    rootElementCount += CalcNumOfRootElements(scopeEntity);
                }

                if (entity is DOM.Alias)
                {
                    rootElementCount += CalcNumOfRootElements((Alias)entity);
                }

                if (rootElementCount > 1)
                {
                    break;
                }
            }
            return(rootElementCount);
        }
示例#2
0
 public override void Visit(Scope pair)
 {
     PrintNodeName(pair);
     PrintNodeStart(pair);
     base.Visit(pair);
     PrintNodeEnd(pair);
 }
示例#3
0
 public override void Visit(Scope pair)
 {
     CheckNoPairValue(pair);
     base.Visit(pair);
 }
 public override void OnScope(Scope pair)
 {
     CheckNoPairValue(pair);
     base.OnScope(pair);
 }