public void ReplaceInList(variant el, variant newel) { vars[FindIndexInList(el)] = newel; }
public void ReplaceInList(variant el, IEnumerable<variant> newels) { var ind = FindIndexInList(el); vars.RemoveAt(ind); vars.InsertRange(ind, newels); }
public variant_list(variant _variant, SourceContext sc) { Add(_variant,sc); }
public bool Remove(variant el) { return vars.Remove(el); }
public override void visit(variant _variant) { //throw new Exception("The method or operation is not implemented."); }
public void visit(variant _variant) { bw.Write((Int16)92); write_variant(_variant); }
private int FindIndexInList(variant el) { var ind = vars.FindIndex(x => x == el); if (ind == -1) throw new Exception(string.Format("У списка {0} не найден элемент {1} среди дочерних\n", this, el)); return ind; }
public void read_variant(variant _variant) { read_syntax_tree_node(_variant); _variant.vars = _read_node() as ident_list; _variant.vars_type = _read_node() as type_definition; }
// Методы списка public variant_list Add(variant elem, SourceContext sc = null) { vars.Add(elem); if (sc != null) source_context = sc; return this; }
public void AddFirst(variant el) { vars.Insert(0, el); }
// Конструкторы списка public variant_list(variant elem, SourceContext sc = null) { Add(elem, sc); }
public variant_list Add(variant _variant, SourceContext sc) { vars.Add(_variant); source_context = sc; return this; }
public variant_list Add(variant _variant) { vars.Add(_variant); return this; }
public override void visit(variant _variant) { prepare_node(_variant.vars,"vars"); prepare_node(_variant.vars_type,"vars_type"); }
public void InsertAfter(variant el, variant newel) { vars.Insert(FindIndex(el) + 1, newel); }
public void visit(variant _variant) { read_variant(_variant); }
public void InsertAfter(variant el, IEnumerable<variant> newels) { vars.InsertRange(FindIndex(el) + 1, newels); }
public override void visit(variant _variant) { throw new NotImplementedException(); }
public void InsertBefore(variant el, variant newel) { vars.Insert(FindIndex(el), newel); }
public override void visit(variant _variant) { }
public void InsertBefore(variant el, IEnumerable<variant> newels) { vars.InsertRange(FindIndex(el), newels); }
public void write_variant(variant _variant) { write_syntax_tree_node(_variant); if (_variant.vars == null) { bw.Write((byte)0); } else { bw.Write((byte)1); _variant.vars.visit(this); } if (_variant.vars_type == null) { bw.Write((byte)0); } else { bw.Write((byte)1); _variant.vars_type.visit(this); } }
public void Replace(variant el, variant newel) { vars[FindIndex(el)] = newel; }