internal void Complete() { if (_nodeStack.Count != 0) { StackNode data = (StackNode)_nodeStack.Pop(); throw ParserException.ParenNotMatch(data.charPushed); } _nodeStack = null; // fix null if (_root.Expression == null) { if (_root.OperandCount == 0) { _root = null; } else if (_root.OperandCount > 1) { throw ParserException.InternalError(); } else { _root = (ExprNode)_root.Operands[0]; _root._parent = null; } } }
internal void Pop(char ch) { _isStart = false; if (_nodeStack.Count == 0) { if (ch == ',') { throw ParserException.NoParenBefore("'( or ']'"); } else { throw ParserException.NoParenBefore(ch.ToString()); } } StackNode data = (StackNode)_nodeStack.Pop(); if (ch != ',' && data.charPushed != ',') { if (ch != data.charPushed) { throw ParserException.ParenNotMatch(ch); } } if (this._root.Expression == null) { if (this._root.OperandCount > 0) { foreach (ExprNode node in this._root.Operands) { node._parent = data.top; } data.top.Operands.AddRange(this._root.Operands); } } else { data.top.Add(this._root); } this._root = data.root; this._top = data.top; }