//------------------------------------------------------------ public override CTerm_Base Clone() { CTerm_Bracket a = new CTerm_Bracket(_Name); CopyTo(a._Stack); return(a); }
//------------------------------------------------------------ // extract the parameters protected override CTerm_Base Compile(ref string Term, Stack <CTerm_Base> Stack, CEnvironment Env) { _Terms = new List <CTerm_Base>(); int StackSize = Stack.Count; CTerm_Base Pending = GetNextTerm(ref Term, Stack, Env, Priotity); StackSize = Stack.Count - StackSize; if (StackSize == 1 && Stack.Peek().Type == TTermType.Bracket) { CTerm_Bracket Brackets = (CTerm_Bracket)Stack.Pop(); StackSize = Brackets.CopyTo(Stack); // Brackets = null; } if (StackSize != _TermCount) { string Msg = (StackSize < _TermCount) ? "missing operand(s)" : "too many operands"; Msg += " for " + _Name + "!"; throw new CTermException(Msg); } while (StackSize > 0) { _Terms.Add(Stack.Pop()); StackSize--; } return(Pending); }