/// <summary> /// 添加一个候选式函数对象的所有委托到本对象 /// </summary> /// <param name="function"></param> public void Add(CandidateFunction <TEnumTokenType, TEnumVType, TTreeNodeValue> function) { if (function != null) { this.m_CandidateFunc += function.m_CandidateFunc; } }
/// <summary> /// 设置给定行、列位置的分析函数 /// </summary> /// <param name="line"></param> /// <param name="column"></param> /// <param name="function"></param> public void SetCell(int line, int column, CandidateFunction <TEnumTokenType, TEnumVType, TTreeNodeValue> function) { if (0 <= line && line < this.m_LineCount) { if (0 <= column && column < this.m_ColumnCount) { this.m_ParserMap[line, column] = function; } else { throw new ArgumentOutOfRangeException("column", column, "LL1分析表列数设置错误!"); } } else { throw new ArgumentOutOfRangeException("line", line, "LL1分析表行数设置错误!"); } }
/// <summary> /// 设置给定语法类型、单词类型所对应的分析函数 /// </summary> /// <param name="leftNode"></param> /// <param name="nextLeave"></param> /// <param name="function"></param> public void SetCell(TEnumVType leftNode, TEnumTokenType nextLeave, CandidateFunction <TEnumTokenType, TEnumVType, TTreeNodeValue> function) { SetCell(this.m_LeftNodes[leftNode], this.m_NextLeaves[nextLeave], function); }