Beispiel #1
0
		public void ReplaceInList(variant el, variant newel)
		{
			vars[FindIndexInList(el)] = newel;
		}
Beispiel #2
0
		public void ReplaceInList(variant el, IEnumerable<variant> newels)
		{
			var ind = FindIndexInList(el);
			vars.RemoveAt(ind);
			vars.InsertRange(ind, newels);
		}
Beispiel #3
0
		public variant_list(variant _variant, SourceContext sc)
		{
		    Add(_variant,sc);
		}
Beispiel #4
0
		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);
		}
Beispiel #7
0
		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;
		}
Beispiel #9
0
		// Методы списка
		public variant_list Add(variant elem, SourceContext sc = null)
		{
			vars.Add(elem);
			if (sc != null)
				source_context = sc;
			return this;
		}
Beispiel #10
0
		public void AddFirst(variant el)
		{
			vars.Insert(0, el);
		}
Beispiel #11
0
		// Конструкторы списка
		public variant_list(variant elem, SourceContext sc = null)
		{
			Add(elem, sc);
		}
Beispiel #12
0
		public variant_list Add(variant _variant, SourceContext sc)
		{
		    vars.Add(_variant);
		    source_context = sc;
		    return this;
		}
Beispiel #13
0
		public variant_list Add(variant _variant)
		{
		    vars.Add(_variant);
		    return this;
		}
Beispiel #14
0
		public override void visit(variant _variant)
		{
			prepare_node(_variant.vars,"vars");
			prepare_node(_variant.vars_type,"vars_type");
		}
Beispiel #15
0
		public void InsertAfter(variant el, variant newel)
		{
			vars.Insert(FindIndex(el) + 1, newel);
		}
		public void visit(variant _variant)
		{
			read_variant(_variant);
		}
Beispiel #17
0
		public void InsertAfter(variant el, IEnumerable<variant> newels)
		{
			vars.InsertRange(FindIndex(el) + 1, newels);
		}
		public override void visit(variant _variant)
		{
			throw new NotImplementedException();
		}
Beispiel #19
0
		public void InsertBefore(variant el, variant newel)
		{
			vars.Insert(FindIndex(el), newel);
		}
Beispiel #20
0
        public override void visit(variant _variant)
        {

        }
Beispiel #21
0
		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;
		}