System.Text.RegularExpressions.Interpreter.Balance C# (CSharp) Method

Balance() private method

private Balance ( int gid, int balance_gid, bool capture, int ptr ) : bool
gid int
balance_gid int
capture bool
ptr int
return bool
		private bool Balance (int gid, int balance_gid, bool capture, int ptr) {
			int b = groups [balance_gid];

			if(b == -1 || marks[b].Index < 0) {
				//Group not previously matched
				return false;
			}
			Debug.Assert (marks [b].IsDefined, "Regex", "Balancng group not closed");
			if (gid > 0 && capture){ 
				Open (gid, marks [b].Index + marks [b].Length);
				Close (gid, ptr);
			}

			groups [balance_gid] = marks[b].Previous;

			return true;
		}