public void ReplaceInList(literal el, literal newel) { literals[FindIndexInList(el)] = newel; }
public void InsertBefore(literal el, IEnumerable<literal> newels) { literals.InsertRange(FindIndex(el), newels); }
public bool Remove(literal el) { return literals.Remove(el); }
public void visit(literal _literal) { bw.Write((Int16)112); write_literal(_literal); }
public override void visit(literal _literal) { AddPossibleComments(_literal, true, true); }
public void visit(literal _literal) { read_literal(_literal); }
public override void visit(literal _literal) { //throw new Exception("The method or operation is not implemented."); }
// Методы списка public literal_const_line Add(literal elem, SourceContext sc = null) { literals.Add(elem); if (sc != null) source_context = sc; return this; }
public void AddFirst(literal el) { literals.Insert(0, el); }
public void CompareInternal(literal left, literal right) { if (left == null && right != null || left != null && right == null) throw_not_equal(left, right); if (left != null && right != null) { if (left.GetType() != right.GetType()) throw_not_equal(left, right); /*Type t = left.GetType(); MethodInfo mi = typeof(SyntaxTreeComparer).GetMethod("CompareInternal", new Type[] { t, t }); mi.Invoke(this, new object[] { left, right });*/ if (left is char_const) CompareInternal(left as char_const, right as char_const); else if (left is sharp_char_const) CompareInternal(left as sharp_char_const, right as sharp_char_const); else if (left is string_const) CompareInternal(left as string_const, right as string_const); else throw new NotImplementedException(left.GetType().ToString()); } }
// Конструкторы списка public literal_const_line(literal elem, SourceContext sc = null) { Add(elem, sc); }
public literal_const_line Add(literal _literal, SourceContext sc) { literals.Add(_literal); source_context = sc; return this; }
public literal_const_line Add(literal _literal) { literals.Add(_literal); return this; }
public literal_const_line(literal _literal, SourceContext sc) { Add(_literal,sc); }
public void ReplaceInList(literal el, IEnumerable<literal> newels) { var ind = FindIndexInList(el); literals.RemoveAt(ind); literals.InsertRange(ind, newels); }
private int FindIndexInList(literal el) { var ind = literals.FindIndex(x => x == el); if (ind == -1) throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); return ind; }
public override void visit(literal _literal) { }
public void InsertAfter(literal el, literal newel) { literals.Insert(FindIndex(el) + 1, newel); }
public void read_literal(literal _literal) { read_const_node(_literal); }
public void InsertAfter(literal el, IEnumerable<literal> newels) { literals.InsertRange(FindIndex(el) + 1, newels); }
public override void visit(literal _literal) { //throw new NotImplementedException(); }
public void InsertBefore(literal el, literal newel) { literals.Insert(FindIndex(el), newel); }
public void write_literal(literal _literal) { write_const_node(_literal); }
public void Replace(literal el, literal newel) { literals[FindIndex(el)] = newel; }