Пример #1
0
 private void PrintNodeName(Pair pair)
 {
     if (_valueNodeExpected.Peek())
     {
         _sb.Append("\t");
         _sb.Append(pair.GetType().Name);
         _sb.Append(" ");
         _sb.Append(QuoteTypeToChar(pair.NameQuotesType));
         PrintNsPrefix(pair);
         _sb.Append(pair.Name);
         _sb.Append(QuoteTypeToChar(pair.NameQuotesType));
     }
     else
     {
         var mappedPair = pair as IMappedPair;
         _sb.Append(mappedPair?.NameInterval.Begin.Line.ToString().PadLeft(2, '0') ?? "00");
         _sb.Append(":");
         _sb.Append(mappedPair?.NameInterval.Begin.Column.ToString().PadLeft(2, '0') ?? "00");
         _sb.Append('\t', _indent);
         _sb.Append("\t");
         _sb.Append(pair.GetType().Name);
         _sb.Append(" ");
         _sb.Append(QuoteTypeToChar(pair.NameQuotesType));
         PrintNsPrefix(pair);
         _sb.Append(pair.Name);
         _sb.Append(QuoteTypeToChar(pair.NameQuotesType));
     }
 }
Пример #2
0
 public virtual void AppendChild(Pair child)
 {
     throw new NotSupportedException(new StringBuilder("Cannot add ").Append(child.GetType().Name).Append(" in ").Append(GetType().Name).ToString());
 }
Пример #3
0
 /// <summary>
 /// Adds another pair as a child. If pair has "pair assignment" <b>:=</b> then the method initializes property PairValue.
 /// </summary>
 /// <param name="child">Child pair to be added</param>
 public virtual void AppendChild(Pair child)
 {
     if (Assignment != AssignmentEnum.CE)
     {
         throw new NotSupportedException(new StringBuilder("Cannot add ").Append(child.GetType().Name)
                                         .Append(" in ").Append(GetType().Name).ToString());
     }
     if (PairValue != null)
     {
         throw new InvalidOperationException("PairValue is already initialized.");
     }
     PairValue = child;
     child.InitializeParent(this);
 }